task1/solution02/src/org/apidesign/apifest08/currency/MoneyImpl.java
changeset 16 2864c6d744c0
parent 6 97662396c0fd
     1.1 --- a/task1/solution02/src/org/apidesign/apifest08/currency/MoneyImpl.java	Sun Sep 28 14:12:38 2008 +0200
     1.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/MoneyImpl.java	Tue Sep 30 11:47:02 2008 +0200
     1.3 @@ -19,7 +19,7 @@
     1.4  	public MoneyImpl(BigDecimal amount, Currency currency) {
     1.5  		if (amount==null) throw new NullPointerException("Amount is null");
     1.6  		if (currency==null) throw new NullPointerException("Currency is null"+currency);
     1.7 -		this.amount = amount.setScale(2);
     1.8 +		this.amount = amount;
     1.9  		this.currency = currency;
    1.10  	}
    1.11  	
    1.12 @@ -31,15 +31,16 @@
    1.13  		this(BigDecimal.valueOf(amount), currency);
    1.14  	}
    1.15  
    1.16 -	/* (non-Javadoc)
    1.17 -	 * @see org.apidesign.apifest08.currency.Money#getAmount()
    1.18 +	/**
    1.19 +	 * Returns amount.
    1.20 +	 * @return
    1.21  	 */
    1.22  	public BigDecimal getAmount() {
    1.23  		return amount;
    1.24  	}
    1.25  	
    1.26 -	/* (non-Javadoc)
    1.27 -	 * @see org.apidesign.apifest08.currency.Money#getCurrency()
    1.28 +	/**
    1.29 +	 * Returns currency.
    1.30  	 */
    1.31  	public Currency getCurrency() {
    1.32  		return currency;
    1.33 @@ -67,7 +68,7 @@
    1.34  		if (amount == null) {
    1.35  			if (other.amount != null)
    1.36  				return false;
    1.37 -		} else if (!amount.equals(other.amount))
    1.38 +		} else if (amount.compareTo(other.amount)!=0)
    1.39  			return false;
    1.40  		if (currency == null) {
    1.41  			if (other.currency != null)