Description
The ExpressionCalculator class allows you to create an expression calculator.
Constructors
Constructs this class and assigns an expression string.
ExpressionCalculator([String? expression])
- expression: String? - expression string.
Properties
autoVariables
Gets the flag to turn on auto-creation of variables for a specified expression.
bool get autoVariables
- returns: bool - returns the flag to turn on auto-creation.
Sets the flag to turn on auto-creation of variables for a specified expression.
set autoVariables(bool value)
- value: bool - flag to turn on auto-creation.
defaultFunctions
List with default functions.
IFunctionCollection get defaultFunctions
- returns: IFunctionCollection - list with default functions.
defaultVariables
List with default variables.
IVariableCollection get defaultVariables
- returns: IVariableCollection - list with default variables.
expression
Expression string.
String? get expression
- returns: String? - expression string.
set expression(String? value)
- value: String? - expression string.
initialTokens
List of original expression tokens.
List<ExpressionToken> get initialTokens
- returns: List<ExpressionToken> - list of original expression tokens.
originalTokens
List of expression tokens.
List<Token> get originalTokens
- returns: Token - list of expression tokens.
set originalTokens(List<Token> value)
- value: Token - list of expression tokens.
resultTokens
List of processed expression tokens.
List<ExpressionToken> get resultTokens
- returns: List<ExpressionToken> - list of processed expression tokens.
variantOperations
Gets the manager for operations on variant values.
IVariantOperations get variantOperations
- returns: IVariantOperations - manager for operations.
Sets the manager for operations on variant values.
set variantOperations(IVariantOperations value)
- value: IVariantOperations - manager for operations.
Instance methods
clear
Cleans up this calculator from all data.
void clear()
createVariables
Cleans up this calculator from all data.
void createVariables(IVariantOperations variables)
- variables: IVariantOperations - list of variables to be populated.
evaluate
Evaluates this expression using default variables and functions.
Future<Variant> evaluate()
- returns: Future<Variant> - evaluation result.
evaluateWithVariables
Evaluates this expression using specified variables.
Future<Variant> evaluateWithVariables(IVariantOperations variables)
- variables: IVariantOperations - list of variables.
- returns: Future<Variant> - evaluation result.
evaluateWithVariablesAndFunctions
Evaluates this expression using specified variables and functions.
Future<Variant> evaluateWithVariablesAndFunctions(IVariantOperations? variables, IFunctionCollection? functions)
- variables: IVariantOperations? - list of variables.
- functions: IFunctionCollection? - list of functions
- returns: Future<Variant> - evaluation result.