Made (un)reduce rvalue methods more consistent
They names were changed from reduce/unreduce to reduced/unreduced, since they return the modified value. This is more consistent with the naming of rounded/rounded.
This commit is contained in:
parent
e6bea6c3eb
commit
e0e181d2af
5 changed files with 16 additions and 11 deletions
|
|
@ -185,10 +185,10 @@ void export_value()
|
|||
.def("rounded", &value_t::rounded)
|
||||
.def("unrounded", &value_t::unrounded)
|
||||
|
||||
.def("reduce", &value_t::reduce)
|
||||
.def("reduced", &value_t::reduced)
|
||||
.def("in_place_reduce", &value_t::in_place_reduce)
|
||||
|
||||
.def("unreduce", &value_t::unreduce)
|
||||
.def("unreduced", &value_t::unreduced)
|
||||
.def("in_place_unreduce", &value_t::in_place_unreduce)
|
||||
|
||||
.def("value", &value_t::value, value_overloads())
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ public:
|
|||
utilize "scaling commodities". For example, an amount of \c 1h
|
||||
after reduction will be \c 3600s.
|
||||
*/
|
||||
amount_t reduce() const {
|
||||
amount_t reduced() const {
|
||||
amount_t temp(*this);
|
||||
temp.in_place_reduce();
|
||||
return temp;
|
||||
|
|
@ -341,7 +341,7 @@ public:
|
|||
compact form greater than one. That is, \c 3599s will unreduce to
|
||||
\c 59.98m, while \c 3601 unreduces to \c 1h.
|
||||
*/
|
||||
amount_t unreduce() const {
|
||||
amount_t unreduced() const {
|
||||
amount_t temp(*this);
|
||||
temp.in_place_unreduce();
|
||||
return temp;
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ public:
|
|||
return temp;
|
||||
}
|
||||
|
||||
balance_t reduce() const {
|
||||
balance_t reduced() const {
|
||||
balance_t temp(*this);
|
||||
temp.in_place_reduce();
|
||||
return temp;
|
||||
|
|
@ -335,11 +335,11 @@ public:
|
|||
// multiple component amounts to collapse to the same commodity.
|
||||
balance_t temp;
|
||||
foreach (const amounts_map::value_type& pair, amounts)
|
||||
temp += pair.second.reduce();
|
||||
temp += pair.second.reduced();
|
||||
return *this = temp;
|
||||
}
|
||||
|
||||
balance_t unreduce() const {
|
||||
balance_t unreduced() const {
|
||||
balance_t temp(*this);
|
||||
temp.in_place_unreduce();
|
||||
return temp;
|
||||
|
|
@ -349,7 +349,7 @@ public:
|
|||
// multiple component amounts to collapse to the same commodity.
|
||||
balance_t temp;
|
||||
foreach (const amounts_map::value_type& pair, amounts)
|
||||
temp += pair.second.unreduce();
|
||||
temp += pair.second.unreduced();
|
||||
return *this = temp;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -812,8 +812,13 @@ xact_t * instance_t::parse_xact(char * line,
|
|||
static_cast<uint_least8_t>(expr_t::PARSE_NO_REDUCE) |
|
||||
static_cast<uint_least8_t>(expr_t::PARSE_NO_ASSIGN));
|
||||
|
||||
#if 0
|
||||
// jww (2009-02-12): This isn't quite working yet; it causes cost computes
|
||||
// to skyrocket, since the per-unit price isn't also being reduced by the
|
||||
// same factor.
|
||||
if (! xact->amount.is_null())
|
||||
xact->amount.reduce();
|
||||
xact->amount.in_place_reduce();
|
||||
#endif
|
||||
|
||||
DEBUG("textual.parse", "line " << linenum << ": "
|
||||
<< "xact amount = " << xact->amount);
|
||||
|
|
|
|||
|
|
@ -408,14 +408,14 @@ public:
|
|||
value_t rounded() const;
|
||||
value_t unrounded() const;
|
||||
|
||||
value_t reduce() const {
|
||||
value_t reduced() const {
|
||||
value_t temp(*this);
|
||||
temp.in_place_reduce();
|
||||
return temp;
|
||||
}
|
||||
void in_place_reduce(); // exists for efficiency's sake
|
||||
|
||||
value_t unreduce() const {
|
||||
value_t unreduced() const {
|
||||
value_t temp(*this);
|
||||
temp.in_place_unreduce();
|
||||
return temp;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue