pip_services3_expressions.calculator.variables.IVariableCollection module

class pip_services3_expressions.calculator.variables.IVariableCollection.IVariableCollection

Bases: abc.ABC

Defines a variables list.

add(variable: pip_services3_expressions.calculator.variables.IVariable.IVariable)

Adds a new variable to the collection.

Parameters

variable – a variable to be added.

clear()

Clears the collection.

clear_values()

Clears all stored variables (assigns null values).

find_by_name(name: str)pip_services3_expressions.calculator.variables.IVariable.IVariable

Finds variable in the list by it’s name.

Parameters

name – The variable name to be found.

Returns

A variable or None if function was not found.

find_index_by_name(name: str)int

Finds variable index in the list by it’s name.

Parameters

name – The variable name to be found.

Returns

Variable index in the list or -1 if variable was not found.

get(index: int)pip_services3_expressions.calculator.variables.IVariable.IVariable

Get a variable by its index.

Parameters

index – a variable index.

Returns

a retrieved variable.

get_all() → List[pip_services3_expressions.calculator.variables.IVariable.IVariable]

Get all variables stores in the collection

Returns

a list with variables.

length()int

Gets a number of variables stored in the collection.

Returns

return a number of stored variables.

locate(name: str)pip_services3_expressions.calculator.variables.IVariable.IVariable

Finds variable in the list or create a new one if variable was not found.

Parameters

name – The variable name to be found.

Returns

Found or created variable.

remove(index: int)

Removes a variable by its index.

Parameters

index – a index of the variable to be removed.

remove_by_name(name: str)

Removes variable by it’s name.

Parameters

name – The variable name to be removed.