Introduced a new class CalculatedAmount. Unlike Amount, it can contain negative values inside without data integrity issues. It also supports addition and subtraction, which was previously done (incorrectly) outside using the underlying BigDecimal types.
CalculatedAmount is deliberately not a subtype of Amount, due to them representing different things, despite sharing a similar implementation.
Removed from Amount methods that are no longer necessary, such as getValue and isNonNegative. These methods have been moved to CalculatedAmount instead.
Removed from Amount the of method and its associated constructor. It is no longer needed.
Changed the type of the following properties in MonthlyBudget
Fixes #279
Changes made:
CalculatedAmount
. UnlikeAmount
, it can contain negative values inside without data integrity issues. It also supports addition and subtraction, which was previously done (incorrectly) outside using the underlyingBigDecimal
types.CalculatedAmount
is deliberately not a subtype ofAmount
, due to them representing different things, despite sharing a similar implementation.Amount
methods that are no longer necessary, such asgetValue
andisNonNegative
. These methods have been moved toCalculatedAmount
instead.Amount
theof
method and its associated constructor. It is no longer needed.MonthlyBudget
monthlyExpenseLimit
:ObservableAmount
->ObjectProperty<Amount>
monthlySavingsGoal
:ObservableAmount
->ObjectProperty<Amount>
remainingBudget
:ObservableAmount
->ObjectProperty<CalculatedAmount>
currentSavings
:ObservableAmount
->ObjectProperty<CalculatedAmount>
Amount
s and are maintained asAmount
s.CalculatedAmount
s.ObservableAmount
class.CalculatedAmount
instead ofBigDecimal
.Pitest: https://ay2021s1-cs2103t-w16-3.github.io/reports/pitest/202011060226