diff options
Diffstat (limited to 'junit4/src/test/java/junit/samples/money/IMoney.java')
-rw-r--r-- | junit4/src/test/java/junit/samples/money/IMoney.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/junit4/src/test/java/junit/samples/money/IMoney.java b/junit4/src/test/java/junit/samples/money/IMoney.java new file mode 100644 index 0000000..b8f9496 --- /dev/null +++ b/junit4/src/test/java/junit/samples/money/IMoney.java @@ -0,0 +1,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); +}
\ No newline at end of file |