Enum Class Comparator.Relation

java.lang.Object
java.lang.Enum<Comparator.Relation>
ch.njol.skript.classes.Comparator.Relation
All Implemented Interfaces:
Serializable, Comparable<Comparator.Relation>, Constable
Enclosing interface:
Comparator<T1,​T2>

public static enum Comparator.Relation extends Enum<Comparator.Relation>
represents a relation between two objects.
  • Enum Constant Details

  • Method Details

    • values

      public static Comparator.Relation[] 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 Comparator.Relation 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
    • get

      public static Comparator.Relation get(boolean b)
      Returns EQUAL for true or NOT_EQUAL for false
      Parameters:
      b -
      Returns:
      b ? Relation.EQUAL : Relation.NOT_EQUAL
    • get

      public static Comparator.Relation get(int i)
      Gets a Relation from a difference: If i is 0, EQUAL is returned, if i is greater than 0, GREATER is returned, otherwise SMALLER.
      Parameters:
      i -
      Returns:
      i == 0 ? Relation.EQUAL : i > 0 ? Relation.GREATER : Relation.SMALLER
    • get

      public static Comparator.Relation get(double d)
      Gets a Relation from a difference: If d is 0, EQUAL is returned, if d is greater than 0, GREATER is returned, otherwise SMALLER.
      Parameters:
      d -
      Returns:
      d == 0 ? Relation.EQUAL : d > 0 ? Relation.GREATER : Relation.SMALLER
    • is

      public boolean is(Comparator.Relation other)
      Test whether this relation is fulfilled if another is, i.e. if the parameter relation fulfils X rel Y, then this relation fulfils X rel Y as well.
      Parameters:
      other -
      Returns:
      Whether this relation is part of the given relation, e.g. GREATER_OR_EQUAL.is(EQUAL) returns true.
    • toString

      public String toString()
      Returns this relation's string representation, which is similar to "equal to" or "greater than".
      Overrides:
      toString in class Enum<Comparator.Relation>
    • getInverse

      public Comparator.Relation getInverse()
      Gets the inverse of this relation, i.e if this relation fulfils X rel Y, then the returned relation fulfils !(X rel Y).
      Returns:
      !this
    • getSwitched

      public Comparator.Relation getSwitched()
      Gets the relation which has switched arguments, i.e. if this relation fulfils X rel Y, then the returned relation fulfils Y rel X.
      Returns:
      siht
    • isEqualOrInverse

      public boolean isEqualOrInverse()
    • getRelation

      public int getRelation()