lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5198] Improve premium-tax encapsulation


From: Greg Chicares
Subject: [lmi-commits] [5198] Improve premium-tax encapsulation
Date: Wed, 01 Jun 2011 20:00:50 +0000

Revision: 5198
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5198
Author:   chicares
Date:     2011-06-01 20:00:47 +0000 (Wed, 01 Jun 2011)
Log Message:
-----------
Improve premium-tax encapsulation

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/basic_values.hpp
    lmi/trunk/ihs_avmly.cpp
    lmi/trunk/ihs_basicval.cpp
    lmi/trunk/loads.cpp
    lmi/trunk/loads_test.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2011-06-01 12:07:37 UTC (rev 5197)
+++ lmi/trunk/ChangeLog 2011-06-01 20:00:47 UTC (rev 5198)
@@ -27932,3 +27932,40 @@
 Remove a misbegotten ledger variable that no xsl template uses. Any
 potential use in pdf output is probably more trouble than it's worth.
 
+20110530T1601Z <address@hidden> [650]
+
+  premium_tax.cpp
+  premium_tax.hpp
+Refactor.
+
+20110601T1132Z <address@hidden> [650]
+
+  premium_tax.cpp
+  premium_tax.hpp
+Regularize argument names.
+
+20110601T1142Z <address@hidden> [650]
+
+  premium_tax.cpp
+  premium_tax.hpp
+Refactor.
+
+20110601T1207Z <address@hidden> [650]
+
+  Makefile.am
+  antediluvian_stubs.cpp
+  basicvalues.cpp
+  objects.make
+  premium_tax.cpp
+  premium_tax.hpp
+Use premium-tax class in antediluvian fork.
+
+20110601T2000Z <address@hidden> [650]
+
+  basic_values.hpp
+  ihs_avmly.cpp
+  ihs_basicval.cpp
+  loads.cpp
+  loads_test.cpp
+Improve premium-tax encapsulation.
+

Modified: lmi/trunk/basic_values.hpp
===================================================================
--- lmi/trunk/basic_values.hpp  2011-06-01 12:07:37 UTC (rev 5197)
+++ lmi/trunk/basic_values.hpp  2011-06-01 20:00:47 UTC (rev 5198)
@@ -110,10 +110,6 @@
     mcenum_state          GetStateOfJurisdiction()     const;
     mcenum_state          GetStateOfDomicile()         const;
     mcenum_state          GetPremiumTaxState()         const;
-    double                PremiumTaxRate()             const; ////
-    double                PremiumTaxLoad()             const; ////
-    double                LowestPremiumTaxLoad()       const; ////
-    double                DomiciliaryPremiumTaxLoad()  const; ////
     bool                  IsSubjectToIllustrationReg() const;
     double                InvestmentManagementFee()    const;
 
@@ -371,13 +367,7 @@
     std::vector<double>     TieredMEBands;
     std::vector<double>     TieredMECharges;
 
-    bool                    PremiumTaxLoadIsTieredInStateOfDomicile_; ////
-    bool                    PremiumTaxLoadIsTieredInPremiumTaxState_; ////
-    bool                    premium_tax_is_retaliatory_; ////
-
   private:
-    void SetPremiumTaxParameters(); ////
-
     double GetModalPrem
         (int                   a_year
         ,mcenum_mode           a_mode
@@ -430,10 +420,6 @@
     mcenum_state        StateOfJurisdiction_;
     mcenum_state        StateOfDomicile_;
     mcenum_state        PremiumTaxState_;
-    double              PremiumTaxRate_; ////
-    double              PremiumTaxLoad_; ////
-    double              LowestPremiumTaxLoad_; ////
-    double              DomiciliaryPremiumTaxLoad_; ////
     mutable double      InitialTargetPremium;
 
     void                Init7702();
@@ -503,26 +489,6 @@
     return PremiumTaxState_;
 }
 
-inline double BasicValues::PremiumTaxRate() const ////
-{
-    return PremiumTaxRate_;
-}
-
-inline double BasicValues::PremiumTaxLoad() const ////
-{
-    return PremiumTaxLoad_;
-}
-
-inline double BasicValues::LowestPremiumTaxLoad() const ////
-{
-    return LowestPremiumTaxLoad_;
-}
-
-inline double BasicValues::DomiciliaryPremiumTaxLoad() const ////
-{
-    return DomiciliaryPremiumTaxLoad_;
-}
-
 inline bool BasicValues::IsSubjectToIllustrationReg() const
 {
     return IsSubjectToIllustrationReg_;

Modified: lmi/trunk/ihs_avmly.cpp
===================================================================
--- lmi/trunk/ihs_avmly.cpp     2011-06-01 12:07:37 UTC (rev 5197)
+++ lmi/trunk/ihs_avmly.cpp     2011-06-01 20:00:47 UTC (rev 5198)
@@ -45,6 +45,7 @@
 #include "miscellany.hpp"
 #include "mortality_rates.hpp"
 #include "outlay.hpp"
+#include "premium_tax.hpp"
 #include "stratified_algorithms.hpp"
 #include "stratified_charges.hpp"
 
@@ -1482,7 +1483,7 @@
         ;
     HOPEFULLY(0.0 <= sum_of_separate_loads);
     LMI_ASSERT
-        (   PremiumTaxLoadIsTieredInPremiumTaxState_
+        (   PremiumTax_->load_is_tiered_in_premium_tax_state()
         ||  materially_equal(total_load, sum_of_separate_loads)
         );
 
@@ -1504,7 +1505,7 @@
 double AccountValue::GetPremTaxLoad(double payment)
 {
     double tax_in_premium_tax_state = YearsPremTaxLoadRate * payment;
-    if(PremiumTaxLoadIsTieredInPremiumTaxState_)
+    if(PremiumTax_->load_is_tiered_in_premium_tax_state())
         {
         LMI_ASSERT(0.0 == tax_in_premium_tax_state);
         tax_in_premium_tax_state = StratifiedCharges_->tiered_premium_tax
@@ -1516,10 +1517,10 @@
     YearsTotalPremTaxLoadInPremiumTaxState += tax_in_premium_tax_state;
 
     double tax_in_state_of_domicile = 0.0;
-    if(premium_tax_is_retaliatory_)
+    if(PremiumTax_->premium_tax_is_retaliatory())
         {
-        tax_in_state_of_domicile = DomiciliaryPremiumTaxLoad() * payment;
-        if(PremiumTaxLoadIsTieredInStateOfDomicile_)
+        tax_in_state_of_domicile = PremiumTax_->domiciliary_load_rate() * 
payment;
+        if(PremiumTax_->load_is_tiered_in_state_of_domicile())
             {
             LMI_ASSERT(0.0 == tax_in_state_of_domicile);
             tax_in_state_of_domicile = StratifiedCharges_->tiered_premium_tax

Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp  2011-06-01 12:07:37 UTC (rev 5197)
+++ lmi/trunk/ihs_basicval.cpp  2011-06-01 20:00:47 UTC (rev 5198)
@@ -235,7 +235,6 @@
     // Outlay requires only input; it might someday use interest rates.
     Outlay_        .reset(new modal_outlay   (yare_input_));
     PremiumTax_    .reset(new premium_tax    (PremiumTaxState_, 
StateOfDomicile_, yare_input_.AmortizePremiumLoad, *Database_, 
*StratifiedCharges_));
-    SetPremiumTaxParameters();
     Loads_         .reset(new Loads          (*this));
 
     // The target premium can't be ascertained yet if specamt is
@@ -310,7 +309,6 @@
     // Outlay requires only input; it might someday use interest rates.
 //  Outlay_        .reset(new modal_outlay   (yare_input_));
     PremiumTax_    .reset(new premium_tax    (PremiumTaxState_, 
StateOfDomicile_, yare_input_.AmortizePremiumLoad, *Database_, 
*StratifiedCharges_));
-    SetPremiumTaxParameters();
     Loads_         .reset(new Loads          (*this));
 
     SetPermanentInvariants();
@@ -806,19 +804,6 @@
     set_rounding_rule(round_interest_rate_7702_, 
RoundingRules_->datum("RoundIntRate7702"));
 }
 
-// Soon to be removed.
-
-void BasicValues::SetPremiumTaxParameters()
-{
-    PremiumTaxLoadIsTieredInPremiumTaxState_ = 
PremiumTax_->load_is_tiered_in_premium_tax_state();
-    PremiumTaxLoadIsTieredInStateOfDomicile_ = 
PremiumTax_->load_is_tiered_in_state_of_domicile();
-    premium_tax_is_retaliatory_              = 
PremiumTax_->premium_tax_is_retaliatory         ();
-    PremiumTaxRate_                          = PremiumTax_->levy_rate          
                ();
-    PremiumTaxLoad_                          = PremiumTax_->load_rate          
                ();
-    LowestPremiumTaxLoad_                    = PremiumTax_->least_load_rate    
                ();
-    DomiciliaryPremiumTaxLoad_               = 
PremiumTax_->domiciliary_load_rate              ();
-}
-
 //============================================================================
 void BasicValues::SetMaxSurvivalDur()
 {

Modified: lmi/trunk/loads.cpp
===================================================================
--- lmi/trunk/loads.cpp 2011-06-01 12:07:37 UTC (rev 5197)
+++ lmi/trunk/loads.cpp 2011-06-01 20:00:47 UTC (rev 5198)
@@ -37,6 +37,7 @@
 #include "et_vector.hpp"
 #include "math_functors.hpp"
 #include "mc_enum_types_aux.hpp" // mc_n_ enumerators
+#include "premium_tax.hpp"
 
 #include <algorithm>
 #include <functional>
@@ -57,9 +58,9 @@
     load_details details
         (length
         ,V.yare_input_.AmortizePremiumLoad
-        ,V.PremiumTaxLoad()
-        ,V.LowestPremiumTaxLoad()
-        ,V.PremiumTaxRate()
+        ,V.PremiumTax_->load_rate()
+        ,V.PremiumTax_->least_load_rate()
+        ,V.PremiumTax_->levy_rate()
         ,V.Database_->Query(DB_PremTaxAmortIntRate)
         ,V.Database_->Query(DB_PremTaxAmortPeriod)
         ,V.Database_->Query(DB_AssetChargeType)
@@ -237,9 +238,9 @@
 
     // Total load excludes monthly_policy_fee_, annual_policy_fee_,
     // amortized_premium_tax_load_, and specified_amount_load_ because
-    // they are charges rather than loads (despite the last one's
-    // name): they're always deducted whether or not any payment is
-    // made.
+    // they are charges rather than loads (despite the names of the
+    // last two): they're always deducted whether or not any payment
+    // is made.
 
     for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
         {

Modified: lmi/trunk/loads_test.cpp
===================================================================
--- lmi/trunk/loads_test.cpp    2011-06-01 12:07:37 UTC (rev 5197)
+++ lmi/trunk/loads_test.cpp    2011-06-01 20:00:47 UTC (rev 5198)
@@ -60,6 +60,11 @@
 void product_database::Query(std::vector<double>& v, e_database_key) const 
{v.resize(length_);}
 double product_database::Query(e_database_key) const {return 0.0;}
 
+#include "premium_tax.hpp"
+double premium_tax::levy_rate      () const {return 0.0;}
+double premium_tax::load_rate      () const {return 0.0;}
+double premium_tax::least_load_rate() const {return 0.0;}
+
 struct LoadsTest
 {
     LoadsTest(load_details const& details)




reply via email to

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