Interface Currency

All Superinterfaces:
Comparable<Currency>, OsidPrimitive, Serializable
All Known Subinterfaces:
Currency

public interface Currency extends OsidPrimitive, Comparable<Currency>
Supplements the OSID Currency interface for Java.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(Currency currency)
    Compares this currency with the specified Currency for order.
    boolean
    Determines if the given Currency is equal to this one.
    int
    Returns a hash code value for this Currency.
    boolean
    isLarger(Currency currency)
    Tests if this Currency is greater than the given Currency.
    boolean
    isSmaller(Currency currency)
    Tests if this Currency is less than the given Currency.

    Methods inherited from interface OsidPrimitive

    toString
    Modifier and Type
    Method
    Description
    Returns a string representation of this OsidPrimitive.
  • Method Details

    • isLarger

      boolean isLarger(Currency currency)
      Tests if this Currency is greater than the given Currency. A greater Currency is one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false.
      Parameters:
      currency - the currency to compare
      Returns:
      true if this currency is larger, false otherwise
      Throws:
      NullArgumentException - currency is null
      UnsupportedException - cannot compare currency types
    • isSmaller

      boolean isSmaller(Currency currency)
      Tests if this Currency is less than the given Currency. A lesser Currency is one whose values plus uncertainty is less than another minus its uncertainty. An uncertainty of infinity is undefined and returns false.
      Parameters:
      currency - the currency to compare
      Returns:
      true if this currency is less, false otherwise
      Throws:
      NullArgumentException - currency is null
      UnsupportedException - cannot compare currency types
    • compareTo

      int compareTo(Currency currency)
      Compares this currency with the specified Currency for order. Returns a negative integer, zero, or a positive integer as this currency is less than, equal to, or greater than the specified currency. This implementation assumes the types are equal to provide a natural ordering based on the amounts. For more accurrate comparisons, use isLarger() or isSmaller() instead.
      Specified by:
      compareTo in interface Comparable<Currency>
      Parameters:
      currency - the currency to be compared
      Returns:
      a negative integer, zero, or a positive integer as this cuurency is less than, equal to, or greater than the specified currency
      Throws:
      ClassCastException - if the specified cuurency's type prevents it from being compared to this currency
    • equals

      boolean equals(Object obj)
      Determines if the given Currency is equal to this one. Two Currency objects are equal if their Currency Types and Currency amounts, and the precision in the currency amounts are equal.
      Overrides:
      equals in class Object
      Parameters:
      obj - an object to compare
      Returns:
      true if the given object is equal to this Currency, false otherwise
    • hashCode

      int hashCode()
      Returns a hash code value for this Currency. The hash code is determined from the currency type and currency amount.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object