Bläddra i källkod

Added PetriNet Ports formalism

Yentl Van Tendeloo 8 år sedan
förälder
incheckning
2f42489d98
1 ändrade filer med 57 tillägg och 0 borttagningar
  1. 57 0
      models/petrinet_ports.mvc

+ 57 - 0
models/petrinet_ports.mvc

@@ -0,0 +1,57 @@
+SimpleClassDiagrams PetriNetsPorts {
+    SimpleAttribute Integer{
+        constraint = $
+            String function constraint(model : Element, name : String):
+                if (is_physical_int(model["model"][name])):
+                    return "OK"!
+                else:
+                    return "Integer has non-integer value"!
+    }
+
+    SimpleAttribute String{
+        constraint = $
+            String function constraint(model : Element, name : String):
+                if (is_physical_string(model["model"][name])):
+                    return "OK"!
+                else:
+                    return "String has non-string value"!
+            $
+    }
+
+    SimpleAttribute PlaceOrTransition{
+        constraint = $
+            String function constraint(model : Element, name : String):
+                if (is_physical_string(model["model"][name])):
+                    if (boolean_or(value_eq(model["model"][name], "transition"), value_eq(model["model"][name], "place"))):
+                        return "OK"!
+                    else:
+                        return "PlaceOrTransition does not contain either Place or Transition"!
+                else:
+                    return "PlaceOrTransition has non-string value"!
+            $
+    }
+    Class Positionable {
+        x : Integer
+        y : Integer
+    }
+    Class Named {
+        name : String
+    }
+    Class Boundary : Named, Positionable {}
+    Class Place : Positionable, Named {
+        nbTokens : Integer
+    }
+    Class Transition : Positionable, Named {}
+    Class Port : Named, Positionable {
+        sourceType : PlaceOrTransition
+        targetType : PlaceOrTransition
+    }
+
+    Association Has1 (Boundary, Place) {}
+    Association Has2 (Boundary, Transition) {}
+    Association Has3 (Boundary, Port) {}
+    Association P2T (Place, Transition) {}
+    Association T2P (Transition, Place) {}
+    Association PortTransition (Port, Transition) {}
+    Association PortPlace (Port, Place) {}
+}