BaseVariable

class osaft.core.variable.BaseVariable(name=None)[source]

Bases: ABC

BaseVariable class defining basic methods and attributes shared between active and passive attributes.

This class and its children are based on the Observer Design Pattern. In the present context value changes shall be tracked so ActiveVariable know when their dependencies changed, and they need to recompute their underlying value.

Parameters

name (None | str, optional) – Name of the variable

Default: None

Raises

TypeError if name is of wrong type

Public Data Attributes:

name

Returns name of the variable.

value

Value of the attribute

Public Methods:

notify()

Notifies all items in BaseVariable._variables_to_notify that a dependent value changed.


notify()[source]

Notifies all items in BaseVariable._variables_to_notify that a dependent value changed. Just the information of a changed dependency is passed.

Return type

None

property name: str

Returns name of the variable.

Setter

sets _name

Return type

str

property value: Any

Value of the attribute

Setter

just defined in PassiveVariable

Getter

returns/computes the value of the instance

Return type

Any