money
Class Money

java.lang.Object
  extended bymoney.Money
All Implemented Interfaces:
IMoney

public class Money
extends Object
implements IMoney

A simple Money.


Constructor Summary
Money(int amount, String currency)
          Constructs a money from the given amount and currency.
 
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.
 int amount()
           
 String currency()
           
 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

Money

public Money(int amount,
             String currency)
Constructs a money from the given amount and currency.

Method Detail

add

public IMoney add(IMoney m)
Adds a money to this money. Forwards the request to the addMoney helper.

Specified by:
add in interface IMoney

addMoney

public IMoney addMoney(Money m)
Description copied from interface: IMoney
Adds a simple Money to this money. This is a helper method for implementing double dispatch

Specified by:
addMoney in interface IMoney

addMoneyBag

public IMoney addMoneyBag(MoneyBag s)
Description copied from interface: IMoney
Adds a MoneyBag to this money. This is a helper method for implementing double dispatch

Specified by:
addMoneyBag in interface IMoney

amount

public int amount()

currency

public String currency()

equals

public boolean equals(Object anObject)

hashCode

public int hashCode()

isZero

public boolean isZero()
Description copied from interface: IMoney
Tests whether this money is zero

Specified by:
isZero in interface IMoney

multiply

public IMoney multiply(int factor)
Description copied from interface: IMoney
Multiplies a money by the given factor.

Specified by:
multiply in interface IMoney

negate

public IMoney negate()
Description copied from interface: IMoney
Negates this money.

Specified by:
negate in interface IMoney

subtract

public IMoney subtract(IMoney m)
Description copied from interface: IMoney
Subtracts a money from this money.

Specified by:
subtract in interface IMoney

toString

public String toString()