Index: petri/.project
===================================================================
--- petri/.project	(revision 0)
+++ petri/.project	(revision 2)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>petri</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: petri/.project
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/src/main/ArcCleaner.java
===================================================================
--- petri/src/main/ArcCleaner.java	(revision 0)
+++ petri/src/main/ArcCleaner.java	(revision 2)
@@ -0,0 +1,54 @@
+package main;
+
+public class ArcCleaner extends Arc{
+	
+
+	public ArcCleaner(Place place) {
+		super(place);
+	
+	}
+	
+	public void doTransition() {
+		if (this.isActive()==true) {
+			this.getPlace().changeToken(-this.getPlace().getToken());
+		}
+	}
+	
+	public boolean isActive() {
+		return (this.getPlace().getToken()>0);
+	}
+	
+	public boolean isPullable() {
+		return this.isActive();
+	}
+	public String toString() {
+		return "ArcCleaner,"+this.getPlace();
+	}
+	public static void main(String[] args) {
+		System.out.println("TEST METHODS ARCCLEANER");
+		
+		System.out.println(" => method isActive()");
+		Place emptyPlace = new Place(0);
+		ArcCleaner arcc1 = new ArcCleaner(emptyPlace);
+		Place place3 = new Place(3);
+		ArcCleaner arcc2 = new ArcCleaner(place3);
+		System.out.println("false : "+arcc1.isActive());
+		System.out.println("true : "+arcc2.isActive());
+
+	
+		System.out.println(" => method isPullable()");
+		System.out.println(arcc1);
+		System.out.println("false : "+arcc1.isPullable());
+		System.out.println(arcc2);
+		System.out.println("true : "+arcc2.isPullable());
+
+		System.out.println(" => method doTranstion()");
+		System.out.println("before : "+arcc2);
+		arcc2.doTransition();
+		System.out.println("after  : "+arcc2);
+
+	}
+	
+	
+
+}

Property changes on: petri/src/main/ArcCleaner.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/src/main/ArcEntering.java
===================================================================
--- petri/src/main/ArcEntering.java	(revision 0)
+++ petri/src/main/ArcEntering.java	(revision 2)
@@ -0,0 +1,56 @@
+package main;
+
+public class ArcEntering extends Arc{
+	
+	private int value;
+
+	public ArcEntering(Place place, int value) {
+		super(place);
+		// TODO Auto-generated constructor stub
+		this.value=value;
+	}
+	
+	public void doTransition() {
+		this.getPlace().changeToken(this.value);
+	}
+	
+	public boolean isActive() {
+		return true;
+	}
+	
+	public boolean isPullable() {
+		return true;
+	}
+	public String toString() {
+		return "ArcEntering value:"+value+", "+this.getPlace();
+	}
+	public static void main(String[] args) {
+		System.out.println("TEST METHODS ARCENTERING");
+		
+		System.out.println(" => method isActive()");
+		Place emptyPlace = new Place(0);
+		ArcEntering arce = new ArcEntering(emptyPlace, 3);
+		System.out.println("true : "+arce.isActive());
+
+	
+		System.out.println(" => method isPullable()");
+		Place place3 = new Place(3);
+		ArcEntering arce2 = new ArcEntering(place3, 2);
+		ArcEntering arce4 = new ArcEntering(place3, 4);
+		System.out.println(arce2);
+		System.out.println("true : "+arce2.isPullable());
+		System.out.println(arce4);
+		System.out.println("true : "+arce4.isPullable());
+		
+		System.out.println(" => method doTranstion()");
+		System.out.println("before : "+arce2);
+		arce2.doTransition();
+		System.out.println("after  : "+arce2);
+		System.out.println(" => method equals()");
+		// the method equals is test here because arc is an abstract method
+		System.out.println("true : "+arce2.equals(arce2));
+		System.out.println("false : "+arce2.equals(arce4));
+	}
+	
+
+}

Property changes on: petri/src/main/ArcEntering.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/src/main/ArcOutering.java
===================================================================
--- petri/src/main/ArcOutering.java	(revision 0)
+++ petri/src/main/ArcOutering.java	(revision 2)
@@ -0,0 +1,55 @@
+package main;
+
+public class ArcOutering extends Arc{
+	
+	private int value;
+
+	public ArcOutering(Place place, int value) {
+		super(place);
+		this.value=value;
+	}
+	public String toString() {
+		return "ArcOutering value:"+value+", "+this.getPlace();
+	}
+	
+	public void doTransition() {
+		this.getPlace().changeToken(this.value*(-1));
+	}
+	
+	public boolean isActive() {
+		return true;
+	}
+	
+	public boolean isPullable() {
+		return (this.getPlace().getToken()>=value);
+	}
+	public static void main(String[] args) {
+		System.out.println("TEST METHODS ARCOUTERING");
+		
+		System.out.println(" => method isActive()");
+		Place emptyPlace = new Place(0);
+		ArcOutering arco = new ArcOutering(emptyPlace, 3);
+		System.out.println("true : "+arco.isActive());
+
+	
+		System.out.println(" => method isPullable()");
+		Place place3 = new Place(3);
+		ArcOutering arco2 = new ArcOutering(place3, 2);
+		ArcOutering arco4 = new ArcOutering(place3, 4);
+		System.out.println(arco2);
+		System.out.println("true : "+arco2.isPullable());
+		System.out.println(arco4);
+		System.out.println("false : "+arco4.isPullable());
+		
+		System.out.println(" => method doTranstion()");
+		System.out.println("before : "+arco2);
+		arco2.doTransition();
+		System.out.println("after  : "+arco2);
+		System.out.println(" => method equals()");
+		// the method equals is test here because arc is an abstract method
+		System.out.println("true : "+arco2.equals(arco2));
+		System.out.println("false : "+arco2.equals(arco4));
+	}
+
+
+}

Property changes on: petri/src/main/ArcOutering.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/src/main/Place.java
===================================================================
--- petri/src/main/Place.java	(revision 0)
+++ petri/src/main/Place.java	(revision 2)
@@ -0,0 +1,57 @@
+package main;
+
+public class Place {
+	
+	private int token;
+	
+	public Place(int token) {
+		this.token=token;
+	}
+	
+	public int getToken() {
+		return this.token;
+	}
+	public String toString() {
+		return "Place Token : "+token;
+	}
+	
+	public boolean isEmpty() {
+		return (this.token==0);
+	}
+	
+	public void changeToken(int i) {
+		token += i;
+	}
+	
+	public boolean equals(Object o) {
+		if((o instanceof Place) &&(System.identityHashCode(((Place)o))==System.identityHashCode(this))) {
+			return true;
+		}
+		else {
+			return false;
+		}
+	}
+	public static void main(String[] args) {
+		System.out.println("TEST METHODS PLACE");
+		
+		System.out.println(" => method isEmpty()");
+		Place emptyPlace = new Place(0);
+		System.out.println("true : "+emptyPlace.isEmpty());
+		Place notEmptyPlace = new Place(2);
+		System.out.println("true : "+notEmptyPlace.isEmpty());
+	
+		System.out.println(" => method changeToken(int i)");
+		Place place3 = new Place(3);
+		place3.changeToken(5);
+		System.out.println("3 + 5 = "+place3.getToken());
+		place3.changeToken(-4);
+		System.out.println("8 - 4 = "+place3.getToken());
+		
+		System.out.println(" => method equals()");
+		Place place1 = new Place(0);
+		Place place2 = new Place(0);
+		System.out.println("true : "+place1.equals(place1));
+		System.out.println("false : "+place1.equals(place2));
+	}
+
+}

Property changes on: petri/src/main/Place.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/src/main/Arc.java
===================================================================
--- petri/src/main/Arc.java	(revision 0)
+++ petri/src/main/Arc.java	(revision 2)
@@ -0,0 +1,24 @@
+package main;
+
+public abstract class Arc implements ArcInterface {
+	
+	private Place place;
+	
+	public Arc(Place place) {
+		this.place=place;
+	}
+	
+	public Place getPlace() {
+		return this.place;
+	}
+	public boolean equals(Object o) {
+		if((o instanceof Arc) &&(System.identityHashCode(((Arc)o))==System.identityHashCode(this))) {
+			return true;
+		}
+		else {
+			return false;
+		}
+		
+	}
+
+}

Property changes on: petri/src/main/Arc.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/src/main/ArcZero.java
===================================================================
--- petri/src/main/ArcZero.java	(revision 0)
+++ petri/src/main/ArcZero.java	(revision 2)
@@ -0,0 +1,48 @@
+package main;
+
+public class ArcZero extends ArcOutering {
+	
+	public ArcZero(Place place, int value) {
+		super(place, value);
+		// TODO Auto-generated constructor stub
+	}
+	
+	public void doTransition() {
+	}
+	public boolean isActive() {
+		return (this.getPlace().getToken()==0);
+	}
+	public boolean isPullable() {
+		return this.isActive();
+	}
+	public String toString() {
+		return "ArcZero, "+this.getPlace(); 
+	}
+	public static void main(String[] args) {
+		System.out.println("TEST METHODS ARCZERO");
+		
+		System.out.println(" => method isActive()");
+		Place emptyPlace = new Place(0);
+		ArcZero arcc1 = new ArcZero(emptyPlace,2);
+		Place place3 = new Place(3);
+		ArcZero arcc2 = new ArcZero(place3,2);
+		System.out.println(arcc1);
+		System.out.println("true : "+arcc1.isActive());
+		System.out.println(arcc2);
+		System.out.println("false : "+arcc2.isActive());
+
+	
+		System.out.println(" => method isPullable()");
+		System.out.println(arcc1);
+		System.out.println("false : "+arcc1.isPullable());
+		System.out.println(arcc2);
+		System.out.println("true : "+arcc2.isPullable());
+
+		System.out.println(" => method doTranstion()");
+		System.out.println("before : "+arcc2);
+		arcc2.doTransition();
+		System.out.println("after  : "+arcc2);
+
+	}
+
+}

Property changes on: petri/src/main/ArcZero.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/src/main/ArcInterface.java
===================================================================
--- petri/src/main/ArcInterface.java	(revision 0)
+++ petri/src/main/ArcInterface.java	(revision 2)
@@ -0,0 +1,9 @@
+package main;
+
+public interface ArcInterface {
+	
+	public void doTransition();
+	public boolean isPullable();
+	public boolean isActive();
+
+}

Property changes on: petri/src/main/ArcInterface.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/src/main/Network.java
===================================================================
--- petri/src/main/Network.java	(revision 0)
+++ petri/src/main/Network.java	(revision 2)
@@ -0,0 +1,173 @@
+package main;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Network {
+	public static int ArcOutering = 2;
+	public static int ArcCleaner = 1;
+	public static int ArcZero = 0;
+	public static int ArcEntering = 3;
+	
+	private List<Place> placeList;
+	private List<Transition> listTransition;	
+	public Network() {
+		this.placeList=new ArrayList<Place>();
+		this.listTransition=new ArrayList<Transition>();
+
+	}
+
+
+	public void addTransition() {
+		Transition transition = new Transition();
+		listTransition.add(transition);
+	}
+	public void addPlace(int value) {
+		Place place = new Place(value);
+		placeList.add(place);
+	}
+
+	public void addArc(Transition transition, Place place, int value, int identifier) {
+
+		if (identifier==ArcZero) {
+			transition.getArcList().add(new ArcZero(place, value));
+		}
+		else if(identifier==ArcCleaner) {
+			transition.getArcList().add(new ArcCleaner(place));
+		}
+		else if(identifier==ArcOutering) {
+			transition.getArcList().add(new ArcOutering(place,value));			
+		}else if(identifier==ArcEntering) {
+			transition.getArcList().add( new ArcEntering(place,value));
+		}
+
+	}
+	public void deleteArc(Arc a) {
+		for(Transition transition: listTransition) {
+			for(Arc arc:transition.getArcList()) {
+				if(arc.equals(a)) {
+					transition.getArcList().remove(arc);
+				}
+			}
+			
+		}
+
+	}
+	
+	public void deletePlace( Place place) {
+		for(Transition transition: listTransition) {
+			for(Arc arc:transition.getArcList()) {
+				if(arc.getPlace().equals(place)) {
+					deleteArc( arc);
+					placeList.remove(place);
+				}
+			}
+			
+		}
+		
+	}
+	
+	public void deleteTransition(Transition transition) {
+	
+		listTransition.remove(transition);
+	}
+
+	public void fire(Transition transition) {
+		if (transition.isPullable()==true) {
+			transition.doTransition();
+		}
+	}
+	public String toString() {
+		String res= "[";
+		for(int i=0;listTransition.size()>i;i++ ) {
+			res=res+"transtion "+i+" :"+listTransition.get(i).toString()+", ";
+		}
+		res=res+"]";
+		return res;
+	}
+	public static void main(String[] args) {
+		
+		Network n0=new Network();
+		n0.addPlace(5);
+		n0.addPlace(4);
+		n0.addTransition();
+		n0.addArc(n0.listTransition.get(0), n0.placeList.get(0), 2, ArcEntering);
+		n0.addArc(n0.listTransition.get(0), n0.placeList.get(1), 2, ArcOutering);
+		System.out.println("");
+		System.out.println("TEST 1 une transtion, un arcOutering un arcEntering");
+		System.out.println("");
+		System.out.println("situtation initial : ");
+		System.out.println(n0);
+		
+		System.out.println("fire 1 : ");
+		n0.fire(n0.listTransition.get(0));
+		System.out.println(n0);
+		
+		System.out.println("fire 2 : ");
+		n0.fire(n0.listTransition.get(0));
+		System.out.println(n0);
+		
+		System.out.println("fire 3 : ");
+		n0.fire(n0.listTransition.get(0));
+		System.out.println(n0);
+		
+		
+		Network n3=new Network();
+		n3.addPlace(5);
+		n3.addPlace(4);
+		n3.addTransition();
+		n3.addArc(n3.listTransition.get(0), n3.placeList.get(0), 2, ArcEntering);
+		n3.addArc(n3.listTransition.get(0), n3.placeList.get(1), 2, ArcOutering);
+		System.out.println("");
+		System.out.println("TEST 2 delete place ");
+		System.out.println("");
+		System.out.println("BEFORE :");
+		System.out.println(n3);
+		System.out.println(n3.placeList);
+		n3.deletePlace(n3.placeList.get(0));
+		System.out.println("AFTER :");
+		System.out.println(n3);
+		System.out.println(n3.placeList);
+		
+		Network n1=new Network();
+		n1.addPlace(5);
+		n1.addPlace(4);
+		n1.addTransition();
+		n1.addArc(n1.listTransition.get(0), n1.placeList.get(0), 2, ArcEntering);
+		n1.addArc(n1.listTransition.get(0), n1.placeList.get(1), 2, ArcOutering);
+		
+		System.out.println("");
+		System.out.println("TEST 3 delete arc ");
+		System.out.println("");
+		System.out.println("BEFORE :");
+		System.out.println(n1);
+		System.out.println("liste des place :"+n1.placeList);
+		n1.deleteArc(n1.listTransition.get(0).getArcList().get(0));
+		System.out.println("AFTER :");
+		System.out.println(n1);
+		System.out.println("liste des place :"+n1.placeList);
+		
+		Network n2=new Network();
+		n2.addPlace(5);
+		n2.addPlace(4);
+		n2.addTransition();
+		n2.addArc(n2.listTransition.get(0), n2.placeList.get(0), 2, ArcEntering);
+		n2.addArc(n2.listTransition.get(0), n2.placeList.get(1), 2, ArcOutering);
+		
+		System.out.println("");
+		System.out.println("TEST 4 delete transition ");
+		System.out.println("");
+		System.out.println("BEFORE :");
+		System.out.println(n2);
+		System.out.println("liste des place :"+n2.placeList);
+		n2.deleteTransition(n2.listTransition.get(0));
+		System.out.println("AFTER :");
+		System.out.println(n2);
+		System.out.println("liste des place :"+n2.placeList);
+		
+		
+
+	}
+
+}

Property changes on: petri/src/main/Network.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/src/main/Transition.java
===================================================================
--- petri/src/main/Transition.java	(revision 0)
+++ petri/src/main/Transition.java	(revision 2)
@@ -0,0 +1,70 @@
+package main;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Transition {
+	
+	
+	private List<Arc> arcList;
+	
+	public String toString() {
+		String res= " [";
+		for(int i=0;arcList.size()>i;i++ ) {
+			res=res+arcList.get(i).toString()+" // ";
+		}
+		res=res+"] ";
+		return res;
+	}
+
+	public Transition() {
+		this.arcList=new ArrayList<Arc>();
+	}
+	
+
+	public boolean isPullable() {
+		int i=0;
+		boolean res=true;
+		while(i<this.arcList.size() && res==true) {
+			res=this.arcList.get(i).isPullable();
+			i=i+1;
+		}
+		return res;
+	}
+	
+	public void doTransition() {
+		if (this.isPullable()==true) {
+			for (int i=0; i<arcList.size();i++) {
+				arcList.get(i).doTransition();
+			}
+		}
+	}
+	public List<Arc> getArcList(){
+		return this.arcList;
+	}
+	public static void main(String[] args) {
+		System.out.println("TEST METHODS TRANSITION");
+		
+		Transition t1=new Transition();
+		t1.arcList.add(new ArcOutering(new Place(4), 2));
+		t1.arcList.add(new ArcEntering(new Place(4), 1));
+
+		Transition t2=new Transition();
+		t2.arcList.add(new ArcOutering(new Place(2), 3));
+		t2.arcList.add(new ArcEntering(new Place(2), 3));
+	
+		System.out.println(" => method isPullable()");
+
+		System.out.println(t1);
+		System.out.println("true : "+t1.isPullable());
+		System.out.println(t2);
+		System.out.println("false : "+t2.isPullable());
+		
+		System.out.println(" => method doTranstion()");
+		System.out.println("before : "+t1);
+		t1.doTransition();
+		System.out.println("after  : "+t1);
+
+
+	}
+}

Property changes on: petri/src/main/Transition.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/Readme.md
===================================================================
--- petri/Readme.md	(revision 0)
+++ petri/Readme.md	(revision 2)
@@ -0,0 +1,22 @@
+# Reseau de Petri
+binome 2 Sean/Amaury
+
+## Note de conception
+Nous avons procédé à quelques modification par rapport a notre conception initiale.
+
+Ainsi nous avons ajouté une methode *equals* aux classes arc et place. Ces methodes servent pour deleteArc() et deletePLace()
+
+Nous avons également rajouté des methodes *toString* afin d'avoir une meilleur visibilité pour nos tests.
+
+Nous avons aussi déclaré des constante ArcEntering, ArcOutering, qui sont des entier pour que lors de la declaration des arc le choix soit clair.
+
+## Execution du code
+Nous avons réalisé des tests "manuel" pour chaque classe et leurs methodes réspectivent. Pour les excuter il *faut executer la methode main de la classe*.
+
+
+**Liste des tests effectuées :**
+* place: changeToken(int i), isempty(), equals(),
+* pour chaque classe Arc : isAtcive(), isPullable(), doTranstion() et equals(),
+* transition : isPullable(),doTransition(),
+* network : cas simple a 2 arc et 1 une transition, deletPlace(place),deleteArc(arc), deleteTransition(transtion), et les methodes add
+
Index: petri/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- petri/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ petri/.settings/org.eclipse.jdt.core.prefs	(revision 2)
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8

Property changes on: petri/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: petri/.classpath
===================================================================
--- petri/.classpath	(revision 0)
+++ petri/.classpath	(revision 2)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: petri/.classpath
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
