Package teamwork :: Package math :: Module rules :: Class Rule
[hide private]
[frames] | no frames]

Class Rule

source code

object --+    
         |    
      dict --+
             |
            Rule

Representation of a single rule. The left-hand side of the rule is a dictionary of attribute-value pairs. The rule fires on inputs that whose value on each attribute matches that of the rule. A rule with a value of None for a given attribute is indifferent to the input value for the attribute.

Instance Methods [hide private]
new empty dictionary

__init__(self, lhs={}, rhs=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
bool
test(self, state, attributes)
Determines whether this rule fires under the given conditions
source code
 
__copy__(self) source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__, __str__

Instance Variables [hide private]
  rhs
the value of the rule if it fires
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, lhs={}, rhs=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • lhs (dict) - the initial attribute-value pairs for the left-hand side of this rule
  • rhs - the right-hand side of the rule
Returns:
new empty dictionary

Overrides: object.__init__

test(self, state, attributes)

source code 

Determines whether this rule fires under the given conditions

Parameters:
Returns: bool
True iff this rule matches the given state