Package com.ezylang.evalex.config
Interface OperatorDictionaryIfc
-
- All Known Implementing Classes:
MapBasedOperatorDictionary
public interface OperatorDictionaryIfcAn operator dictionary holds all the operators, that can be used in an expression.
The default implementation is theMapBasedOperatorDictionary.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddOperator(java.lang.String operatorString, OperatorIfc operator)Allows to add an operator to the dictionary.OperatorIfcgetInfixOperator(java.lang.String operatorString)Get the operator definition for an infix operator name.OperatorIfcgetPostfixOperator(java.lang.String operatorString)Get the operator definition for a postfix operator name.OperatorIfcgetPrefixOperator(java.lang.String operatorString)Get the operator definition for a prefix operator name.default booleanhasInfixOperator(java.lang.String operatorString)Check if the dictionary has an infix operator with that name.default booleanhasPostfixOperator(java.lang.String operatorString)Check if the dictionary has a postfix operator with that name.default booleanhasPrefixOperator(java.lang.String operatorString)Check if the dictionary has a prefix operator with that name.
-
-
-
Method Detail
-
addOperator
void addOperator(java.lang.String operatorString, OperatorIfc operator)Allows to add an operator to the dictionary. Implementation is optional, if you have a fixed set of operators, this method can throw an exception.- Parameters:
operatorString- The operator name.operator- The operator implementation.
-
hasPrefixOperator
default boolean hasPrefixOperator(java.lang.String operatorString)
Check if the dictionary has a prefix operator with that name.- Parameters:
operatorString- The operator name to look for.- Returns:
trueif an operator was found orfalseif not.
-
hasPostfixOperator
default boolean hasPostfixOperator(java.lang.String operatorString)
Check if the dictionary has a postfix operator with that name.- Parameters:
operatorString- The operator name to look for.- Returns:
trueif an operator was found orfalseif not.
-
hasInfixOperator
default boolean hasInfixOperator(java.lang.String operatorString)
Check if the dictionary has an infix operator with that name.- Parameters:
operatorString- The operator name to look for.- Returns:
trueif an operator was found orfalseif not.
-
getPrefixOperator
OperatorIfc getPrefixOperator(java.lang.String operatorString)
Get the operator definition for a prefix operator name.- Parameters:
operatorString- The name of the operator.- Returns:
- The operator definition or
nullif no operator was found.
-
getPostfixOperator
OperatorIfc getPostfixOperator(java.lang.String operatorString)
Get the operator definition for a postfix operator name.- Parameters:
operatorString- The name of the operator.- Returns:
- The operator definition or
nullif no operator was found.
-
getInfixOperator
OperatorIfc getInfixOperator(java.lang.String operatorString)
Get the operator definition for an infix operator name.- Parameters:
operatorString- The name of the operator.- Returns:
- The operator definition or
nullif no operator was found.
-
-