Package redempt.crunch
Class Crunch
java.lang.Object
redempt.crunch.Crunch
Public API methods for compiling expressions
- 
Method Summary
Modifier and TypeMethodDescriptionstatic CompiledExpressioncompileExpression(String expression) Compiles a mathematical expression into a CompiledExpression.static CompiledExpressioncompileExpression(String expression, ExpressionEnv env) Compiles a mathematical expression into a CompiledExpression.static doubleevaluateExpression(String expression, double... varValues) Compiles and evaluates an expression once. 
- 
Method Details
- 
compileExpression
Compiles a mathematical expression into a CompiledExpression. Variables must be integers starting at 1 prefixed with $. Supported operations can be found inBinaryOperator, which lists the operations and their symbols for use in expressions. Parenthesis are also supported.- Parameters:
 expression- The expression to compile- Returns:
 - The compiled expression
 
 - 
compileExpression
Compiles a mathematical expression into a CompiledExpression. Variables must be integers starting at 1 prefixed with $. Supported operations can be found inBinaryOperator, which lists the operations and their symbols for use in expressions. Parenthesis are also supported.- Parameters:
 expression- The expression to compileenv- The EvaluationEnvironment providing custom functions that can be used in the expression- Returns:
 - The compiled expression
 
 - 
evaluateExpression
Compiles and evaluates an expression once. This is only for if you need a one-off evaluation of an expression which will not be evaluated again. If the expression will be evaluated multiple times, usecompileExpression(String)- Parameters:
 expression- The expression to evaluatevarValues- The variable values for the expression- Returns:
 - The value of the expression
 
 
 -