|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmoney.MoneyBag
A MoneyBag defers exchange rate conversions. For example adding 12 Swiss Francs to 14 US Dollars is represented as a bag containing the two Monies 12 CHF and 14 USD. Adding another 10 Swiss francs gives a bag with 22 CHF and 14 USD. Due to the deferred exchange rate conversion we can later value a MoneyBag with different exchange rates. A MoneyBag is represented as a list of Monies and provides different constructors to create a MoneyBag.
Constructor Summary | |
MoneyBag(Money[] bag)
|
|
MoneyBag(MoneyBag m1,
MoneyBag m2)
|
|
MoneyBag(Money m1,
Money m2)
|
|
MoneyBag(Money m,
MoneyBag bag)
|
Method Summary | |
IMoney |
add(IMoney m)
Adds a money to this money. |
IMoney |
addMoney(Money m)
Adds a simple Money to this money. |
IMoney |
addMoneyBag(MoneyBag s)
Adds a MoneyBag to this money. |
boolean |
equals(Object anObject)
|
int |
hashCode()
|
boolean |
isZero()
Tests whether this money is zero |
IMoney |
multiply(int factor)
Multiplies a money by the given factor. |
IMoney |
negate()
Negates this money. |
IMoney |
subtract(IMoney m)
Subtracts a money from this money. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public MoneyBag(Money[] bag)
public MoneyBag(Money m1, Money m2)
public MoneyBag(Money m, MoneyBag bag)
public MoneyBag(MoneyBag m1, MoneyBag m2)
Method Detail |
public IMoney add(IMoney m)
IMoney
add
in interface IMoney
public IMoney addMoney(Money m)
IMoney
addMoney
in interface IMoney
public IMoney addMoneyBag(MoneyBag s)
IMoney
addMoneyBag
in interface IMoney
public boolean equals(Object anObject)
public int hashCode()
public boolean isZero()
IMoney
isZero
in interface IMoney
public IMoney multiply(int factor)
IMoney
multiply
in interface IMoney
public IMoney negate()
IMoney
negate
in interface IMoney
public IMoney subtract(IMoney m)
IMoney
subtract
in interface IMoney
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |