blob: b8f9496f7907b5992465c402f9dafe9b76b1b965 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package junit.samples.money;
/**
* The common interface for simple Monies and MoneyBags
*
*/
public interface IMoney {
/**
* Adds a money to this money.
*/
public abstract IMoney add(IMoney m);
/**
* Adds a simple Money to this money. This is a helper method for
* implementing double dispatch
*/
public abstract IMoney addMoney(Money m);
/**
* Adds a MoneyBag to this money. This is a helper method for
* implementing double dispatch
*/
public abstract IMoney addMoneyBag(MoneyBag s);
/**
* Tests whether this money is zero
*/
public abstract boolean isZero();
/**
* Multiplies a money by the given factor.
*/
public abstract IMoney multiply(int factor);
/**
* Negates this money.
*/
public abstract IMoney negate();
/**
* Subtracts a money from this money.
*/
public abstract IMoney subtract(IMoney m);
/**
* Append this to a MoneyBag m.
* appendTo() needs to be public because it is used
* polymorphically, but it should not be used by clients
* because it modifies the argument m.
*/
public abstract void appendTo(MoneyBag m);
}
|