|
@@ -74,7 +74,7 @@ Element function petrinet_fire(model : Element):
|
|
|
workset = allIncomingAssociationInstances(model, transition, "P2T")
|
|
|
while (0 < read_nr_out(workset)):
|
|
|
working_arc = set_pop(workset)
|
|
|
- working_place = getName(model, read_edge_src(model["model"][working_arc]))
|
|
|
+ working_place = reverseKeyLookup(model["model"], read_edge_src(model["model"][working_arc]))
|
|
|
new_value = integer_subtraction(read_attribute(model, working_place, "tokens"), read_attribute(model, working_arc, "weight"))
|
|
|
unset_attribute(model, working_place, "tokens")
|
|
|
instantiate_attribute(model, working_place, "tokens", new_value)
|
|
@@ -84,7 +84,7 @@ Element function petrinet_fire(model : Element):
|
|
|
workset = allOutgoingAssociationInstances(model, transition, "T2P")
|
|
|
while (0 < read_nr_out(workset)):
|
|
|
working_arc = set_pop(workset)
|
|
|
- working_place = getName(model, read_edge_dst(model["model"][working_arc]))
|
|
|
+ working_place = reverseKeyLookup(model["model"], read_edge_dst(model["model"][working_arc]))
|
|
|
new_value = integer_addition(read_attribute(model, working_place, "tokens"), read_attribute(model, working_arc, "weight"))
|
|
|
unset_attribute(model, working_place, "tokens")
|
|
|
instantiate_attribute(model, working_place, "tokens", new_value)
|
|
@@ -268,7 +268,7 @@ Element function model_loaded(model : Element):
|
|
|
while (read_nr_out(keys_m) > 0):
|
|
|
v_m = set_pop(keys_m)
|
|
|
// Filter out anonymous objects
|
|
|
- typename = getName(model["metamodel"], dict_read_node(model["type_mapping"], model["model"][v_m]))
|
|
|
+ typename = reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], model["model"][v_m]))
|
|
|
if (bool_not(string_startswith(v_m, "__"))):
|
|
|
output(((" " + v_m) + " : ") + typename)
|
|
|
elif (cmd == "read"):
|
|
@@ -280,10 +280,10 @@ Element function model_loaded(model : Element):
|
|
|
metamodel_element_pn = dict_read_node(model["type_mapping"], read_elem)
|
|
|
|
|
|
output("Name: " + cmd)
|
|
|
- output("Type: " + getName(model["metamodel"], metamodel_element_pn))
|
|
|
+ output("Type: " + reverseKeyLookup(model["metamodel"]["model"], metamodel_element_pn))
|
|
|
if (is_edge(read_elem)):
|
|
|
- output("Source: " + getName(model, read_edge_src(read_elem)))
|
|
|
- output("Destination: " + getName(model, read_edge_dst(read_elem)))
|
|
|
+ output("Source: " + reverseKeyLookup(model["model"], read_edge_src(read_elem)))
|
|
|
+ output("Destination: " + reverseKeyLookup(model["model"], read_edge_dst(read_elem)))
|
|
|
if (cast_v2s(read_elem) != "None"):
|
|
|
output("Value: " + cast_v2s(read_elem))
|
|
|
output("Defines attributes:")
|
|
@@ -297,7 +297,7 @@ Element function model_loaded(model : Element):
|
|
|
attr_keys_pn = dict_keys(attr_list_pn)
|
|
|
while (0 < read_nr_out(attr_keys_pn)):
|
|
|
attr_key_pn = set_pop(attr_keys_pn)
|
|
|
- output(((((" " + cast_v2s(attr_key_pn)) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])) + " = ") + cast_v2s(read_attribute(model, getName(model, read_elem), attr_key_pn)))
|
|
|
+ output(((((" " + cast_v2s(attr_key_pn)) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])) + " = ") + cast_v2s(read_attribute(model, reverseKeyLookup(model["model"], read_elem), attr_key_pn)))
|
|
|
else:
|
|
|
output("Unknown element; aborting")
|
|
|
elif (cmd == "verify"):
|
|
@@ -310,7 +310,7 @@ Element function model_loaded(model : Element):
|
|
|
while (read_nr_out(keys_t) > 0):
|
|
|
v_t = set_pop(keys_t)
|
|
|
if (bool_not(string_startswith(v_t, "__"))):
|
|
|
- output(string_join((" " + v_t) + " : ", getName(model["metamodel"]["metamodel"], dict_read_node(model["metamodel"]["type_mapping"], model["metamodel"]["model"][v_t]))))
|
|
|
+ output(string_join((" " + v_t) + " : ", reverseKeyLookup(model["metamodel"]["metamodel"]["model"], dict_read_node(model["metamodel"]["type_mapping"], model["metamodel"]["model"][v_t]))))
|
|
|
elif (cmd == "retype"):
|
|
|
output("Element to retype?")
|
|
|
String elementname
|