task2/solution05/src/org/apidesign/apifest08/currency/Amount.java
changeset 42 2c8c32ad44f7
parent 41 a7e6f84fb078
child 44 6a500cd1e467
     1.1 --- a/task2/solution05/src/org/apidesign/apifest08/currency/Amount.java	Tue Oct 07 01:18:23 2008 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,92 +0,0 @@
     1.4 -package org.apidesign.apifest08.currency;
     1.5 -
     1.6 -/**
     1.7 - * Amount is a class reprezenting an amount of many. It consist of
     1.8 - * whole currency amount and of pence amount. Both items are long values
     1.9 - * and it's not defined that the 100 pences = 1 amount. It's up to the converter
    1.10 - * to verify such invariants.
    1.11 - *
    1.12 - * @author jindra
    1.13 - */
    1.14 -public final class Amount {
    1.15 -
    1.16 -    private long amount;
    1.17 -    private long pence;
    1.18 -
    1.19 -    /**
    1.20 -     * Construct Amount with no pences.
    1.21 -     *
    1.22 -     * @param amount the amount in some currency
    1.23 -     *
    1.24 -     */
    1.25 -    public Amount(long amount) {
    1.26 -        this.amount = amount;
    1.27 -        this.pence = 0;
    1.28 -    }
    1.29 -
    1.30 -    /**
    1.31 -     * Construct Amount with the pences.
    1.32 -     *
    1.33 -     * @param amount the amount in some currency
    1.34 -     * @param pence the pence count
    1.35 -     */
    1.36 -    public Amount(long amount, long pence) {
    1.37 -        this.amount = amount;
    1.38 -        this.pence = pence;
    1.39 -    }
    1.40 -
    1.41 -    /**
    1.42 -     * @return the amount
    1.43 -     */
    1.44 -    public long getAmount() {
    1.45 -        return amount;
    1.46 -    }
    1.47 -
    1.48 -    /**
    1.49 -     * @param amount the amount to set
    1.50 -     */
    1.51 -    public void setAmount(long amount) {
    1.52 -        this.amount = amount;
    1.53 -    }
    1.54 -
    1.55 -    /**
    1.56 -     * @return the pence
    1.57 -     */
    1.58 -    public long getPence() {
    1.59 -        return pence;
    1.60 -    }
    1.61 -
    1.62 -    /**
    1.63 -     * @param pence the pence to set
    1.64 -     */
    1.65 -    public void setPence(long pence) {
    1.66 -        this.pence = pence;
    1.67 -    }
    1.68 -
    1.69 -    @Override
    1.70 -    public boolean equals(Object obj) {
    1.71 -        if (obj == null) {
    1.72 -            return false;
    1.73 -        }
    1.74 -        if (!(obj instanceof Amount)) {
    1.75 -            return false;
    1.76 -        }
    1.77 -        Amount other = (Amount) obj;
    1.78 -        return (amount == other.amount) && (pence == other.pence);
    1.79 -    }
    1.80 -
    1.81 -    @Override
    1.82 -    public int hashCode() {
    1.83 -        int hash = 7;
    1.84 -        hash = 79 * hash + (int) (this.amount ^ (this.amount >>> 32));
    1.85 -        hash = 79 * hash + (int) (this.pence ^ (this.pence >>> 32));
    1.86 -        return hash;
    1.87 -    }
    1.88 -
    1.89 -    @Override
    1.90 -    public String toString() {
    1.91 -        return amount + "." + pence;
    1.92 -    }
    1.93 -
    1.94 -
    1.95 -}