Enum Class Comparison
- All Implemented Interfaces:
Serializable,Comparable<Comparison>,Constable,BiFunction<Integer,Integer, Boolean>
Enumeration of comparison operators for numeric requirements.
Comparison defines operators used in VarRequirement and
GenericRequirement to compare actual values against expected values.
Available Operators
LESS_THAN- value < expectedLESS_THAN_EQUAL- value <= expectedGREATER_THAN- value > expectedGREATER_THAN_EQUAL- value >= expectedEQUAL- value == expectedNOT_EQUAL- value != expected
Usage Example
// Check if a value meets a threshold
boolean result = Comparison.GREATER_THAN_EQUAL.apply(currentLevel, 70);
// Common use in VarRequirement
VarRequirement req = new VarRequirement(
Comparison.EQUAL,
VarType.VARBIT,
1234,
1
);
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionExact equality comparison.Strictly greater than comparison.Greater than or equal comparison.Strictly less than comparison.Less than or equal comparison.Inequality comparison. -
Method Summary
Modifier and TypeMethodDescriptionApplies the comparison operator to two integer values.static ComparisonReturns the enum constant of this class with the specified name.static Comparison[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface java.util.function.BiFunction
andThen
-
Enum Constant Details
-
LESS_THAN
Strictly less than comparison. -
LESS_THAN_EQUAL
Less than or equal comparison. -
GREATER_THAN
Strictly greater than comparison. -
GREATER_THAN_EQUAL
Greater than or equal comparison. -
EQUAL
Exact equality comparison. -
NOT_EQUAL
Inequality comparison.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
apply
Applies the comparison operator to two integer values.- Specified by:
applyin interfaceBiFunction<Integer,Integer, Boolean> - Parameters:
value- the actual value to checkexpected- the expected value to compare against- Returns:
- true if the comparison is satisfied, false otherwise
-