Description
The ExpressionCalculator class allows you to create an expression calculator.
Constructors
Constructs this class and assigns a expression string.
ExpressionCalculator(expression: str = None)
- expression: str - expression string.
Properties
auto_variables
Gets the flag to turn on auto-creation of variables for a specified expression.
auto_variables(): bool
- returns: bool - returns the flag to turn on auto-creation.
Sets the flag to turn on auto-creation of variables for specified expression.
auto_variables(value: bool)
- value: bool - flag to turn on auto-creation.
default_functions
List with default functions.
default_functions(): IFunctionCollection
- returns: IFunctionCollection - list with default functions.
default_variables
List with default variables.
default_variables(): IVariableCollection
- returns: IVariableCollection - list with default variables.
expression
Expression string.
expression(): str
- returns: str - expression string.
expression(value: str)
- value: str - expression string.
initial_tokens
List of original expression tokens.
initial_tokens(): List[ExpressionToken]
- returns: List[ExpressionToken] - list of original expression tokens.
original_tokens
List of expression tokens.
original_tokens(): List[Token]
- returns: List[Token] - list of expression tokens.
original_tokens(value: List[Token])
- value: List[Token] - list of expression tokens.
result_tokens
List of processed expression tokens.
result_tokens(): List[ExpressionToken]
- returns: List[ExpressionToken] - list of processed expression tokens.
variant_operations
Gets the manager for operations on variant values.
variant_operations(): IVariantOperations
- returns: IVariantOperations - manager for operations.
Sets the manager for operations on variant values.
variant_operations(value: IVariantOperations)
- value: IVariantOperations - manager for operations.
Instance methods
clear
Cleans up this calculator from all data.
clear()
create_variables
Cleans up this calculator from all data.
create_variables(variables: IVariantOperations)
- variables: IVariantOperations - list of variables to be populated.
evaluate
Evaluates this expression using default variables and functions.
evaluate(): Variant
- returns: Variant - evaluation result.
evaluate_with_variables
Evaluates this expression using specified variables.
evaluate_with_variables(variables: IVariantOperations): Variant
- variables: IVariantOperations - list of variables.
- returns: Variant - evaluation result.
evaluate_with_variables_and_functions
Evaluates this expression using specified variables and functions.
evaluate_with_variables_and_functions(variables: Optional[IVariantOperations], functions: Optional[IFunctionCollection]): Variant
- variables: Optional[IVariantOperations] - list of variables.
- functions: Optional[IFunctionCollection] - list of functions
- returns: Variant - evaluation result.