public enum Factory12f extends Enum<Factory12f> implements DecimalFactory<Scale12f>
Decimal12f
and
MutableDecimal12f
instances.Enum Constant and Description |
---|
INSTANCE
Singleton factory instance for immutable and mutable decimals with scale 12.
|
Modifier and Type | Method and Description |
---|---|
DecimalFactory<?> |
deriveFactory(int scale)
Returns a factory for the given
scale . |
<S extends ScaleMetrics> |
deriveFactory(S scaleMetrics)
Returns a factory for the given
scaleMetrics . |
int |
getScale()
Returns the scale of values created by this factory.
|
Scale12f |
getScaleMetrics()
Returns the scale metrics type associated with Decimal values created by
this factory.
|
Class<Decimal12f> |
immutableType()
Returns the implementing class for immutable values.
|
Class<MutableDecimal12f> |
mutableType()
Returns the implementing class for mutable values.
|
Decimal12f[] |
newArray(int length)
Creates a one dimensional array of the specified
length for
immutable Decimal values. |
MutableDecimal12f |
newMutable()
Creates a new mutable value initialized with zero.
|
MutableDecimal12f[] |
newMutableArray(int length)
Creates a one dimensional array of the specified
length for
mutable Decimal values. |
Decimal12f |
parse(String value)
Translates the string representation of a
Decimal into an
immutable Decimal . |
Decimal12f |
parse(String value,
RoundingMode roundingMode)
Translates the string representation of a
Decimal into an
immutable Decimal . |
Decimal12f |
valueOf(BigDecimal value)
Returns a new immutable Decimal whose value is calculated by rounding the
specified
BigDecimal argument to the scale of
this factory using HALF_UP rounding. |
Decimal12f |
valueOf(BigDecimal value,
RoundingMode roundingMode)
Returns a new immutable Decimal whose value is calculated by rounding the
specified
BigDecimal argument to the scale of
this factory using the specified roundingMode . |
Decimal12f |
valueOf(BigInteger value)
Returns a new immutable Decimal whose value is numerically equal to that
of the specified
BigInteger value. |
Decimal12f |
valueOf(Decimal<?> value)
|
Decimal12f |
valueOf(Decimal<?> value,
RoundingMode roundingMode)
|
Decimal12f |
valueOf(double value)
|
Decimal12f |
valueOf(double value,
RoundingMode roundingMode)
Returns a new immutable Decimal whose value is calculated by rounding the
specified
double argument to the scale of
this factory using the specified roundingMode . |
Decimal12f |
valueOf(float value)
|
Decimal12f |
valueOf(float value,
RoundingMode roundingMode)
Returns a new immutable Decimal whose value is calculated by rounding the
specified
float argument to the scale of this
factory using the specified roundingMode . |
Decimal12f |
valueOf(long value)
Returns a new immutable Decimal whose value is numerically equal to that
of the specified
long value. |
static Factory12f |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
Decimal12f |
valueOfUnscaled(long unscaledValue)
Returns a new immutable Decimal whose value is numerically equal to
(unscaled × 10-scale) where
scale
refers to this factory's scale . |
Decimal12f |
valueOfUnscaled(long unscaledValue,
int scale)
Returns a new immutable Decimal whose value is numerically equal to
(unscaled × 10-scale).
|
Decimal12f |
valueOfUnscaled(long unscaledValue,
int scale,
RoundingMode roundingMode)
Returns a new immutable Decimal whose value is numerically equal to
(unscaled × 10-scale).
|
static Factory12f[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Factory12f INSTANCE
public static Factory12f[] values()
for (Factory12f c : Factory12f.values()) System.out.println(c);
public static Factory12f valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic final Scale12f getScaleMetrics()
DecimalFactory
getScaleMetrics
in interface DecimalFactory<Scale12f>
public final int getScale()
DecimalFactory
getScale
in interface DecimalFactory<Scale12f>
public final Class<Decimal12f> immutableType()
DecimalFactory
immutableType
in interface DecimalFactory<Scale12f>
public final Class<MutableDecimal12f> mutableType()
DecimalFactory
mutableType
in interface DecimalFactory<Scale12f>
public final DecimalFactory<?> deriveFactory(int scale)
DecimalFactory
scale
.deriveFactory
in interface DecimalFactory<Scale12f>
scale
- the scale of Decimal numbers created by the returned factorypublic final <S extends ScaleMetrics> DecimalFactory<S> deriveFactory(S scaleMetrics)
DecimalFactory
scaleMetrics
.deriveFactory
in interface DecimalFactory<Scale12f>
S
- the generic type for scaleMetrics
scaleMetrics
- the metrics defining the scale of the Decimal numbers created
by the returned factoryscaleMetrics
public final Decimal12f valueOf(long value)
DecimalFactory
long
value. An exception is thrown if the
specified value is too large to be represented as a Decimal of this
factory's scale
.valueOf
in interface DecimalFactory<Scale12f>
value
- long value to convert into an immutable Decimal valuelong
valuepublic final Decimal12f valueOf(float value)
DecimalFactory
float
argument to the scale
of this
factory using HALF_UP
rounding. An exception
is thrown if the specified value is too large to be represented as a
Decimal of this factory's scale.valueOf
in interface DecimalFactory<Scale12f>
value
- float value to convert into an immutable Decimal valuepublic final Decimal12f valueOf(float value, RoundingMode roundingMode)
DecimalFactory
float
argument to the scale
of this
factory using the specified roundingMode
. An exception is thrown
if the specified value is too large to be represented as a Decimal of
this factory's scale.valueOf
in interface DecimalFactory<Scale12f>
value
- float value to convert into an immutable Decimal valueroundingMode
- the rounding mode to apply during the conversion if necessarypublic final Decimal12f valueOf(double value)
DecimalFactory
double
argument to the scale
of
this factory using HALF_UP
rounding. An
exception is thrown if the specified value is too large to be represented
as a Decimal of this factory's scale.valueOf
in interface DecimalFactory<Scale12f>
value
- double value to convert into an immutable Decimal valuepublic final Decimal12f valueOf(double value, RoundingMode roundingMode)
DecimalFactory
double
argument to the scale
of
this factory using the specified roundingMode
. An exception is
thrown if the specified value is too large to be represented as a Decimal
of this factory's scale.valueOf
in interface DecimalFactory<Scale12f>
value
- double value to convert into an immutable Decimal valueroundingMode
- the rounding mode to apply during the conversion if necessarypublic final Decimal12f valueOf(BigInteger value)
DecimalFactory
BigInteger
value. An exception is thrown if the
specified value is too large to be represented as a Decimal of this
factory's scale
.valueOf
in interface DecimalFactory<Scale12f>
value
- BigInteger
value to convert into an immutable Decimal
valuepublic final Decimal12f valueOf(BigDecimal value)
DecimalFactory
BigDecimal
argument to the scale
of
this factory using HALF_UP
rounding. An
exception is thrown if the specified value is too large to be represented
as a Decimal of this factory's scale.valueOf
in interface DecimalFactory<Scale12f>
value
- BigDecimal
value to convert into an immutable Decimal
valuepublic final Decimal12f valueOf(BigDecimal value, RoundingMode roundingMode)
DecimalFactory
BigDecimal
argument to the scale
of
this factory using the specified roundingMode
. An exception is
thrown if the specified value is too large to be represented as a Decimal
of this factory's scale.valueOf
in interface DecimalFactory<Scale12f>
value
- BigDecimal
value to convert into an immutable Decimal
valueroundingMode
- the rounding mode to apply during the conversion if necessarypublic final Decimal12f valueOf(Decimal<?> value)
DecimalFactory
Decimal
argument to the scale
of
this factory using HALF_UP
rounding. An
exception is thrown if the specified value is too large to be represented
as a Decimal of this factory's scale.valueOf
in interface DecimalFactory<Scale12f>
value
- Decimal value to convert into an immutable Decimal value of
this factory's scalepublic final Decimal12f valueOf(Decimal<?> value, RoundingMode roundingMode)
DecimalFactory
Decimal
argument to the scale
of
this factory using the specified roundingMode
. An exception is
thrown if the specified value is too large to be represented as a Decimal
of this factory's scale.valueOf
in interface DecimalFactory<Scale12f>
value
- Decimal value to convert into an immutable Decimal value of
this factory's scaleroundingMode
- the rounding mode to apply during the conversion if necessarypublic final Decimal12f parse(String value)
DecimalFactory
Decimal
into an
immutable Decimal
. 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 digits than this factory's
scale
, the value is rounded using
HALF_UP
rounding. An exception is thrown if
the value is too large to be represented as a Decimal of this factory's
scale.
parse
in interface DecimalFactory<Scale12f>
value
- String value to convert into an immutable Decimal value of
this factory's scalepublic final Decimal12f parse(String value, RoundingMode roundingMode)
DecimalFactory
Decimal
into an
immutable Decimal
. 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 digits than this factory's
scale
, the value is rounded using the specified
roundingMode
. An exception is thrown if the value is too large to
be represented as a Decimal of this factory's scale.
parse
in interface DecimalFactory<Scale12f>
value
- String value to convert into an immutable Decimal value of
this factory's scaleroundingMode
- the rounding mode to apply if the fraction contains more
digits than the scale of this factorypublic final Decimal12f valueOfUnscaled(long unscaledValue)
DecimalFactory
scale
refers to this factory's scale
.valueOfUnscaled
in interface DecimalFactory<Scale12f>
unscaledValue
- unscaled value to convert into an immutable Decimal valuepublic final Decimal12f valueOfUnscaled(long unscaledValue, int scale)
DecimalFactory
scale
of this factory using
HALF_UP
rounding. An exception is thrown if
the specified value is too large to be represented as a Decimal of this
factory's scale.valueOfUnscaled
in interface DecimalFactory<Scale12f>
unscaledValue
- unscaled value to convert into an immutable Decimal valuescale
- the scale to apply to the unscaled
valuepublic final Decimal12f valueOfUnscaled(long unscaledValue, int scale, RoundingMode roundingMode)
DecimalFactory
scale
of this factory using the specified
roundingMode
. An exception is thrown if the specified value is
too large to be represented as a Decimal of this factory's scale.valueOfUnscaled
in interface DecimalFactory<Scale12f>
unscaledValue
- unscaled value to convert into an immutable Decimal valuescale
- the scale to apply to the unscaled
valueroundingMode
- the rounding mode to apply during the conversion if necessarypublic final Decimal12f[] newArray(int length)
DecimalFactory
length
for
immutable Decimal values.newArray
in interface DecimalFactory<Scale12f>
length
- the length of the returned arraypublic final MutableDecimal12f newMutable()
DecimalFactory
newMutable
in interface DecimalFactory<Scale12f>
public final MutableDecimal12f[] newMutableArray(int length)
DecimalFactory
length
for
mutable Decimal values.newMutableArray
in interface DecimalFactory<Scale12f>
length
- the length of the returned array