123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- include "primitives.alh"
- include "modelling.alh"
- include "object_operations.alh"
- Element function pn_print(params : Element, output_mms : Element):
- Element model
- model = params["epn"]
- Element all_places
- String place
- String name
- Integer tokens
- Element all_t
- String t
- log("Places:")
- all_places = allInstances(model, "Place")
- while (read_nr_out(all_places) > 0):
- place = set_pop(all_places)
- name = read_attribute(model, place, "name")
- tokens = read_attribute(model, place, "tokens")
- log(((" " + name) + ": ") + cast_v2s(tokens))
- log("Transitions:")
- all_places = allInstances(model, "Transition")
- while (read_nr_out(all_places) > 0):
- place = set_pop(all_places)
- name = read_attribute(model, place, "name")
- log(" " + name)
- all_t = allIncomingAssociationInstances(model, place, "P2T")
- while (read_nr_out(all_t) > 0):
- t = set_pop(all_t)
- log(" <-- " + cast_v2s(read_attribute(model, readAssociationSource(model, t), "name")))
- all_t = allOutgoingAssociationInstances(model, place, "T2P")
- while (read_nr_out(all_t) > 0):
- t = set_pop(all_t)
- log(" --> " + cast_v2s(read_attribute(model, readAssociationDestination(model, t), "name")))
- log("Ports:")
- all_places = allInstances(model, "Port")
- while (read_nr_out(all_places) > 0):
- place = set_pop(all_places)
- name = read_attribute(model, place, "name")
- log(" " + name)
- return create_node()!
|