[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [5189] Move premium-tax implementation
From: |
Greg Chicares |
Subject: |
[lmi-commits] [5189] Move premium-tax implementation |
Date: |
Sun, 29 May 2011 15:21:44 +0000 |
Revision: 5189
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5189
Author: chicares
Date: 2011-05-29 15:21:42 +0000 (Sun, 29 May 2011)
Log Message:
-----------
Move premium-tax implementation
Modified Paths:
--------------
lmi/trunk/basic_values.hpp
lmi/trunk/ihs_basicval.cpp
lmi/trunk/premium_tax.cpp
lmi/trunk/premium_tax.hpp
Modified: lmi/trunk/basic_values.hpp
===================================================================
--- lmi/trunk/basic_values.hpp 2011-05-29 14:29:30 UTC (rev 5188)
+++ lmi/trunk/basic_values.hpp 2011-05-29 15:21:42 UTC (rev 5189)
@@ -378,7 +378,6 @@
private:
void SetPremiumTaxParameters(); ////
- void TestPremiumTaxLoadConsistency() const; ////
double GetModalPrem
(int a_year
Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp 2011-05-29 14:29:30 UTC (rev 5188)
+++ lmi/trunk/ihs_basicval.cpp 2011-05-29 15:21:42 UTC (rev 5189)
@@ -841,7 +841,8 @@
,*StratifiedCharges_
);
- // TODO ?? It would be better not to constrain so many things
+ // [Marked as a defect in class premium_tax.]
+ // It would be better not to constrain so many things
// not to vary by duration by using Query(enumerator).
database_index index = Database_->index().state(GetPremiumTaxState());
@@ -863,67 +864,15 @@
}
}
- TestPremiumTaxLoadConsistency();
+ LMI_ASSERT(PremiumTaxLoadIsTieredInPremiumTaxState_ ==
PremiumTax_->PremiumTaxLoadIsTieredInPremiumTaxState());
+ LMI_ASSERT(PremiumTaxLoadIsTieredInStateOfDomicile_ ==
PremiumTax_->PremiumTaxLoadIsTieredInStateOfDomicile());
+ LMI_ASSERT(premium_tax_is_retaliatory_ ==
PremiumTax_->premium_tax_is_retaliatory());
+ LMI_ASSERT(LowestPremiumTaxLoad_ ==
PremiumTax_->LowestPremiumTaxLoad());
+ LMI_ASSERT(PremiumTaxRate_ ==
PremiumTax_->PremiumTaxRate());
+ LMI_ASSERT(PremiumTaxLoad_ ==
PremiumTax_->PremiumTaxLoad());
+ LMI_ASSERT(DomiciliaryPremiumTaxLoad_ ==
PremiumTax_->DomiciliaryPremiumTaxLoad());
}
-/// Test consistency of premium-tax loads.
-///
-/// In particular, if the tiered premium-tax load isn't zero, then the
-/// corresponding non-tiered load must be zero.
-///
-/// Premium-tax pass-through for AK, DE, and SD insurers is not
-/// supported. If the state of domicile has a tiered rate, then most
-/// likely the premium-tax state does not, and retaliation would often
-/// override the tiering. When those two states are the same, then no
-/// retaliation occurs, and calculations would presumably be correct.
-/// When both states have tiered rates, but they are different states,
-/// then the calculation could be complicated; but DE tiering is not
-/// supported at all yet, and AK (SD) companies probably write few
-/// contracts in SD (AK), so these exotic cases haven't commanded any
-/// attention. If premium tax is not passed through as a load, then
-/// there's no problem at all.
-
-void BasicValues::TestPremiumTaxLoadConsistency() const
-{
- if(PremiumTaxLoadIsTieredInPremiumTaxState_)
- {
- if(0.0 != PremiumTaxLoad())
- {
- fatal_error()
- << "Premium-tax load is tiered in premium-tax state "
- << mc_str(GetPremiumTaxState())
- << ", but the product database specifies a scalar load of "
- << PremiumTaxLoad()
- << " instead of zero as expected. Probably the database"
- << " is incorrect."
- << LMI_FLUSH
- ;
- }
- }
-
- if(PremiumTaxLoadIsTieredInStateOfDomicile_)
- {
- if(0.0 != DomiciliaryPremiumTaxLoad())
- {
- fatal_error()
- << "Premium-tax load is tiered in state of domicile "
- << mc_str(GetStateOfDomicile())
- << ", but the product database specifies a scalar load of "
- << DomiciliaryPremiumTaxLoad()
- << " instead of zero as expected. Probably the database"
- << " is incorrect."
- << LMI_FLUSH
- ;
- }
- fatal_error()
- << "Premium-tax load is tiered in state of domicile "
- << mc_str(GetStateOfDomicile())
- << ", but that case is not supported."
- << LMI_FLUSH
- ;
- }
-}
-
//============================================================================
void BasicValues::SetMaxSurvivalDur()
{
Modified: lmi/trunk/premium_tax.cpp
===================================================================
--- lmi/trunk/premium_tax.cpp 2011-05-29 14:29:30 UTC (rev 5188)
+++ lmi/trunk/premium_tax.cpp 2011-05-29 15:21:42 UTC (rev 5189)
@@ -45,13 +45,133 @@
,state_of_domicile_ (state_of_domicile)
,amortize_premium_load_ (amortize_premium_load)
{
-(void)database;
-(void)strata;
+ SetPremiumTaxParameters(database, strata);
}
premium_tax::~premium_tax()
{}
+/// Set all parameters that depend on premium-tax state.
+///
+/// These database entities should be looked up by tax state:
+/// - DB_PremTaxLoad
+/// - DB_PremTaxRate
+/// These probably (for inchoate amortization) shouldn't:
+/// - DB_PremTaxAmortPeriod
+/// - DB_PremTaxAmortIntRate
+/// This definitely shouldn't be:
+/// - DB_PremTaxState
+/// These aren't used anywhere yet:
+/// - DB_PremTaxFundCharge
+/// - DB_PremTaxTable
+/// - DB_PremTaxTierGroup
+/// - DB_PremTaxTierPeriod
+/// - DB_PremTaxTierNonDecr
+
+void premium_tax::SetPremiumTaxParameters
+ (product_database const& Database_
+ ,stratified_charges const& StratifiedCharges_
+ )
+{
+ PremiumTaxLoadIsTieredInStateOfDomicile_ =
StratifiedCharges_.premium_tax_is_tiered(state_of_domicile_);
+ PremiumTaxLoadIsTieredInPremiumTaxState_ =
StratifiedCharges_.premium_tax_is_tiered(premium_tax_state_);
+
+ premium_tax_is_retaliatory_ = ::premium_tax_is_retaliatory
+ (premium_tax_state_
+ ,state_of_domicile_
+ );
+
+ LowestPremiumTaxLoad_ = lowest_premium_tax_load
+ (premium_tax_state_
+ ,state_of_domicile_
+ ,amortize_premium_load_
+ ,Database_
+ ,StratifiedCharges_
+ );
+
+ // TODO ?? It would be better not to constrain so many things
+ // not to vary by duration by using Query(enumerator).
+
+ database_index index = Database_.index().state(premium_tax_state_);
+ PremiumTaxRate_ = Database_.Query(DB_PremTaxRate ,
index);
+ PremiumTaxLoad_ = Database_.Query(DB_PremTaxLoad ,
index);
+
+ {
+ database_index index = Database_.index().state(state_of_domicile_);
+ DomiciliaryPremiumTaxLoad_ = 0.0;
+ if(!amortize_premium_load_)
+ {
+ double domiciliary_premium_tax_rate = Database_.Query(DB_PremTaxRate,
index);
+ DomiciliaryPremiumTaxLoad_ = Database_.Query(DB_PremTaxLoad,
index);
+ if(premium_tax_is_retaliatory_)
+ {
+ PremiumTaxRate_ = std::max(PremiumTaxRate_,
domiciliary_premium_tax_rate);
+ PremiumTaxLoad_ = std::max(PremiumTaxLoad_,
DomiciliaryPremiumTaxLoad_ );
+ }
+ }
+ }
+
+ TestPremiumTaxLoadConsistency();
+}
+
+/// Test consistency of premium-tax loads.
+///
+/// In particular, if the tiered premium-tax load isn't zero, then the
+/// corresponding non-tiered load must be zero.
+///
+/// Premium-tax pass-through for AK, DE, and SD insurers is not
+/// supported. If the state of domicile has a tiered rate, then most
+/// likely the premium-tax state does not, and retaliation would often
+/// override the tiering. When those two states are the same, then no
+/// retaliation occurs, and calculations would presumably be correct.
+/// When both states have tiered rates, but they are different states,
+/// then the calculation could be complicated; but DE tiering is not
+/// supported at all yet, and AK (SD) companies probably write few
+/// contracts in SD (AK), so these exotic cases haven't commanded any
+/// attention. If premium tax is not passed through as a load, then
+/// there's no problem at all.
+
+void premium_tax::TestPremiumTaxLoadConsistency() const
+{
+ if(PremiumTaxLoadIsTieredInPremiumTaxState_)
+ {
+ if(0.0 != PremiumTaxLoad())
+ {
+ fatal_error()
+ << "Premium-tax load is tiered in premium-tax state "
+ << mc_str(premium_tax_state_)
+ << ", but the product database specifies a scalar load of "
+ << PremiumTaxLoad()
+ << " instead of zero as expected. Probably the database"
+ << " is incorrect."
+ << LMI_FLUSH
+ ;
+ }
+ }
+
+ if(PremiumTaxLoadIsTieredInStateOfDomicile_)
+ {
+ if(0.0 != DomiciliaryPremiumTaxLoad())
+ {
+ fatal_error()
+ << "Premium-tax load is tiered in state of domicile "
+ << mc_str(state_of_domicile_)
+ << ", but the product database specifies a scalar load of "
+ << DomiciliaryPremiumTaxLoad()
+ << " instead of zero as expected. Probably the database"
+ << " is incorrect."
+ << LMI_FLUSH
+ ;
+ }
+ fatal_error()
+ << "Premium-tax load is tiered in state of domicile "
+ << mc_str(state_of_domicile_)
+ << ", but that case is not supported."
+ << LMI_FLUSH
+ ;
+ }
+}
+
/// Determine whether premium tax is retaliatory.
///
/// Here's a general discussion:
Modified: lmi/trunk/premium_tax.hpp
===================================================================
--- lmi/trunk/premium_tax.hpp 2011-05-29 14:29:30 UTC (rev 5188)
+++ lmi/trunk/premium_tax.hpp 2011-05-29 15:21:42 UTC (rev 5189)
@@ -52,9 +52,15 @@
double LowestPremiumTaxLoad() const; ////
double DomiciliaryPremiumTaxLoad() const; ////
bool PremiumTaxLoadIsTiered() const; ////
+ bool PremiumTaxLoadIsTieredInPremiumTaxState() const;
+ bool PremiumTaxLoadIsTieredInStateOfDomicile() const;
+ bool premium_tax_is_retaliatory() const;
private:
- void SetPremiumTaxParameters(); ////
+ void SetPremiumTaxParameters
+ (product_database const&
+ ,stratified_charges const&
+ ); ////
void TestPremiumTaxLoadConsistency() const; ////
// Ctor value-arguments.
@@ -104,10 +110,26 @@
return DomiciliaryPremiumTaxLoad_;
}
+//// Identical to the more-appropriately-named
PremiumTaxLoadIsTieredInPremiumTaxState().
inline bool premium_tax::PremiumTaxLoadIsTiered() const ////
{
return PremiumTaxLoadIsTieredInPremiumTaxState_;
}
+inline bool premium_tax::PremiumTaxLoadIsTieredInPremiumTaxState() const
+{
+ return PremiumTaxLoadIsTieredInPremiumTaxState_;
+}
+
+inline bool premium_tax::PremiumTaxLoadIsTieredInStateOfDomicile() const
+{
+ return PremiumTaxLoadIsTieredInStateOfDomicile_;
+}
+
+inline bool premium_tax::premium_tax_is_retaliatory() const
+{
+ return premium_tax_is_retaliatory_;
+}
+
#endif // premium_tax_hpp
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [5189] Move premium-tax implementation,
Greg Chicares <=