Record Class Operator

java.lang.Object
java.lang.Record
org.skriptlang.skript.lang.arithmetic.Operator
Record Components:
sign - the symbolic representation of the operator (e.g., "+", "-").
node - localized name of the operator
All Implemented Interfaces:
Comparable<Operator>

public record Operator(String sign, Priority priority, Noun node) extends Record implements Comparable<Operator>
Represents an operator used in expressions.
  • Field Details

    • ADDITION_SUBTRACTION_PRIORITY

      public static final Priority ADDITION_SUBTRACTION_PRIORITY
    • MULTIPLICATION_DIVISION_PRIORITY

      public static final Priority MULTIPLICATION_DIVISION_PRIORITY
    • EXPONENTIATION_PRIORITY

      public static final Priority EXPONENTIATION_PRIORITY
    • ADDITION

      public static final Operator ADDITION
    • SUBTRACTION

      public static final Operator SUBTRACTION
    • MULTIPLICATION

      public static final Operator MULTIPLICATION
    • DIVISION

      public static final Operator DIVISION
    • EXPONENTIATION

      public static final Operator EXPONENTIATION
  • Constructor Details

    • Operator

      public Operator(String sign, Priority priority, String node)
      Parameters:
      node - resolves to 'operators.' in the lang file
    • Operator

      public Operator(char sign, Priority priority, Noun node)
    • Operator

      public Operator(char sign, Priority priority, String node)
    • Operator

      public Operator(String sign, Priority priority, Noun node)
      Creates an instance of a Operator record class.
      Parameters:
      sign - the value for the sign record component
      priority - the value for the priority record component
      node - the value for the node record component
  • Method Details

    • getName

      public String getName()
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • compareTo

      public int compareTo(@NotNull @NotNull Operator o)
      Specified by:
      compareTo in interface Comparable<Operator>
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sign

      public String sign()
      Returns the value of the sign record component.
      Returns:
      the value of the sign record component
    • priority

      public Priority priority()
      Returns the value of the priority record component.
      Returns:
      the value of the priority record component
    • node

      public Noun node()
      Returns the value of the node record component.
      Returns:
      the value of the node record component