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

Class RuleThenInputCell
source code

object --+    
         |    
      Cell --+
             |
            RuleThenInputCell

Runs the rule to determine initial value, then acts like a InputCell

Instance Methods [hide private]
  __init__(self, owner, name=None, rule=lambda s, p: None, unchanged_if=None)
Initializes a RuleThenInputCell, whose initial value is determined by the passed rule but then acts like an InputCell
  run(self)
You may not run() an RuleThenInputCell after the initial run()

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, set, 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 RuleThenInputCell, whose initial value is determined by the passed rule but then acts like an InputCell
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__

run(self)

source code 
You may not run() an RuleThenInputCell after the initial run()
Returns:
None

Raises:
  • InputCellRunError - Raises if instance has been bound
Overrides: Cell.run