diff --git a/src/main/java/org/petriNet/Arc.java b/src/main/java/org/petriNet/Arc.java index f2248c3cf6abc53400a2dd002ff5abcd03a756ef..e30be0f851f7f25363a236e917d269b47e4e0811 100644 --- a/src/main/java/org/petriNet/Arc.java +++ b/src/main/java/org/petriNet/Arc.java @@ -5,47 +5,47 @@ public abstract class Arc { private int id; private Place place; private Transition transition; - private int poids; + private int weight; - public Arc(Transition transition, Place place, int poids, int id) { + public Arc(Transition transition, Place place, int weight, int id) { this.place = place; this.transition = transition; // verify that the weight is not negative - if (poids >= 0) { - this.poids = poids; + if (weight >= 0) { + this.weight = weight; } else { System.out.println("The weight cannot be negative."); } this.id = id; // Assign a unique ID with the generateId method in the ReseauPetri class } - public abstract void valider(); + public abstract void validate(); - public int getPoids(){ - return this.poids; - } ; + public int getWeight() { + return this.weight; + } - public int getId(){ + public int getId() { return this.id; - }; + } - public void setPoids(int poids){ - this.poids = poids; - }; + public void setWeight(int weight) { + this.weight = weight; + } - public Place getPlace(){ + public Place getPlace() { return this.place; - }; + } - public void setPlace(Place place){ + public void setPlace(Place place) { this.place = place; - }; + } - public Transition getTransition(){ + public Transition getTransition() { return this.transition; - }; + } - public void supprimerPlace(Place place) { + public void removePlace(Place place) { this.place = null; } } diff --git a/src/main/java/org/petriNet/Arc_ENTRANT.java b/src/main/java/org/petriNet/Arc_ENTRANT.java index 5ef376c2c35384cd767d00707c9dac6b0fab1b0a..59d0ff569016689c4a6ebcb737648b84b31d3348 100644 --- a/src/main/java/org/petriNet/Arc_ENTRANT.java +++ b/src/main/java/org/petriNet/Arc_ENTRANT.java @@ -25,13 +25,13 @@ public abstract class Arc_ENTRANT extends Arc { */ public boolean verifier_tirable() { - return this.getPlace().get_nombre_jetons() >= this.getPoids(); + return this.getPlace().get_nombre_jetons() >= this.getWeight(); } @Override - public void valider() { + public void validate() { // On retire le nombre de jetons du poids de l'arc - this.getPlace().enlever_jeton(this.getPoids()); + this.getPlace().enlever_jeton(this.getWeight()); } } \ No newline at end of file diff --git a/src/main/java/org/petriNet/Arc_SORTANT.java b/src/main/java/org/petriNet/Arc_SORTANT.java index c106470141709a02f35d225fe550184da7efaa89..44413ae9f9ad40a44311a4de686de55b2a4b6130 100644 --- a/src/main/java/org/petriNet/Arc_SORTANT.java +++ b/src/main/java/org/petriNet/Arc_SORTANT.java @@ -13,9 +13,9 @@ public class Arc_SORTANT extends Arc { @Override - public void valider() { + public void validate() { // On ajoute le nombre de jetons du poids de l'arc - this.getPlace().ajouter_jeton(this.getPoids()); + this.getPlace().ajouter_jeton(this.getWeight()); } } \ No newline at end of file diff --git a/src/main/java/org/petriNet/Arc_videur.java b/src/main/java/org/petriNet/Arc_videur.java index 3d5306056a2350c344b22833282c15507e9e4083..041068e043f2c21a61cc929541a311b8ef054beb 100644 --- a/src/main/java/org/petriNet/Arc_videur.java +++ b/src/main/java/org/petriNet/Arc_videur.java @@ -23,7 +23,7 @@ public class Arc_videur extends Arc_ENTRANT { } @Override - public void valider() { + public void validate() { // On retire le nombre de jetons du poids de l'arc // prendre en cond la place choisie this.getPlace().enlever_jeton(this.getPlace().get_nombre_jetons()); diff --git a/src/main/java/org/petriNet/ReseauPetri.java b/src/main/java/org/petriNet/ReseauPetri.java index 91041755aaa0f76f2a9712909b8d0c34480d8822..5da57000402b648c9ac49400607f3d8103a9a61c 100644 --- a/src/main/java/org/petriNet/ReseauPetri.java +++ b/src/main/java/org/petriNet/ReseauPetri.java @@ -194,13 +194,13 @@ public class ReseauPetri implements PetriNetService { * 1 transition * 2 arcs * Liste des places : - * 1 : place avec 4 jetons, 1 arc sortant, 0 arc entrant - * 2 : place avec 0 jetons, 0 arc sortant, 1 arc entrant + * 1 : place avec 4 jetons, 1 arc simple sortant, 0 arc simple entrant + * 2 : place avec 0 jetons, 0 arc simple sortant, 1 arc simple entrant * Liste des transitions * 1 : transition, 1 arc entrant, 1 arc sortant * Liste des arcs : - * 1 : arc poids 1 (place avec 4 jetons vers transition) - * 2 : arc poids 1 (transition vers place avec 0 jetons) + * 1 : arc simple poids 1 (place avec 4 jetons vers transition) + * 2 : arc simple poids 1 (transition vers place avec 0 jetons) */ System.out.println("Réseau de Petri"); @@ -227,7 +227,7 @@ public class ReseauPetri implements PetriNetService { } // entrants / sortants à la place System.out.println(place.getId() + " : place avec " + place.get_nombre_jetons() + " jetons, " - + arcs_ENTRANTS.size() + " arc sortant, " + arcs_SORTANTS.size() + " arc entrant"); + + arcs_ENTRANTS.size() + " arc simple sortant, " + arcs_SORTANTS.size() + " arc simple entrant"); } System.out.println("Liste des transitions :"); @@ -239,10 +239,10 @@ public class ReseauPetri implements PetriNetService { System.out.println("Liste des arcs :"); for (Arc arc : this.arcs) { if (arc instanceof Arc_ENTRANT) { - System.out.println(arc.getId() + " : arc poids " + arc.getPoids() + " (" + System.out.println(arc.getId() + " : arc simple poids " + arc.getPoids() + " (" + "Place d'Id " + arc.getPlace().getId() + " vers " + arc.getTransition().getNom() + ")"); } else { - System.out.println(arc.getId() + " : arc poids " + arc.getPoids() + " (" + System.out.println(arc.getId() + " : arc simple poids " + arc.getPoids() + " (" + arc.getTransition().getNom() + " vers " + "Place d'Id " + arc.getPlace().getId() + ")"); } } diff --git a/src/main/java/org/petriNet/Transition.java b/src/main/java/org/petriNet/Transition.java index 8d15c5ac2b400eedff833e320d65255af7bd00bd..0cb06754917312b8d1cc181469d8e382b0356a5e 100644 --- a/src/main/java/org/petriNet/Transition.java +++ b/src/main/java/org/petriNet/Transition.java @@ -93,11 +93,11 @@ public class Transition { if (tirable) { for (Arc_ENTRANT arc_ENTRANT : this.getArcs_ENTRANTS()) { - arc_ENTRANT.valider(); + arc_ENTRANT.validate(); } for (Arc_SORTANT arc_SORTANT : this.getArcs_SORTANTS()) { - arc_SORTANT.valider(); + arc_SORTANT.validate(); } System.out.println("Transition tirée avec succès"); }