| |
|
| java.lang.Object java.lang.Number org.kuali.core.util.KualiDecimal
All known Subclasses: org.kuali.core.util.KualiPercent,
KualiDecimal | public class KualiDecimal extends Number implements Comparable(Code) | | This class is a wrapper around java.math.BigDecimal. It exposes the only the
needed functionality of BigDecimal and uses a standard SCALE of 2 and
ROUND_BEHAVIOR of BigDecimal.ROUND_HALF_UP
Members of this class are, like BigDecimal, immutable; even methods which
might be expected to change the value (like setScale, for example) actually
just return a new instance with the new value.
|
ROUND_BEHAVIOR | final public static int ROUND_BEHAVIOR(Code) | | |
SCALE | final public static int SCALE(Code) | | |
KualiDecimal | public KualiDecimal(String value)(Code) | | This is the base constructor, used by constructors that take other types
Parameters: value - String containing numeric value throws: IllegalArgumentException - if the given String is null |
KualiDecimal | public KualiDecimal(int value)(Code) | | |
KualiDecimal | public KualiDecimal(double value)(Code) | | |
abs | public KualiDecimal abs()(Code) | | a KualiDecimal with the same scale and the absolute value |
add | public KualiDecimal add(KualiDecimal addend)(Code) | | Wraps BigDecimal's add method to accept and return KualiDecimal instances
instead of BigDecimals, so that users of the class don't have to typecast
the return value.
Parameters: addend - result of adding the given addend to this value throws: IllegalArgumentException - if the given addend is null |
bigDecimalValue | public BigDecimal bigDecimalValue()(Code) | | the value of this instance as a BigDecimal. |
compareTo | public int compareTo(Object o)(Code) | | Compares this KualiDecimal with the specified Object. If the Object is a
KualiDecimal, this method behaves like
java.lang.Comparable#compareTo(java.lang.Object).
Otherwise, it throws a ClassCastException (as KualiDecimals
are comparable only to other KualiDecimals).
See Also: java.lang.Comparable.compareTo(java.lang.Object) |
divide | public KualiDecimal divide(KualiDecimal divisor)(Code) | | Wraps BigDecimal's divide method to enforce the default Kuali rounding
behavior
Parameters: divisor - result of dividing this value by the given divisor throws: an - IllegalArgumentException if the given divisor is null |
isGreaterEqual | public boolean isGreaterEqual(KualiDecimal operand)(Code) | | Parameters: operand - true if this KualiDecimal is greater than or equal to the givenKualiDecimal |
isGreaterThan | public boolean isGreaterThan(KualiDecimal operand)(Code) | | Parameters: operand - true if this KualiDecimal is greater than the given KualiDecimal |
isLessEqual | public boolean isLessEqual(KualiDecimal operand)(Code) | | Parameters: operand - true if this KualiDecimal is less than or equal to the givenKualiDecimal |
isLessThan | public boolean isLessThan(KualiDecimal operand)(Code) | | Parameters: operand - true if this KualiDecimal is less than the given KualiDecimal |
isNegative | public boolean isNegative()(Code) | | true if this KualiDecimal is less than zero |
isNonZero | public boolean isNonZero()(Code) | | true if this KualiDecimal is not equal to zero |
isNumeric | public static boolean isNumeric(String s)(Code) | | true if the given String can be used to construct a validKualiDecimal |
isPositive | public boolean isPositive()(Code) | | true if this KualiDecimal is greater than zero |
isZero | public boolean isZero()(Code) | | true if this KualiDecimal is equal to zero |
mod | public KualiDecimal mod(KualiDecimal modulus)(Code) | | This method calculates the mod between to KualiDecimal values by first
casting to doubles and then by performing the % operation on the two
primitives.
Parameters: modulus - The other value to apply the mod to. result of performing the mod calculation throws: IllegalArgumentException - if the given modulus is null |
multiply | public KualiDecimal multiply(KualiDecimal multiplier)(Code) | | Wraps BigDecimal's multiply method to accept and return KualiDecimal
instances instead of BigDecimals, so that users of the class don't have
to typecast the return value.
Parameters: multiplicand - result of multiplying this value by the given multiplier throws: IllegalArgumentException - if the given multiplier is null |
negated | public KualiDecimal negated()(Code) | | a KualiDecimal with the same scale and a negated value (iff thevalue is non-zero) |
setScale | public KualiDecimal setScale(int scale)(Code) | | Wraps BigDecimal's setScale method to enforce the default Kuali rounding
behavior.
KualiDecimal instance set to the given scale, rounded with thedefault rounding behavior (if necessary) |
setScale | public KualiDecimal setScale()(Code) | | Simplified wrapper over the setScale() method, this one has no arguments.
When used with no arguments, it defaults to the Kuali default Scale and
Rounding.
a rounded, scaled, KualiDecimal |
subtract | public KualiDecimal subtract(KualiDecimal subtrahend)(Code) | | Wraps BigDecimal's subtract method to accept and return KualiDecimal
instances instead of BigDecimals, so that users of the class don't have
to typecast the return value.
Parameters: subtrahend - result of the subtracting the given subtrahend from this value throws: IllegalArgumentException - if the given subtrahend is null |
|
|
|