public enum TruncatedPart extends Enum<TruncatedPart>
DecimalRounding
Enum Constant and Description |
---|
EQUAL_TO_HALF
Truncated part
t == 0.5 . |
GREATER_THAN_HALF
Truncated part
t > 0.5 . |
LESS_THAN_HALF_BUT_NOT_ZERO
Truncated part
0 < t < 0.5 . |
ZERO
Truncated part
t == 0 . |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
isEqualToHalf()
Returns true if the truncated part is equal to one half.
|
abstract boolean |
isGreaterEqualHalf()
Returns true if the truncated part is greater than or equal to one half.
|
abstract boolean |
isGreaterThanHalf()
Returns true if the truncated part is greater than one half.
|
abstract boolean |
isGreaterThanZero()
Returns true if the truncated part is greater than zero.
|
static TruncatedPart |
valueOf(int firstTruncatedDigit,
boolean zeroAfterFirstTruncatedDigit)
Returns a truncated part constant given the first truncated digit and a
boolean indicating whether there is non-zero digits after that.
|
static TruncatedPart |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static TruncatedPart[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final TruncatedPart ZERO
t == 0
.public static final TruncatedPart LESS_THAN_HALF_BUT_NOT_ZERO
0 < t < 0.5
.public static final TruncatedPart EQUAL_TO_HALF
t == 0.5
.public static final TruncatedPart GREATER_THAN_HALF
t > 0.5
.public static TruncatedPart[] values()
for (TruncatedPart c : TruncatedPart.values()) System.out.println(c);
public static TruncatedPart 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 abstract boolean isGreaterThanZero()
this > 0
public abstract boolean isEqualToHalf()
this == 0.5
public abstract boolean isGreaterEqualHalf()
this >= 0.5
public abstract boolean isGreaterThanHalf()
this > 0.5
public static final TruncatedPart valueOf(int firstTruncatedDigit, boolean zeroAfterFirstTruncatedDigit)
firstTruncatedDigit
- the first truncated digit, must be in [0, 1, ..., 9]
zeroAfterFirstTruncatedDigit
- true if all truncated digits after the first truncated digit
are zero, and false otherwise