lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5695] Refactor


From: Greg Chicares
Subject: [lmi-commits] [5695] Refactor
Date: Thu, 18 Apr 2013 11:53:12 +0000

Revision: 5695
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5695
Author:   chicares
Date:     2013-04-18 11:53:12 +0000 (Thu, 18 Apr 2013)
Log Message:
-----------
Refactor

Modified Paths:
--------------
    lmi/trunk/premium_tax.cpp
    lmi/trunk/premium_tax.hpp

Modified: lmi/trunk/premium_tax.cpp
===================================================================
--- lmi/trunk/premium_tax.cpp   2013-04-18 09:24:25 UTC (rev 5694)
+++ lmi/trunk/premium_tax.cpp   2013-04-18 11:53:12 UTC (rev 5695)
@@ -104,6 +104,8 @@
     ,is_tiered_in_tax_state_ (false) // Reset below.
     ,is_tiered_in_domicile_  (false) // Reset below.
     ,is_retaliatory_         (false) // Reset below.
+    ,varies_by_state_        (false) // Reset below.
+    ,load_rate_is_levy_rate_ (false) // Reset below.
     ,ytd_taxable_premium_    (0.0)
     ,ytd_load_               (0.0)
     ,ytd_load_in_tax_state_  (0.0)
@@ -114,6 +116,10 @@
 
     is_retaliatory_ = premium_tax_is_retaliatory(tax_state_, domicile_);
 
+    varies_by_state_ = db.varies_by_state(DB_PremTaxLoad);
+
+    load_rate_is_levy_rate_ = db.are_equivalent(DB_PremTaxLoad, 
DB_PremTaxRate);
+
     minimum_load_rate_ = ascertain_minimum_load_rate(db, strata);
 
     // TODO ?? It would be better not to constrain so many things
@@ -138,7 +144,7 @@
         }
     }
 
-    test_consistency(db);
+    test_consistency();
 }
 
 /// Antediluvian ctor.
@@ -157,6 +163,8 @@
     ,is_tiered_in_tax_state_ (false)
     ,is_tiered_in_domicile_  (false)
     ,is_retaliatory_         (false)
+    ,varies_by_state_        (false)
+    ,load_rate_is_levy_rate_ (false)
     ,ytd_taxable_premium_    (0.0)
     ,ytd_load_               (0.0)
     ,ytd_load_in_tax_state_  (0.0)
@@ -194,12 +202,9 @@
 /// attention. If premium tax is not passed through as a load, then
 /// there's no problem at all.
 
-void premium_tax::test_consistency(product_database const& db) const
+void premium_tax::test_consistency() const
 {
-    if
-        (  db.varies_by_state(DB_PremTaxLoad)
-        && !db.are_equivalent(DB_PremTaxLoad, DB_PremTaxRate)
-        )
+    if(varies_by_state_ && !load_rate_is_levy_rate_)
         {
         fatal_error()
             << "Premium-tax load varies by state, but differs"
@@ -442,7 +447,7 @@
         z = std::max(z, db.Query(DB_PremTaxLoad, index));
         }
 
-    if(!db.varies_by_state(DB_PremTaxLoad))
+    if(!varies_by_state_)
         {
         return z;
         }

Modified: lmi/trunk/premium_tax.hpp
===================================================================
--- lmi/trunk/premium_tax.hpp   2013-04-18 09:24:25 UTC (rev 5694)
+++ lmi/trunk/premium_tax.hpp   2013-04-18 11:53:12 UTC (rev 5695)
@@ -125,7 +125,7 @@
     bool   is_tiered              () const;
 
   private:
-    void test_consistency(product_database const& db) const;
+    void test_consistency() const;
 
     double ascertain_minimum_load_rate
         (product_database   const& db
@@ -144,6 +144,8 @@
     bool   is_tiered_in_tax_state_;
     bool   is_tiered_in_domicile_;
     bool   is_retaliatory_;
+    bool   varies_by_state_;
+    bool   load_rate_is_levy_rate_;
 
     double ytd_taxable_premium_;
     double ytd_load_;




reply via email to

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