Package teamwork :: Package math :: Module Keys :: Class Key
[hide private]
[frames] | no frames]

Class Key

source code

object --+    
         |    
      dict --+
             |
            Key
Known Subclasses:

Superclass for all different keys, used for indexing the various symbolic matrices and hyperplanes

Instance Methods [hide private]
 
__str__(self)
str(x)
source code
 
__hash__(self)
Allows Key objects to be used as dictionary keys
source code
 
simpleText(self) source code
Key[]
instantiate(self, table)
Utility method that takes a mapping from entity references (e.g., 'self', 'actor') to actual entity names (e.g., 'Bill', 'agent0').
source code
 
__copy__(self) source code
Element
__xml__(self)
XML Serialization
source code
 
parse(self, element)
Updates the current key with the elements stored in the given XML element
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __init__, __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__

Class Variables [hide private]
  keyType = 'generic'
  slots = {}
  CLASS = 0
  ENTITY = 1
  STATE = 2
  ACTION = 3
  VALUE = 4
  ENTITIES = 5
  TEST = 6
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__hash__(self)
(Hashing function)

source code 

Allows Key objects to be used as dictionary keys

Returns:
A hash value for this Key
Overrides: object.__hash__

instantiate(self, table)

source code 

Utility method that takes a mapping from entity references (e.g., 'self', 'actor') to actual entity names (e.g., 'Bill', 'agent0'). It returns a new key string with the substitution applied. Subclasses should override this method for more instantiation of more specialized fields.

Parameters:
  • table (dict) - A dictionary of label-value pairs. Any slot in the key whose filler matches a label in the given table will be replaced by the associated value.
Returns: Key[]
Any new Key instances with the appropriate label substitutions

__xml__(self)

source code 

XML Serialization

The format looks like:

  <key type="self.keyType">
     <tag1>value1</tag1>
     <tag2>value2</tag2>
     ...
     <tagn>valuen</tagn>
  </key>
Returns: Element
An XML object representing this Key

parse(self, element)

source code 

Updates the current key with the elements stored in the given XML element

Parameters:
  • element (Element)
Returns:
the Key object stored in the given XML element