All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.roguewave.money.currency.v1_0.MoneyCalculator

java.lang.Object
   |
   +----com.roguewave.money.currency.v1_0.MoneyCalculator

public class MoneyCalculator
extends Object
Class MoneyCalculator can perform algebraic operations when the money operands in the equation are not necessarily of the same currency. Because some conversion from one currency to another must occur before such an operation can be carried out, MoneyCalculator lets you specify a conversion policy for currency exchange. Four conversion policies are available. They are described below. Conversions are carried out through the ExchangeFactory object that is associated with the particular calculator object. For a description of rounding methods see the Money API documentation.

Author:
Trevor Misfeldt
See Also:
Money, ExchangeFactory, MoneyCalculatorExample, FactoryExample, GroupExample

Variable Index

 o CONVERSION_BASE
Base Currency Conversion.
 o CONVERSION_SOURCE
Source Currency Conversion.
 o CONVERSION_TARGET
Target Currency Conversion.
 o DEFAULT_BASE
The default base currency is the US dollar, "USD".
 o DEFAULT_CONVERSION
The default conversion policy is no conversion.
 o DEFAULT_ROUND_METHOD
The default rounding method is no rounding.
 o NO_CONVERSION
No Conversion.

Constructor Index

 o MoneyCalculator()
Creates a new calculator with default rounding, conversion, accuracy and digit.
 o MoneyCalculator(ExchangeFactory)
Creates a new calculator with the default conversion using the specified exchange factory and the default rounding method, accuracy and rounding digit.
 o MoneyCalculator(ExchangeFactory, short)
Creates a new calculator that uses the specified conversion policy and exchange factory with the default base currency, rounding method, accuracy and rounding digit.
 o MoneyCalculator(ExchangeFactory, short, short)
Creates a new calculator that uses the specified conversion policy, exchange factory and rounding method with the default base currency, accuracy and rounding digit.
 o MoneyCalculator(ExchangeFactory, short, short, int)
Creates a new calculator that uses the specified conversion policy, exchange factory, rounding method and accuracy with the default base currency and rounding digit.
 o MoneyCalculator(ExchangeFactory, short, short, int, int)
Creates a new calculator that uses the specified conversion policy, exchange factory, rounding method, accuracy and rounding digit with the default base currency.
 o MoneyCalculator(ExchangeFactory, short, String)
Creates a new calculator that uses the specified conversion policy, exchange factory and base currency with the default rounding method, accuracy and rounding digit.
 o MoneyCalculator(ExchangeFactory, short, String, short)
Creates a new calculator that uses the specified conversion policy, exchange factory, base currency and rounding method with the accuracy and rounding digit.
 o MoneyCalculator(ExchangeFactory, short, String, short, int)
Creates a new calculator that uses the specified conversion policy, exchange factory, base currency, rounding method and accuracy with the default rounding digit.
 o MoneyCalculator(ExchangeFactory, short, String, short, int, int)
Creates a new calculator that uses the specified conversion policy, exchange factory, base currency, rounding method, accuracy and rounding digit.
 o MoneyCalculator(ExchangeRateTable)
Creates a new calculator with the default conversion using the specified exchange rate table and the default rounding method, accuracy and rounding digit.
 o MoneyCalculator(ExchangeRateTable, short)
Creates a new calculator that uses the specified conversion policy and exchange rate table with the default base currency, rounding method, accuracy and rounding digit.
 o MoneyCalculator(ExchangeRateTable, short, short)
Creates a new calculator that uses the specified conversion policy, exchange rate table and rounding method with the default base currency, accuracy and rounding digit.
 o MoneyCalculator(ExchangeRateTable, short, short, int)
Creates a new calculator that uses the specified conversion policy, exchange rate table, rounding method and accuracy with the default base currency and rounding digit.
 o MoneyCalculator(ExchangeRateTable, short, short, int, int)
Creates a new calculator that uses the specified conversion policy, exchange rate table, rounding method, accuracy and rounding digit with the default base currency.
 o MoneyCalculator(ExchangeRateTable, short, String)
Creates a new calculator that uses the specified conversion policy, exchange rate table and base currency with the default rounding method, accuracy and rounding digit.
 o MoneyCalculator(ExchangeRateTable, short, String, short)
Creates a new calculator that uses the specified conversion policy, exchange rate table, base currency and rounding method with the accuracy and rounding digit.
 o MoneyCalculator(ExchangeRateTable, short, String, short, int)
Creates a new calculator that uses the specified conversion policy, exchange rate table, base currency, rounding method and accuracy with the default rounding digit.
 o MoneyCalculator(ExchangeRateTable, short, String, short, int, int)
Creates a new calculator that uses the specified conversion policy, exchange rate table, base currency, rounding method, accuracy and rounding digit.
 o MoneyCalculator(short, int)
Creates a new calculator with the desired rounding method and accuracy and with the default conversion policy and rounding digit.
 o MoneyCalculator(short, int, int)
Creates a new calculator with the desired rounding method, accuracy and rounding digit.

Method Index

 o abs(Money)
Returns a new money which has the absolute value of the money's amount.
 o add(Money, Money)
Returns a new money which is the sum of the two money objects.
 o divide(Money, BigDecimal)
Returns a new money which is the quotient of the money and the decimal divisor.
 o divide(Money, double)
Returns a new money which is the quotient of the money and the floating point divisor.
 o equals(Money, Money)
Returns true if the first money is equal to the second money.
 o getAccuracy()
Returns the accuracy (the number of places following the decimal position).
 o getBaseCurrency()
Returns the base currency.
 o getConversionPolicy()
Returns the currency conversion policy.
 o getExchangeFactory()
Returns the currency exchange factory.
 o getRoundDigit()
Returns the rounding digit.
 o getRoundMethod()
Returns the current rounding method.
 o greaterThan(Money, Money)
Returns true if the first money is greater than the second money.
 o greaterThanOrEquals(Money, Money)
Returns true if the first money is greater than or equal to the second money.
 o greaterThanZero(Money)
Returns true if the money's amount is greater than zero.
 o isZero(Money)
Returns true if the money's amount is zero.
 o lessThan(Money, Money)
Returns true if the first money is less than the second money.
 o lessThanOrEquals(Money, Money)
Returns true if the first money is less than or equal to the second money.
 o lessThanZero(Money)
Returns true if the money's amount is less than zero.
 o multiply(Money, BigDecimal)
Returns a new money which is the product of the money and the decimal value.
 o multiply(Money, double)
Returns a new money which is the product of the money and the floating point value.
 o negate(Money)
Returns a new money which has the negation of the money's amount.
 o round(Money)
Returns a new rounded version of the specified money.
 o sameCurrency(Money, Money)
Returns true if the two money objects have the same currency.
 o setAccuracy(int)
Sets the accuracy (the desired number of places to the right of the decimal point).
 o setBaseCurrency(String)
Sets the base currency.
 o setConversionPolicy(short)
Sets the currency conversion policy.
 o setExchangeFactory(ExchangeFactory)
Sets the exchange factory which will be used for currency conversions.
 o setRoundDigit(int)
Sets the rounding digit which comes into play during plain and bankers rounding.
 o setRoundMethod(short)
Sets the current rounding method.
 o subtract(Money, Money)
Returns a new money which is the difference between the two money objects.

Variables

 o DEFAULT_BASE
 public static final String DEFAULT_BASE
The default base currency is the US dollar, "USD".

 o NO_CONVERSION
 public static final short NO_CONVERSION
No Conversion. Any operations performed on monies of different currencies will cause the error handler to be invoked.

 o CONVERSION_BASE
 public static final short CONVERSION_BASE
Base Currency Conversion. When arithmetic operations are performed on monies of different currencies both operands will first be converted to the base currency. The operation will then be performed and the result returned in the base currency.

 o CONVERSION_SOURCE
 public static final short CONVERSION_SOURCE
Source Currency Conversion. When arithmetic operations are performed on monies of different currencies, the target operand (second argument) is converted to the source operand (first argument) currency and the result is returned in the source currency.

 o CONVERSION_TARGET
 public static final short CONVERSION_TARGET
Target Currency Conversion. When arithmetic operations are performed on monies of different currencies, the source operand (first argument) is converted to the target operand (second argument) currency and the result is returned in the target currency.

 o DEFAULT_CONVERSION
 public static final short DEFAULT_CONVERSION
The default conversion policy is no conversion.

See Also:
NO_CONVERSION
 o DEFAULT_ROUND_METHOD
 public static final short DEFAULT_ROUND_METHOD
The default rounding method is no rounding.

See Also:
NO_ROUND

Constructors

 o MoneyCalculator
 public MoneyCalculator()
Creates a new calculator with default rounding, conversion, accuracy and digit.

See Also:
DEFAULT_ROUND_METHOD, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_CONVERSION
 o MoneyCalculator
 public MoneyCalculator(short method,
                        int accuracy)
Creates a new calculator with the desired rounding method and accuracy and with the default conversion policy and rounding digit.

Parameters:
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
See Also:
ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT, DEFAULT_CONVERSION
 o MoneyCalculator
 public MoneyCalculator(short method,
                        int accuracy,
                        int digit)
Creates a new calculator with the desired rounding method, accuracy and rounding digit.

Parameters:
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
digit - the desired rounding digit
See Also:
ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT, DEFAULT_CONVERSION
 o MoneyCalculator
 public MoneyCalculator(ExchangeRateTable table)
Creates a new calculator with the default conversion using the specified exchange rate table and the default rounding method, accuracy and rounding digit.

Parameters:
table - the exchange rate table
See Also:
ExchangeRateTable, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD, DEFAULT_CONVERSION
 o MoneyCalculator
 public MoneyCalculator(ExchangeRateTable table,
                        short policy)
Creates a new calculator that uses the specified conversion policy and exchange rate table with the default base currency, rounding method, accuracy and rounding digit.

Parameters:
table - the exchange rate table
policy - the desired conversion policy
See Also:
ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_BASE, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD
 o MoneyCalculator
 public MoneyCalculator(ExchangeRateTable table,
                        short policy,
                        String base)
Creates a new calculator that uses the specified conversion policy, exchange rate table and base currency with the default rounding method, accuracy and rounding digit.

Parameters:
table - the exchange rate table
policy - the desired conversion policy
base - the desired base currency
See Also:
ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD
 o MoneyCalculator
 public MoneyCalculator(ExchangeRateTable table,
                        short policy,
                        short method)
Creates a new calculator that uses the specified conversion policy, exchange rate table and rounding method with the default base currency, accuracy and rounding digit.

Parameters:
table - the exchange rate table
policy - the desired conversion policy
method - the desired rounding method
See Also:
ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_BASE, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_ACCURACY, DEFAULT_DIGIT
 o MoneyCalculator
 public MoneyCalculator(ExchangeRateTable table,
                        short policy,
                        short method,
                        int accuracy)
Creates a new calculator that uses the specified conversion policy, exchange rate table, rounding method and accuracy with the default base currency and rounding digit.

Parameters:
table - the exchange rate table
policy - the desired conversion policy
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
See Also:
ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT, DEFAULT_BASE
 o MoneyCalculator
 public MoneyCalculator(ExchangeRateTable table,
                        short policy,
                        short method,
                        int accuracy,
                        int digit)
Creates a new calculator that uses the specified conversion policy, exchange rate table, rounding method, accuracy and rounding digit with the default base currency.

Parameters:
table - the exchange rate table
policy - the desired conversion policy
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
digit - the desired rounding digit
See Also:
ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_BASE
 o MoneyCalculator
 public MoneyCalculator(ExchangeRateTable table,
                        short policy,
                        String base,
                        short method)
Creates a new calculator that uses the specified conversion policy, exchange rate table, base currency and rounding method with the accuracy and rounding digit.

Parameters:
table - the exchange rate table
policy - the desired conversion policy
base - the desired base currency
method - the desired rounding method
See Also:
ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_ACCURACY, DEFAULT_DIGIT
 o MoneyCalculator
 public MoneyCalculator(ExchangeRateTable table,
                        short policy,
                        String base,
                        short method,
                        int accuracy)
Creates a new calculator that uses the specified conversion policy, exchange rate table, base currency, rounding method and accuracy with the default rounding digit.

Parameters:
table - the exchange rate table
policy - the desired conversion policy
base - the desired base currency
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
See Also:
ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT
 o MoneyCalculator
 public MoneyCalculator(ExchangeRateTable table,
                        short policy,
                        String base,
                        short method,
                        int accuracy,
                        int digit)
Creates a new calculator that uses the specified conversion policy, exchange rate table, base currency, rounding method, accuracy and rounding digit.

Parameters:
table - the exchange rate table
policy - the desired conversion policy
base - the desired base currency
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
digit - the desired rounding digit
See Also:
ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND
 o MoneyCalculator
 public MoneyCalculator(ExchangeFactory factory)
Creates a new calculator with the default conversion using the specified exchange factory and the default rounding method, accuracy and rounding digit.

Parameters:
factory - the exchange rate factory
See Also:
ExchangeFactory, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD, DEFAULT_CONVERSION
 o MoneyCalculator
 public MoneyCalculator(ExchangeFactory factory,
                        short policy)
Creates a new calculator that uses the specified conversion policy and exchange factory with the default base currency, rounding method, accuracy and rounding digit.

Parameters:
factory - the exchange factory
policy - the desired conversion policy
See Also:
ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_BASE, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD
 o MoneyCalculator
 public MoneyCalculator(ExchangeFactory factory,
                        short policy,
                        String base)
Creates a new calculator that uses the specified conversion policy, exchange factory and base currency with the default rounding method, accuracy and rounding digit.

Parameters:
factory - the exchange factory
policy - the desired conversion policy
base - the desired base currency
See Also:
ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD
 o MoneyCalculator
 public MoneyCalculator(ExchangeFactory factory,
                        short policy,
                        short method)
Creates a new calculator that uses the specified conversion policy, exchange factory and rounding method with the default base currency, accuracy and rounding digit.

Parameters:
factory - the exchange factory
policy - the desired conversion policy
method - the desired rounding method
See Also:
ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_BASE, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_ACCURACY, DEFAULT_DIGIT
 o MoneyCalculator
 public MoneyCalculator(ExchangeFactory factory,
                        short policy,
                        short method,
                        int accuracy)
Creates a new calculator that uses the specified conversion policy, exchange factory, rounding method and accuracy with the default base currency and rounding digit.

Parameters:
factory - the exchange factory
policy - the desired conversion policy
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
See Also:
ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT, DEFAULT_BASE
 o MoneyCalculator
 public MoneyCalculator(ExchangeFactory factory,
                        short policy,
                        short method,
                        int accuracy,
                        int digit)
Creates a new calculator that uses the specified conversion policy, exchange factory, rounding method, accuracy and rounding digit with the default base currency.

Parameters:
factory - the exchange factory
policy - the desired conversion policy
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
digit - the desired rounding digit
See Also:
ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_BASE
 o MoneyCalculator
 public MoneyCalculator(ExchangeFactory factory,
                        short policy,
                        String base,
                        short method)
Creates a new calculator that uses the specified conversion policy, exchange factory, base currency and rounding method with the accuracy and rounding digit.

Parameters:
factory - the exchange factory
policy - the desired conversion policy
base - the desired base currency
method - the desired rounding method
See Also:
ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_ACCURACY, DEFAULT_DIGIT
 o MoneyCalculator
 public MoneyCalculator(ExchangeFactory factory,
                        short policy,
                        String base,
                        short method,
                        int accuracy)
Creates a new calculator that uses the specified conversion policy, exchange factory, base currency, rounding method and accuracy with the default rounding digit.

Parameters:
factory - the exchange factory
policy - the desired conversion policy
base - the desired base currency
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
See Also:
ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT
 o MoneyCalculator
 public MoneyCalculator(ExchangeFactory factory,
                        short policy,
                        String base,
                        short method,
                        int accuracy,
                        int digit)
Creates a new calculator that uses the specified conversion policy, exchange factory, base currency, rounding method, accuracy and rounding digit.

Parameters:
factory - the exchange factory
policy - the desired conversion policy
base - the desired base currency
method - the desired rounding method
accuracy - the desired accuracy (the number of digits following the decimal point)
digit - the desired rounding digit
See Also:
ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND

Methods

 o getRoundDigit
 public int getRoundDigit()
Returns the rounding digit. That is, the determining digit for plain and bankers rounding.

Returns:
the digit
See Also:
ROUND_PLAIN, ROUND_BANKERS, DEFAULT_DIGIT
 o setRoundDigit
 public void setRoundDigit(int digit)
Sets the rounding digit which comes into play during plain and bankers rounding.

Parameters:
digit - the rounding digit.
See Also:
ROUND_PLAIN, ROUND_BANKERS, DEFAULT_DIGIT
 o getAccuracy
 public int getAccuracy()
Returns the accuracy (the number of places following the decimal position).

Returns:
the accuracy
See Also:
DEFAULT_ACCURACY
 o setAccuracy
 public void setAccuracy(int accuracy)
Sets the accuracy (the desired number of places to the right of the decimal point).

Parameters:
accuracy - the desired accuracy
See Also:
DEFAULT_ACCURACY
 o getConversionPolicy
 public short getConversionPolicy()
Returns the currency conversion policy.

Returns:
the type
See Also:
NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_CONVERSION
 o setConversionPolicy
 public void setConversionPolicy(short policy)
Sets the currency conversion policy.

Parameters:
policy - the desired conversion policy
See Also:
NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_CONVERSION
 o getRoundMethod
 public short getRoundMethod()
Returns the current rounding method.

Returns:
the method
See Also:
ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND
 o setRoundMethod
 public void setRoundMethod(short method)
Sets the current rounding method.

Parameters:
method - the desired rounding method
See Also:
ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND
 o getExchangeFactory
 public ExchangeFactory getExchangeFactory()
Returns the currency exchange factory.

Returns:
the factory
See Also:
ExchangeFactory
 o setExchangeFactory
 public void setExchangeFactory(ExchangeFactory factory)
Sets the exchange factory which will be used for currency conversions.

Parameters:
factory - the desired exchange factory
See Also:
ExchangeFactory
 o getBaseCurrency
 public String getBaseCurrency()
Returns the base currency. This only becomes relevant if the conversion policy is set to 'CONVERSION_BASE'.

See Also:
CONVERSION_BASE, DEFAULT_BASE
 o setBaseCurrency
 public void setBaseCurrency(String currency)
Sets the base currency. This only becomes relevant if the conversion policy is set to 'CONVERSION_BASE'.

Parameters:
currency - the desired base currency
See Also:
CONVERSION_BASE, DEFAULT_BASE
 o sameCurrency
 public boolean sameCurrency(Money money1,
                             Money money2)
Returns true if the two money objects have the same currency.

Returns:
whether the currencies are equal or not
See Also:
Money, Currency
 o multiply
 public Money multiply(Money money,
                       double operand)
Returns a new money which is the product of the money and the floating point value.

Parameters:
money - the money operand
amount - the floating point operand
Returns:
the product
See Also:
Money
 o multiply
 public Money multiply(Money money,
                       BigDecimal operand)
Returns a new money which is the product of the money and the decimal value.

Parameters:
money - the money operand
amount - the decimal operand
Returns:
the product
See Also:
Money
 o divide
 public Money divide(Money money,
                     double operand)
Returns a new money which is the quotient of the money and the floating point divisor.

Parameters:
money - the money operand
amount - the floating point divisor
Returns:
the quotient
See Also:
Money
 o divide
 public Money divide(Money money,
                     BigDecimal operand)
Returns a new money which is the quotient of the money and the decimal divisor.

Parameters:
money - the money operand
amount - the decimal divisor
Returns:
the quotient
See Also:
Money
 o abs
 public Money abs(Money money)
Returns a new money which has the absolute value of the money's amount.

Returns:
the absolute value
See Also:
Money
 o negate
 public Money negate(Money money)
Returns a new money which has the negation of the money's amount.

Returns:
the negation
See Also:
Money
 o lessThan
 public boolean lessThan(Money money1,
                         Money money2)
Returns true if the first money is less than the second money. Converts the currencies according to the given conversion policy and base currency. If the two currencies are not equal after conversion then the error handler is called.

Parameters:
money - the first money
money - the second money
Returns:
whether the first money is less than the second
 o lessThanOrEquals
 public boolean lessThanOrEquals(Money money1,
                                 Money money2)
Returns true if the first money is less than or equal to the second money. Converts the currencies according to the given conversion policy and base currency. If the two currencies are not equal after conversion then the error handler is called.

Parameters:
money - the first money
money - the second money
Returns:
whether the first money is less than or equal to the second
 o greaterThan
 public boolean greaterThan(Money money1,
                            Money money2)
Returns true if the first money is greater than the second money. Converts the currencies according to the given conversion policy and base currency. If the two currencies are not equal after conversion then the error handler is called.

Parameters:
money - the first money
money - the second money
Returns:
whether the first money is greater than the second
 o greaterThanOrEquals
 public boolean greaterThanOrEquals(Money money1,
                                    Money money2)
Returns true if the first money is greater than or equal to the second money. Converts the currencies according to the given conversion policy and base currency. If the two currencies are not equal after conversion then the error handler is called.

Parameters:
money - the first money
money - the second money
Returns:
whether the first money is greater than or equal to the second
 o equals
 public boolean equals(Money money1,
                       Money money2)
Returns true if the first money is equal to the second money. Converts the currencies according to the given conversion policy and base currency. If the two currencies are not equal after conversion then the error handler is called.

Parameters:
money - the first money
money - the second money
Returns:
whether the first money is equal to the second
 o greaterThanZero
 public boolean greaterThanZero(Money money)
Returns true if the money's amount is greater than zero.

Parameters:
money - the money for comparison
Returns:
whether this money's amount is greater than zero
 o lessThanZero
 public boolean lessThanZero(Money money)
Returns true if the money's amount is less than zero.

Parameters:
money - the money for comparison
Returns:
whether this money's amount is less than zero
 o isZero
 public boolean isZero(Money money)
Returns true if the money's amount is zero.

Parameters:
money - the money for comparison
Returns:
whether this money's amount equals zero or not
 o round
 public Money round(Money money)
Returns a new rounded version of the specified money. Uses the specified rounding policy, accuracy and digit.

Parameters:
money - money to be rounded
Returns:
rounded money
 o add
 public Money add(Money money1,
                  Money money2)
Returns a new money which is the sum of the two money objects. Converts the currencies if requested and necessary.

Parameters:
money - the first operand
money - the second operand
Returns:
the sum
See Also:
Money
 o subtract
 public Money subtract(Money money1,
                       Money money2)
Returns a new money which is the difference between the two money objects. Converts the currencies if requested and necessary.

Parameters:
money - the first operand
money - the second operand
Returns:
the difference
See Also:
Money

All Packages  Class Hierarchy  This Package  Previous  Next  Index