public final class MutableDecimal5f extends AbstractMutableDecimal<Scale5f,MutableDecimal5f> implements Cloneable
All methods for this class throw NullPointerException when passed a
null object reference for any input parameter.
| Constructor and Description |
|---|
MutableDecimal5f()
Constructs a new
MutableDecimal5f with value zero. |
MutableDecimal5f(BigDecimal value)
Constructs a
MutableDecimal5f whose value is calculated by
rounding the specified BigDecimal argument to scale 5 using
HALF_UP rounding. |
MutableDecimal5f(BigInteger value)
Constructs a
MutableDecimal5f whose value is numerically equal to
that of the specified BigInteger value. |
MutableDecimal5f(Decimal<?> value)
|
MutableDecimal5f(Decimal5f value)
Constructs a
MutableDecimal5f whose value is numerically equal to
that of the specified Decimal5f value. |
MutableDecimal5f(double value)
Constructs a
MutableDecimal5f whose value is calculated by
rounding the specified double argument to scale 5 using
HALF_UP rounding. |
MutableDecimal5f(long value)
Constructs a
MutableDecimal5f whose value is numerically equal
to that of the specified long value. |
MutableDecimal5f(String value)
Translates the string representation of a
Decimal into a
MutableDecimal5f. |
| Modifier and Type | Method and Description |
|---|---|
static MutableDecimal5f |
billion()
Returns a new
MutableDecimal5f whose value is equal to one billion. |
MutableDecimal5f |
clone()
Returns a clone of this mutable Decimal numerically identical to this
value.
|
protected MutableDecimal5f |
create(long unscaled)
Returns a new
Decimal whose value is
(unscaled × 10-scale). |
protected MutableDecimal5f[] |
createArray(int length)
Returns a new
Decimal array of the specified length. |
static MutableDecimal5f |
eight()
Returns a new
MutableDecimal5f whose value is equal to eight. |
static MutableDecimal5f |
five()
Returns a new
MutableDecimal5f whose value is equal to five. |
static MutableDecimal5f |
four()
Returns a new
MutableDecimal5f whose value is equal to four. |
protected DecimalArithmetic |
getDefaultArithmetic()
Returns the default arithmetic performing unchecked operations with
rounding mode
HALF_UP. |
protected DecimalArithmetic |
getDefaultCheckedArithmetic()
Returns the default arithmetic performing checked operations with
rounding mode
HALF_UP. |
Factory5f |
getFactory()
Returns the factory that can be used to create other Decimal values of the same scale as
this Decimal. |
protected DecimalArithmetic |
getRoundingDownArithmetic()
Returns the arithmetic performing unchecked operations with rounding mode
DOWN. |
protected DecimalArithmetic |
getRoundingFloorArithmetic()
Returns the arithmetic performing unchecked operations with rounding mode
FLOOR. |
protected DecimalArithmetic |
getRoundingHalfEvenArithmetic()
Returns the arithmetic performing unchecked operations with rounding mode
HALF_EVEN. |
protected DecimalArithmetic |
getRoundingUnnecessaryArithmetic()
Returns the arithmetic performing unchecked operations with rounding mode
UNNECESSARY. |
int |
getScale()
Returns the scale associated with this Decimal.
|
Scale5f |
getScaleMetrics()
Returns the metrics associated with the scale of this Decimal.
|
static MutableDecimal5f |
half()
Returns a new
MutableDecimal5f whose value is equal to one half. |
static MutableDecimal5f |
hundred()
Returns a new
MutableDecimal5f whose value is equal to one hundred. |
static MutableDecimal5f |
hundredth()
Returns a new
MutableDecimal5f whose value is equal to one hundredth. |
static MutableDecimal5f |
million()
Returns a new
MutableDecimal5f whose value is equal to one million. |
static MutableDecimal5f |
minusOne()
Returns a new
MutableDecimal5f whose value is equal to minus one. |
Multipliable5f |
multiplyExact()
Returns this
Decimal as a multipliable factor for exact
typed exact multiplication. |
static MutableDecimal5f |
nine()
Returns a new
MutableDecimal5f whose value is equal to nine. |
static MutableDecimal5f |
one()
Returns a new
MutableDecimal5f whose value is equal to one. |
protected MutableDecimal5f |
self()
Returns
this decimal value as concrete implementation subtype. |
static MutableDecimal5f |
seven()
Returns a new
MutableDecimal5f whose value is equal to seven. |
static MutableDecimal5f |
six()
Returns a new
MutableDecimal5f whose value is equal to six. |
static MutableDecimal5f |
ten()
Returns a new
MutableDecimal5f whose value is equal to ten. |
static MutableDecimal5f |
tenth()
Returns a new
MutableDecimal5f whose value is equal to one tenth. |
static MutableDecimal5f |
thousand()
Returns a new
MutableDecimal5f whose value is equal to one thousand. |
static MutableDecimal5f |
thousandth()
Returns a new
MutableDecimal5f whose value is equal to one thousandth. |
static MutableDecimal5f |
three()
Returns a new
MutableDecimal5f whose value is equal to three. |
Decimal5f |
toImmutableDecimal()
If this
Decimal value is already an ImmutableDecimal it is simply returned. |
MutableDecimal5f |
toMutableDecimal()
If this
Decimal value is already a MutableDecimal it is simply returned. |
static MutableDecimal5f |
trillion()
Returns a new
MutableDecimal5f whose value is equal to one trillion. |
static MutableDecimal5f |
two()
Returns a new
MutableDecimal5f whose value is equal to two. |
static MutableDecimal5f |
ulp()
Returns a new
MutableDecimal5f whose value is equal to one ULP. |
static MutableDecimal5f |
unscaled(long unscaledValue)
Returns a new
MutableDecimal5f whose value is equal to
unscaledValue * 10-5. |
static MutableDecimal5f |
zero()
Returns a new
MutableDecimal5f whose value is equal to zero. |
createOrAssign, max, min, multiplyExact, scale, scale, scale, scale, set, set, set, set, set, set, set, set, set, set, set, set, setMinusOne, setOne, setUlp, setUnscaled, setUnscaled, setUnscaled, setZero, unscaledValueabs, abs, add, add, add, add, add, add, add, add, addSquared, addSquared, addSquared, addUnscaled, addUnscaled, addUnscaled, addUnscaled, addUnscaled, avg, avg, byteValueExact, compareTo, compareToNumerically, divide, divide, divide, divide, divide, divide, divide, divide, divideAndRemainder, divideAndRemainder, divideBy, divideBy, divideBy, divideByPowerOfTen, divideByPowerOfTen, divideByPowerOfTen, divideExact, divideToIntegralValue, divideToIntegralValue, divideToLongValue, divideToLongValue, divideTruncate, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, doubleValue, doubleValue, equals, floatValue, floatValue, fractionalPart, getArithmeticFor, getArithmeticFor, getArithmeticFor, getCheckedArithmeticFor, hashCode, integralPart, intValue, intValueExact, invert, invert, invert, isBetweenZeroAndMinusOne, isBetweenZeroAndOne, isEqualTo, isEqualToNumerically, isGreaterThan, isGreaterThanOrEqualTo, isIntegral, isIntegralPartZero, isLessThan, isLessThanOrEqualTo, isMinusOne, isNegative, isNonNegative, isNonPositive, isOne, isPositive, isUlp, isZero, longValue, longValue, longValueExact, max, max, min, min, multiply, multiply, multiply, multiply, multiply, multiply, multiply, multiplyBy, multiplyBy, multiplyBy, multiplyByPowerOfTen, multiplyByPowerOfTen, multiplyByPowerOfTen, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, negate, negate, pow, pow, pow, remainder, round, round, round, shiftLeft, shiftLeft, shiftLeft, shiftRight, shiftRight, shiftRight, shortValueExact, signum, sqrt, sqrt, square, square, square, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtractSquared, subtractSquared, subtractSquared, subtractUnscaled, subtractUnscaled, subtractUnscaled, subtractUnscaled, subtractUnscaled, toBigDecimal, toBigDecimal, toBigInteger, toBigInteger, toBigIntegerExact, toStringbyteValue, shortValuefinalize, getClass, notify, notifyAll, wait, wait, waitabs, abs, add, add, add, add, add, add, add, add, addSquared, addSquared, addSquared, addUnscaled, addUnscaled, addUnscaled, addUnscaled, addUnscaled, avg, avg, divide, divide, divide, divide, divide, divide, divide, divide, divideAndRemainder, divideAndRemainder, divideBy, divideBy, divideBy, divideByPowerOfTen, divideByPowerOfTen, divideByPowerOfTen, divideExact, divideToIntegralValue, divideToIntegralValue, divideTruncate, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, fractionalPart, integralPart, invert, invert, invert, multiply, multiply, multiply, multiply, multiply, multiply, multiply, multiplyBy, multiplyBy, multiplyBy, multiplyByPowerOfTen, multiplyByPowerOfTen, multiplyByPowerOfTen, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, negate, negate, pow, pow, pow, remainder, round, round, round, shiftLeft, shiftLeft, shiftLeft, shiftRight, shiftRight, shiftRight, sqrt, sqrt, square, square, square, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtractSquared, subtractSquared, subtractSquared, subtractUnscaled, subtractUnscaled, subtractUnscaled, subtractUnscaled, subtractUnscaledbyteValue, byteValueExact, compareTo, compareToNumerically, divideToLongValue, divideToLongValue, doubleValue, doubleValue, equals, floatValue, floatValue, hashCode, intValue, intValueExact, isBetweenZeroAndMinusOne, isBetweenZeroAndOne, isEqualTo, isEqualToNumerically, isGreaterThan, isGreaterThanOrEqualTo, isIntegral, isIntegralPartZero, isLessThan, isLessThanOrEqualTo, isMinusOne, isNegative, isNonNegative, isNonPositive, isOne, isPositive, isUlp, isZero, longValue, longValue, longValueExact, max, min, shortValue, shortValueExact, signum, toBigDecimal, toBigDecimal, toBigInteger, toBigInteger, toBigIntegerExact, toStringpublic MutableDecimal5f()
MutableDecimal5f with value zero.zero()public MutableDecimal5f(String value)
Decimal into a
MutableDecimal5f. The string representation consists
of an optional sign, '+' or '-' , followed by a sequence
of zero or more decimal digits ("the integer"), optionally followed by a
fraction.
The fraction consists of a decimal point followed by zero or more decimal
digits. The string must contain at least one digit in either the integer
or the fraction. If the fraction contains more than 5 digits, the
value is rounded using HALF_UP rounding. An
exception is thrown if the value is too large to be represented as a
MutableDecimal5f.
value - String value to convert into a MutableDecimal5fNumberFormatException - if value does not represent a valid Decimal
or if the value is too large to be represented as a
MutableDecimal5fAbstractMutableDecimal.set(String, RoundingMode)public MutableDecimal5f(long value)
MutableDecimal5f whose value is numerically equal
to that of the specified long value. An exception is thrown if the
specified value is too large to be represented as a MutableDecimal5f.value - long value to convert into a MutableDecimal5fIllegalArgumentException - if value is too large to be represented as a
MutableDecimal5fpublic MutableDecimal5f(double value)
MutableDecimal5f whose value is calculated by
rounding the specified double argument to scale 5 using
HALF_UP rounding. An exception is thrown if the
specified value is too large to be represented as a MutableDecimal5f.value - double value to convert into a MutableDecimal5fIllegalArgumentException - if value is NaN or infinite or if the magnitude is too large
for the double to be represented as a MutableDecimal5fAbstractMutableDecimal.set(double, RoundingMode),
AbstractMutableDecimal.set(float),
AbstractMutableDecimal.set(float, RoundingMode)public MutableDecimal5f(BigInteger value)
MutableDecimal5f whose value is numerically equal to
that of the specified BigInteger value. An exception is thrown if the
specified value is too large to be represented as a MutableDecimal5f.value - BigInteger value to convert into a MutableDecimal5fIllegalArgumentException - if value is too large to be represented as a MutableDecimal5fpublic MutableDecimal5f(BigDecimal value)
MutableDecimal5f whose value is calculated by
rounding the specified BigDecimal argument to scale 5 using
HALF_UP rounding. An exception is thrown if the
specified value is too large to be represented as a MutableDecimal5f.value - BigDecimal value to convert into a MutableDecimal5fIllegalArgumentException - if value is too large to be represented as a MutableDecimal5fAbstractMutableDecimal.set(BigDecimal, RoundingMode)public MutableDecimal5f(Decimal5f value)
MutableDecimal5f whose value is numerically equal to
that of the specified Decimal5f value.value - Decimal5f value to convert into a MutableDecimal5fpublic MutableDecimal5f(Decimal<?> value)
MutableDecimal5f whose value is calculated by
rounding the specified Decimal argument to scale 5 using
HALF_UP rounding. An exception is thrown if
the specified value is too large to be represented as a MutableDecimal5f.value - Decimal value to convert into a MutableDecimal5fIllegalArgumentException - if value is too large to be represented as a MutableDecimal5fAbstractMutableDecimal.set(Decimal, RoundingMode)protected final MutableDecimal5f create(long unscaled)
AbstractDecimalDecimal whose value is
(unscaled × 10-scale).create in class AbstractDecimal<Scale5f,MutableDecimal5f>unscaled - unscaled value to be returned as a Decimalprotected final MutableDecimal5f[] createArray(int length)
AbstractDecimalDecimal array of the specified length.createArray in class AbstractDecimal<Scale5f,MutableDecimal5f>length - the length of the array to returnnew D[length]protected final MutableDecimal5f self()
AbstractDecimalthis decimal value as concrete implementation subtype.self in class AbstractDecimal<Scale5f,MutableDecimal5f>thispublic final Scale5f getScaleMetrics()
Decimallong value underlying this Decimal.getScaleMetrics in interface Decimal<Scale5f>ScaleMetrics.getScale(),
ScaleMetrics.getScaleFactor()public final int getScale()
Decimallong value underlying this Decimal.
If the scale is f then the value represented by a Decimal instance is
(unscaledValue × 10-f).
This method is a shortcut for getScaleMetrics().getScale().
getScale in interface Decimal<Scale5f>Decimal.getScaleMetrics(),
ScaleMetrics.getScale(),
Decimal.unscaledValue()public Factory5f getFactory()
Decimalthis Decimal.getFactory in interface Decimal<Scale5f>protected DecimalArithmetic getDefaultArithmetic()
AbstractDecimalHALF_UP.getDefaultArithmetic in class AbstractDecimal<Scale5f,MutableDecimal5f>HALF_UP
rounding and UNCHECKED overflow
modeprotected DecimalArithmetic getDefaultCheckedArithmetic()
AbstractDecimalHALF_UP.getDefaultCheckedArithmetic in class AbstractDecimal<Scale5f,MutableDecimal5f>HALF_UP
rounding and CHECKED overflow modeprotected DecimalArithmetic getRoundingDownArithmetic()
AbstractDecimalDOWN.getRoundingDownArithmetic in class AbstractDecimal<Scale5f,MutableDecimal5f>DOWN rounding and
UNCHECKED overflow modeprotected DecimalArithmetic getRoundingFloorArithmetic()
AbstractDecimalFLOOR.getRoundingFloorArithmetic in class AbstractDecimal<Scale5f,MutableDecimal5f>FLOOR rounding and
UNCHECKED overflow modeprotected DecimalArithmetic getRoundingHalfEvenArithmetic()
AbstractDecimalHALF_EVEN.getRoundingHalfEvenArithmetic in class AbstractDecimal<Scale5f,MutableDecimal5f>HALF_UP rounding and
UNCHECKED overflow modeprotected DecimalArithmetic getRoundingUnnecessaryArithmetic()
AbstractDecimalUNNECESSARY.getRoundingUnnecessaryArithmetic in class AbstractDecimal<Scale5f,MutableDecimal5f>UNNECESSARY
rounding and UNCHECKED overflow
modepublic MutableDecimal5f clone()
MutableDecimalclone in interface MutableDecimal<Scale5f>clone in class AbstractMutableDecimal<Scale5f,MutableDecimal5f>public static MutableDecimal5f unscaled(long unscaledValue)
MutableDecimal5f whose value is equal to
unscaledValue * 10-5.unscaledValue - the unscaled decimal value to convertMutableDecimal5f value initialised with unscaledValue * 10-5AbstractMutableDecimal.setUnscaled(long, int),
AbstractMutableDecimal.setUnscaled(long, int, RoundingMode)public static MutableDecimal5f zero()
MutableDecimal5f whose value is equal to zero.MutableDecimal5f value initialised with 0.public static MutableDecimal5f ulp()
MutableDecimal5f whose value is equal to one ULP.MutableDecimal5f value initialised with 10-5.public static MutableDecimal5f one()
MutableDecimal5f whose value is equal to one.MutableDecimal5f value initialised with 1.public static MutableDecimal5f two()
MutableDecimal5f whose value is equal to two.MutableDecimal5f value initialised with 2.public static MutableDecimal5f three()
MutableDecimal5f whose value is equal to three.MutableDecimal5f value initialised with 3.public static MutableDecimal5f four()
MutableDecimal5f whose value is equal to four.MutableDecimal5f value initialised with 4.public static MutableDecimal5f five()
MutableDecimal5f whose value is equal to five.MutableDecimal5f value initialised with 5.public static MutableDecimal5f six()
MutableDecimal5f whose value is equal to six.MutableDecimal5f value initialised with 6.public static MutableDecimal5f seven()
MutableDecimal5f whose value is equal to seven.MutableDecimal5f value initialised with 7.public static MutableDecimal5f eight()
MutableDecimal5f whose value is equal to eight.MutableDecimal5f value initialised with 8.public static MutableDecimal5f nine()
MutableDecimal5f whose value is equal to nine.MutableDecimal5f value initialised with 9.public static MutableDecimal5f ten()
MutableDecimal5f whose value is equal to ten.MutableDecimal5f value initialised with 10.public static MutableDecimal5f hundred()
MutableDecimal5f whose value is equal to one hundred.MutableDecimal5f value initialised with 100.public static MutableDecimal5f thousand()
MutableDecimal5f whose value is equal to one thousand.MutableDecimal5f value initialised with 1000.public static MutableDecimal5f million()
MutableDecimal5f whose value is equal to one million.MutableDecimal5f value initialised with 106.public static MutableDecimal5f billion()
MutableDecimal5f whose value is equal to one billion.MutableDecimal5f value initialised with 109.public static MutableDecimal5f trillion()
MutableDecimal5f whose value is equal to one trillion.MutableDecimal5f value initialised with 1012.public static MutableDecimal5f minusOne()
MutableDecimal5f whose value is equal to minus one.MutableDecimal5f value initialised with -1.public static MutableDecimal5f half()
MutableDecimal5f whose value is equal to one half.MutableDecimal5f value initialised with 0.5.public static MutableDecimal5f tenth()
MutableDecimal5f whose value is equal to one tenth.MutableDecimal5f value initialised with 0.1.public static MutableDecimal5f hundredth()
MutableDecimal5f whose value is equal to one hundredth.MutableDecimal5f value initialised with 0.01.public static MutableDecimal5f thousandth()
MutableDecimal5f whose value is equal to one thousandth.MutableDecimal5f value initialised with 0.001.public Multipliable5f multiplyExact()
Decimal as a multipliable factor for exact
typed exact multiplication. The second factor is passed to one of
the by(..) methods of the returned multiplier. The scale of
the result is the sum of the scales of this Decimal and the
second factor passed to the by(..) method.
The method is similar to multiplyExact(Decimal) but the result
is retrieved in exact typed form with the correct result scale.
For instance one can write:
Decimal7f product = this.multiplyExact().by(Decimal2f.FIVE);
public Decimal5f toImmutableDecimal()
DecimalDecimal value is already an ImmutableDecimal it is simply returned. Otherwise a new
immutable value with the same scale and numerical value as this Decimal is created and returned.toImmutableDecimal in interface Decimal<Scale5f>this if immutable and a new ImmutableDecimal with the same scale and value as
this Decimal otherwisepublic MutableDecimal5f toMutableDecimal()
DecimalDecimal value is already a MutableDecimal it is simply returned. Otherwise a new mutable
value with the same scale and numerical value as this Decimal is created and returned.toMutableDecimal in interface Decimal<Scale5f>this if mutable and a new MutableDecimal with the same scale and value as this
Decimal otherwise