|        |   | 
- actionNode
 - classSociety
 - decisionNode
 - finalNode
 - initialNode
 - stateMachine
  
 
 
  
class actionNode |  
    
|     | 
This class represents an action node from the document object model.   |  
|   | 
Methods defined here: 
- __init__(self)
  
 |    
 
  
class classSociety |  
    
|     | 
This class represents a society of classes created by parsing an XMI document.   |  
|   | 
Methods defined here: 
- __init__(self, file_name=None)
 - Constructor.  Parse the XMI document if given.
  
- addMethod(self, func_name, class_name, file_name)
 - This method adds a new method to a class currently contained in this instance.  The
 
method that is added comes from an XMI file containing an activity diagram.  This 
method takes three arguments.  func_name is the name of the new method.  class_name is 
the name of the class the new method is being added to.  file_name is the location of 
the xmi document that contains the activity diagram representing the new method.  Any 
new methods added to a class can only accept keyword arguments.  Each keyword argument 
found when the method is called from an instance of the object is transformed into 
an attribute of the object.  
- getClass(self, class_name)
 - Return the class object of the given class name.  A PyXMINoClassDefined exception
 
is raised if the given class does not exist.  
- getClasses(self)
 - Get all the class nodes from the document object model.  For each class node that is
 
found, create a sub-class of the stateMachine class and assign it to this classSociety 
instance.  
- hasClass(self, class_name)
 - Return true if the classSociety instance has the given class.
  
- load(self, file_name)
 - This method works the same as the constructor.  It is intended to be used to parse an
 
XMI document after the object has been constructed.  
 |    
  
 
  
class finalNode |  
    
|     | 
This class represents a final node from the document object model.   |  
|   | 
Methods defined here: 
- __init__(self)
  
 |    
  
 
  
class stateMachine |  
    
|     | 
This class represents a state machine that is created by parsing an xmi document.   |  
|   | 
Methods defined here: 
- __init__(self, file_name=None)
 - Constructor.  Parse the xmi document then call the functions to get all the elements
 
of the diagram.  
- exportPyxmi(self, file_name)
 - Create an XMI document for the current stateMachine instance.  This XMI format is
 
different from the format used by Poseidon.  This format is much smaller because it 
only exports elements needed to re-create this instance.  
- getActions(self)
 - Get all the CallAction nodes from the document object model.  Start by finding all
 
call action elements.  For each call action element that is found, find the incomming 
edge elements and append the id attribute to the incomming list.  Then find all outgoing 
edge elements and append the id attribute to the outgoing list.  Once all incomming 
and outgoing elements have been found, add the call action node to the actions list.  
- getDecisions(self)
 - Get all the decision nodes from the document object model.  Start by finding all
 
decision node elements.  For each decision node element that is found, find the 
incomming edge element and assign the id attribute to the decision node's incomming 
variable.  Then find all outgoing edge elements and append the id attribute to the 
decision node's outgoing list.  Once all incomming and outgoing elements have been 
found, add decision node to the decisions list.  
- getFinal(self)
 - Get the final node from the document object model.  Find any final node elements in
 
the document.  In order for the program to function as intended, there should only be one. 
Loop through the child elements of the current final node and assign the id attribute to 
the outgoing variable.  
- getGuards(self)
 - Get the guard conditions for any decision points.  Find all opaque expression elements
 
and for each element found, if the grandparent element of the current element is an 
activity edge element, add the guard expression to the guards dictionary with the id 
attribute of the grandparent node as the key.  
- getId(self)
 - Get the diagram id from the document object model.
  
- getInitial(self)
 - Get the initial node from the document object model.  Find any initial node elements
 
in the document.  In order for the program to function as intended, there should only be 
one.  Loop through the child elements of the current initial node and assign the id 
attribute to the outgoing variable.  
- getName(self)
 - Get the diagram name from the document object model.
  
- importPyxmi(self, file_name)
 - Construct the state machine by parsing an XMI document created with the exportPyxmi
 
method.  
- load(self, file_name)
 - This method works the same as the constructor.  It is intended to be used when the
 
state machine object has already been constructed with no XMI document.  
- run(self, *args)
 - Execute all action statements and decision nodes begining at the initial node and
 
ending at the final node.  Any number of arguments may be passed to run.  These 
arguments can be accessed from the diagram using args[index].  For each iteration 
through the main loop, the next variable is compared to all nodes incomming lists. 
First, the final node is checked.  If the next variable matches the an element in the 
incomming list, the main loop is exited.  Second, all action nodes are checked to see 
if one of them is next.  If an action node is found to be next, the contained python 
statement is executed, the next variable becomes the current action node's outgoing 
variable.  Last, all decision nodes are checked.  If a decision node is found to be 
next, all the decision nodes outgoing guard conditions are evaluated.  If there is no 
else guard condition and none of the other conditions evaluate to true, the program 
will be stuck in the main loop.  The next variable becomes the current decision node's 
outgoing variable whos guard condition evaluates to true.  The return value is whatever 
the value of the return_value is.  This variable defaults to None.  
 |    |