@Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   ExchangeTicket other = (ExchangeTicket) obj;
   if (client == null) {
     if (other.client != null) return false;
   } else if (!client.equals(other.client)) return false;
   if (fromCurr == null) {
     if (other.fromCurr != null) return false;
   } else if (!fromCurr.equals(other.fromCurr)) return false;
   if (id != other.id) return false;
   if (status == null) {
     if (other.status != null) return false;
   } else if (!status.equals(other.status)) return false;
   if (toCurr == null) {
     if (other.toCurr != null) return false;
   } else if (!toCurr.equals(other.toCurr)) return false;
   if (toCurrAmount.longValue() != other.toCurrAmount.longValue()) return false;
   return true;
 }
Ejemplo n.º 2
0
  /**
   * Compare this money for equality with the specified money.
   *
   * @param object the money to compare
   * @return <code>true</code> iff the monies are equal.
   */
  public boolean equals(Object object) {
    Money money = (Money) object;

    assert currency.equals(money.currency);

    return (amount == money.amount);
  }
Ejemplo n.º 3
0
  /**
   * Compare this money to the specified money.
   *
   * @param object the money to compare
   * @return the value <code>0</code> if the monies are equal; <code>1</code> if this money is more
   *     than the specified money or <code>-1</code> if this money is less than the specified money.
   */
  public int compareTo(Object object) {
    Money money = (Money) object;

    assert currency.equals(money.currency);

    if (amount < money.amount) return -1;
    if (amount > money.amount) return 1;
    return 0;
  }
Ejemplo n.º 4
0
 @Override
 public boolean equals(Object object) {
   if (this == object) {
     return true;
   }
   if (!(object instanceof Money)) {
     return false;
   }
   final Money other = (Money) object;
   if (!(currency == null ? other.currency == null : currency.equals(other.currency))) {
     return false;
   }
   if (!(moneyValue == null ? other.moneyValue == null : moneyValue.equals(other.moneyValue))) {
     return false;
   }
   return true;
 }
Ejemplo n.º 5
0
  /**
   * Return whether this money is greater than or equal to the given money.
   *
   * @param money the money to compare with
   * @return <code>true</code> if this money is greater than or equal to the given money.
   */
  public boolean isGreaterThanEqual(Money money) {
    assert currency.equals(money.currency);

    return (amount >= money.amount);
  }
Ejemplo n.º 6
0
  /**
   * Return whether this money is less than or equal to the given money.
   *
   * @param money the money to compare with
   * @return <code>true</code> if this money is less than or equal to the given money.
   */
  public boolean isLessThanEqual(Money money) {
    assert currency.equals(money.currency);

    return (amount <= money.amount);
  }
Ejemplo n.º 7
0
  /**
   * Subtract the given money from this money.
   *
   * @param money the money to subtract.
   * @return the resultant <code>Money</code>.
   */
  public Money subtract(Money money) {
    assert currency.equals(money.currency);

    return new Money(currency, conversion, amount - money.amount);
  }
Ejemplo n.º 8
0
  /**
   * Add the given money to this money.
   *
   * @param money the money to add.
   * @return the resultant <code>Money</code>.
   */
  public Money add(Money money) {
    assert currency.equals(money.currency);

    return new Money(currency, conversion, amount + money.amount);
  }
 public void show() {
   Currency usd = Currency.get("USD");
   print(usd.equals(Currency.get("USD")));
 }