Skip to content
Snippets Groups Projects
Commit 22ca708c authored by gabriel's avatar gabriel
Browse files

final

parent ad6d2204
No related branches found
No related tags found
No related merge requests found
......@@ -8,5 +8,7 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
<classpathentry kind="src" path="/test"/>
<classpathentry kind="lib" path="/mapd-pne-code (1).zip_expanded/lib/javax.xml.bind.jar"/>
<classpathentry kind="lib" path="/mapd-pne-code (1).zip_expanded/lib/pn-imta-initial-models-and-adapters.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
......@@ -11,6 +11,15 @@ public class ReseauPetri implements InterfaceReseauPetri{
this.placeList = new LinkedList<Place>();
this.transitionList = new LinkedList<Transition>();
}
public LinkedList<Arc> getArcList(){
return this.arcList;
}
public LinkedList<Transition> getTransitionList(){
return this.transitionList;
}
public LinkedList<Place> getPlaceList() {
return this.placeList;
}
@Override
public boolean Fire(Transition t) {
if(t.isActivable()) {
......@@ -42,7 +51,9 @@ public class ReseauPetri implements InterfaceReseauPetri{
@Override
public boolean Add(Arc an) {
an.getTransition().addArcToList(an);
return this.arcList.add(an);
}
@Override
......@@ -55,11 +66,16 @@ public class ReseauPetri implements InterfaceReseauPetri{
@Override
public boolean Remove(Place p) {
LinkedList<Arc> listArc = new LinkedList<Arc>();
for(int i = 0; i < this.arcList.size(); i++) {
if(this.arcList.get(i).getPlace().equals(p)) {
this.Remove(this.arcList.get(i));
listArc.add(this.arcList.get(i));
}
}
for(int i = 0; i < listArc.size(); i++){
this.Remove(listArc.get(i));
}
return this.placeList.remove(p);
}
......@@ -156,10 +172,8 @@ public class ReseauPetri implements InterfaceReseauPetri{
Place p1 = new Place(1,0);
Place p2 = new Place(1,1);
Transition t1 = new Transition(0);
ArcVideur a1 = new ArcVideur(p1,t1);
Arc a2 = new Arc(1,p2,0,t1);
t1.getArcList().add(a1);
t1.getArcList().add(a2);
Arc a1 = new Arc(1,p1,1,t1);
Arc a2 = new Arc(2,p2,0,t1);
t.Add(a1);
t.Add(a2);
t.Add(p1);
......
......@@ -27,6 +27,9 @@ public class Transition {
public void setArcList(LinkedList<Arc> arcList) {
this.arcList = arcList;
}
public void addArcToList(Arc a) {
this.arcList.add(a);
}
/**
* @return the finalID
*/
......@@ -36,6 +39,7 @@ public class Transition {
public boolean isActivable() {
for (int i = 0; i < this.arcList.size(); i++) {
if (this.arcList.get(i).isActivable() == false) {
System.out.print(arcList.get(i).getDestination());
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment