Activity population - modelint/xuml-populate GitHub Wiki
Activity
process_execution_units()
Here we populate the Activities for both Methods and States. We start by populating each Method.
Method population
Our Activity python class has a dictonary: cls.methods created earlier with a dictionary keyed as follows:
class name:
method name:
anum : <Activity ID> str
domain : <Domain Name> str
text : <unparsed text> str // for generating useful error messages and diagnostics
parse : <parsed method> // Output from the method Scrall parser
Using the Cabin.Ping method as an example, we see:
Cabin:
Ping:
anum : 'A7'
domain : 'Elevator Management'
text : ...
parse : [[Execution_Unit_a(statement_set=...
We iterate through each class and method creating an instance of Method Activity to perform the action population, sending the method name, class name, entire activity (method) data item, ex: Ping: anum, domain, text, parse.
Method Activity
We initialize this instance by setting a few useful self attributes and then proceed to populate the execution units.
pop_xunits()
We obtain the Method signature number (signum) from the database since it was populated earlier and also lookup the id of the executing instance. This is the flow that provides a reference to self inside the Activity.
We then create a named tuple: Activity_ap
Activity_ap is the same named tuple we use for state and ee activities. To customize it for a Method Activity we leave the sname, state_model, smtype, eename, and piflow fields empty. And since this is a Method, the xiflow always has a value.
A statement set is either a single standalone statement or a bracketed group of statements (such as the true or false component of a decision)
We iterate through each parsed statement set of the Method invoke a ExecutionUnit processing(...) python method for each. For a Method activity, we either call:
process_method_statement_set(...) // For all statement sets except the one that returns a method value
OR
process_synch_output(...) // This statement set produces output from the method (a return value)
Each takes the Activity_ap named tuple in the activity_detail variable as input along with the parse of the statement set.