[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master ed61612: Expunge index origin from input sequ
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master ed61612: Expunge index origin from input sequences |
Date: |
Sat, 28 Jan 2017 19:03:14 +0000 (UTC) |
branch: master
commit ed61612f7d5470ddac8608257a5324582fb5d2ff
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Expunge index origin from input sequences
Comments removed from the header explain why this was always a bad idea.
Comments added to the header explain why it would make no sense anyway.
It was never implemented and never will be, so nothing is lost hereby.
The never-implemented 'inforce_duration' and 'effective_year' notions
might someday be expunged as well.
---
gpt_input.cpp | 2 --
input_realization.cpp | 6 ------
input_seq_test.cpp | 4 ++--
input_sequence.cpp | 2 --
input_sequence.hpp | 26 ++++++++------------------
input_sequence_entry.cpp | 2 --
mec_input.cpp | 2 --
7 files changed, 10 insertions(+), 34 deletions(-)
diff --git a/gpt_input.cpp b/gpt_input.cpp
index 7e80a03..2c84413 100644
--- a/gpt_input.cpp
+++ b/gpt_input.cpp
@@ -49,7 +49,6 @@ std::string realize_sequence_string
(gpt_input & input
,std::vector<T> & v
,datum_sequence const& sequence_string
- ,int index_origin = 0
)
{
InputSequence s
@@ -59,7 +58,6 @@ std::string realize_sequence_string
,input.maturity_age () // This class has no "retirement age".
,input.inforce_year ()
,input.effective_year ()
- ,index_origin
);
detail::convert_vector(v, s.linear_number_representation());
return s.formatted_diagnostics(true);
diff --git a/input_realization.cpp b/input_realization.cpp
index c39437b..4413805 100644
--- a/input_realization.cpp
+++ b/input_realization.cpp
@@ -47,7 +47,6 @@ std::string realize_sequence_string
(Input const& input
,std::vector<T> & v
,datum_sequence const& sequence_string
- ,int index_origin = 0
)
{
InputSequence s
@@ -57,7 +56,6 @@ std::string realize_sequence_string
,input.retirement_age ()
,input.inforce_year ()
,input.effective_year ()
- ,index_origin
);
detail::convert_vector(v, s.linear_number_representation());
return s.formatted_diagnostics(true);
@@ -72,7 +70,6 @@ std::string realize_sequence_string
,datum_sequence const& sequence_string
,detail::stringmap const& keyword_dictionary
,std::string const& default_keyword
- ,int index_origin = 0
)
{
InputSequence s
@@ -82,7 +79,6 @@ std::string realize_sequence_string
,input.retirement_age ()
,input.inforce_year ()
,input.effective_year ()
- ,index_origin
,detail::extract_keys_from_string_map(keyword_dictionary)
,default_keyword
,true
@@ -106,7 +102,6 @@ std::string realize_sequence_string
,datum_sequence const& sequence_string
,detail::stringmap const& keyword_dictionary
,std::string const& default_keyword
- ,int index_origin = 0
)
{
InputSequence s
@@ -116,7 +111,6 @@ std::string realize_sequence_string
,input.retirement_age ()
,input.inforce_year ()
,input.effective_year ()
- ,index_origin
,detail::extract_keys_from_string_map(keyword_dictionary)
,default_keyword
,false
diff --git a/input_seq_test.cpp b/input_seq_test.cpp
index 3f1335e..d7563af 100644
--- a/input_seq_test.cpp
+++ b/input_seq_test.cpp
@@ -40,7 +40,7 @@ void check
,std::string const& w = std::string()
)
{
- InputSequence const seq(e, n, 90, 95, 0, 2002, 0, k, w);
+ InputSequence const seq(e, n, 90, 95, 0, 2002, k, w);
std::vector<double> const& v(seq.linear_number_representation());
bool const bv = v == std::vector<double>(d, d + n);
@@ -340,7 +340,7 @@ int test_main(int, char*[])
double const d[n] = {7, 7, 7, 7, 7, 4, 4, 4, 4, 4};
std::string const e("7, retirement; 4");
check(__FILE__, __LINE__, d, n, e);
- InputSequence const seq("7, retirement; 4", 10, 90, 95, 0, 2002, 0);
+ InputSequence const seq("7, retirement; 4", 10, 90, 95, 0, 2002);
std::vector<ValueInterval> const& i(seq.interval_representation());
BOOST_TEST(e_inception == i[0].begin_mode);
BOOST_TEST(e_retirement == i[0].end_mode );
diff --git a/input_sequence.cpp b/input_sequence.cpp
index d0e1c22..899dafc 100644
--- a/input_sequence.cpp
+++ b/input_sequence.cpp
@@ -54,7 +54,6 @@ InputSequence::InputSequence
,int a_retirement_age
,int a_inforce_duration
,int a_effective_year
- ,int a_index_origin
,std::vector<std::string> const& a_extra_keywords
,std::string const& a_default_keyword
,bool a_keywords_only
@@ -65,7 +64,6 @@ InputSequence::InputSequence
,retirement_age (a_retirement_age)
,inforce_duration (a_inforce_duration)
,effective_year (a_effective_year)
- ,index_origin (a_index_origin)
,extra_keywords (a_extra_keywords)
,default_keyword (a_default_keyword)
,keywords_only (a_keywords_only)
diff --git a/input_sequence.hpp b/input_sequence.hpp
index f8078bc..22aaab8 100644
--- a/input_sequence.hpp
+++ b/input_sequence.hpp
@@ -44,11 +44,17 @@
// Extract the grammar from lines matching the regexp _// GRAMMAR_ in
// the implementation file.
//
+// Index origin is always zero. This is actually natural for end users,
+// who think in terms of endpoints--inception implicitly being duration
+// zero, and each postinitial interval implicitly beginning at the prior
+// interval's endpoint, inclusive. Thus, a single-premium policy allows
+// payments in "year one" only, i.e., duration [0,1): from issue up to
+// but not including the first anniversary.
+//
// Possible enhancements:
//
// Alternatives to
// 1[0,3);2[3,5);0 --> 1 1 1 2 2 0 0...0
-// Index origin 1 could be a configuration option
// Keywords could be used instead, e.g.
// 1 from 1 to 3; 2 from 3 through 4; 0
//
@@ -141,21 +147,7 @@
//
// Representation in input file.
//
-// This is certainly a string. Distinctions between e.g. age, date, and
-// policy year must be preserved, because their interpretation depends
-// on context.
-//
-// Strings might simply be saved exactly as entered. That seems to be
-// the least surprising way. However, if we make index origin a
-// configurable option, then this method becomes ambiguous at best, and
-// at worst
-// 1 [0, 1)
-// becomes an error in origin one. This could be resolved by storing
-// the index origin in the input file, but then it's not really a
-// configuration option, and files saved with one convention cannot
-// easily and reliably be shared with a different user who prefers a
-// different convention. Furthermore, this approach means we can never
-// change the grammar without preserving backward compatibility.
+// Strings are stored in the least surprising way: exactly as entered.
//
// Alternatively, we can choose a canonical representation for input file
// storage. Explicit interval notation is probably best because it
@@ -247,7 +239,6 @@ class LMI_SO InputSequence
,int a_retirement_age
,int a_inforce_duration
,int a_effective_year
- ,int a_index_origin
,std::vector<std::string> const& a_extra_keywords
= std::vector<std::string>()
,std::string const& a_default_keyword = ""
@@ -334,7 +325,6 @@ class LMI_SO InputSequence
int retirement_age;
int inforce_duration;
int effective_year;
- int index_origin;
std::vector<std::string> extra_keywords;
std::string default_keyword;
bool keywords_only;
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index b7ab9fe..54bd49b 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -1216,7 +1216,6 @@ wxString InputSequenceEditor::get_diagnostics_message()
,input_.retirement_age ()
,input_.inforce_year ()
,input_.effective_year ()
- ,0
,keywords_
);
wxString msg = sequence.formatted_diagnostics(true).c_str();
@@ -1556,7 +1555,6 @@ void InputSequenceEntry::DoOpenEditor()
,in.retirement_age ()
,in.inforce_year ()
,in.effective_year ()
- ,0
,keywords
,ds.default_keyword()
,keywords_only
diff --git a/mec_input.cpp b/mec_input.cpp
index 8f5107d..2f5e390 100644
--- a/mec_input.cpp
+++ b/mec_input.cpp
@@ -49,7 +49,6 @@ std::string realize_sequence_string
(mec_input & input
,std::vector<T> & v
,datum_sequence const& sequence_string
- ,int index_origin = 0
)
{
InputSequence s
@@ -59,7 +58,6 @@ std::string realize_sequence_string
,input.maturity_age () // This class has no "retirement age".
,input.inforce_year ()
,input.effective_year ()
- ,index_origin
);
detail::convert_vector(v, s.linear_number_representation());
return s.formatted_diagnostics(true);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [lmi] master ed61612: Expunge index origin from input sequences,
Greg Chicares <=