Package cells :: Module cell :: Class RuleCell
[hide private]
[frames] | no frames]

Class RuleCell
source code

object --+    
         |    
      Cell --+
             |
            RuleCell
Known Subclasses:
LazyCell

A cell whose value is determined by a function (a rule).

Instance Methods [hide private]
  __init__(self, owner, name=None, rule=lambda s, p: None, unchanged_if=None)
Initializes a RuleCell object, which may not be set and whose value is determined by a rule.
  set(self, value)
You may not set a RuleCell

Inherited from Cell: add_called_by, add_calls, called_by_list, calls_list, changed, getvalue, propogate, propogation_list, remove_called_bys, remove_cb, reset_calls, run, updatecell

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]

Inherited from object: __class__


Instance Variables [hide private]

Inherited from Cell: called_by, calls, synapse_space


Method Details [hide private]

__init__(self, owner, name=None, rule=lambda s, p: None, unchanged_if=None)
(Constructor)

source code 
Initializes a RuleCell object, which may not be set and whose value is determined by a rule.
Parameters:
  • name - This cell's name. When using a Cell with Models, this parameter is assigned automatically.
  • rule - Define a rule which backs this cell. You must only define one of rule or value. Lacking celltype, this creates a RuleCell. This must be passed a callable with the signature f(self, prev) -> value, where self is the model instance the cell is in and prev is the cell's out-of-date value.
  • unchanged_if - Sets a function to determine if a cell's value has changed. The signature for the passed function is f(old, new) -> bool.
Returns:
None

Raises:
  • RuleCellSetError - If value is passed as a parameter
Overrides: Cell.__init__

set(self, value)

source code 
You may not set a RuleCell
Returns:
None

Raises:
  • RuleCellSetError - Always raises this exception.
Overrides: Cell.set