public enum Factory6f extends Enum<Factory6f> implements DecimalFactory<Scale6f>
Decimal6f
and
MutableDecimal6f
instances.Enum Constant and Description |
---|
INSTANCE
Singleton factory instance for immutable and mutable decimals with scale 6.
|
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.
|
Scale6f |
getScaleMetrics()
Returns the scale metrics type associated with Decimal values created by
this factory.
|
Class<Decimal6f> |
immutableType()
Returns the implementing class for immutable values.
|
Class<MutableDecimal6f> |
mutableType()
Returns the implementing class for mutable values.
|
Decimal6f[] |
newArray(int length)
Creates a one dimensional array of the specified
length for
immutable Decimal values. |
MutableDecimal6f |
newMutable()
Creates a new mutable value initialized with zero.
|
MutableDecimal6f[] |
newMutableArray(int length)
Creates a one dimensional array of the specified
length for
mutable Decimal values. |
Decimal6f |
parse(String value)
Translates the string representation of a
Decimal into an
immutable Decimal . |
Decimal6f |
parse(String value,
RoundingMode roundingMode)
Translates the string representation of a
Decimal into an
immutable Decimal . |
Decimal6f |
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. |
Decimal6f |
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 . |
Decimal6f |
valueOf(BigInteger value)
Returns a new immutable Decimal whose value is numerically equal to that
of the specified
BigInteger value. |
Decimal6f |
valueOf(Decimal<?> value)
|
Decimal6f |
valueOf(Decimal<?> value,
RoundingMode roundingMode)
|
Decimal6f |
valueOf(double value)
|
Decimal6f |
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 . |
Decimal6f |
valueOf(float value)
|
Decimal6f |
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 . |
Decimal6f |
valueOf(long value)
Returns a new immutable Decimal whose value is numerically equal to that
of the specified
long value. |
static Factory6f |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
Decimal6f |
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 . |
Decimal6f |
valueOfUnscaled(long unscaledValue,
int scale)
Returns a new immutable Decimal whose value is numerically equal to
(unscaled × 10-scale).
|
Decimal6f |
valueOfUnscaled(long unscaledValue,
int scale,
RoundingMode roundingMode)
Returns a new immutable Decimal whose value is numerically equal to
(unscaled × 10-scale).
|
static Factory6f[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static Factory6f[] values()
for (Factory6f c : Factory6f.values()) System.out.println(c);
public static Factory6f 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 Scale6f getScaleMetrics()
DecimalFactory
getScaleMetrics
in interface DecimalFactory<Scale6f>
public final int getScale()
DecimalFactory
getScale
in interface DecimalFactory<Scale6f>
public final Class<Decimal6f> immutableType()
DecimalFactory
immutableType
in interface DecimalFactory<Scale6f>
public final Class<MutableDecimal6f> mutableType()
DecimalFactory
mutableType
in interface DecimalFactory<Scale6f>
public final DecimalFactory<?> deriveFactory(int scale)
DecimalFactory
scale
.deriveFactory
in interface DecimalFactory<Scale6f>
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<Scale6f>
S
- the generic type for scaleMetrics
scaleMetrics
- the metrics defining the scale of the Decimal numbers created
by the returned factoryscaleMetrics
public final Decimal6f 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<Scale6f>
value
- long value to convert into an immutable Decimal valuelong
valuepublic final Decimal6f 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<Scale6f>
value
- float value to convert into an immutable Decimal valuepublic final Decimal6f 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<Scale6f>
value
- float value to convert into an immutable Decimal valueroundingMode
- the rounding mode to apply during the conversion if necessarypublic final Decimal6f 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<Scale6f>
value
- double value to convert into an immutable Decimal valuepublic final Decimal6f 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<Scale6f>
value
- double value to convert into an immutable Decimal valueroundingMode
- the rounding mode to apply during the conversion if necessarypublic final Decimal6f 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<Scale6f>
value
- BigInteger
value to convert into an immutable Decimal
valuepublic final Decimal6f 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<Scale6f>
value
- BigDecimal
value to convert into an immutable Decimal
valuepublic final Decimal6f 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<Scale6f>
value
- BigDecimal
value to convert into an immutable Decimal
valueroundingMode
- the rounding mode to apply during the conversion if necessarypublic final Decimal6f 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<Scale6f>
value
- Decimal value to convert into an immutable Decimal value of
this factory's scalepublic final Decimal6f 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<Scale6f>
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 Decimal6f 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<Scale6f>
value
- String value to convert into an immutable Decimal value of
this factory's scalepublic final Decimal6f 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<Scale6f>
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 Decimal6f valueOfUnscaled(long unscaledValue)
DecimalFactory
scale
refers to this factory's scale
.valueOfUnscaled
in interface DecimalFactory<Scale6f>
unscaledValue
- unscaled value to convert into an immutable Decimal valuepublic final Decimal6f 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<Scale6f>
unscaledValue
- unscaled value to convert into an immutable Decimal valuescale
- the scale to apply to the unscaled
valuepublic final Decimal6f 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<Scale6f>
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 Decimal6f[] newArray(int length)
DecimalFactory
length
for
immutable Decimal values.newArray
in interface DecimalFactory<Scale6f>
length
- the length of the returned arraypublic final MutableDecimal6f newMutable()
DecimalFactory
newMutable
in interface DecimalFactory<Scale6f>
public final MutableDecimal6f[] newMutableArray(int length)
DecimalFactory
length
for
mutable Decimal values.newMutableArray
in interface DecimalFactory<Scale6f>
length
- the length of the returned array