lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master f474d10 08/10: Prepare to abstract specified


From: Greg Chicares
Subject: [lmi-commits] [lmi] master f474d10 08/10: Prepare to abstract specified amount
Date: Fri, 4 Sep 2020 21:16:10 -0400 (EDT)

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

    Prepare to abstract specified amount
    
    At least three sets of variables store specified amount:
        death_benefits::specamt_     and death_benefits::supplamt_
        AccountValue::ActualSpecAmt  and AccountValue::TermSpecAmt
        LedgerInvariant::SpecAmt     and LedgerInvariant::TermSpecAmt
    Those in the ledger class are problematic because they should be
    treated as write-only output, but are often used for temporary storage
    of evanescent values. Furthermore, ledger data members are generally of
    type 'double', and it is most convenient for them all to share the same
    data type, but a currency type is preferable for actual calculations.
    Therefore, established accessors for these ledger variables, to make it
    easier in forthcoming commits to refactor code that uses them for
    temporary storage.
---
 account_value.hpp |  5 +++++
 accountvalue.cpp  |  7 +++++++
 ihs_acctval.cpp   | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+)

diff --git a/account_value.hpp b/account_value.hpp
index fb24786..f3705f2 100644
--- a/account_value.hpp
+++ b/account_value.hpp
@@ -115,6 +115,11 @@ class LMI_SO AccountValue final
     double TotalAccountValue() const;
     double CashValueFor7702() const;
 
+    double base_specamt(int year) const;
+    double term_specamt(int year) const;
+    double specamt_for_7702(int year) const;
+    double specamt_for_7702A(int year) const;
+
     // We're not yet entirely sure how to handle ledger values. Right now,
     // we have pointers to a Ledger and also to its variant and invariant
     // parts. We put data into the parts, and then insert the parts into
diff --git a/accountvalue.cpp b/accountvalue.cpp
index 43f6873..ac64f53 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -124,6 +124,13 @@ AccountValue::AccountValue(Input const& input)
     NetPmts    .resize(12);
 }
 
+/// Specified amount.
+
+double AccountValue::base_specamt(int year) const
+{
+    return InvariantValues().SpecAmt[year];
+}
+
 //============================================================================
 std::shared_ptr<Ledger const> AccountValue::ledger_from_av() const
 {
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index aeef35d..7c71d51 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -138,6 +138,40 @@ AccountValue::AccountValue(Input const& input)
     withdrawal_ullage_  .reserve(BasicValues::GetLength());
 }
 
+/// Specified amount (disregarding any term or "supplemental" amount).
+
+double AccountValue::base_specamt(int year) const
+{
+    return InvariantValues().SpecAmt[year];
+}
+
+/// Specified amount of term rider.
+
+double AccountValue::term_specamt(int year) const
+{
+    return InvariantValues().TermSpecAmt[year];
+}
+
+/// Specified amount for 7702 (not 7702A).
+
+double AccountValue::specamt_for_7702(int year) const
+{
+    return
+                              InvariantValues().SpecAmt    [year]
+        + (TermIsDbFor7702  ? InvariantValues().TermSpecAmt[year] : 0.0)
+        ;
+}
+
+/// Specified amount for 7702A (not 7702).
+
+double AccountValue::specamt_for_7702A(int year) const
+{
+    return
+                              InvariantValues().SpecAmt    [year]
+        + (TermIsDbFor7702A ? InvariantValues().TermSpecAmt[year] : 0.0)
+        ;
+}
+
 //============================================================================
 std::shared_ptr<Ledger const> AccountValue::ledger_from_av() const
 {



reply via email to

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