Skip to content
Snippets Groups Projects
Commit 4bc590d8 authored by Sebastian Ebert's avatar Sebastian Ebert
Browse files

added ref-place and ref-transition execution support

parent f8dfb6b3
No related branches found
No related tags found
1 merge request!1added ref-place and ref-transition execution support
......@@ -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;
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();
}
package de.tudresden.inf.st.pnml;
import de.tudresden.inf.st.pnml.jastadd.model.Marking;
import de.tudresden.inf.st.pnml.jastadd.model.PetriNet;
import de.tudresden.inf.st.pnml.jastadd.model.*;
import fr.lip6.move.pnml.framework.general.PNType;
import fr.lip6.move.pnml.framework.hlapi.HLAPIRootClass;
import fr.lip6.move.pnml.framework.utils.ModelRepository;
......@@ -27,7 +26,7 @@ public class Main {
// String fileName = "src/main/resources/minimal.pnml";
// String fileName = "src/main/resources/philo.pnml";
String fileName = "src/main/resources/haddadin_automaton_flat.pnml";
String fileName = "src/main/resources/placeRefNet.pnml";
List<PetriNet> petriNets = parsePnml(fileName);
......
<pnml xmlns="http://www.pnml.org/version-2009/grammar/pnml">
<net id="n-E2D0-BCF46-0" type ="http://www.pnml.org/version-2009/grammar/ptnet">
<name>
<text>minimal</text>
</name>
<page id="top">
<page id="p1">
<place id="p4">
<name>
<text>p4</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>1</text>
</initialMarking>
<graphics>
<position x="30" y="50"/>
</graphics>
</place>
<transition id="tRefIn">
<name>
<text>tRefIn</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="285" y="205"/>
</graphics>
</transition>
<referencePlace id="rp1" ref="p-E2D0-BCF6F-2">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>loc1</location>
<subnet>s1</subnet>
</toolspecific>
<name>
<text>rp1</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="20" y="20"/>
</graphics>
</referencePlace>
<arc id="rin" source="tRefIn" target="rp1">
</arc>
<arc id="arc-p4-TRefIn" source="p4" target="tRefIn">
</arc>
</page>
<page id="p2">
<place id="p-E2D0-BCF6F-2">
<name>
<text>p0</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>0</text>
</initialMarking>
<graphics>
<position x="30" y="50"/>
</graphics>
</place>
<place id="p-E2D0-BCF9D-3">
<name>
<text>p1</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<graphics>
<position x="635" y="90"/>
</graphics>
</place>
<transition id="t-E2D0-BCFAC-4">
<name>
<text>t0</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="300" y="50"/>
</graphics>
</transition>
<transition id="t-E2D0-BCFBD-5">
<name>
<text>t1</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="285" y="205"/>
</graphics>
</transition>
<arc id="e-E2D0-BCFCD-6" source="t-E2D0-BCFBD-5" target="p-E2D0-BCF6F-2">
</arc>
<arc id="e-E2D0-BCFDB-7" source="p-E2D0-BCF9D-3" target="t-E2D0-BCFBD-5">
</arc>
<arc id="e-E2D0-BCFF3-8" source="t-E2D0-BCFAC-4" target="p-E2D0-BCF9D-3">
</arc>
<arc id="e-E2D0-BCFFB-9" source="p-E2D0-BCF6F-2" target="t-E2D0-BCFAC-4">
</arc>
</page>
</page>
</net>
</pnml>
<pnml xmlns="http://www.pnml.org/version-2009/grammar/pnml">
<net id="n-E2D0-BCF46-0" type ="http://www.pnml.org/version-2009/grammar/ptnet">
<name>
<text>minimal</text>
</name>
<page id="top">
<page id="p1">
<place id="pRefSrc">
<name>
<text>pRefSrc</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>1</text>
</initialMarking>
<graphics>
<position x="30" y="50"/>
</graphics>
</place>
<referenceTransition id="rt1" ref="t-E2D0-BCFAC-4">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>loc1</location>
<subnet>s1</subnet>
</toolspecific>
</referenceTransition>
<arc id="rin" source="pRefSrc" target="rt1">
</arc>
</page>
<page id="p2">
<place id="p-E2D0-BCF6F-2">
<name>
<text>p0</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>1</text>
</initialMarking>
<graphics>
<position x="30" y="50"/>
</graphics>
</place>
<place id="p-E2D0-BCF9D-3">
<name>
<text>p1</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<graphics>
<position x="635" y="90"/>
</graphics>
</place>
<transition id="t-E2D0-BCFAC-4">
<name>
<text>t0</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="300" y="50"/>
</graphics>
</transition>
<transition id="t-E2D0-BCFBD-5">
<name>
<text>t1</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="285" y="205"/>
</graphics>
</transition>
<arc id="e-E2D0-BCFCD-6" source="t-E2D0-BCFBD-5" target="p-E2D0-BCF6F-2">
</arc>
<arc id="e-E2D0-BCFDB-7" source="p-E2D0-BCF9D-3" target="t-E2D0-BCFBD-5">
</arc>
<arc id="e-E2D0-BCFF3-8" source="t-E2D0-BCFAC-4" target="p-E2D0-BCF9D-3">
</arc>
<arc id="e-E2D0-BCFFB-9" source="p-E2D0-BCF6F-2" target="t-E2D0-BCFAC-4">
</arc>
</page>
</page>
</net>
</pnml>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment