pip_services3_expressions.calculator.variables package

Submodules

Module contents

class pip_services3_expressions.calculator.variables.IVariable

Bases: abc.ABC

Defines a variable interface.

abstract property name
Returns

The variable name.

abstract property value
Returns

The variable value.

class pip_services3_expressions.calculator.variables.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.

class pip_services3_expressions.calculator.variables.Variable(name: str, value: Optional[pip_services3_expressions.variants.Variant.Variant, None] = None)

Bases: pip_services3_expressions.calculator.variables.IVariable.IVariable

Implements a variable holder object.

property name

The variable name.

property value

The variable value.

class pip_services3_expressions.calculator.variables.VariableCollection

Bases: pip_services3_expressions.calculator.variables.IVariableCollection.IVariableCollection

Implements 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.

property length

Gets a number of variables stored in the collection.

Returns

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.