public class ExpressionBuilder
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
PROPERTY_UNARY_HIGH_PRECEDENCE
Property name for unary precedence choice. 
 | 
| Constructor and Description | 
|---|
ExpressionBuilder(java.lang.String expression)
Create a new ExpressionBuilder 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Calculable | 
build()
build a new  
Calculable from the expression using the supplied variables | 
ExpressionBuilder | 
withCustomFunction(CustomFunction function)
add a custom function instance for the evaluator to recognize 
 | 
ExpressionBuilder | 
withCustomFunctions(java.util.Collection<CustomFunction> functions)  | 
ExpressionBuilder | 
withExpression(java.lang.String expression)
set the mathematical expression for parsing 
 | 
ExpressionBuilder | 
withOperation(CustomOperator operation)
set a  
CustomOperator to be used in the expression | 
ExpressionBuilder | 
withOperations(java.util.Collection<CustomOperator> operations)
set a  
Collection of CustomOperator to use in the expression | 
ExpressionBuilder | 
withVariable(java.lang.String variableName,
            double value)
set the value for a variable 
 | 
ExpressionBuilder | 
withVariableNames(java.lang.String... variableNames)
set the variables names used in the expression without setting their values 
 | 
ExpressionBuilder | 
withVariables(java.util.Map<java.lang.String,java.lang.Double> variableMap)
set the values for variables 
 | 
public static final java.lang.String PROPERTY_UNARY_HIGH_PRECEDENCE
public ExpressionBuilder(java.lang.String expression)
expression - the expression to evaluatepublic Calculable build() throws UnknownFunctionException, UnparsableExpressionException
Calculable from the expression using the supplied variablesCalculable which can be used to evaluate the expressionUnknownFunctionException - when an unrecognized function name is used in the expressionUnparsableExpressionException - if the expression could not be parsedpublic ExpressionBuilder withCustomFunction(CustomFunction function)
function - the CustomFunction to addExpressionBuilder instancepublic ExpressionBuilder withCustomFunctions(java.util.Collection<CustomFunction> functions)
public ExpressionBuilder withVariable(java.lang.String variableName, double value)
variableName - the variable name e.g. "x"value - the value e.g. 2.32dExpressionBuilder instancepublic ExpressionBuilder withVariableNames(java.lang.String... variableNames)
variableNames - vararg String of the variable names used in the expressionpublic ExpressionBuilder withVariables(java.util.Map<java.lang.String,java.lang.Double> variableMap)
variableMap - a map of variable names to variable valuesExpressionBuilder instancepublic ExpressionBuilder withOperation(CustomOperator operation)
CustomOperator to be used in the expressionoperation - the CustomOperator to be usedExpressionBuilder instancepublic ExpressionBuilder withOperations(java.util.Collection<CustomOperator> operations)
Collection of CustomOperator to use in the expressionoperations - the Collection of CustomOperator to useExpressionBuilder instancepublic ExpressionBuilder withExpression(java.lang.String expression)
expression - a mathematical expressionExpressionBuilder instance