[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 579a4f4 3/9: Simplify [378]
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 579a4f4 3/9: Simplify [378] |
Date: |
Thu, 4 Oct 2018 19:24:14 -0400 (EDT) |
branch: master
commit 579a4f44662acf2e28e4ec51f0d04eb9bf8f52fd
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Simplify [378]
See the immediately preceding commit.
---
ledger.cpp | 25 -------------------------
ledger.hpp | 8 --------
2 files changed, 33 deletions(-)
diff --git a/ledger.cpp b/ledger.cpp
index c7d9db2..7ef4d24 100644
--- a/ledger.cpp
+++ b/ledger.cpp
@@ -73,7 +73,6 @@ Ledger::Ledger
,nonillustrated_ {nonillustrated}
,no_can_issue_ {no_can_issue}
,is_composite_ {is_composite}
- ,composite_lapse_year_ {0.0}
,ledger_map_ {new ledger_map_holder}
,ledger_invariant_ {new LedgerInvariant(length)}
{
@@ -234,10 +233,6 @@ Ledger& Ledger::PlusEq(Ledger const& a_Addend)
((*addend_i).second
,a_Addend.ledger_invariant_->GetInforceLives()
);
- composite_lapse_year_ = std::max
- (composite_lapse_year_
- ,(*addend_i).second.LapseYear
- );
(*this_i).second.LapseYear = std::max
((*this_i).second.LapseYear
,(*addend_i).second.LapseYear
@@ -287,26 +282,6 @@ void Ledger::SetOneLedgerVariant
//============================================================================
int Ledger::GetMaxLength() const
{
- if(is_composite_)
- {
- ledger_map_t const& l_map_rep = ledger_map_->held();
- double max_length = 0.0;
-
- for(auto const& i : l_map_rep)
- {
- max_length = std::max(max_length, i.second.LapseYear);
- }
- LMI_ASSERT(max_length == composite_lapse_year_);
- // TODO ?? The rationale for this special case is not evident.
- // This variable is initialized to zero in the ctor. If it has
- // acquired a value that's actually meaningful, then it looks
- // like the variables used in the general case would have, too,
- // which would reduce this special case to mere caching, which
- // seems like a premature optimization and a needless
- // complication.
- return static_cast<int>(composite_lapse_year_);
- }
-
// For all ledgers in the map, find the longest duration that must
// be printed (until the last one lapses).
ledger_map_t const& l_map_rep = ledger_map_->held();
diff --git a/ledger.hpp b/ledger.hpp
index 0bd8821..d5bee27 100644
--- a/ledger.hpp
+++ b/ledger.hpp
@@ -133,14 +133,6 @@ class LMI_SO Ledger
bool no_can_issue_ ;
bool is_composite_ ;
- // TODO ?? This is either badly named or badly implemented. Every
- // instance of this class, even an instance for a single cell, has
- // this variable. It seems to be used only for composites. It
- // seems to cache the latest lapse year on any basis, but only for
- // composites, yet it is not evident why that is desirable for
- // composites but not for all cells.
- double composite_lapse_year_;
-
std::shared_ptr<ledger_map_holder> ledger_map_;
std::shared_ptr<LedgerInvariant> ledger_invariant_;
- [lmi-commits] [lmi] master updated (b3e084f -> b36660c), Greg Chicares, 2018/10/04
- [lmi-commits] [lmi] master af5a41d 2/9: Demonstrate the nugatoriness of composite_lapse_year_, Greg Chicares, 2018/10/04
- [lmi-commits] [lmi] master b957c49 1/9: Rewrite write_tsv(), Greg Chicares, 2018/10/04
- [lmi-commits] [lmi] master 1d9b6e9 4/9: Store a useful value; discard a useless one, Greg Chicares, 2018/10/04
- [lmi-commits] [lmi] master 579a4f4 3/9: Simplify [378],
Greg Chicares <=
- [lmi-commits] [lmi] master fac6d21 8/9: Rename local variables in one function, Greg Chicares, 2018/10/04
- [lmi-commits] [lmi] master 4c6e6c3 6/9: Prefer bourn_cast to static_cast for arithmetic type conversions, Greg Chicares, 2018/10/04
- [lmi-commits] [lmi] master b36660c 9/9: Define short aliases early; use them wherever possible, Greg Chicares, 2018/10/04
- [lmi-commits] [lmi] master 18f1ca3 7/9: Refactor to remove duplication, Greg Chicares, 2018/10/04
- [lmi-commits] [lmi] master 797a8b8 5/9: Rename a member function, Greg Chicares, 2018/10/04