public enum Factory0f extends Enum<Factory0f> implements DecimalFactory<Scale0f>
Decimal0f and
MutableDecimal0f instances.| Enum Constant and Description |
|---|
INSTANCE
Singleton factory instance for immutable and mutable decimals with scale 0.
|
| 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.
|
Scale0f |
getScaleMetrics()
Returns the scale metrics type associated with Decimal values created by
this factory.
|
Class<Decimal0f> |
immutableType()
Returns the implementing class for immutable values.
|
Class<MutableDecimal0f> |
mutableType()
Returns the implementing class for mutable values.
|
Decimal0f[] |
newArray(int length)
Creates a one dimensional array of the specified
length for
immutable Decimal values. |
MutableDecimal0f |
newMutable()
Creates a new mutable value initialized with zero.
|
MutableDecimal0f[] |
newMutableArray(int length)
Creates a one dimensional array of the specified
length for
mutable Decimal values. |
Decimal0f |
parse(String value)
Translates the string representation of a
Decimal into an
immutable Decimal. |
Decimal0f |
parse(String value,
RoundingMode roundingMode)
Translates the string representation of a
Decimal into an
immutable Decimal. |
Decimal0f |
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. |
Decimal0f |
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. |
Decimal0f |
valueOf(BigInteger value)
Returns a new immutable Decimal whose value is numerically equal to that
of the specified
BigInteger value. |
Decimal0f |
valueOf(Decimal<?> value)
|
Decimal0f |
valueOf(Decimal<?> value,
RoundingMode roundingMode)
|
Decimal0f |
valueOf(double value)
|
Decimal0f |
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. |
Decimal0f |
valueOf(float value)
|
Decimal0f |
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. |
Decimal0f |
valueOf(long value)
Returns a new immutable Decimal whose value is numerically equal to that
of the specified
long value. |
static Factory0f |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
Decimal0f |
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. |
Decimal0f |
valueOfUnscaled(long unscaledValue,
int scale)
Returns a new immutable Decimal whose value is numerically equal to
(unscaled × 10-scale). |
Decimal0f |
valueOfUnscaled(long unscaledValue,
int scale,
RoundingMode roundingMode)
Returns a new immutable Decimal whose value is numerically equal to
(unscaled × 10-scale). |
static Factory0f[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static Factory0f[] values()
for (Factory0f c : Factory0f.values()) System.out.println(c);
public static Factory0f 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 Scale0f getScaleMetrics()
DecimalFactorygetScaleMetrics in interface DecimalFactory<Scale0f>public final int getScale()
DecimalFactorygetScale in interface DecimalFactory<Scale0f>public final Class<Decimal0f> immutableType()
DecimalFactoryimmutableType in interface DecimalFactory<Scale0f>public final Class<MutableDecimal0f> mutableType()
DecimalFactorymutableType in interface DecimalFactory<Scale0f>public final DecimalFactory<?> deriveFactory(int scale)
DecimalFactoryscale.deriveFactory in interface DecimalFactory<Scale0f>scale - the scale of Decimal numbers created by the returned factorypublic final <S extends ScaleMetrics> DecimalFactory<S> deriveFactory(S scaleMetrics)
DecimalFactoryscaleMetrics.deriveFactory in interface DecimalFactory<Scale0f>S - the generic type for scaleMetricsscaleMetrics - the metrics defining the scale of the Decimal numbers created
by the returned factoryscaleMetricspublic final Decimal0f valueOf(long value)
DecimalFactorylong 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<Scale0f>value - long value to convert into an immutable Decimal valuelong
valuepublic final Decimal0f valueOf(float value)
DecimalFactoryfloat 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<Scale0f>value - float value to convert into an immutable Decimal valueroundHALF_UP(value)public final Decimal0f valueOf(float value, RoundingMode roundingMode)
DecimalFactoryfloat 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<Scale0f>value - float value to convert into an immutable Decimal valueroundingMode - the rounding mode to apply during the conversion if necessaryround(value)public final Decimal0f valueOf(double value)
DecimalFactorydouble 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<Scale0f>value - double value to convert into an immutable Decimal valueroundHALF_UP(value)public final Decimal0f valueOf(double value, RoundingMode roundingMode)
DecimalFactorydouble 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<Scale0f>value - double value to convert into an immutable Decimal valueroundingMode - the rounding mode to apply during the conversion if necessaryround(value)public final Decimal0f valueOf(BigInteger value)
DecimalFactoryBigInteger 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<Scale0f>value - BigInteger value to convert into an immutable Decimal
valuepublic final Decimal0f valueOf(BigDecimal value)
DecimalFactoryBigDecimal 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<Scale0f>value - BigDecimal value to convert into an immutable Decimal
valueroundHALF_UP(value)public final Decimal0f valueOf(BigDecimal value, RoundingMode roundingMode)
DecimalFactoryBigDecimal 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<Scale0f>value - BigDecimal value to convert into an immutable Decimal
valueroundingMode - the rounding mode to apply during the conversion if necessaryround(value)public final Decimal0f valueOf(Decimal<?> value)
DecimalFactoryDecimal 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<Scale0f>value - Decimal value to convert into an immutable Decimal value of
this factory's scaleroundHALF_UP(value)public final Decimal0f valueOf(Decimal<?> value, RoundingMode roundingMode)
DecimalFactoryDecimal 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<Scale0f>value - Decimal value to convert into an immutable Decimal value of
this factory's scaleroundingMode - the rounding mode to apply during the conversion if necessaryround(value)public final Decimal0f parse(String value)
DecimalFactoryDecimal 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<Scale0f>value - String value to convert into an immutable Decimal value of
this factory's scaleroundHALF_UP(value)public final Decimal0f parse(String value, RoundingMode roundingMode)
DecimalFactoryDecimal 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<Scale0f>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 factoryround(value)public final Decimal0f valueOfUnscaled(long unscaledValue)
DecimalFactory(unscaled × 10-scale) where scale
refers to this factory's scale.valueOfUnscaled in interface DecimalFactory<Scale0f>unscaledValue - unscaled value to convert into an immutable Decimal valueunscaled × 10-scalepublic final Decimal0f valueOfUnscaled(long unscaledValue, int scale)
DecimalFactory(unscaled × 10-scale). The result is rounded 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.valueOfUnscaled in interface DecimalFactory<Scale0f>unscaledValue - unscaled value to convert into an immutable Decimal valuescale - the scale to apply to the unscaled valueroundHALF_UP(unscaled × 10-scale)public final Decimal0f valueOfUnscaled(long unscaledValue, int scale, RoundingMode roundingMode)
DecimalFactory(unscaled × 10-scale). The result is rounded 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.valueOfUnscaled in interface DecimalFactory<Scale0f>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 necessaryround(unscaled × 10-scale)public final Decimal0f[] newArray(int length)
DecimalFactorylength for
immutable Decimal values.newArray in interface DecimalFactory<Scale0f>length - the length of the returned arraypublic final MutableDecimal0f newMutable()
DecimalFactorynewMutable in interface DecimalFactory<Scale0f>public final MutableDecimal0f[] newMutableArray(int length)
DecimalFactorylength for
mutable Decimal values.newMutableArray in interface DecimalFactory<Scale0f>length - the length of the returned array