lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 2889a4d 4/5: Refactor


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 2889a4d 4/5: Refactor
Date: Thu, 27 Aug 2020 14:42:48 -0400 (EDT)

branch: master
commit 2889a4de7395f5dfae4801873ed87c1b7877d437
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Refactor
    
    Read modes from class modal_outlay rather than ledger.
---
 accountvalue.cpp |  6 +++---
 ihs_acctval.cpp  |  8 ++++----
 ihs_avmly.cpp    |  6 +++---
 ihs_avstrtgy.cpp | 13 +++++++------
 4 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/accountvalue.cpp b/accountvalue.cpp
index d4afefb..366285f 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -285,7 +285,7 @@ void AccountValue::DoYear
     ActualSpecAmt         = InvariantValues().SpecAmt[Year];
 
     // These variables are set for each pass independently.
-    pmt_mode        = InvariantValues().EeMode[Year].value();
+    pmt_mode        = Outlay_->ee_premium_modes()[Year];
     ModeIndex       = get_mode_index(pmt_mode);
     RequestedLoan   = Outlay_->new_cash_loans()[Year];
     wd              = Outlay_->withdrawals()[Year];
@@ -443,12 +443,12 @@ void AccountValue::PerformSpecAmtStrategy()
             break;
         case mce_sa_maximum:
             {
-            SA = GetModalMaxSpecAmt(InvariantValues().EeMode[0].value(), 
InvariantValues().EePmt[0]);
+            SA = GetModalMaxSpecAmt(Outlay_->ee_premium_modes()[0], 
InvariantValues().EePmt[0]);
             }
             break;
         case mce_sa_target:
             {
-            SA = GetModalTgtSpecAmt(InvariantValues().EeMode[0].value(), 
InvariantValues().EePmt[0]);
+            SA = GetModalTgtSpecAmt(Outlay_->ee_premium_modes()[0], 
InvariantValues().EePmt[0]);
             }
             break;
         case mce_sa_mep:
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index b13b627..0ca5046 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -928,7 +928,7 @@ void AccountValue::InitializeSpecAmt()
         {
         auto const z = GetModalMinPrem
             (Year
-            ,InvariantValues().ErMode[Year].value()
+            ,Outlay_->er_premium_modes()[Year]
             ,InvariantValues().SpecAmt[Year]
             );
         InvariantValues().ModalMinimumPremium[Year]   = z;
@@ -938,7 +938,7 @@ void AccountValue::InitializeSpecAmt()
         {
         auto const z = GetModalPremMlyDedEx
             (Year
-            ,InvariantValues().ErMode[Year].value()
+            ,Outlay_->er_premium_modes()[Year]
             ,InvariantValues().SpecAmt[Year]
             ,InvariantValues().TermSpecAmt[Year]
             );
@@ -1016,7 +1016,7 @@ void AccountValue::set_list_bill_premium()
         {
         auto const z = GetListBillPremMlyDed
             (Year
-            ,InvariantValues().ErMode[Year].value()
+            ,Outlay_->er_premium_modes()[Year]
             ,InvariantValues().SpecAmt[Year]
             );
         InvariantValues().ListBillPremium   = z;
@@ -1026,7 +1026,7 @@ void AccountValue::set_list_bill_premium()
         {
         auto const z = GetListBillPremMlyDedEx
             (Year
-            ,InvariantValues().ErMode[Year].value()
+            ,Outlay_->er_premium_modes()[Year]
             ,InvariantValues().SpecAmt[Year]
             ,InvariantValues().TermSpecAmt[Year]
             );
diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index b5f964b..49026b5 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -674,7 +674,7 @@ bool AccountValue::IsModalPmtDate(mcenum_mode mode) const
 
 int AccountValue::MonthsToNextModalPmtDate() const
 {
-    return 1 + (11 - Month) % (12 / InvariantValues().ErMode[Year].value());
+    return 1 + (11 - Month) % (12 / Outlay_->er_premium_modes()[Year]);
 }
 
 /// Determine instantaneous base-policy minimum specified amount.
@@ -1168,8 +1168,8 @@ void AccountValue::TxAscertainDesiredPayment()
 //     does GPT effect also vary by basis?
 //       e.g. when opt change produces different spec amts
 
-    mcenum_mode const ee_mode = InvariantValues().EeMode[Year].value();
-    mcenum_mode const er_mode = InvariantValues().ErMode[Year].value();
+    mcenum_mode const ee_mode = Outlay_->ee_premium_modes()[Year];
+    mcenum_mode const er_mode = Outlay_->er_premium_modes()[Year];
     bool const ee_pay_this_month = IsModalPmtDate(ee_mode);
     bool const er_pay_this_month = IsModalPmtDate(er_mode);
     // Month zero must be a modal payment date for both ee and er.
diff --git a/ihs_avstrtgy.cpp b/ihs_avstrtgy.cpp
index e748777..6dcb90d 100644
--- a/ihs_avstrtgy.cpp
+++ b/ihs_avstrtgy.cpp
@@ -27,6 +27,7 @@
 #include "death_benefits.hpp"
 #include "ledger_invariant.hpp"
 #include "mortality_rates.hpp"
+#include "outlay.hpp"
 
 #include <algorithm>
 #include <utility>
@@ -63,9 +64,9 @@ double AccountValue::CalculateSpecAmtFromStrategy
     ) const
 {
     double annualized_pmt =
-            InvariantValues().EeMode[reference_year].value()
+            Outlay_->ee_premium_modes()[reference_year]
           * InvariantValues().EePmt [reference_year]
-        +   InvariantValues().ErMode[reference_year].value()
+        +   Outlay_->er_premium_modes()[reference_year]
           * InvariantValues().ErPmt [reference_year]
         ;
     switch(strategy)
@@ -319,8 +320,8 @@ double AccountValue::PerformEePmtStrategy() const
 {
     return DoPerformPmtStrategy
         (mce_solve_ee_prem
-        ,InvariantValues().EeMode[Year].value()
-        ,InvariantValues().EeMode[0]   .value()
+        ,Outlay_->ee_premium_modes()[Year]
+        ,Outlay_->ee_premium_modes()[0]
         ,yare_input_.InsuredPremiumTableFactor
         ,InvariantValues().EePmt
         ,yare_input_.PaymentStrategy
@@ -333,8 +334,8 @@ double AccountValue::PerformErPmtStrategy() const
 {
     return DoPerformPmtStrategy
         (mce_solve_er_prem
-        ,InvariantValues().ErMode[Year].value()
-        ,InvariantValues().ErMode[0]   .value()
+        ,Outlay_->er_premium_modes()[Year]
+        ,Outlay_->er_premium_modes()[0]
         ,yare_input_.CorporationPremiumTableFactor
         ,InvariantValues().ErPmt
         ,yare_input_.CorporationPaymentStrategy



reply via email to

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