Enum Class Operator

java.lang.Object
java.lang.Enum<Operator>
redempt.crunch.token.Operator
All Implemented Interfaces:
Serializable, Comparable<Operator>, Constable, Token

public enum Operator extends Enum<Operator> implements Token
Represents an Operator which can be used in mathematical expressions
  • Enum Constant Details

    • BOOLEAN_OR

      public static final Operator BOOLEAN_OR
    • BOOLEAN_OR_ALT

      public static final Operator BOOLEAN_OR_ALT
    • BOOLEAN_AND

      public static final Operator BOOLEAN_AND
    • BOOLEAN_AND_ALT

      public static final Operator BOOLEAN_AND_ALT
    • GREATER_THAN

      public static final Operator GREATER_THAN
    • LESS_THAN

      public static final Operator LESS_THAN
    • EQUAL_TO

      public static final Operator EQUAL_TO
    • EQUAL_TO_ALT

      public static final Operator EQUAL_TO_ALT
    • NOT_EQUAL_TO

      public static final Operator NOT_EQUAL_TO
    • GREATER_THAN_OR_EQUAL_TO

      public static final Operator GREATER_THAN_OR_EQUAL_TO
    • LESS_THAN_OR_EQUAL_TO

      public static final Operator LESS_THAN_OR_EQUAL_TO
    • BOOLEAN_NOT

      public static final Operator BOOLEAN_NOT
    • RANDOM_DOUBLE

      public static final Operator RANDOM_DOUBLE
    • ROUND

      public static final Operator ROUND
    • CEILING

      public static final Operator CEILING
    • FLOOR

      public static final Operator FLOOR
    • ARC_SINE

      public static final Operator ARC_SINE
    • ARC_COSINE

      public static final Operator ARC_COSINE
    • ARC_TANGENT

      public static final Operator ARC_TANGENT
    • SINE

      public static final Operator SINE
    • COSINE

      public static final Operator COSINE
    • TANGENT

      public static final Operator TANGENT
    • HYPERBOLIC_SINE

      public static final Operator HYPERBOLIC_SINE
    • HYPERBOLIC_COSINE

      public static final Operator HYPERBOLIC_COSINE
    • HYPERBOLIC_TANGENT

      public static final Operator HYPERBOLIC_TANGENT
    • ABSOLUTE_VALUE

      public static final Operator ABSOLUTE_VALUE
    • LOGARITHM

      public static final Operator LOGARITHM
    • SQUARE_ROOT

      public static final Operator SQUARE_ROOT
    • CUBE_ROOT

      public static final Operator CUBE_ROOT
    • EXPONENT

      public static final Operator EXPONENT
    • MULTIPLY

      public static final Operator MULTIPLY
    • DIVIDE

      public static final Operator DIVIDE
    • MODULUS

      public static final Operator MODULUS
    • ADD

      public static final Operator ADD
    • SUBTRACT

      public static final Operator SUBTRACT
    • NEGATE

      public static final Operator NEGATE
    • SCIENTIFIC_NOTATION

      public static final Operator SCIENTIFIC_NOTATION
  • Method Details

    • values

      public static Operator[] 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 Operator 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
    • getPriority

      public int getPriority()
      Returns:
      The priority of the operation in evaluation - higher priority will be evaluated first
    • getSymbol

      public String getSymbol()
      Returns:
      The symbol to represent this Operator in expressions
    • isUnary

      public boolean isUnary()
      Returns:
      Whether this Operator operates on only one value
    • operate

      public double operate(double first, double second)
      Applies this Operator to the given values
      Parameters:
      first - The first value
      second - The second value
      Returns:
      The resulting value
    • operate

      public double operate(double value)
      Applies this Operator to one value
      Parameters:
      value - The operand value
      Returns:
      The resulting value
    • isInternal

      public boolean isInternal()
      Returns:
      Whether this Operator can only be used internally

      If true, it will not be generated simply by typing its symbol

    • getType

      public TokenType getType()
      Specified by:
      getType in interface Token
      Returns:
      The type of this Token
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Operator>
    • canInline

      public boolean canInline()