|
@@ -111,6 +111,10 @@ Element function expand_parallel_state(model : Element, parallel_state : String)
|
|
|
|
|
|
return result!
|
|
|
|
|
|
+Void function delete_class(model : Element, data : Element, identifier : String):
|
|
|
+ // Stop a specific class instance, with attached statechart, from executing
|
|
|
+ dict_delete(data["classes"], identifier)
|
|
|
+
|
|
|
Void function start_class(model : Element, data : Element, class : String, identifier : String, parameters : Element):
|
|
|
// Start up the class and assign its initial state to it
|
|
|
|
|
@@ -277,7 +281,36 @@ Element function execute_transition(model : Element, data : Element, class : Str
|
|
|
parameter_action = get_func_AL_model(import_node(parameter_action))
|
|
|
parameter_action = parameter_action(data["classes"][class]["attributes"], event_parameter)
|
|
|
|
|
|
- set_add(data["events"], create_tuple(read_attribute(model, event, "event"), parameter_action))
|
|
|
+ String scope
|
|
|
+ scope = read_attribute(model, event, "scope")
|
|
|
+ if (scope == "cd"):
|
|
|
+ // Is an event for us internally, so don't append
|
|
|
+ // Instead, we process it directly
|
|
|
+ String operation
|
|
|
+ operation = read_attribute(model, event, "event")
|
|
|
+ if (operation == "create_instance"):
|
|
|
+ log("Creating new instance")
|
|
|
+ // Start up a new class of the desired type
|
|
|
+
|
|
|
+ // Parameters of this call:
|
|
|
+ // class -- type of the class to instantiate
|
|
|
+ // identifier -- name of this instance, for future reference
|
|
|
+ // parameters -- parameters for constructor
|
|
|
+ String class
|
|
|
+ String identifier
|
|
|
+ Element parameters
|
|
|
+ class = set_pop(filter(model, allInstances(model, "SCCD/Class"), "name", list_read(parameter_action, 0)))
|
|
|
+ identifier = list_read(parameter_action, 1)
|
|
|
+ parameters = list_read(parameter_action, 2)
|
|
|
+ start_class(model, data, class, identifier, parameters)
|
|
|
+
|
|
|
+ elif (operation == "delete_instance"):
|
|
|
+ // Delete the requested class
|
|
|
+ String identifier
|
|
|
+ identifier = list_read(parameter_action, 0)
|
|
|
+ delete_class(model, data, identifier)
|
|
|
+ else:
|
|
|
+ set_add(data["events"], create_tuple(read_attribute(model, event, "event"), parameter_action))
|
|
|
|
|
|
// Find new set of states
|
|
|
Element target_states
|