[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master bd18171 8/8: Improve a member name [406]
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master bd18171 8/8: Improve a member name [406] |
Date: |
Mon, 30 Jan 2017 02:49:05 +0000 (UTC) |
branch: master
commit bd18171d4d23e83fdf847ef707acd615bb17c2f0
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Improve a member name [406]
This was an improvement:
:%s/last_possible_duration/years_to_maturity/gc
because it's more descriptive and follows usage elsewhere. This is
not "maturity age" as was suggested in a removed comment: it is
instead the number of years until that age is reached.
This possible change:
:%s/inforce_duration/inforce_year/gc
was considered but not applied. It would follow usage elsewhere, but
"duration" unambiguously means "time since", whereas "year" could be
confused with "calendar year".
---
input_sequence.cpp | 26 +++++++++++++-------------
input_sequence.hpp | 6 ++----
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/input_sequence.cpp b/input_sequence.cpp
index f0ce975..7ccea96 100644
--- a/input_sequence.cpp
+++ b/input_sequence.cpp
@@ -50,7 +50,7 @@ ValueInterval::ValueInterval()
InputSequence::InputSequence
(std::string const& input_expression
- ,int a_last_possible_duration // TODO ?? Prefer maturity age?
+ ,int a_years_to_maturity
,int a_issue_age
,int a_retirement_age
,int a_inforce_duration
@@ -60,7 +60,7 @@ InputSequence::InputSequence
,bool a_keywords_only
)
:input_stream (input_expression.c_str())
- ,last_possible_duration (a_last_possible_duration)
+ ,years_to_maturity (a_years_to_maturity)
,issue_age (a_issue_age)
,retirement_age (a_retirement_age)
,inforce_duration (a_inforce_duration)
@@ -92,7 +92,7 @@ InputSequence::InputSequence
// This invariant has not yet been established, whether or not the
// sequence was empty.
- intervals.back().end_duration = last_possible_duration;
+ intervals.back().end_duration = years_to_maturity;
// This invariant is established by realize_vector(), but it does
// no harm to repeat it here, and it would be confusing not to do
// so in conjunction with the line above.
@@ -131,7 +131,7 @@ InputSequence::InputSequence
// unintended use.
InputSequence::InputSequence(std::vector<double> const& v)
- :last_possible_duration(v.size())
+ :years_to_maturity(v.size())
{
ValueInterval dummy;
@@ -167,7 +167,7 @@ InputSequence::InputSequence(std::vector<double> const& v)
}
InputSequence::InputSequence(std::vector<std::string> const& v)
- :last_possible_duration(v.size())
+ :years_to_maturity(v.size())
{
ValueInterval dummy;
dummy.value_is_keyword = true;
@@ -207,7 +207,7 @@ InputSequence::InputSequence
(std::vector<double> const& n_v
,std::vector<std::string> const& s_v
)
- :last_possible_duration(n_v.size())
+ :years_to_maturity(n_v.size())
{
if(n_v.size() != s_v.size())
{
@@ -277,14 +277,14 @@ void InputSequence::realize_vector()
// Every ctor must already have established this...
LMI_ASSERT(!intervals.empty());
// ...and this:
- LMI_ASSERT(last_possible_duration == intervals.back().end_duration);
+ LMI_ASSERT(years_to_maturity == intervals.back().end_duration);
// It cannot be assumed that all ctors have yet established this...
intervals.back().end_mode = e_maturity;
// ...though now of course it has been established:
LMI_ASSERT(e_maturity == intervals.back().end_mode );
- std::vector<double> default_numeric_vector(last_possible_duration);
- std::vector<std::string> default_string_vector(last_possible_duration,
default_keyword);
+ std::vector<double> default_numeric_vector(years_to_maturity);
+ std::vector<std::string> default_string_vector(years_to_maturity,
default_keyword);
std::vector<double> r(default_numeric_vector);
number_result = r;
std::vector<std::string> s(default_string_vector);
@@ -354,7 +354,7 @@ void InputSequence::realize_vector()
bool interval_is_ok =
0 <= interval_i.begin_duration
&& interval_i.begin_duration <= interval_i.end_duration
- && interval_i.end_duration <= last_possible_duration
+ && interval_i.end_duration <= years_to_maturity
;
if(!interval_is_ok)
{
@@ -433,7 +433,7 @@ void InputSequence::duration_scalar()
else if("maturity" == current_keyword)
{
current_duration_scalar_mode = e_maturity;
- current_duration_scalar = last_possible_duration;
+ current_duration_scalar = years_to_maturity;
match(e_keyword);
return;
}
@@ -604,7 +604,7 @@ void InputSequence::validate_duration
mark_diagnostic_context();
return;
}
- else if(last_possible_duration < tentative_end_duration)
+ else if(years_to_maturity < tentative_end_duration)
{
current_interval.insane = true;
diagnostics
@@ -1038,7 +1038,7 @@ std::string InputSequence::mathematical_representation()
const
break;
}
- if(interval_i.end_duration != last_possible_duration)
+ if(interval_i.end_duration != years_to_maturity)
{
oss
<< " ["
diff --git a/input_sequence.hpp b/input_sequence.hpp
index 929d9db..29679ef 100644
--- a/input_sequence.hpp
+++ b/input_sequence.hpp
@@ -234,7 +234,7 @@ class LMI_SO InputSequence
public:
InputSequence
(std::string const& input_expression
- ,int a_last_possible_duration // TODO ?? Prefer maturity age?
+ ,int a_years_to_maturity
,int a_issue_age
,int a_retirement_age
,int a_inforce_duration
@@ -313,9 +313,7 @@ class LMI_SO InputSequence
void mark_diagnostic_context();
std::istringstream input_stream;
- // Maturity (last possible) duration in context of this particular
- // life's issue age.
- int last_possible_duration;
+ int years_to_maturity;
int issue_age;
int retirement_age;
int inforce_duration;
- [lmi-commits] [lmi] master updated (8cdbb16 -> bd18171), Greg Chicares, 2017/01/29
- [lmi-commits] [lmi] master 87991df 2/8: Improve encapsulation, Greg Chicares, 2017/01/29
- [lmi-commits] [lmi] master 4646e6e 7/8: Don't mark speculative enhancements as defects [408], Greg Chicares, 2017/01/29
- [lmi-commits] [lmi] master 4bb2aed 1/8: Improve concinnity of whitespace, Greg Chicares, 2017/01/29
- [lmi-commits] [lmi] master 1556768 3/8: Resolve a marked defect: forbid unsorted sequence intervals [414], Greg Chicares, 2017/01/29
- [lmi-commits] [lmi] master 2a2d275 6/8: Expunge vestiges of an unwanted ctor [411], Greg Chicares, 2017/01/29
- [lmi-commits] [lmi] master bd18171 8/8: Improve a member name [406],
Greg Chicares <=
- [lmi-commits] [lmi] master 0f89067 4/8: Resolve a marked defect: default keyword already tested [413], Greg Chicares, 2017/01/29
- [lmi-commits] [lmi] master abb154b 5/8: Write this project's name in lowercase only, Greg Chicares, 2017/01/29