Package redempt.crunch.token
Enum Class Operator
- All Implemented Interfaces:
Serializable,Comparable<Operator>,Constable,Token
Represents an Operator which can be used in mathematical expressions
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionbooleanintgetType()booleanbooleanisUnary()doubleoperate(double value) Applies this Operator to one valuedoubleoperate(double first, double second) Applies this Operator to the given valuestoString()static OperatorReturns the enum constant of this class with the specified name.static Operator[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BOOLEAN_OR
-
BOOLEAN_OR_ALT
-
BOOLEAN_AND
-
BOOLEAN_AND_ALT
-
GREATER_THAN
-
LESS_THAN
-
EQUAL_TO
-
EQUAL_TO_ALT
-
NOT_EQUAL_TO
-
GREATER_THAN_OR_EQUAL_TO
-
LESS_THAN_OR_EQUAL_TO
-
BOOLEAN_NOT
-
RANDOM_DOUBLE
-
ROUND
-
CEILING
-
FLOOR
-
ARC_SINE
-
ARC_COSINE
-
ARC_TANGENT
-
SINE
-
COSINE
-
TANGENT
-
HYPERBOLIC_SINE
-
HYPERBOLIC_COSINE
-
HYPERBOLIC_TANGENT
-
ABSOLUTE_VALUE
-
LOGARITHM
-
SQUARE_ROOT
-
CUBE_ROOT
-
EXPONENT
-
MULTIPLY
-
DIVIDE
-
MODULUS
-
ADD
-
SUBTRACT
-
NEGATE
-
SCIENTIFIC_NOTATION
-
-
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
-
getPriority
public int getPriority()- Returns:
- The priority of the operation in evaluation - higher priority will be evaluated first
-
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 valuesecond- 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
-
toString
-
canInline
public boolean canInline()
-