Package net.objecthunter.exp4j
Class ExpressionBuilder
java.lang.Object
net.objecthunter.exp4j.ExpressionBuilder
Factory class for
Expression instances. This class is the main API entrypoint. Users should create new
Expression instances using this factory class.-
Constructor Summary
ConstructorsConstructorDescriptionExpressionBuilder(String expression) Create a new ExpressionBuilder instance and initialize it with a given expression string. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build theExpressioninstance using the custom operators and functions set.Add aFunctionimplementation available for use in the expressionAdd multipleFunctionimplementations available for use in the expressionAdd multipleFunctionimplementations available for use in the expressionimplicitMultiplication(boolean enabled) Add multipleOperatorimplementations which should be available for use in the expressionAdd anOperatorwhich should be available for use in the expressionAdd multipleOperatorimplementations which should be available for use in the expressionDeclare a variable used in the expressionDeclare variable names used in the expressionDeclare variable names used in the expression
-
Constructor Details
-
ExpressionBuilder
Create a new ExpressionBuilder instance and initialize it with a given expression string.- Parameters:
expression- the expression to be parsed
-
-
Method Details
-
function
-
functions
-
functions
-
variables
Declare variable names used in the expression- Parameters:
variableNames- the variables used in the expression- Returns:
- the ExpressionBuilder instance
-
variables
Declare variable names used in the expression- Parameters:
variableNames- the variables used in the expression- Returns:
- the ExpressionBuilder instance
-
variable
Declare a variable used in the expression- Parameters:
variableName- the variable used in the expression- Returns:
- the ExpressionBuilder instance
-
implicitMultiplication
-
operator
-
operator
-
operator
-
build
Build theExpressioninstance using the custom operators and functions set.- Returns:
- an
Expressioninstance which can be used to evaluate the result of the expression
-