mm_petrinet.od 794 B

12345678910111213141516171819202122232425262728293031
  1. # Places, transitions, arcs (and only one kind of arc)
  2. PNConnectable:Class { abstract = True; }
  3. arc:Association (PNConnectable -> PNConnectable)
  4. PNPlace:Class
  5. PNTransition:Class
  6. # inhibitor arc
  7. inh_arc:Association (PNPlace -> PNTransition)
  8. :Inheritance (PNPlace -> PNConnectable)
  9. :Inheritance (PNTransition -> PNConnectable)
  10. # A place has a number of tokens, and that's it.
  11. PNPlaceState:Class
  12. PNPlaceState_numTokens:AttributeLink (PNPlaceState -> Integer) {
  13. name = "numTokens";
  14. optional = False;
  15. constraint = `"numTokens cannot be negative" if get_value(get_target(this)) < 0 else None`;
  16. }
  17. pn_of:Association (PNPlaceState -> PNPlace) {
  18. # one-to-one
  19. source_lower_cardinality = 1;
  20. source_upper_cardinality = 1;
  21. target_lower_cardinality = 1;
  22. target_upper_cardinality = 1;
  23. }