diff --git a/DO.plantuml b/DO.plantuml deleted file mode 100644 index b98901e..0000000 --- a/DO.plantuml +++ /dev/null @@ -1,18 +0,0 @@ -@startuml -object "Liaison : l1" as l1 -object "Station : Melun" as melun -object "Liaison : l2" as l2 -object "Liaison : l3" as l3 -object "Station : Maison Alfort" as ma -object "Station : Vert de Maison" as vdm -object "Ligne : R" as ligner -object "Ligne : Rer D" as rerd -object "PAC : : MVM" as PACMVM -object "PS : Ligne Rer D" as pslignererD -object "PS : Ligne R" as pslignedr -object "PS : Ligne D" as psligned - -melun <-- l1 -garedelyon <-- l1 - -@enduml \ No newline at end of file diff --git a/DO.png b/DO.png deleted file mode 100644 index ab83685..0000000 Binary files a/DO.png and /dev/null differ diff --git a/DSsemaine2TDQuestion1.plantuml b/DSsemaine2TDQuestion1.plantuml deleted file mode 100644 index 9de2a5f..0000000 --- a/DSsemaine2TDQuestion1.plantuml +++ /dev/null @@ -1,21 +0,0 @@ --- Exemple tiré de la documentation --- utilie des abbréviations -@startuml -autonumber -participant "VueJardin:Pape14" as v -participant "Parcelle:p0" as p0 -participant "Parcelle:p1" as p1 -participant "Parcelle:p2" as p2 -participant "Parcelle:p3" as p3 -v -> p0 ++ : getSplit() -return V -v -> p0 ++ : getSecond() -return p1 -v -- -v -> p1 ++ : getSplit() -return V -v -> p1 ++ : reset() -p1 -> p2 !! : delete -p1 -> p3 !! : delete -return -@enduml diff --git a/TP1/DO_seri-khane.plantuml b/TP1/DO_seri-khane.plantuml new file mode 100644 index 0000000..bcef9d9 --- /dev/null +++ b/TP1/DO_seri-khane.plantuml @@ -0,0 +1,49 @@ +@startuml +scale 1.5 +object "Station : Melun" as melun +object "Station : Gare de Lyon" as garedelyon +object "Station : Maisons-Alfortville" as ma +object "Station : Vert de Maison" as vdm + +object "Liaison : l1" as l1 +object "Liaison : l2" as l2 +object "Liaison : l3" as l3 + +object "Ligne : R" as ligner +object "Ligne : RER D" as rerd + +object "PS : Parcours simple1" as ps1 +object "PS : Parcours simple2" as ps2 +object "PAC : Parcours complexe" as pc + +melun <-- "debut" l1 +garedelyon <-- "fin" l1 +garedelyon <-- "debut" l2 +ma <-- "fin" l2 +ma <-- "debut" l3 +vdm <-- "fin" l3 + +melun <-- "debut" ps1 +garedelyon <-- "fin" ps1 +garedelyon <-- "debut" ps2 +ma <-- "fin" ps2 +melun <-- "debut" pc +vdm <-- "fin" pc + +l1--o ligner +l1--o ps1 +l2--o rerd +l2--o ps2 +l3--o rerd +l3--o ps2 + +l1--> ligner +l2--> rerd +l3--> rerd + +ps1--> ligner +ps2--> rerd +pc o--ps1 +pc o--ps2 + +@enduml diff --git a/TP1/DO_seri-khane.png b/TP1/DO_seri-khane.png new file mode 100644 index 0000000..cc75864 Binary files /dev/null and b/TP1/DO_seri-khane.png differ diff --git a/TP1/plantuml.jar b/TP1/plantuml.jar new file mode 100644 index 0000000..52e0cfe Binary files /dev/null and b/TP1/plantuml.jar differ diff --git a/DSsemaine2TDQuestion1.svg b/TP2/DSsemaine2TDQuestion1.svg similarity index 100% rename from DSsemaine2TDQuestion1.svg rename to TP2/DSsemaine2TDQuestion1.svg diff --git a/TP2/DSsemaine2TDQuestion1_seri-khane.plantuml b/TP2/DSsemaine2TDQuestion1_seri-khane.plantuml new file mode 100644 index 0000000..8845d14 --- /dev/null +++ b/TP2/DSsemaine2TDQuestion1_seri-khane.plantuml @@ -0,0 +1,80 @@ +@startuml +autonumber + +' La vue affiche une parcelle donnée +participant "VueJardin:Pape14" as v +participant "Parcelle:p0" as p0 +participant "Parcelle:p1" as p1 +participant "Parcelle:p2" as p2 +participant "Parcelle:p3" as p3 +participant "Parcelle:p00" as p00 +participant "Parcelle:p4" as p4 +participant "Parcelle:p5" as p5 + +... setParcelleVisible : change la parcelle affichée ... +v -> v ++ : setParcelleVisible(p0) +v -- + +... getSplit : indique si la parcelle est découpée et comment ... +v -> p0 ++ : getSplit() +return V + +... getSecond : renvoie la seconde sous-parcelle issue d'une découpe ... +v -> p0 ++ : getSecond() +return p1 + +... getSplit : ici p1 n'est pas encore découpée ... +v -> p1 ++ : getSplit() +return null + +... split : découpe la parcelle en deux nouvelles parcelles ... +v -> p1 ++ : split(V) +create p2 +p1 -> p2 : new +create p3 +p1 -> p3 : new +return + +... reset : annule la découpe et supprime les sous-parcelles ... +v -> p1 ++ : reset() +p1 -> p2 !! : delete +p1 -> p3 !! : delete +return + +... split : nouvelle découpe, cette fois horizontale ... +v -> p1 ++ : split(H) +create p4 +p1 -> p4 : new +create p5 +p1 -> p5 : new +return + +... getParcelleMere : permet de revenir à la parcelle d'origine ... +v -> p1 ++ : getParcelleMere() +return p0 + +... setParcelleVisible : la vue revient sur p0 ... +v -> v ++ : setParcelleVisible(p0) +v -- + +... getFirst : renvoie la première sous-parcelle (ici p00) ... +v -> p0 ++ : getFirst() +return p00 + +... setParcelleVisible : la vue affiche maintenant p00 ... +v -> v ++ : setParcelleVisible(p00) +v -- + +... getLegume : renvoie le légume actuellement présent ... +v -> p00 ++ : getLegume() +return romaine + +... removeLegume : enlève la culture de la parcelle ... +v -> p00 ++ : removeLegume() +return + +... setLegume : plante un nouveau légume sur la parcelle ... +v -> p00 ++ : setLegume(epinards) +return + +@enduml diff --git a/TP2/DSsemaine2TDQuestion1_seri-khane.png b/TP2/DSsemaine2TDQuestion1_seri-khane.png new file mode 100644 index 0000000..237d812 Binary files /dev/null and b/TP2/DSsemaine2TDQuestion1_seri-khane.png differ diff --git a/TP2/Parcelle.java b/TP2/Parcelle.java new file mode 100644 index 0000000..ec9f53d --- /dev/null +++ b/TP2/Parcelle.java @@ -0,0 +1,28 @@ +public class Parcelle { + + private boolean estPrincipale; + private Parcelle parent; + private Parcelle[] sousparcelles = new Parcelle[2]; + private String legume; + private char orientation; + + public Parcelle(boolean estPrincipale) { + this.estPrincipale = estPrincipale; + } + + public Parcelle(Parcelle parent) { + this(false); // Appelle le constructeur principal + this.parent = parent; + } + + public char getSplit() { + return orientation; + } + + public Parcelle getFirst() { + if (orientation == 'V' || orientation == 'H') { + return sousparcelles[0]; + } + return null; + } +} diff --git a/Question1TP2.txt b/TP2/Question1TP2.txt similarity index 100% rename from Question1TP2.txt rename to TP2/Question1TP2.txt diff --git a/TP2/VueJardin.java b/TP2/VueJardin.java new file mode 100644 index 0000000..d24e3a2 --- /dev/null +++ b/TP2/VueJardin.java @@ -0,0 +1,16 @@ +import java.awt.*; +import javax.swing.*; + +public class VueJardin extends JFrame { + + private Parcelle parcelleactive; + + public VueJardin(Parcelle p1){ + super("Jardin"); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.setSize(500,500); + this.parcellevisible = p1; + this.setVisible(true); + } + +} \ No newline at end of file diff --git a/TP2/plantuml.jar b/TP2/plantuml.jar new file mode 100644 index 0000000..52e0cfe Binary files /dev/null and b/TP2/plantuml.jar differ diff --git a/TP03_Exo4.plantuml b/TP3/TP03_Exo4.plantuml similarity index 100% rename from TP03_Exo4.plantuml rename to TP3/TP03_Exo4.plantuml diff --git a/TP4/Exemple.java b/TP4/Exemple.java deleted file mode 100644 index 1f5eafd..0000000 --- a/TP4/Exemple.java +++ /dev/null @@ -1,21 +0,0 @@ -public class Exemple { - public static void main(String[] args) { - - MonBrin brin = new MonBrin(); - - brin.ajouterFin(Base.G); - brin.ajouterFin(Base.C); - brin.ajouterFin(Base.T); - brin.ajouterFin(Base.T); - brin.ajouterFin(Base.A); - brin.ajouterFin(Base.G); - - System.out.println(brin); // gcttag - - - Iterator it = brin.iterator(); - while(it.hasNext()) { - System.out.println(it.next()); - } - } -} diff --git a/TP4/Exo0/Base.class b/TP4/Exo0/Base.class new file mode 100644 index 0000000..eab34f6 Binary files /dev/null and b/TP4/Exo0/Base.class differ diff --git a/TP4/Base.java b/TP4/Exo0/Base.java similarity index 100% rename from TP4/Base.java rename to TP4/Exo0/Base.java diff --git a/TP4/Exo0/Exemple.class b/TP4/Exo0/Exemple.class new file mode 100644 index 0000000..2325f06 Binary files /dev/null and b/TP4/Exo0/Exemple.class differ diff --git a/TP4/Exo0/Exemple.java b/TP4/Exo0/Exemple.java new file mode 100644 index 0000000..43ccc8b --- /dev/null +++ b/TP4/Exo0/Exemple.java @@ -0,0 +1,29 @@ + +public class Exemple{ + public static void main(String[] args) { + // codon GCT code l'analine https://en.wikipedia.org/wiki/DNA_codon_table + // stop codon TAG, voir https://en.wikipedia.org/wiki/Stop_codon + + System.out.println("construction du brin GCTTAG"); + MonMaillon l = new MonMaillon(Base.G); + l = new MonMaillon(Base.A,l); + l = new MonMaillon(Base.T,l); + l = new MonMaillon(Base.T,l); + l = new MonMaillon(Base.C,l); + l = new MonMaillon(Base.G,l); + + MonBrin b = new MonBrin(l); + + System.out.println("l'affichage par défaut du brin ne va pas vous plaire"); + System.out.println(b.toString()); + + System.out.println("Affichage en parcourant les éléments un par un"); + System.out.println("Utilisez cette logique pour implémenter l'interface Iterator de java.util"); + MonMaillon actuel = b.getDebut(); + + while (actuel != null){ + System.out.println(actuel.getBase()); + actuel = actuel.getApresMaillon(); + } + } +} diff --git a/TP4/Exo0/MonBrin.class b/TP4/Exo0/MonBrin.class new file mode 100644 index 0000000..a8867c9 Binary files /dev/null and b/TP4/Exo0/MonBrin.class differ diff --git a/TP4/Exo0/MonBrin.java b/TP4/Exo0/MonBrin.java new file mode 100644 index 0000000..70c10c1 --- /dev/null +++ b/TP4/Exo0/MonBrin.java @@ -0,0 +1,27 @@ +public class MonBrin { + // Attribut privé qui représente le début du brin (chaîne de maillons) + private MonMaillon debut; + + /** + * Constructeur de la classe MonBrin. + * Ce constructeur initialise un brin à partir du premier maillon donné en paramètre. + * + * @param p Le premier maillon du brin + */ + public MonBrin(MonMaillon p) { + // Associe le maillon donné au début du brin + this.debut = p; + // throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + /** + * Méthode getter pour obtenir le premier maillon du brin. + * + * @return Le maillon qui représente le début du brin + */ + public MonMaillon getDebut() { + // Retourne le maillon stocké dans l'attribut debut + return this.debut; + // throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } +} \ No newline at end of file diff --git a/TP4/Exo0/MonMaillon.class b/TP4/Exo0/MonMaillon.class new file mode 100644 index 0000000..9577de6 Binary files /dev/null and b/TP4/Exo0/MonMaillon.class differ diff --git a/TP4/Exo0/MonMaillon.java b/TP4/Exo0/MonMaillon.java new file mode 100644 index 0000000..860cf02 --- /dev/null +++ b/TP4/Exo0/MonMaillon.java @@ -0,0 +1,30 @@ + +public class MonMaillon { + private Base valeur; + private MonMaillon suivant; + //Le constructeur de base retourne un brin à une base; + public MonMaillon(Base b){ + this.valeur = b; + //throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + // Le constructeur évolué ajoute une base à un brin. + public MonMaillon(Base b, MonMaillon l){ + this.valeur = b; + this.suivant = l; + //throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public Base getBase(){ + return this.valeur; + //throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public MonMaillon getApresMaillon(){ + return this.suivant; + //throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + +} + + diff --git a/TP4/Exo1/1Iterable/Base.class b/TP4/Exo1/1Iterable/Base.class new file mode 100644 index 0000000..bbba20c Binary files /dev/null and b/TP4/Exo1/1Iterable/Base.class differ diff --git a/TP4/Exo1/1Iterable/Base.java b/TP4/Exo1/1Iterable/Base.java new file mode 100644 index 0000000..5e6a4cf --- /dev/null +++ b/TP4/Exo1/1Iterable/Base.java @@ -0,0 +1,4 @@ +// juste un type énuméré pour nommer les bases +public enum Base { + A,C,G,T +} diff --git a/TP4/Exo1/1Iterable/Exemple.class b/TP4/Exo1/1Iterable/Exemple.class new file mode 100644 index 0000000..303a7f8 Binary files /dev/null and b/TP4/Exo1/1Iterable/Exemple.class differ diff --git a/TP4/Exo1/1Iterable/Exemple.java b/TP4/Exo1/1Iterable/Exemple.java new file mode 100644 index 0000000..3d1c98f --- /dev/null +++ b/TP4/Exo1/1Iterable/Exemple.java @@ -0,0 +1,47 @@ +// Fichier Exemple pour le second exercice sur l'ADN + +public class Exemple { + public static void main(String[] args) { + // codon GCT code l'analine https://en.wikipedia.org/wiki/DNA_codon_table + // stop codon TAG, voir https://en.wikipedia.org/wiki/Stop_codon + + System.out.println("construction du brin GCTTAG"); + MonMaillon l = new MonMaillon(Base.G); + l = new MonMaillon(Base.A, l); + l = new MonMaillon(Base.T, l); + l = new MonMaillon(Base.T, l); + l = new MonMaillon(Base.C, l); + l = new MonMaillon(Base.G, l); + + MonBrin b = new MonBrin(l); + + System.out.println("l'affichage par défaut du brin ne va pas vous plaire"); + System.out.println(b.toString()); + + System.out.println("On peut maintenant afficher en itérant avec un while comme ceci"); + + while (b.hasNext()) { + System.out.println(b.next()); + } + + // Simulation de plusieurs navigations successives + System.out.println("Navigation successive avec l'index secondaire :"); + while (b.hasNextSecondaire()) { + System.out.println(b.nextSecondaire()); + } + + System.out.println("Navigation successive avec l'index tertiaire :"); + while (b.hasNextTertiaire()) { + System.out.println(b.nextTertiaire()); + } + + // Simulation de plusieurs navigations simultanées + System.out.println("Navigation simultanée :"); + if (b.hasNextSecondaire()) + System.out.println("Secondaire: " + b.nextSecondaire()); + if (b.hasNextTertiaire()) + System.out.println("Tertiaire: " + b.nextTertiaire()); + if (b.hasNextSecondaire()) + System.out.println("Secondaire: " + b.nextSecondaire()); + } +} diff --git a/TP4/Exo1/1Iterable/MonBrin.class b/TP4/Exo1/1Iterable/MonBrin.class new file mode 100644 index 0000000..46c3a33 Binary files /dev/null and b/TP4/Exo1/1Iterable/MonBrin.class differ diff --git a/TP4/Exo1/1Iterable/MonBrin.java b/TP4/Exo1/1Iterable/MonBrin.java new file mode 100644 index 0000000..6058b77 --- /dev/null +++ b/TP4/Exo1/1Iterable/MonBrin.java @@ -0,0 +1,72 @@ +import java.util.Iterator; +import java.util.NoSuchElementException; +/** + MonBrin code un brin d'ADN sous forme de liste simplement chaînée. + + Plusieurs instances de MonMaillon reliées convenablement forment une structure de liste simplement chaînée contenant pour chaque maillon le nom de la base. + + On n'utilise pas java.util et on recode tout. + + Cette version a un problème : la structuration et la navigation sont dans la même classe. +*/ +public class MonBrin implements Iterator{ + + private MonMaillon premier; + private MonMaillon index; + /** + * Autres index pour d'autres personnes qui naviguent + */ + private MonMaillon secondaire; + private MonMaillon tertiaire; + + //Le constructeur fabrique un brin à partir du premier maillon p; + public MonBrin(MonMaillon p){ + this.premier = p; + this.index = p; + this.secondaire = p; + this.tertiaire = p; + } + + public MonMaillon getDebut(){ + return this.premier; + } + + @Override + public boolean hasNext(){ + return index != null; + } + + @Override + public Base next() { + if(this.index == null) throw new NoSuchElementException(); + + Base b = index.getBase(); + index = index.getSuiteMaillon(); + return b; + } + + public boolean hasNextSecondaire(){ + return secondaire != null; + } + + public Base nextSecondaire() { + if(this.secondaire == null) throw new NoSuchElementException(); + + Base b = secondaire.getBase(); + secondaire = secondaire.getSuiteMaillon(); + return b; + } + + public boolean hasNextTertiaire(){ + return tertiaire != null; + } + + public Base nextTertiaire() { + if(this.tertiaire == null) throw new NoSuchElementException(); + + Base b = tertiaire.getBase(); + tertiaire = tertiaire.getSuiteMaillon(); + return b; + } + +} diff --git a/TP4/Exo1/1Iterable/MonMaillon.class b/TP4/Exo1/1Iterable/MonMaillon.class new file mode 100644 index 0000000..9a997c9 Binary files /dev/null and b/TP4/Exo1/1Iterable/MonMaillon.class differ diff --git a/TP4/Exo1/1Iterable/MonMaillon.java b/TP4/Exo1/1Iterable/MonMaillon.java new file mode 100644 index 0000000..030d660 --- /dev/null +++ b/TP4/Exo1/1Iterable/MonMaillon.java @@ -0,0 +1,31 @@ +/** + * La classe MonMaillon représente un élément d'une chaîne d'ADN. + * Chaque maillon contient une base et une référence au maillon suivant. + */ +public class MonMaillon { + + private Base contenu; + private MonMaillon suivant; + + // Constructeur pour créer un maillon avec une seule base. + public MonMaillon(Base base) { + contenu = base; + suivant = null; + } + + // Constructeur pour créer un maillon et le relier à un autre maillon. + public MonMaillon(Base base, MonMaillon prochain) { + contenu = base; + suivant = prochain; + } + + // Retourne la base contenue dans ce maillon. + public Base obtenirBase() { + return contenu; + } + + // Retourne le maillon suivant dans la chaîne. + public MonMaillon obtenirSuivant() { + return suivant; + } +} diff --git a/TP4/MonBrin.java b/TP4/MonBrin.java deleted file mode 100644 index 4707f60..0000000 --- a/TP4/MonBrin.java +++ /dev/null @@ -1,48 +0,0 @@ -public class MonBrin { - private MonMaillon head; - - public MonBrin() { - this.head = null; - } - - // Ajouter une base au début du brin - public void ajouterDebut(Base b) { - head = new MonMaillon(b, head); - } - - // Ajouter une base à la fin du brin - public void ajouterFin(Base b) { - if (head == null) { - head = new MonMaillon(b, null); - return; - } - - MonMaillon courant = head; - while (courant.getNext() != null) { - courant = courant.getNext(); - } - - courant.setNext(new MonMaillon(b, null)); - } - - public MonMaillon getHead() { - return head; - } - - // Fournir un itérateur maison - public Iterator iterator() { - return new MonBrinIterator(this.head); - } - - // Pour affichage du brin entier - @Override - public String toString() { - String s = ""; - MonMaillon courant = head; - while (courant != null) { - s += courant.getBase().toString(); - courant = courant.getNext(); - } - return s.toLowerCase(); // affiche : gcttag - } -} diff --git a/TP4/MonMaillon.java b/TP4/MonMaillon.java deleted file mode 100644 index b186fd9..0000000 --- a/TP4/MonMaillon.java +++ /dev/null @@ -1,21 +0,0 @@ -public class MonMaillon { - private Base base; - private MonMaillon next; - - public MonMaillon(Base b, MonMaillon suivant) { - this.base = b; - this.next = suivant; - } - - public Base getBase() { - return base; - } - - public MonMaillon getNext() { - return next; - } - - public void setNext(MonMaillon n) { - this.next = n; - } -}