public enum Scale17f extends Enum<Scale17f> implements ScaleMetrics
scale 17 and
scale factor 100000000000000000.| Enum Constant and Description |
|---|
INSTANCE
The singleton instance for scale 17.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
SCALE
The scale value
17. |
static long |
SCALE_FACTOR
The scale factor
1017. |
| Modifier and Type | Method and Description |
|---|---|
long |
divideByScaleFactor(long dividend)
Returns
dividend/scaleFactor. |
long |
divideUnsignedByScaleFactor(long unsignedDividend)
Returns
unsignedDividend/scaleFactor using unsigned division. |
DecimalArithmetic |
getArithmetic(RoundingMode roundingMode)
Returns the arithmetic for this scale that performs all operations with the specified
roundingMode and
without overflow checks. |
DecimalArithmetic |
getArithmetic(TruncationPolicy truncationPolicy)
Returns the arithmetic for this scale that performs all operations with the specified
truncationPolicy. |
DecimalArithmetic |
getCheckedArithmetic(RoundingMode roundingMode)
Returns the arithmetic for this scale that performs all operations with the specified
roundingMode and
with overflow checks. |
DecimalArithmetic |
getDefaultArithmetic()
Returns the default arithmetic for this scale performing unchecked operations with rounding mode
HALF_UP. |
DecimalArithmetic |
getDefaultCheckedArithmetic()
Returns the default arithmetic for this scale performing checked operations with rounding mode
HALF_UP. |
long |
getMaxIntegerValue()
Returns the largest integer value that can be represented using this scale.
|
long |
getMinIntegerValue()
Returns the smallest integer value that can be represented using this scale.
|
DecimalArithmetic |
getRoundingDownArithmetic()
Returns the arithmetic for this scale performing unchecked operations with rounding mode
DOWN. |
DecimalArithmetic |
getRoundingFloorArithmetic()
Returns the arithmetic for this scale performing unchecked operations with rounding mode
FLOOR. |
DecimalArithmetic |
getRoundingHalfEvenArithmetic()
Returns the arithmetic for this scale performing unchecked operations with rounding mode
HALF_EVEN. |
DecimalArithmetic |
getRoundingUnnecessaryArithmetic()
Returns the arithmetic for this scale performing unchecked operations with rounding mode
UNNECESSARY. |
int |
getScale()
Returns the scale, the number of fraction digits to the right of the decimal point of a
Decimal value. |
long |
getScaleFactor()
Returns the scale factor, which is 10f where
f stands for the scale. |
BigDecimal |
getScaleFactorAsBigDecimal()
Returns the
scale factor as a BigDecimal value with scale zero. |
BigInteger |
getScaleFactorAsBigInteger()
Returns the
scale factor as a BigInteger value. |
int |
getScaleFactorNumberOfLeadingZeros()
Returns the number of leading zeros of the scale factor
|
boolean |
isValidIntegerValue(long value)
Returns true if the specified integer
value can be represented using this scale. |
long |
moduloByScaleFactor(long dividend)
Returns
dividend % scaleFactor also known as reminder. |
long |
mulhiByScaleFactor(int factor)
Returns
factor*high32(scaleFactor) where high32 refers to the high 32 bits of the factor. |
long |
mulloByScaleFactor(int factor)
Returns
factor*low32(scaleFactor) where low32 refers to the low 32 bits of the factor. |
long |
multiplyByScaleFactor(long factor)
Returns
factor*scaleFactor. |
long |
multiplyByScaleFactorExact(long factor)
Returns
factor*scaleFactor, checking for lost information. |
String |
toString() |
String |
toString(long value)
Returns the string representation of the specified
value applying this metric's scale. |
static Scale17f |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Scale17f[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final int SCALE
17.public static final long SCALE_FACTOR
1017.public static Scale17f[] values()
for (Scale17f c : Scale17f.values()) System.out.println(c);
public static Scale17f 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 int getScale()
ScaleMetricsDecimal value.getScale in interface ScaleMetricspublic final long getScaleFactor()
ScaleMetricsf stands for the scale.getScaleFactor in interface ScaleMetricspublic final int getScaleFactorNumberOfLeadingZeros()
ScaleMetricsgetScaleFactorNumberOfLeadingZeros in interface ScaleMetricsLong.numberOfLeadingZeros(long) applied to the scale factorpublic final long multiplyByScaleFactor(long factor)
ScaleMetricsfactor*scaleFactor.multiplyByScaleFactor in interface ScaleMetricsfactor - the factorfactor*scaleFactorpublic final BigInteger getScaleFactorAsBigInteger()
ScaleMetricsscale factor as a BigInteger value.getScaleFactorAsBigInteger in interface ScaleMetricspublic final BigDecimal getScaleFactorAsBigDecimal()
ScaleMetricsscale factor as a BigDecimal value with scale zero.getScaleFactorAsBigDecimal in interface ScaleMetricspublic final long getMaxIntegerValue()
ScaleMetricsgetMaxIntegerValue in interface ScaleMetricsLong.MAX_VALUE / scaleFactorpublic final long getMinIntegerValue()
ScaleMetricsgetMinIntegerValue in interface ScaleMetricsLong.MIN_VALUE / scaleFactorpublic final boolean isValidIntegerValue(long value)
ScaleMetricsvalue can be represented using this scale.isValidIntegerValue in interface ScaleMetricsvalue - the value to test(Long.MIN_VALUE / scaleFactor) <= value <= (Long.MAX_VALUE / scaleFactor)public final long multiplyByScaleFactorExact(long factor)
ScaleMetricsfactor*scaleFactor, checking for lost information. If the result is out of the range of the
long type, then an ArithmeticException is thrown.multiplyByScaleFactorExact in interface ScaleMetricsfactor - the factorfactor*scaleFactorpublic final long mulloByScaleFactor(int factor)
ScaleMetricsfactor*low32(scaleFactor) where low32 refers to the low 32 bits of the factor.mulloByScaleFactor in interface ScaleMetricsfactor - the factorfactor*low32(scaleFactor)public final long mulhiByScaleFactor(int factor)
ScaleMetricsfactor*high32(scaleFactor) where high32 refers to the high 32 bits of the factor.mulhiByScaleFactor in interface ScaleMetricsfactor - the factorfactor*high32(scaleFactor)public final long divideByScaleFactor(long dividend)
ScaleMetricsdividend/scaleFactor.divideByScaleFactor in interface ScaleMetricsdividend - the dividenddividend/scaleFactorpublic final long divideUnsignedByScaleFactor(long unsignedDividend)
ScaleMetricsunsignedDividend/scaleFactor using unsigned division.divideUnsignedByScaleFactor in interface ScaleMetricsunsignedDividend - the unsigned dividendunsignedDividend/scaleFactorpublic final long moduloByScaleFactor(long dividend)
ScaleMetricsdividend % scaleFactor also known as reminder.moduloByScaleFactor in interface ScaleMetricsdividend - the dividenddividend % scaleFactorpublic final String toString(long value)
ScaleMetricsvalue applying this metric's scale.toString in interface ScaleMetricsvalue - the unscaled decimal to convert to a stringDecimalArithmetic.toString(long)public final DecimalArithmetic getDefaultArithmetic()
ScaleMetricsHALF_UP.getDefaultArithmetic in interface ScaleMetricspublic final DecimalArithmetic getDefaultCheckedArithmetic()
ScaleMetricsHALF_UP.getDefaultCheckedArithmetic in interface ScaleMetricspublic final DecimalArithmetic getRoundingDownArithmetic()
ScaleMetricsDOWN.getRoundingDownArithmetic in interface ScaleMetricspublic final DecimalArithmetic getRoundingFloorArithmetic()
ScaleMetricsFLOOR.getRoundingFloorArithmetic in interface ScaleMetricspublic final DecimalArithmetic getRoundingHalfEvenArithmetic()
ScaleMetricsHALF_EVEN.getRoundingHalfEvenArithmetic in interface ScaleMetricspublic final DecimalArithmetic getRoundingUnnecessaryArithmetic()
ScaleMetricsUNNECESSARY.getRoundingUnnecessaryArithmetic in interface ScaleMetricspublic final DecimalArithmetic getArithmetic(RoundingMode roundingMode)
ScaleMetricsroundingMode and
without overflow checks.getArithmetic in interface ScaleMetricsroundingMode - the rounding mode used by the returned arithmeticpublic final DecimalArithmetic getCheckedArithmetic(RoundingMode roundingMode)
ScaleMetricsroundingMode and
with overflow checks.getCheckedArithmetic in interface ScaleMetricsroundingMode - the rounding mode used by the returned arithmeticpublic final DecimalArithmetic getArithmetic(TruncationPolicy truncationPolicy)
ScaleMetricstruncationPolicy.getArithmetic in interface ScaleMetricstruncationPolicy - the truncation policy used by the returned arithmetic