Package teamwork :: Package messages :: Module PsychMessage :: Class Message
[hide private]
[frames] | no frames]

Class Message

source code

            object --+        
                     |        
                  dict --+    
                         |    
action.PsychActions.Action --+
                             |
                            Message
Known Subclasses:

Subclass of Action corresponding to messages, which are realized as attempts to modify the beliefs of others

Instance Methods [hide private]
new empty dictionary

__init__(self, arg={})
Translates an action in string form into a structured representation of that same action (e.g., 'CLF-violence-to-UrbanPoor' becomes a PsychAction object {'actor':CLF,'type':'violence','object':UrbanPoor}
source code
 
__setitem__(self, index, value)
x[i]=y
source code
 
extractFromString(self, str)
The string representation of a non-command message is: <key11>:<key12>:...:<key1n>=<value1>;<key21>:<key22>:...:<key2m>=<value2>;...
source code
 
force(self, agent='', value=None) source code
 
forceAccept(self, agent='')
Sets the message to force acceptance by the receiver
source code
 
forceReject(self, agent='')
Sets the message to force rejection by the receiver
source code
boolean
mustAccept(self, agent='')
Returns: true iff this message has been set to force acceptance by the specified receiver
source code
boolean
mustReject(self, agent='')
Returns: true iff this message has been set to force rejection by the receiver
source code
 
__cmp__(self, other)
cmp(x,y)
source code
 
__copy__(self) source code
 
__xml__(self) source code
 
parse(self, doc) source code
 
__str__(self)
Translates a structured dictionary representation of an action into a standardized string format (e.g., {'actor':CLF,'type':'violence','object':UrbanPoor} becomes 'CLF-violence-to-UrbanPoor'
source code
 
pretty(self, query=None)
Returns: a more user-friendly string rep of this message
source code

Inherited from action.PsychActions.Action: __deepcopy__, __delitem__, __getitem__, __hash__, addField, instantiate, keys, makeRange, matchTemplate, simpleText

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

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__

Class Variables [hide private]
  fields = {'_observed': {}, '_unobserved': {}, 'actor': {}, 'co...
the available keys for messages of this class (unless otherwise noted, the value under each key is a string)
  acceptString = 'accept'
the flag indicating that a hearer should be forced to believe this message
  rejectString = 'reject'
the flag indicating that a hearer should be forced to disbelieve this message

Inherited from action.PsychActions.Action: format, nop

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, arg={})
(Constructor)

source code 

Translates an action in string form into a structured representation of that same action (e.g., 'CLF-violence-to-UrbanPoor' becomes a PsychAction object {'actor':CLF,'type':'violence','object':UrbanPoor}

Returns:
new empty dictionary

Overrides: object.__init__
(inherited documentation)

__setitem__(self, index, value)
(Index assignment operator)

source code 

x[i]=y

Overrides: dict.__setitem__
(inherited documentation)

extractFromString(self, str)

source code 

The string representation of a non-command message is: <key11>:<key12>:...:<key1n>=<value1>;<key21>:<key22>:...:<key2m>=<value2>;... e.g., entities:Psyops:state:power=0.7;entities:Paramilitary:entities:Psyops:state:power=0.7 e.g., message Psyops Paramilitary entities:Psyops:policy:observation depth 3 actor Paramilitary type violence object UrbanPoor violence-to-Paramilitary For commands, the syntax is 'command;<key1>=<val1>;<key2>=<val2>;...', where the usual keys are 'object' (e.g., 'opponent') and 'type' (e.g., 'violence'). This same format is expected by the constructor and returned by the string converter.

force(self, agent='', value=None)

source code 
Parameters:
  • value - if a positive number or equals the 'acceptString' attribute, then sets the message to force acceptance; if value is a negative number of equals the 'rejectString' attribute, then sets the message to force rejection; otherwise, the acceptance of this message is left up to the receiver
  • agent (str) - the agent whose acceptance is being forced. If the empty string, then all agents are forced (the default)

forceAccept(self, agent='')

source code 

Sets the message to force acceptance by the receiver

Parameters:
  • agent (str) - the agent whose acceptance is being forced. If the empty string, then all agents are forced (the default)

forceReject(self, agent='')

source code 

Sets the message to force rejection by the receiver

Parameters:
  • agent (str) - the agent whose acceptance is being forced. If the empty string, then all agents are forced (the default)

mustAccept(self, agent='')

source code 
Parameters:
  • agent (str) - the agent whose forcing is being tested. If the empty string, then the test is over all agents (the default)
Returns: boolean
true iff this message has been set to force acceptance by the specified receiver

mustReject(self, agent='')

source code 
Parameters:
  • agent (str) - the agent whose forcing is being tested. If the empty string, then the test is over all agents (the default)
Returns: boolean
true iff this message has been set to force rejection by the receiver

__cmp__(self, other)
(Comparison operator)

source code 

cmp(x,y)

Overrides: dict.__cmp__
(inherited documentation)

__xml__(self)

source code 
Overrides: action.PsychActions.Action.__xml__

parse(self, doc)

source code 
Overrides: action.PsychActions.Action.parse

__str__(self)
(Informal representation operator)

source code 

Translates a structured dictionary representation of an action into a standardized string format (e.g., {'actor':CLF,'type':'violence','object':UrbanPoor} becomes 'CLF-violence-to-UrbanPoor'

Overrides: object.__str__
(inherited documentation)

pretty(self, query=None)

source code 
Returns:
a more user-friendly string rep of this message

Class Variable Details [hide private]

fields

the available keys for messages of this class (unless otherwise noted, the value under each key is a string)
  • sender: the agent sending the message (i.e., the actor)
  • receiver: the sender's intended hearer (i.e., the object)
  • type: the action type (default is _message)
  • performative: as defined by ACL conventions (default is tell)
  • command: the action that the sender is commanding the receiver to perform (probably doesn't work)
  • force: dictionary (over receivers) of flags indicating whether acceptance/rejection of the message should be forced. For each name key, if the value is None, then the agent decides for itself; if acceptString, then theagent must believe the message; if rejectString, then the agent must reject the message. You should not set this field's value directly; rather, use the forceAccept, forceReject, mustAccept, and mustReject methods as appropriate
  • factors: the content of the message, in the form of a list of dictionaries, specifying the intended change to individual beliefs
Value:
{'_observed': {},
 '_unobserved': {},
 'actor': {},
 'command': {},
 'factors': {},
 'force': {},
 'matrix': {},
 'object': {},
...