java.lang.Object
java.lang.Enum<Comparison>
net.storm.api.movement.pathfinder.model.requirement.Comparison
All Implemented Interfaces:
Serializable, Comparable<Comparison>, Constable, BiFunction<Integer,Integer,Boolean>

public enum Comparison extends Enum<Comparison> implements 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

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:
  • Enum Constant Details

    • LESS_THAN

      public static final Comparison LESS_THAN
      Strictly less than comparison.
    • LESS_THAN_EQUAL

      public static final Comparison LESS_THAN_EQUAL
      Less than or equal comparison.
    • GREATER_THAN

      public static final Comparison GREATER_THAN
      Strictly greater than comparison.
    • GREATER_THAN_EQUAL

      public static final Comparison GREATER_THAN_EQUAL
      Greater than or equal comparison.
    • EQUAL

      public static final Comparison EQUAL
      Exact equality comparison.
    • NOT_EQUAL

      public static final Comparison NOT_EQUAL
      Inequality comparison.
  • Method Details

    • values

      public static Comparison[] 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

      public static Comparison valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • apply

      public Boolean apply(Integer value, Integer expected)
      Applies the comparison operator to two integer values.
      Specified by:
      apply in interface BiFunction<Integer,Integer,Boolean>
      Parameters:
      value - the actual value to check
      expected - the expected value to compare against
      Returns:
      true if the comparison is satisfied, false otherwise