lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 918810f 4/6: Expunge mathematical_representat


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 918810f 4/6: Expunge mathematical_representation() [395]
Date: Sun, 26 Feb 2017 19:04:53 -0500 (EST)

branch: master
commit 918810f0088118fa9b374d9518283f312271620a
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Expunge mathematical_representation() [395]
    
    canonical_form() is always preferable.
---
 input_sequence.cpp      | 60 -------------------------------------------------
 input_sequence.hpp      |  2 --
 input_sequence_test.cpp | 14 ------------
 3 files changed, 76 deletions(-)

diff --git a/input_sequence.cpp b/input_sequence.cpp
index 17739d3..30fbb3c 100644
--- a/input_sequence.cpp
+++ b/input_sequence.cpp
@@ -386,66 +386,6 @@ std::vector<std::string> const& 
InputSequence::linear_keyword_representation() c
     return keyword_result_;
 }
 
-/// Regularized representation in [x,y) interval notation.
-///
-/// If there's only one interval, it must span all years, so depict it
-/// as the simple scalar that it is, specifying no interval.
-///
-/// Use keyword 'maturity' for the last duration. This avoids
-/// gratuitous differences between lives, e.g.
-///   '10000 [20,55); 0' for a 45-year-old
-/// and
-///   '10000 [20,65); 0' for a 35-year-old
-/// which the census GUI would treat as varying across cells, whereas
-///   '10000 [20,65); maturity'
-/// expresses the same sequence uniformly.
-///
-/// TODO ?? For the same reason, this representation should preserve
-/// duration keywords such as 'retirement'.
-
-std::string InputSequence::mathematical_representation() const
-{
-    std::ostringstream oss;
-    for(auto const& interval_i : intervals_)
-        {
-        if(interval_i.value_is_keyword)
-            {
-            oss << interval_i.value_keyword;
-            }
-        else
-            {
-            oss << value_cast<std::string>(interval_i.value_number);
-            }
-
-        if(1 == intervals_.size())
-            {
-            break;
-            }
-
-        if(interval_i.end_duration != years_to_maturity_)
-            {
-            oss
-                << " ["
-                << interval_i.begin_duration
-                << ", "
-                << interval_i.end_duration
-                << "); "
-                ;
-            }
-        else
-            {
-            oss
-                << " ["
-                << interval_i.begin_duration
-                << ", "
-                << "maturity"
-                << ")"
-                ;
-            }
-        }
-    return oss.str();
-}
-
 std::vector<ValueInterval> const& InputSequence::interval_representation() 
const
 {
     return intervals_;
diff --git a/input_sequence.hpp b/input_sequence.hpp
index 1fad852..27ae666 100644
--- a/input_sequence.hpp
+++ b/input_sequence.hpp
@@ -168,8 +168,6 @@ class LMI_SO InputSequence
     std::vector<double>      const& linear_number_representation()  const;
     std::vector<std::string> const& linear_keyword_representation() const;
 
-    std::string mathematical_representation() const;
-
     std::vector<ValueInterval> const& interval_representation() const;
 
   private:
diff --git a/input_sequence_test.cpp b/input_sequence_test.cpp
index b6e7ce6..282d54f 100644
--- a/input_sequence_test.cpp
+++ b/input_sequence_test.cpp
@@ -396,11 +396,6 @@ void input_sequence_test::test()
     InputSequence const seq(v);
     BOOST_TEST(v == seq.linear_number_representation());
     BOOST_TEST_EQUAL("1 3; 2", canonicalized_input_sequence(v));
-    BOOST_TEST_EQUAL("1 3; 2", seq.canonical_form());
-    BOOST_TEST_EQUAL
-        ("1 [0, 3); 2 [3, maturity)"
-        ,seq.mathematical_representation()
-        );
     }
 
     // Test construction from string (keyword) vector.
@@ -412,11 +407,6 @@ void input_sequence_test::test()
         ("alpha 1; beta 3; gamma 4; eta"
         ,canonicalized_input_sequence(v)
         );
-    BOOST_TEST_EQUAL("alpha 1; beta 3; gamma 4; eta", seq.canonical_form());
-    BOOST_TEST_EQUAL
-        ("alpha [0, 1); beta [1, 3); gamma [3, 4); eta [4, maturity)"
-        ,seq.mathematical_representation()
-        );
     }
 
     // Test construction from one-element vector.
@@ -425,8 +415,6 @@ void input_sequence_test::test()
     InputSequence const seq(v);
     BOOST_TEST(v == seq.linear_number_representation());
     BOOST_TEST_EQUAL("3", canonicalized_input_sequence(v));
-    BOOST_TEST_EQUAL("3", seq.canonical_form());
-    BOOST_TEST_EQUAL("3", seq.mathematical_representation());
     }
 
     // Test construction from empty vector.
@@ -435,8 +423,6 @@ void input_sequence_test::test()
     InputSequence const seq(v);
     BOOST_TEST(v == seq.linear_number_representation());
     BOOST_TEST_EQUAL("0", canonicalized_input_sequence(v));
-    BOOST_TEST_EQUAL("0", seq.canonical_form());
-    BOOST_TEST_EQUAL("0", seq.mathematical_representation());
     }
 
     // Test (enumerative) allowed keywords, and keywords-only switch



reply via email to

[Prev in Thread] Current Thread [Next in Thread]