Package generic.expressions
Enum Class ExpressionOperator
- All Implemented Interfaces:
ExpressionElement
,Serializable
,Comparable<ExpressionOperator>
,Constable
Enum of support operators for the
ExpressionEvaluator
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic List
<Set<ExpressionOperator>> Returns a list of all the binary operators in precedence order, organized into sets where each set contains all the operators of the same precedence.static ExpressionOperator
getOperator
(String token, String lookahead1, boolean preferBinary) Returns the operator for the given token and look ahead token and if we are expecting to find a binary operator.boolean
isBinary()
Returns if the operator is a binary operator.boolean
isUnary()
Returns if the operator is a unary operator.int
size()
Returns the number of chars in the operatortoString()
static ExpressionOperator
Returns the enum constant of this class with the specified name.static ExpressionOperator[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BITWISE_NOT
-
LOGICAL_NOT
-
UNARY_PLUS
-
UNARY_MINUS
-
MULTIPLY
-
DIVIDE
-
ADD
-
SUBTRACT
-
SHIFT_LEFT
-
SHIFT_RIGHT
-
LESS_THAN
-
GREATER_THAN
-
LESS_THAN_OR_EQUAL
-
GREATER_THAN_OR_EQUAL
-
EQUALS
-
NOT_EQUALS
-
BITWISE_AND
-
BITWISE_XOR
-
BITWISE_OR
-
LOGICAL_AND
-
LOGICAL_OR
-
-
Field Details
-
binaryOperatorsByPrecedence
-
-
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
-
toString
- Overrides:
toString
in classEnum<ExpressionOperator>
-
getBinaryOperatorsByPrecedence
Returns a list of all the binary operators in precedence order, organized into sets where each set contains all the operators of the same precedence.- Returns:
- a list of all the binary operators in precedence order, organized into sets where each set contains all the operators of the same precedence.
-
getOperator
Returns the operator for the given token and look ahead token and if we are expecting to find a binary operator. This method first tries merging the tokens looking for a double char operator first.- Parameters:
token
- the first tokenlookahead1
- the next token that may or may not be part of this operandpreferBinary
- if we are expecting a binary operator (the previous expression element was an operand value). We need this to know if the token '-' is the unary operator or the binary operator. If the token before was an operator, then we expect a unary operator. If the previous was a value, then we expect a binary operator.- Returns:
- the operator that matches the given tokens and expected type
-
size
public int size()Returns the number of chars in the operator- Returns:
- the number of chars in the operator
-
isUnary
public boolean isUnary()Returns if the operator is a unary operator.- Returns:
- if the operator is a unary operator.
-
isBinary
public boolean isBinary()Returns if the operator is a binary operator.- Returns:
- if the operator is a binary operator.
-