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.default java.util.Set<java.lang.String>getAvailableInfixOperatorNames()Get all infix operator names in current configuration.default java.util.Set<OperatorIfc>getAvailableInfixOperators()Get all infix operators in current configuration.default java.util.Set<java.lang.String>getAvailablePostfixOperatorNames()Get all postfix operator names in current configuration.default java.util.Set<OperatorIfc>getAvailablePostfixOperators()Get all postfix operators in current configuration.default java.util.Set<java.lang.String>getAvailablePrefixOperatorNames()Get all prefix operator names in current configuration.default java.util.Set<OperatorIfc>getAvailablePrefixOperators()Get all prefix operators in current configuration.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.
-
getAvailablePrefixOperatorNames
default java.util.Set<java.lang.String> getAvailablePrefixOperatorNames()
Get all prefix operator names in current configuration.- Returns:
- A set of all defined prefix operator names.
- Throws:
java.lang.UnsupportedOperationException- when this operation is not supported by the implementation.
-
getAvailablePostfixOperatorNames
default java.util.Set<java.lang.String> getAvailablePostfixOperatorNames()
Get all postfix operator names in current configuration.- Returns:
- A set of all defined postfix operator names.
- Throws:
java.lang.UnsupportedOperationException- when this operation is not supported by the implementation.
-
getAvailableInfixOperatorNames
default java.util.Set<java.lang.String> getAvailableInfixOperatorNames()
Get all infix operator names in current configuration.- Returns:
- A set of all defined infix operator names.
- Throws:
java.lang.UnsupportedOperationException- when this operation is not supported by the implementation.
-
getAvailablePrefixOperators
default java.util.Set<OperatorIfc> getAvailablePrefixOperators()
Get all prefix operators in current configuration.- Returns:
- A set of all defined prefix operators.
- Throws:
java.lang.UnsupportedOperationException- when this operation is not supported by the implementation.
-
getAvailablePostfixOperators
default java.util.Set<OperatorIfc> getAvailablePostfixOperators()
Get all postfix operators in current configuration.- Returns:
- A set of all defined postfix operators.
- Throws:
java.lang.UnsupportedOperationException- when this operation is not supported by the implementation.
-
getAvailableInfixOperators
default java.util.Set<OperatorIfc> getAvailableInfixOperators()
Get all infix operators in current configuration.- Returns:
- A set of all defined infix operators.
- Throws:
java.lang.UnsupportedOperationException- when this operation is not supported by the implementation.
-
-