public enum Comparison extends Enum<Comparison>
In a ternary comparison the result may not only be greater than, equal or smaller than but the result can also be undefined.
| Enum Constant and Description |
|---|
EQUAL |
GREATER_THAN |
GREATER_THAN_AND_EQUAL |
SMALLER_THAN |
SMALLER_THAN_AND_EQUAL |
UNDEFINED |
| Modifier and Type | Method and Description |
|---|---|
static Comparison |
from(int i)
Maps an integer value to comparison result.
|
int |
value()
Integer representation of comparison
|
static Comparison |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Comparison[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Comparison GREATER_THAN
public static final Comparison EQUAL
public static final Comparison SMALLER_THAN
public static final Comparison GREATER_THAN_AND_EQUAL
public static final Comparison SMALLER_THAN_AND_EQUAL
public static final Comparison UNDEFINED
public static Comparison[] values()
for (Comparison c : Comparison.values()) System.out.println(c);
public static Comparison 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 int value()
Returns a positive integer if GREATER_THAN than, negative integer for
SMALLER_THAN,
and zero for EQUAL
IllegalStateException - if the result is undefined.public static Comparison from(int i)
i - the integer to be mapped to a ComparisonGREATER_THAN than if positive, SMALLER_THAN if negative or
EQUAL if zeroCopyright © 2016–2021 MWARE SOLUTIONS. All rights reserved.