Package teamwork :: Package examples :: Package Thespian :: Module ThespianGeneric
[hide private]
[frames] | no frames]

Source Code for Module teamwork.examples.Thespian.ThespianGeneric

 1  __author__ = 'Mei Si <meisi@isi.edu>' 
 2  
 
 3  
 
 4  from teamwork.agent.Generic import * 
 5  
 
6 -class ThespianGenericModel(GenericModel):
7 option_messages = [] 8
9 - def __init__(self,name=''):
10 GenericModel.__init__(self,name) 11 self.option_messages = [] 12 self.real_option_messages = []
13
14 - def __repr__(self):
15 """Returns a string representation of this entity""" 16 content = GenericModel.__repr__(self) 17 content += '\n\tOption_messages:\n' 18 content += '\t\t'+`self.option_messages` 19 return content
20
21 - def importDict(self,generic):
22 """Updates generic model from dictionary-style spec""" 23 GenericModel.importDict(self,generic) 24 # Option_messages 25 if generic.has_key('option_messages'): 26 for entry in generic['option_messages']: 27 if not entry in self.option_messages: 28 self.option_messages.append(copy.copy(entry)) 29 30 if generic.has_key('real_option_messages'): 31 for entry in generic['real_option_messages']: 32 if not entry in self.real_option_messages: 33 self.real_option_messages.append(copy.copy(entry))
34