Interface Currency
- All Superinterfaces:
Comparable<Currency>, OsidPrimitive, Serializable
- All Known Subinterfaces:
Currency
Supplements the OSID Currency interface for Java.
-
Method Summary
Modifier and TypeMethodDescriptionintCompares this currency with the specified Currency for order.booleanDetermines if the givenCurrencyis equal to this one.inthashCode()Returns a hash code value for thisCurrency.booleanTests if this Currency is greater than the given Currency.booleanTests if this Currency is less than the given Currency.Methods inherited from interface OsidPrimitive
toString
-
Method Details
-
isLarger
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:
trueif this currency is larger,falseotherwise- Throws:
NullArgumentException-currencyisnullUnsupportedException- cannot compare currency types
-
isSmaller
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:
trueif this currency is less,falseotherwise- Throws:
NullArgumentException-currencyisnullUnsupportedException- cannot compare currency types
-
compareTo
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, useisLarger()orisSmaller()instead.- Specified by:
compareToin interfaceComparable<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
Determines if the givenCurrencyis 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. -
hashCode
-