Package csb :: Package statistics :: Package pdf :: Module parameterized :: Class AbstractParameter

[frames] | no frames]

# Class AbstractParameter

source code

    object --+
             |
            AbstractParameter

Known Subclasses:
  - Parameter

Abstract parameterization, which can exist independently or be coupled to other parameters upon request. Virtual/coupled/derived parameters cannot be overwritten explicitly, but their values will get recomputed once their corresponding base parameters get updated. This is a lazy process - parameter recalculation happens only when an out of date parameter is requested. This triggers a real-time cascaded update which affects all parameters from the nearest consistent base down to the current inconsistent node.

Implementing subclasses must override AbstractParameter._validate and virtual parameters should additionally override AbstractParameter._compute.

Instance Methods

__init__(self, value=None, name=None, base=None) x.__init__(...) initializes x; see help(type(x)) for signature | source code

bind_to(self, parameter) Bind the current parameter to a base parameter. | source code

AbstractParameter

find_base_parameter(self) Find and return the non-virtual base parameter that is the root of the current hierarchy. | source code

set(self, value) Update the value of this parameter. | source code

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables
| NULL = `None` hash(x)

Properties
| is_virtual True if this parameter is virtual (computed)
| name Parameter name
| value Parameter value (guaranteed to be up to date)
Inherited from `object`: `__class__`

Method Details

### __init__(self, value=None, name=None, base=None)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  - `value` (object) - initial value (defaults to None / AbstractParameter.NULL)
  - `name` (str) - name of parameter (this is the name of the class by default)
  - `base` (AbstractParameter) - optional base parameter to compute this instance from
Overrides: object.__init__
  (inherited documentation)

### bind_to(self, parameter)

source code

Bind the current parameter to a base parameter. This converts the current parameter to a virtual one, whose value will get implicitly updated to be consistent with its base.

Note that virtual parameters must have exactly one base; computing a parameter from multiple bases is not allowed. Cycles are also not allowed; the topology must always stay a tree with a non-virtual parameter at the root.

Parameters:
  - `parameter` - base parameter to compute this instance from
  - `parameter` - AbstractParameter
Raises:
  - `ParameterizationError` - if this parameter is already virtual
  - `ParameterizationError` - on attempt to create a circular dependency

### find_base_parameter(self)

source code

Find and return the non-virtual base parameter that is the root of the current hierarchy. If self is not virtual, return self.

Returns: AbstractParameter
  base parameter

### set(self, value)

source code

Update the value of this parameter. This is not possible for virtual parameters.

Parameters:
  - `value` (object) - new value
Raises:
  - `ParameterizationError` - if this is a virtual parameter
  - `ParameterValueError` - on invalid value

Property Details

### is_virtual

True if this parameter is virtual (computed)

Get Method:
  unreachable.is_virtual(self) - True if this parameter is virtual (computed)

### name

Parameter name

Get Method:
  unreachable.name(self) - Parameter name

### value

Parameter value (guaranteed to be up to date)

Get Method:
  unreachable.value(self) - Parameter value (guaranteed to be up to date)