Integer divides this money by that BigDecimal and returns the remainder
Integer divides this money by that BigDecimal and returns the remainder
BigDecimal
Money
Multiplies this money by that squants.market.CurrencyExchangeRate and returns the equal value in the other currency.
Multiplies this money by that squants.market.CurrencyExchangeRate and returns the equal value in the other currency.
Delegates to CurrencyExchangeRate * Money
BigDecimal
moneyPlus *
moneyMinus *
toThe
Divide this money by a Price and return Quantity
Divide this money by a Price and return Quantity
Quantity Type
Price
A
Divide this money by another (non-money) Quantity and return a Price
Divide this money by another (non-money) Quantity and return a Price
Quantity Type
Quantity
Price[A]
Integer divides this money by that BigDecimal and returns the quotient and the remainder
Integer divides this money by that BigDecimal and returns the quotient and the remainder
BigDecimal
(Money, Money)
approx
approx
Returns the absolute value of this Quantity
the amount of money
Returns boolean result of approximate equality comparison
Returns boolean result of approximate equality comparison
Quantity
Quantity
Returns the smallest (closest to negative infinity) Quantity value that is greater than or equal to the argument and is equal to a mathematical integer.
Returns the smallest (closest to negative infinity) Quantity value that is greater than or equal to the argument and is equal to a mathematical integer.
Quantity
java.lang.Math#ceil(double)
Override for Quantity.
the currency in which the money is denominated
The Dimension this quantity represents
Override for Quantity.
Overrides Quantity.
Divides this money by that BigDecimal and returns a new Money
Divides this money by that BigDecimal and returns a new Money
BigDecimal
Money
Returns a Pair that includes the result of divideToInteger and remainder
Returns a Pair that includes the result of divideToInteger and remainder
Quantity
(Double, Quantity)
Returns a Pair that includes the result of divideToInteger and remainder
Returns a Pair that includes the result of divideToInteger and remainder
Double
(Quantity, Quantity)
Override for Quantity.
Returns the largest (closest to positive infinity) Quantity value that is less than or equal to the argument and is equal to a mathematical integer
Returns the largest (closest to positive infinity) Quantity value that is less than or equal to the argument and is equal to a mathematical integer
Quantity
java.lang.Math#floor(double)
Override of hashCode
Reboxes this Money value in a Money in the given Currency
Reboxes this Money value in a Money in the given Currency
Currency
MoneyContext required for cross currency operations
Money
when no exchange rate is available
Returns an equivalent Quantity boxed with the supplied Unit
Returns an equivalent Quantity boxed with the supplied Unit
UnitOfMeasure[A]
Quantity
Applies a function to the underlying value of the Quantity, returning a new Quantity in the same unit
Applies a function to the underlying value of the Quantity, returning a new Quantity in the same unit
Double => Double function
Applies a function to the underlying amount of the Money, returning a Money in the same Currency
Applies a function to the underlying amount of the Money, returning a Money in the same Currency
BigDecimal => BigDecimal function
Money
Override for Quantity.
Override for Quantity.
Override Quantity.
Supports compare operation on Moneys of dislike Currency
Supports compare operation on Moneys of dislike Currency
Money
MoneyContext
Divides this money by that money and returns the ratio between the converted amounts
Divides this money by that money and returns the ratio between the converted amounts
Money
MoneyContext
Supports equality comparisons on Moneys of dislike Currency
Supports equality comparisons on Moneys of dislike Currency
Money
MoneyContext
Supports max operation on Moneys of dislike Currency
Supports max operation on Moneys of dislike Currency
Money
MoneyContext
Supports min operation on Moneys of dislike Currency
Supports min operation on Moneys of dislike Currency
Money
MoneyContext
Subtracts that Money from this Money converted to this.
Subtracts that Money from this Money converted to this.currency via context
Money
MoneyContext required for cross currency operations
Money
when no exchange rate is available
Supports non-equality comparisons on Moneys of dislike Currency
Supports non-equality comparisons on Moneys of dislike Currency
Money
MoneyContext
Adds this Money to that Money converted to this.
Adds this Money to that Money converted to this.currency via context
Money
MoneyContext required for cross currency operations
Money
when no exchange rate is available
Returns the negative value of this Quantity
Returns true if this value is not within (contains) the range
Returns true if this value is not within (contains) the range
QuantityRange
Boolean
Overrides Quantity.
Returns a QuantityRange representing the range for this value +- that
Returns a QuantityRange representing the range for this value +- that
Quantity
QuantityRange
Returns the remainder of a division by a like quantity
Returns the remainder of a division by a like quantity
Quantity
Double
Returns the remainder of a division by a number
Returns the remainder of a division by a number
Quantity
Quantity
Returns the Quantity value that is closest in value to the argument and is equal to a mathematical integer.
Returns the Quantity value that is closest in value to the argument and is equal to a mathematical integer.
Quantity
java.lang.Math#rint(double)
Returns a Money rounded using scale and mode.
Overrides Quantity.
Multiplies this money by that BigDecimal and returns a new Money
Multiplies this money by that BigDecimal and returns a new Money
BigDecimal
Money
Convert this Money to a Double representing the currency unit
Convert this Money to a Double representing the currency unit
Currency
MoneyContext required for cross currency operations
Double
when no exchange rate is available
Returns a Double representing the quantity in terms of the supplied unit
Returns a Double representing the quantity in terms of the supplied unit
val d = Feet(3) (d to Inches) should be(36)
UnitOfMeasure[A]
Double
Returns a QuantityRange that goes from this to that
Returns a QuantityRange that goes from this to that
Quantity
QuantityRange
Returns a string formatted with the amount, rounded based on the Currency rules, and the currency symbol
Returns a string formatted with the amount, rounded based on the Currency rules, and the currency symbol
eg USD(12.4563) => "$123.46"
String
Converts the amount to the given currency and returns a string formatted with the original precision and the currency code
Converts the amount to the given currency and returns a string formatted with the original precision and the currency code
Currency
MoneyContext required for conversion
Returns a string formatted with the original precision amount and the currency code
Returns a string representing the quantity's value in the given unit
in the given format
Returns a string representing the quantity's value in the given unit
in the given format
UnitOfMeasure[A] with UnitConverter
String containing the format for the value (ie "%.3f")
String
Returns a string representing the quantity's value in the given unit
Returns a string representing the quantity's value in the given unit
UnitOfMeasure[A] with UnitConverter
String
Combines with that Money to create an squants.market.CurrencyExchangeRate
Combines with that Money to create an squants.market.CurrencyExchangeRate
Exchange Rates on the same currency are not supported
val rate: CurrencyExchangeRate = JPY(100) toThe USD(1)
Money
if the that.currency matches this.currency
Returns a pair representing the numeric value and the uom's symbol
Returns a pair representing the numeric value and the uom's symbol
UnitOfMeasure[A]
Returns a tuple representing the numeric value and the unit's symbol
Returns a tuple representing the numeric value and the unit's symbol
The Unit of Measure the value represents
The value of the quantity given the unit
Returns true if this value is within (contains) the range
Returns true if this value is within (contains) the range
QuantityRange
Boolean
approx
approx
approx
approx
Represents a quantity of Money.
Money is similar to other quantities in that it represents an amount of something - purchasing power - and it is measured in units - currencies.
The main difference is that the conversion rate between currencies can not be certain at compile. (In fact it may not always be so easy to know them at runtime as well.)
To address this diversion from the way most other quantities work, Money overrides several of the standard methods and operators to ensure one of two rules is followed:
1) this and that are in the same currency, or 2) there is in an implicit MoneyContext in scope (which may or may not have the applicable exchange rate)
Methods and operations applied to moneys of different currencies may throw a NoSuchExchangeRateException if the implicit MoneyContext does not contain the Rate(s) necessary to perform the conversion.
The defaultMoneyContext includes USD as the default currency, a list of ~20 other currencies and NO exchange rates
0.1