All Packages Class Hierarchy This Package Previous Next Index
Class com.roguewave.money.currency.v1_0.DoubleValue
java.lang.Object
|
+----com.roguewave.money.currency.v1_0.DoubleValue
- public class DoubleValue
- extends Object
- implements Value
DoubleValue
class encapsulates a primitive double
.
This class provides the exact same functionality as the double
but exists to that BigDecimalValue
and DoubleValue
can have identical interfaces. That common interface is Value
DoubleValue
provides less accuracy than BigDecimalValue
but exhibits much better performance.
- Author:
- Trevor Misfeldt
- See Also:
- BigDecimalValue, Value
-
DoubleValue(double)
- Creates a new DoubleValue with the underlying floating-point number.
-
abs()
- Returns a new value object which has the absolute value of this value.
-
compare(Value)
- Compares this value with the specified value.
-
equals(Value)
- Returns true if the two values are equal.
-
getValue()
- Returns the underlying floating-point double.
-
greaterThan(Value)
- Returns true if this value is greater than the specified value.
-
greaterThanOrEqual(Value)
- Returns true if this value is greater than or equal to the specified value.
-
greaterThanZero()
- Returns true if this value is greater than zero.
-
isZero()
- Returns true if this value is equal to zero.
-
lessThan(Value)
- Returns true if this value is less than the specified value.
-
lessThanOrEqual(Value)
- Returns true if this value is less than or equal to the specified value.
-
lessThanZero()
- Returns true if this value is less than zero.
-
minus(Value)
- Returns a value object which has an underlying value equal to the difference
between this value and the specified value.
-
negate()
- Returns a new value object which has the negation of this value.
-
notEquals(Value)
- Returns true if the two values are not equal.
-
over(Value)
- Returns a value object which has an underlying value equal to this value
divided by the specified value.
-
plus(Value)
- Returns a value object which has an underlying value equal to the sum of the
this value and the specified value.
-
round(int, short, int)
- Rounds this value and returns it in a new value object.
-
setValue(double)
- Sets the underlying floating-point value.
-
times(Value)
- Returns a value object which has an underlying value equal to the product
between this value and the specified value.
-
toString()
- Returns a string representation of the encapsulated value.
DoubleValue
public DoubleValue(double value)
- Creates a new DoubleValue with the underlying floating-point number.
- Parameters:
- value - the desired value
getValue
public double getValue()
- Returns the underlying floating-point double.
- Returns:
- the value
setValue
public void setValue(double value)
- Sets the underlying floating-point value.
- Parameters:
- value - the desired value
plus
public Value plus(Value value)
- Returns a value object which has an underlying value equal to the sum of the
this value and the specified value.
- Parameters:
- value - the operand
- Returns:
- the sum
minus
public Value minus(Value value)
- Returns a value object which has an underlying value equal to the difference
between this value and the specified value.
- Parameters:
- value - the operand
- Returns:
- the difference
times
public Value times(Value value)
- Returns a value object which has an underlying value equal to the product
between this value and the specified value.
- Parameters:
- value - the operand
- Returns:
- the product
over
public Value over(Value value)
- Returns a value object which has an underlying value equal to this value
divided by the specified value.
- Parameters:
- value - the divisor
- Returns:
- the quotient
equals
public boolean equals(Value value)
- Returns true if the two values are equal. False, otherwise.
- Parameters:
- value - the value for comparison
- Returns:
- whether the two values are equal or not
notEquals
public boolean notEquals(Value value)
- Returns true if the two values are not equal. False, otherwise.
- Parameters:
- value - the value for comparison
- Returns:
- whether the two values are not equal
lessThan
public boolean lessThan(Value value)
- Returns true if this value is less than the specified value. False, otherwise.
- Parameters:
- value - the value for comparison
- Returns:
- whether this value is less than the specified value
greaterThan
public boolean greaterThan(Value value)
- Returns true if this value is greater than the specified value. False,
otherwise.
- Parameters:
- value - the value for comparison
- Returns:
- whether this value is greater than the specified value
lessThanOrEqual
public boolean lessThanOrEqual(Value value)
- Returns true if this value is less than or equal to the specified value.
False, otherwise. Precisions are ignored.
- Parameters:
- value - the value for comparison
- Returns:
- whether this value is less than or equal to the specified value
greaterThanOrEqual
public boolean greaterThanOrEqual(Value value)
- Returns true if this value is greater than or equal to the specified value.
False, otherwise. Precisions are ignored.
- Parameters:
- value - the value for comparison
- Returns:
- whether this value is greater than or equal to the specified value
isZero
public boolean isZero()
- Returns true if this value is equal to zero. False, otherwise.
- Parameters:
- value - the value for comparison
- Returns:
- whether this value is zero
lessThanZero
public boolean lessThanZero()
- Returns true if this value is less than zero. False, otherwise.
- Parameters:
- value - the value for comparison
- Returns:
- whether this value is less than zero
greaterThanZero
public boolean greaterThanZero()
- Returns true if this value is greater than zero. False, otherwise.
- Parameters:
- value - the value for comparison
- Returns:
- whether this value is greater than zero
compare
public int compare(Value value)
- Compares this value with the specified value.
- Parameters:
- the - value to compare
- Returns:
- -1 if this value is less than the specified value, 0 if they are equal,
or 1 if this value is greater
abs
public Value abs()
- Returns a new value object which has the absolute value of this value.
- Returns:
- the absolute value
negate
public Value negate()
- Returns a new value object which has the negation of this value.
- Returns:
- the negation
round
public Value round(int accuracy,
short rounding,
int digit)
- Rounds this value and returns it in a new value object.
- Parameters:
- accuracy - The desired digits after the decimal point.
- rounding - the desired rounding method
- digit - the desired digit to round on. For example, '
5
'.
- Returns:
- the rounded value
- See Also:
- NO_ROUND, ROUND_UP, ROUND_DOWN, ROUND_PLAIN, ROUND_BANKERS
toString
public String toString()
- Returns a string representation of the encapsulated value.
- Returns:
- the value as a string
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index