Skip to content
Snippets Groups Projects

added ref-place and ref-transition execution support

Merged Sebastian Ebert requested to merge feature/ref-execution into master
5 unresolved threads
Files
4
@@ -2,22 +2,40 @@ aspect Navigation {
inh PetriNet PnObject.petriNet();
eq PetriNet.getChild().petriNet() = this;
syn java.util.Collection<Place> Transition.incomingPlaces() {
java.util.Set<Place> incomingPlaces = new java.util.HashSet<>();
for (Arc incomingArc : getInArcList()) {
incomingPlaces.add(incomingArc.getSource().asPlaceNode().place());
}
return incomingPlaces;
syn java.util.Collection<Place> TransitionNode.incomingPlaces() {
java.util.Set<Place> s = new java.util.HashSet<>();
for (Arc incomingArc : getInArcList()) {
s.add(incomingArc.getSource().asPlaceNode().place());
}
for (TransitionNode ref : getReferencingTransitions()) {
s.addAll(ref.incomingPlaces());
}
return s;
}
syn java.util.Collection<Place> TransitionNode.outgoingPlaces() {
java.util.Set<Place> s = new java.util.HashSet<>();
syn java.util.Collection<Place> Transition.outgoingPlaces() {
java.util.Set<Place> outgoingPlaces = new java.util.HashSet<>();
for (Arc outgoingArc : getOutArcList()) {
outgoingPlaces.add(outgoingArc.getTarget().asPlaceNode().place());
for (Arc outgoing : getOutArcList()) {
s.add(outgoing.getTarget().asPlaceNode().place());
}
return outgoingPlaces;
for (TransitionNode ref : getReferencingTransitions()) {
s.addAll(ref.outgoingPlaces());
}
return s;
}
inh Page PnObject.ContainingPage();
eq Page.getObject().ContainingPage() = this;
eq PetriNet.getPage().ContainingPage() = null;
syn boolean Node.isPlaceNode() = false;
eq PlaceNode.isPlaceNode() = true;
@@ -38,6 +56,21 @@ aspect Navigation {
eq Transition.transition() = this;
eq RefTransition.transition() = getRef().transition();
syn boolean PlaceNode.isRefPlace() = false;
eq RefPlace.isRefPlace() = true;
syn boolean TransitionNode.isTransition() = false;
eq Transition.isTransition() = true;
syn boolean TransitionNode.isRefTransition() = false;
eq RefTransition.isRefTransition() = true;
syn RefTransition TransitionNode.asRefTransition() = null;
eq RefTransition.asRefTransition() = this;
syn Transition TransitionNode.asTransition() = null;
eq Transition.asTransition() = this;
coll java.util.Set<PnObject> PetriNet.allObjects() [new java.util.HashSet()] root PetriNet;
PnObject contributes this
to PetriNet.allObjects()
@@ -57,4 +90,25 @@ aspect Navigation {
Arc contributes this
to PetriNet.allArcs()
for petriNet();
coll java.util.Set<Page> PetriNet.allPages() [new java.util.HashSet()] root PetriNet;
Page contributes this
to PetriNet.allPages()
for petriNet();
coll java.util.Set<TransitionNode> PetriNet.allTransitionNodes() [new java.util.HashSet()] root PetriNet;
    • I don't see a reason why these collection attributes should exist. It is dangerous to keep them, because when the contents are resolved (with place() or transition()), the result is no longer a set.

      The example below does something with the same transition multiple times.

      for (TransitionNode n: pn.allTransitionNodes()) {
        n.transition().doSomething();
      }

      So I would remove allTransitionNodes() allRefTransitions() allRefPlaces()

Please register or sign in to reply
TransitionNode contributes this
to PetriNet.allTransitionNodes()
for petriNet();
coll java.util.Set<RefTransition> PetriNet.allRefTransitions() [new java.util.HashSet()] root PetriNet;
RefTransition contributes this
to PetriNet.allRefTransitions()
for petriNet();
coll java.util.Set<RefPlace> PetriNet.allRefPlaces() [new java.util.HashSet()] root PetriNet;
RefPlace contributes this
to PetriNet.allRefPlaces()
for petriNet();
}
Loading