public final class MutableDecimal18f extends AbstractMutableDecimal<Scale18f,MutableDecimal18f> implements Cloneable
All methods for this class throw NullPointerException
when passed a
null
object reference for any input parameter.
Constructor and Description |
---|
MutableDecimal18f()
Constructs a new
MutableDecimal18f with value zero. |
MutableDecimal18f(BigDecimal value)
Constructs a
MutableDecimal18f whose value is calculated by
rounding the specified BigDecimal argument to scale 18 using
HALF_UP rounding. |
MutableDecimal18f(BigInteger value)
Constructs a
MutableDecimal18f whose value is numerically equal to
that of the specified BigInteger value. |
MutableDecimal18f(Decimal<?> value)
|
MutableDecimal18f(Decimal18f value)
Constructs a
MutableDecimal18f whose value is numerically equal to
that of the specified Decimal18f value. |
MutableDecimal18f(double value)
Constructs a
MutableDecimal18f whose value is calculated by
rounding the specified double argument to scale 18 using
HALF_UP rounding. |
MutableDecimal18f(long value)
Constructs a
MutableDecimal18f whose value is numerically equal
to that of the specified long value. |
MutableDecimal18f(String value)
Translates the string representation of a
Decimal into a
MutableDecimal18f . |
Modifier and Type | Method and Description |
---|---|
static MutableDecimal18f |
billionth()
Returns a new
MutableDecimal18f whose value is equal to one billionth. |
MutableDecimal18f |
clone()
Returns a clone of this mutable Decimal numerically identical to this
value.
|
protected MutableDecimal18f |
create(long unscaled)
Returns a new
Decimal whose value is
(unscaled × 10-scale). |
protected MutableDecimal18f[] |
createArray(int length)
Returns a new
Decimal array of the specified length . |
static MutableDecimal18f |
eight()
Returns a new
MutableDecimal18f whose value is equal to eight. |
static MutableDecimal18f |
five()
Returns a new
MutableDecimal18f whose value is equal to five. |
static MutableDecimal18f |
four()
Returns a new
MutableDecimal18f 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 . |
Factory18f |
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.
|
Scale18f |
getScaleMetrics()
Returns the metrics associated with the scale of this Decimal.
|
static MutableDecimal18f |
half()
Returns a new
MutableDecimal18f whose value is equal to one half. |
static MutableDecimal18f |
hundredth()
Returns a new
MutableDecimal18f whose value is equal to one hundredth. |
static MutableDecimal18f |
millionth()
Returns a new
MutableDecimal18f whose value is equal to one millionth. |
static MutableDecimal18f |
minusOne()
Returns a new
MutableDecimal18f whose value is equal to minus one. |
Multipliable18f |
multiplyExact()
Returns this
Decimal as a multipliable factor for exact
typed exact multiplication. |
static MutableDecimal18f |
nine()
Returns a new
MutableDecimal18f whose value is equal to nine. |
static MutableDecimal18f |
one()
Returns a new
MutableDecimal18f whose value is equal to one. |
static MutableDecimal18f |
quadrillionth()
Returns a new
MutableDecimal18f whose value is equal to one quadrillionth. |
static MutableDecimal18f |
quintillionth()
Returns a new
MutableDecimal18f whose value is equal to one quintillionth. |
protected MutableDecimal18f |
self()
Returns
this decimal value as concrete implementation subtype. |
static MutableDecimal18f |
seven()
Returns a new
MutableDecimal18f whose value is equal to seven. |
static MutableDecimal18f |
six()
Returns a new
MutableDecimal18f whose value is equal to six. |
static MutableDecimal18f |
tenth()
Returns a new
MutableDecimal18f whose value is equal to one tenth. |
static MutableDecimal18f |
thousandth()
Returns a new
MutableDecimal18f whose value is equal to one thousandth. |
static MutableDecimal18f |
three()
Returns a new
MutableDecimal18f whose value is equal to three. |
Decimal18f |
toImmutableDecimal()
If this
Decimal value is already an ImmutableDecimal it is simply returned. |
MutableDecimal18f |
toMutableDecimal()
If this
Decimal value is already a MutableDecimal it is simply returned. |
static MutableDecimal18f |
trillionth()
Returns a new
MutableDecimal18f whose value is equal to one trillionth. |
static MutableDecimal18f |
two()
Returns a new
MutableDecimal18f whose value is equal to two. |
static MutableDecimal18f |
ulp()
Returns a new
MutableDecimal18f whose value is equal to one ULP. |
static MutableDecimal18f |
unscaled(long unscaledValue)
Returns a new
MutableDecimal18f whose value is equal to
unscaledValue * 10-18 . |
static MutableDecimal18f |
zero()
Returns a new
MutableDecimal18f 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, unscaledValue
abs, 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, toString
byteValue, shortValue
finalize, getClass, notify, notifyAll, wait, wait, wait
abs, 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, subtractUnscaled
byteValue, 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, toString
public MutableDecimal18f()
MutableDecimal18f
with value zero.zero()
public MutableDecimal18f(String value)
Decimal
into a
MutableDecimal18f
. 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 18 digits, the
value is rounded using HALF_UP
rounding. An
exception is thrown if the value is too large to be represented as a
MutableDecimal18f
.
value
- String value to convert into a MutableDecimal18f
NumberFormatException
- if value
does not represent a valid Decimal
or if the value is too large to be represented as a
MutableDecimal18f
AbstractMutableDecimal.set(String, RoundingMode)
public MutableDecimal18f(long value)
MutableDecimal18f
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 MutableDecimal18f
.value
- long value to convert into a MutableDecimal18f
IllegalArgumentException
- if value
is too large to be represented as a
MutableDecimal18f
public MutableDecimal18f(double value)
MutableDecimal18f
whose value is calculated by
rounding the specified double
argument to scale 18 using
HALF_UP
rounding. An exception is thrown if the
specified value is too large to be represented as a MutableDecimal18f
.value
- double value to convert into a MutableDecimal18f
IllegalArgumentException
- if value
is NaN or infinite or if the magnitude is too large
for the double to be represented as a MutableDecimal18f
AbstractMutableDecimal.set(double, RoundingMode)
,
AbstractMutableDecimal.set(float)
,
AbstractMutableDecimal.set(float, RoundingMode)
public MutableDecimal18f(BigInteger value)
MutableDecimal18f
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 MutableDecimal18f
.value
- BigInteger
value to convert into a MutableDecimal18f
IllegalArgumentException
- if value
is too large to be represented as a MutableDecimal18f
public MutableDecimal18f(BigDecimal value)
MutableDecimal18f
whose value is calculated by
rounding the specified BigDecimal
argument to scale 18 using
HALF_UP
rounding. An exception is thrown if the
specified value is too large to be represented as a MutableDecimal18f
.value
- BigDecimal
value to convert into a MutableDecimal18f
IllegalArgumentException
- if value
is too large to be represented as a MutableDecimal18f
AbstractMutableDecimal.set(BigDecimal, RoundingMode)
public MutableDecimal18f(Decimal18f value)
MutableDecimal18f
whose value is numerically equal to
that of the specified Decimal18f
value.value
- Decimal18f
value to convert into a MutableDecimal18f
public MutableDecimal18f(Decimal<?> value)
MutableDecimal18f
whose value is calculated by
rounding the specified Decimal
argument to scale 18 using
HALF_UP
rounding. An exception is thrown if
the specified value is too large to be represented as a MutableDecimal18f
.value
- Decimal value to convert into a MutableDecimal18f
IllegalArgumentException
- if value
is too large to be represented as a MutableDecimal18f
AbstractMutableDecimal.set(Decimal, RoundingMode)
protected final MutableDecimal18f create(long unscaled)
AbstractDecimal
Decimal
whose value is
(unscaled × 10-scale).create
in class AbstractDecimal<Scale18f,MutableDecimal18f>
unscaled
- unscaled value to be returned as a Decimal
protected final MutableDecimal18f[] createArray(int length)
AbstractDecimal
Decimal
array of the specified length
.createArray
in class AbstractDecimal<Scale18f,MutableDecimal18f>
length
- the length of the array to returnnew D[length]
protected final MutableDecimal18f self()
AbstractDecimal
this
decimal value as concrete implementation subtype.self
in class AbstractDecimal<Scale18f,MutableDecimal18f>
this
public final Scale18f getScaleMetrics()
Decimal
long
value underlying this Decimal
.getScaleMetrics
in interface Decimal<Scale18f>
ScaleMetrics.getScale()
,
ScaleMetrics.getScaleFactor()
public final int getScale()
Decimal
long
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<Scale18f>
Decimal.getScaleMetrics()
,
ScaleMetrics.getScale()
,
Decimal.unscaledValue()
public Factory18f getFactory()
Decimal
this
Decimal.getFactory
in interface Decimal<Scale18f>
protected DecimalArithmetic getDefaultArithmetic()
AbstractDecimal
HALF_UP
.getDefaultArithmetic
in class AbstractDecimal<Scale18f,MutableDecimal18f>
HALF_UP
rounding and UNCHECKED
overflow
modeprotected DecimalArithmetic getDefaultCheckedArithmetic()
AbstractDecimal
HALF_UP
.getDefaultCheckedArithmetic
in class AbstractDecimal<Scale18f,MutableDecimal18f>
HALF_UP
rounding and CHECKED
overflow modeprotected DecimalArithmetic getRoundingDownArithmetic()
AbstractDecimal
DOWN
.getRoundingDownArithmetic
in class AbstractDecimal<Scale18f,MutableDecimal18f>
DOWN
rounding and
UNCHECKED
overflow modeprotected DecimalArithmetic getRoundingFloorArithmetic()
AbstractDecimal
FLOOR
.getRoundingFloorArithmetic
in class AbstractDecimal<Scale18f,MutableDecimal18f>
FLOOR
rounding and
UNCHECKED
overflow modeprotected DecimalArithmetic getRoundingHalfEvenArithmetic()
AbstractDecimal
HALF_EVEN
.getRoundingHalfEvenArithmetic
in class AbstractDecimal<Scale18f,MutableDecimal18f>
HALF_UP
rounding and
UNCHECKED
overflow modeprotected DecimalArithmetic getRoundingUnnecessaryArithmetic()
AbstractDecimal
UNNECESSARY
.getRoundingUnnecessaryArithmetic
in class AbstractDecimal<Scale18f,MutableDecimal18f>
UNNECESSARY
rounding and UNCHECKED
overflow
modepublic MutableDecimal18f clone()
MutableDecimal
clone
in interface MutableDecimal<Scale18f>
clone
in class AbstractMutableDecimal<Scale18f,MutableDecimal18f>
public static MutableDecimal18f unscaled(long unscaledValue)
MutableDecimal18f
whose value is equal to
unscaledValue * 10-18
.unscaledValue
- the unscaled decimal value to convertMutableDecimal18f
value initialised with unscaledValue * 10-18
AbstractMutableDecimal.setUnscaled(long, int)
,
AbstractMutableDecimal.setUnscaled(long, int, RoundingMode)
public static MutableDecimal18f zero()
MutableDecimal18f
whose value is equal to zero.MutableDecimal18f
value initialised with 0.public static MutableDecimal18f ulp()
MutableDecimal18f
whose value is equal to one ULP.MutableDecimal18f
value initialised with 10-18.public static MutableDecimal18f one()
MutableDecimal18f
whose value is equal to one.MutableDecimal18f
value initialised with 1.public static MutableDecimal18f two()
MutableDecimal18f
whose value is equal to two.MutableDecimal18f
value initialised with 2.public static MutableDecimal18f three()
MutableDecimal18f
whose value is equal to three.MutableDecimal18f
value initialised with 3.public static MutableDecimal18f four()
MutableDecimal18f
whose value is equal to four.MutableDecimal18f
value initialised with 4.public static MutableDecimal18f five()
MutableDecimal18f
whose value is equal to five.MutableDecimal18f
value initialised with 5.public static MutableDecimal18f six()
MutableDecimal18f
whose value is equal to six.MutableDecimal18f
value initialised with 6.public static MutableDecimal18f seven()
MutableDecimal18f
whose value is equal to seven.MutableDecimal18f
value initialised with 7.public static MutableDecimal18f eight()
MutableDecimal18f
whose value is equal to eight.MutableDecimal18f
value initialised with 8.public static MutableDecimal18f nine()
MutableDecimal18f
whose value is equal to nine.MutableDecimal18f
value initialised with 9.public static MutableDecimal18f minusOne()
MutableDecimal18f
whose value is equal to minus one.MutableDecimal18f
value initialised with -1.public static MutableDecimal18f half()
MutableDecimal18f
whose value is equal to one half.MutableDecimal18f
value initialised with 0.5.public static MutableDecimal18f tenth()
MutableDecimal18f
whose value is equal to one tenth.MutableDecimal18f
value initialised with 0.1.public static MutableDecimal18f hundredth()
MutableDecimal18f
whose value is equal to one hundredth.MutableDecimal18f
value initialised with 0.01.public static MutableDecimal18f thousandth()
MutableDecimal18f
whose value is equal to one thousandth.MutableDecimal18f
value initialised with 0.001.public static MutableDecimal18f millionth()
MutableDecimal18f
whose value is equal to one millionth.MutableDecimal18f
value initialised with 10-6.public static MutableDecimal18f billionth()
MutableDecimal18f
whose value is equal to one billionth.MutableDecimal18f
value initialised with 10-9.public static MutableDecimal18f trillionth()
MutableDecimal18f
whose value is equal to one trillionth.MutableDecimal18f
value initialised with 10-12.public static MutableDecimal18f quadrillionth()
MutableDecimal18f
whose value is equal to one quadrillionth.MutableDecimal18f
value initialised with 10-15.public static MutableDecimal18f quintillionth()
MutableDecimal18f
whose value is equal to one quintillionth.MutableDecimal18f
value initialised with 10-18.public Multipliable18f 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:
Decimal18f product = this.multiplyExact().by(Decimal0f.FIVE);
public Decimal18f toImmutableDecimal()
Decimal
Decimal
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<Scale18f>
this
if immutable and a new ImmutableDecimal
with the same scale and value as
this
Decimal otherwisepublic MutableDecimal18f toMutableDecimal()
Decimal
Decimal
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<Scale18f>
this
if mutable and a new MutableDecimal
with the same scale and value as this
Decimal otherwise