ExpressionCalculator

Implements an expression calculator.

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

defaultVariables

List with default variables.

IVariableCollection get defaultVariables

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

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

variantOperations

Gets the manager for operations on variant values.

IVariantOperations get variantOperations

Sets the manager for operations on variant values.

set variantOperations(IVariantOperations value)

Instance methods

clear

Cleans up this calculator from all data.

void clear()

createVariables

Cleans up this calculator from all data.

void createVariables(IVariantOperations variables)

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)

evaluateWithVariablesAndFunctions

Evaluates this expression using specified variables and functions.

Future<Variant> evaluateWithVariablesAndFunctions(IVariantOperations? variables, IFunctionCollection? functions)