diff --git a/DEV/DEV3.1/TP01/Exercise1/Database.java b/DEV/DEV3.1/TP_Genericity/Exercise1/Database.java similarity index 100% rename from DEV/DEV3.1/TP01/Exercise1/Database.java rename to DEV/DEV3.1/TP_Genericity/Exercise1/Database.java diff --git a/DEV/DEV3.1/TP01/Exercise1/Main.java b/DEV/DEV3.1/TP_Genericity/Exercise1/Main.java similarity index 100% rename from DEV/DEV3.1/TP01/Exercise1/Main.java rename to DEV/DEV3.1/TP_Genericity/Exercise1/Main.java diff --git a/DEV/DEV3.1/TP01/Exercise1/Vote.java b/DEV/DEV3.1/TP_Genericity/Exercise1/Vote.java similarity index 100% rename from DEV/DEV3.1/TP01/Exercise1/Vote.java rename to DEV/DEV3.1/TP_Genericity/Exercise1/Vote.java diff --git a/DEV/DEV3.1/TP01/Exercise1/Votes.java b/DEV/DEV3.1/TP_Genericity/Exercise1/Votes.java similarity index 100% rename from DEV/DEV3.1/TP01/Exercise1/Votes.java rename to DEV/DEV3.1/TP_Genericity/Exercise1/Votes.java diff --git a/DEV/DEV3.1/TP01/Exercise1/data.sql b/DEV/DEV3.1/TP_Genericity/Exercise1/data.sql similarity index 100% rename from DEV/DEV3.1/TP01/Exercise1/data.sql rename to DEV/DEV3.1/TP_Genericity/Exercise1/data.sql diff --git a/DEV/DEV3.1/TP01/Exercise1/start.sh b/DEV/DEV3.1/TP_Genericity/Exercise1/start.sh similarity index 100% rename from DEV/DEV3.1/TP01/Exercise1/start.sh rename to DEV/DEV3.1/TP_Genericity/Exercise1/start.sh diff --git a/DEV/DEV3.1/TP01/Exercise2/Database.java b/DEV/DEV3.1/TP_Genericity/Exercise2/Database.java similarity index 100% rename from DEV/DEV3.1/TP01/Exercise2/Database.java rename to DEV/DEV3.1/TP_Genericity/Exercise2/Database.java diff --git a/DEV/DEV3.1/TP01/Exercise2/Main.java b/DEV/DEV3.1/TP_Genericity/Exercise2/Main.java similarity index 100% rename from DEV/DEV3.1/TP01/Exercise2/Main.java rename to DEV/DEV3.1/TP_Genericity/Exercise2/Main.java diff --git a/DEV/DEV3.1/TP01/Exercise2/ScoreBoardWindow.java b/DEV/DEV3.1/TP_Genericity/Exercise2/ScoreBoardWindow.java similarity index 100% rename from DEV/DEV3.1/TP01/Exercise2/ScoreBoardWindow.java rename to DEV/DEV3.1/TP_Genericity/Exercise2/ScoreBoardWindow.java diff --git a/DEV/DEV3.1/TP03/Exercise1/GridWindow.java b/DEV/DEV3.1/TP_List/Exercise1/GridWindow.java similarity index 100% rename from DEV/DEV3.1/TP03/Exercise1/GridWindow.java rename to DEV/DEV3.1/TP_List/Exercise1/GridWindow.java diff --git a/DEV/DEV3.1/TP03/Exercise1/GridWindowClosedEvent.java b/DEV/DEV3.1/TP_List/Exercise1/GridWindowClosedEvent.java similarity index 100% rename from DEV/DEV3.1/TP03/Exercise1/GridWindowClosedEvent.java rename to DEV/DEV3.1/TP_List/Exercise1/GridWindowClosedEvent.java diff --git a/DEV/DEV3.1/TP03/Exercise1/Main.java b/DEV/DEV3.1/TP_List/Exercise1/Main.java similarity index 100% rename from DEV/DEV3.1/TP03/Exercise1/Main.java rename to DEV/DEV3.1/TP_List/Exercise1/Main.java diff --git a/DEV/DEV3.1/TP03/Exercise2/Champ.java b/DEV/DEV3.1/TP_List/Exercise2/Champ.java similarity index 100% rename from DEV/DEV3.1/TP03/Exercise2/Champ.java rename to DEV/DEV3.1/TP_List/Exercise2/Champ.java diff --git a/DEV/DEV3.1/TP03/Exercise2/Database.java b/DEV/DEV3.1/TP_List/Exercise2/Database.java similarity index 100% rename from DEV/DEV3.1/TP03/Exercise2/Database.java rename to DEV/DEV3.1/TP_List/Exercise2/Database.java diff --git a/DEV/DEV3.1/TP03/Exercise2/Main.java b/DEV/DEV3.1/TP_List/Exercise2/Main.java similarity index 100% rename from DEV/DEV3.1/TP03/Exercise2/Main.java rename to DEV/DEV3.1/TP_List/Exercise2/Main.java diff --git a/DEV/DEV3.1/TP03/Exercise2/schema.sql b/DEV/DEV3.1/TP_List/Exercise2/schema.sql similarity index 100% rename from DEV/DEV3.1/TP03/Exercise2/schema.sql rename to DEV/DEV3.1/TP_List/Exercise2/schema.sql diff --git a/DEV/DEV3.1/TP_Queue/Exercise1/SortedQueue.java b/DEV/DEV3.1/TP_Queue/Exercise1/SortedQueue.java new file mode 100644 index 0000000..e69de29 diff --git a/DEV/DEV3.1/TP_Queue/Exercise2/CustomQueue.java b/DEV/DEV3.1/TP_Queue/Exercise2/CustomQueue.java new file mode 100644 index 0000000..888f81d --- /dev/null +++ b/DEV/DEV3.1/TP_Queue/Exercise2/CustomQueue.java @@ -0,0 +1,6 @@ +import java.util.AbstractQueue; +import java.util.Collection; + +public class CustomQueue extends AbstractQueue { + +} diff --git a/DEV/DEV3.1/TP02/.DS_Store b/DEV/DEV3.1/TP_Recursion/.DS_Store similarity index 100% rename from DEV/DEV3.1/TP02/.DS_Store rename to DEV/DEV3.1/TP_Recursion/.DS_Store diff --git a/DEV/DEV3.1/TP02/Part1/ClickSwapImageEvent.java b/DEV/DEV3.1/TP_Recursion/Part1/ClickSwapImageEvent.java similarity index 100% rename from DEV/DEV3.1/TP02/Part1/ClickSwapImageEvent.java rename to DEV/DEV3.1/TP_Recursion/Part1/ClickSwapImageEvent.java diff --git a/DEV/DEV3.1/TP02/Part1/ImageManager.java b/DEV/DEV3.1/TP_Recursion/Part1/ImageManager.java similarity index 100% rename from DEV/DEV3.1/TP02/Part1/ImageManager.java rename to DEV/DEV3.1/TP_Recursion/Part1/ImageManager.java diff --git a/DEV/DEV3.1/TP02/Part1/ImageWindow.java b/DEV/DEV3.1/TP_Recursion/Part1/ImageWindow.java similarity index 100% rename from DEV/DEV3.1/TP02/Part1/ImageWindow.java rename to DEV/DEV3.1/TP_Recursion/Part1/ImageWindow.java diff --git a/DEV/DEV3.1/TP02/Part1/Main.java b/DEV/DEV3.1/TP_Recursion/Part1/Main.java similarity index 100% rename from DEV/DEV3.1/TP02/Part1/Main.java rename to DEV/DEV3.1/TP_Recursion/Part1/Main.java diff --git a/DEV/DEV3.1/TP02/Part2/ApprovedButtonPressedEvent.java b/DEV/DEV3.1/TP_Recursion/Part2/ApprovedButtonPressedEvent.java similarity index 100% rename from DEV/DEV3.1/TP02/Part2/ApprovedButtonPressedEvent.java rename to DEV/DEV3.1/TP_Recursion/Part2/ApprovedButtonPressedEvent.java diff --git a/DEV/DEV3.1/TP02/Part2/CancelButtonPressedEvent.java b/DEV/DEV3.1/TP_Recursion/Part2/CancelButtonPressedEvent.java similarity index 100% rename from DEV/DEV3.1/TP02/Part2/CancelButtonPressedEvent.java rename to DEV/DEV3.1/TP_Recursion/Part2/CancelButtonPressedEvent.java diff --git a/DEV/DEV3.1/TP02/Part2/ClickSwapImageEvent.java b/DEV/DEV3.1/TP_Recursion/Part2/ClickSwapImageEvent.java similarity index 100% rename from DEV/DEV3.1/TP02/Part2/ClickSwapImageEvent.java rename to DEV/DEV3.1/TP_Recursion/Part2/ClickSwapImageEvent.java diff --git a/DEV/DEV3.1/TP02/Part2/CloseVerificationWindow.java b/DEV/DEV3.1/TP_Recursion/Part2/CloseVerificationWindow.java similarity index 100% rename from DEV/DEV3.1/TP02/Part2/CloseVerificationWindow.java rename to DEV/DEV3.1/TP_Recursion/Part2/CloseVerificationWindow.java diff --git a/DEV/DEV3.1/TP02/Part2/ImageWindow.java b/DEV/DEV3.1/TP_Recursion/Part2/ImageWindow.java similarity index 100% rename from DEV/DEV3.1/TP02/Part2/ImageWindow.java rename to DEV/DEV3.1/TP_Recursion/Part2/ImageWindow.java diff --git a/DEV/DEV3.1/TP02/Part2/Main.java b/DEV/DEV3.1/TP_Recursion/Part2/Main.java similarity index 100% rename from DEV/DEV3.1/TP02/Part2/Main.java rename to DEV/DEV3.1/TP_Recursion/Part2/Main.java diff --git a/DEV/DEV3.1/TP02/Part2/WindowClosedEvent.java b/DEV/DEV3.1/TP_Recursion/Part2/WindowClosedEvent.java similarity index 100% rename from DEV/DEV3.1/TP02/Part2/WindowClosedEvent.java rename to DEV/DEV3.1/TP_Recursion/Part2/WindowClosedEvent.java diff --git a/DEV/DEV3.1/TP02/Part2/start.sh b/DEV/DEV3.1/TP_Recursion/Part2/start.sh similarity index 100% rename from DEV/DEV3.1/TP02/Part2/start.sh rename to DEV/DEV3.1/TP_Recursion/Part2/start.sh diff --git a/DEV/DEV3.1/TP02/resources/dice.jpg b/DEV/DEV3.1/TP_Recursion/resources/dice.jpg similarity index 100% rename from DEV/DEV3.1/TP02/resources/dice.jpg rename to DEV/DEV3.1/TP_Recursion/resources/dice.jpg diff --git a/DEV/DEV3.1/TP02/resources/frog.png b/DEV/DEV3.1/TP_Recursion/resources/frog.png similarity index 100% rename from DEV/DEV3.1/TP02/resources/frog.png rename to DEV/DEV3.1/TP_Recursion/resources/frog.png diff --git a/DEV/DEV3.1/TP02/resources/random.jpg b/DEV/DEV3.1/TP_Recursion/resources/random.jpg similarity index 100% rename from DEV/DEV3.1/TP02/resources/random.jpg rename to DEV/DEV3.1/TP_Recursion/resources/random.jpg diff --git a/DEV/DEV3.2/TP_Tree1/Exercise1/DirectoryList.java b/DEV/DEV3.2/TP_Tree1/Exercise1/DirectoryList.java new file mode 100644 index 0000000..3d2dc6c --- /dev/null +++ b/DEV/DEV3.2/TP_Tree1/Exercise1/DirectoryList.java @@ -0,0 +1,32 @@ +import java.io.File; + +class DirectoryList { + + public static void main(String[] args) { + if(args.length == 0) { + System.err.println("Usage: DirectoryList "); + return; + } + + String repositoryName = args[0]; + + File directory = new File(repositoryName); + + if(!directory.exists()) { + System.err.println("Repository not found."); + return; + } + + System.out.println(directory.getName()); + listFiles(directory, "\t"); + } + + private static void listFiles(File directory, String space) { + if(!directory.isDirectory() || directory.listFiles().length == 0) return; + + for(File file : directory.listFiles()) { + System.out.println(space + file.getName()); + listFiles(file, space + '\t'); + } + } +} \ No newline at end of file diff --git a/DEV/DEV3.2/TP_Tree1/Exercise1/Node.java b/DEV/DEV3.2/TP_Tree1/Exercise1/Node.java new file mode 100644 index 0000000..c51a628 --- /dev/null +++ b/DEV/DEV3.2/TP_Tree1/Exercise1/Node.java @@ -0,0 +1,8 @@ +public class Node { + private String name; + private Node[] children; + + public Node(String name) { + + } +} diff --git a/DEV/DEV3.2/TP_Tree1/Exercise1/tp/answer.txt b/DEV/DEV3.2/TP_Tree1/Exercise1/tp/answer.txt new file mode 100644 index 0000000..e69de29 diff --git a/DEV/DEV3.2/TP_Tree1/Exercise1/tp/tp1/content.txt b/DEV/DEV3.2/TP_Tree1/Exercise1/tp/tp1/content.txt new file mode 100644 index 0000000..e69de29 diff --git a/DEV/DEV3.4/TP01/ADN.java b/DEV/DEV3.4/TP01/ADN.java new file mode 100644 index 0000000..e69de29 diff --git a/DEV/DEV3.4/TP01/Base.java b/DEV/DEV3.4/TP01/Base.java new file mode 100644 index 0000000..81d1097 --- /dev/null +++ b/DEV/DEV3.4/TP01/Base.java @@ -0,0 +1,6 @@ +public enum Base { + A, + C, + G, + T +} diff --git a/DEV/DEV3.4/TP01/stub/0Bad/Base.java b/DEV/DEV3.4/TP01/stub/0Bad/Base.java new file mode 100644 index 0000000..5e6a4cf --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/0Bad/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/DEV/DEV3.4/TP01/stub/0Bad/Exemple.java b/DEV/DEV3.4/TP01/stub/0Bad/Exemple.java new file mode 100644 index 0000000..ae72d5c --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/0Bad/Exemple.java @@ -0,0 +1,31 @@ +// Fichier Exemple pour le premier 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 afficher en avançant"); + System.out.println("Il faut s'en inspirer pour implémenter l'interface iterator de Java.util"); + MonMaillon actuel = b.getDebut();//NB: c'est comme l ci-dessus + + while (actuel != null){ + System.out.println(actuel.getBase()); + actuel = actuel.getSuiteMaillon(); + } + } +} diff --git a/DEV/DEV3.4/TP01/stub/0Bad/MonBrin.java b/DEV/DEV3.4/TP01/stub/0Bad/MonBrin.java new file mode 100644 index 0000000..5026f07 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/0Bad/MonBrin.java @@ -0,0 +1,28 @@ +/** + 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 navigation n'est pas raisonnable +*/ +public class MonBrin { + + //Le constructeur fabrique un brin à partir du premier maillon p; + public MonBrin(MonMaillon p){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public MonMaillon getDebut(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + /** et pour naviguer? + On pourrait implémenter l'interface iterator de java.util ici + **/ + + +} + + diff --git a/DEV/DEV3.4/TP01/stub/0Bad/MonMaillon.java b/DEV/DEV3.4/TP01/stub/0Bad/MonMaillon.java new file mode 100644 index 0000000..d5e4c66 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/0Bad/MonMaillon.java @@ -0,0 +1,29 @@ +/** + MonMaillon code un maillon d'un brin d'ADN. + plusieurs instances 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. + +*/ +public class MonMaillon { + + //Le constructeur de base retourne un brin à une base; + public MonMaillon(Base 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){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public Base getBase(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public MonMaillon getSuiteMaillon(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + +} + + diff --git a/DEV/DEV3.4/TP01/stub/1Iterable/Base.java b/DEV/DEV3.4/TP01/stub/1Iterable/Base.java new file mode 100644 index 0000000..5e6a4cf --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/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/DEV/DEV3.4/TP01/stub/1Iterable/Exemple.java b/DEV/DEV3.4/TP01/stub/1Iterable/Exemple.java new file mode 100644 index 0000000..94a55a7 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/1Iterable/Exemple.java @@ -0,0 +1,34 @@ +// 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()); + } + + // ajouter du code ici pour gérer les questions en plus + // (simulation de plusieurs navigations successives) + + + // (simulation de plusieurs navigations simultanées) + } + +} diff --git a/DEV/DEV3.4/TP01/stub/1Iterable/MonBrin.java b/DEV/DEV3.4/TP01/stub/1Iterable/MonBrin.java new file mode 100644 index 0000000..35674eb --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/1Iterable/MonBrin.java @@ -0,0 +1,45 @@ +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 courant; + + public MonBrin(MonMaillon premier){ + this.premier = premier; + this.courant = premier; + } + + public MonMaillon getDebut(){ + return this.premier; + } + + + // rappel : on met @Override pour dire au compilateur qu'on veut surcharger (en particulier c'est le cas quand on implémente une interface) + // ce n'est pas nécessaire dans ce cas mais ça permet d'avoir des messages d'alerte si on se trompe (typo dans le nom de la méthode ...) + // voir https://stackoverflow.com/questions/94361/when-do-you-use-javas-override-annotation-and-why + @Override + public boolean hasNext(){ + return this.courant != null; + } + + @Override + public Base next() { + Base base = this.courant.getBase(); + this.courant = this.courant.getSuiteMaillon(); + return base; + } + +} + + + + diff --git a/DEV/DEV3.4/TP01/stub/1Iterable/MonMaillon.java b/DEV/DEV3.4/TP01/stub/1Iterable/MonMaillon.java new file mode 100644 index 0000000..90e044c --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/1Iterable/MonMaillon.java @@ -0,0 +1,36 @@ +import java.util.Iterator; + +/** + MonMaillon code un maillon d'un brin d'ADN. + plusieurs instances 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. + +*/ +public class MonMaillon implements Iterable { + private Base b; + private MonMaillon l; + + public MonMaillon(Base b) { + this.b = b; + } + + public MonMaillon(Base b, MonMaillon l){ + this.b = b; + this.l = l; + } + + public Base getBase(){ + return this.b; + } + + public MonMaillon getSuiteMaillon(){ + return l; + } + + @Override + public Iterator iterator() { + return new MonBrin(l); + } +} + + diff --git a/DEV/DEV3.4/TP01/stub/2Iterator/Base.java b/DEV/DEV3.4/TP01/stub/2Iterator/Base.java new file mode 100644 index 0000000..5e6a4cf --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/2Iterator/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/DEV/DEV3.4/TP01/stub/2Iterator/Exemple.java b/DEV/DEV3.4/TP01/stub/2Iterator/Exemple.java new file mode 100644 index 0000000..b48d0a7 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/2Iterator/Exemple.java @@ -0,0 +1,35 @@ +// Fichier Exemple pour le dernier exercice sur l'ADN (Iterable) + +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 m = new MonBrin(l); + + System.out.println("l'affichage par défaut du brin ne va pas vous plaire"); + System.out.println(m.toString()); + + System.out.println("On peut afficher en itérant avec forEach (une méthode proposée par Iterable, regardez la doc)"); + m.forEach(b -> System.out.println(b)); + + System.out.println("On a découplé la navigation de la structuration en implémentant iterable plutôt que iterator. On peut maintenant naviguer 2 fois facilement, c'est vraiment trop fort."); + m.forEach(b -> System.out.println(b)); + + System.out.println("On peut même utiliser les boucles avancées de Java 8 et notre code en devient presque pythonesque"); + for(Base b: m){ + System.out.println(b); + } + } + +} diff --git a/DEV/DEV3.4/TP01/stub/2Iterator/MonBrin.java b/DEV/DEV3.4/TP01/stub/2Iterator/MonBrin.java new file mode 100644 index 0000000..b6782cc --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/2Iterator/MonBrin.java @@ -0,0 +1,37 @@ +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 est correcte : la structuration et la navigation sont dans 2 classes séparées. +La classe MonBrin implémente Iterable au sens où elle peut générer à la demande un objet Iterator. + +NB : Notez que j'implémente Iterable plutôt que Iterable qui n'était pas tout à fait propre +c'est un peu technique et c'est lié aux types génériques. + Il y a des détails ici +https://stackoverflow.com/questions/20790770/why-cant-i-assign-a-raw-type-to-a-parameterized-type-java?rq=1 +*/ +public class MonBrin implements Iterable{ + + + public MonBrin(MonMaillon p){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public MonMaillon getDebut(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + /** Pour naviguer? + On implémente l'interface iterator de java.util ici + L'avantage c'est que c'est standard et tout le monde comprendra sans trop de mal comment la navigation fonctionne. + **/ + @Override + public Iterator iterator() { + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } +} diff --git a/DEV/DEV3.4/TP01/stub/2Iterator/MonBrinIterator.java b/DEV/DEV3.4/TP01/stub/2Iterator/MonBrinIterator.java new file mode 100644 index 0000000..a2a85e7 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/2Iterator/MonBrinIterator.java @@ -0,0 +1,32 @@ +import java.util.Iterator; +import java.util.NoSuchElementException; + +/** +MonBrinIterator + +gère la navigation dans un Brin d'ADN + +*/ +public class MonBrinIterator implements Iterator { + + public MonBrinIterator(MonMaillon m){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + /** Pour naviguer? + On implémente l'interface iterable de java.util ici + L'avantage c'est que c'est standard et tout le monde comprendra sans trop de mal comment la navogation fonctionne. + **/ + @Override + public boolean hasNext(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + @Override + public Base next() { + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + +} + + diff --git a/DEV/DEV3.4/TP01/stub/2Iterator/MonMaillon.java b/DEV/DEV3.4/TP01/stub/2Iterator/MonMaillon.java new file mode 100644 index 0000000..d5e4c66 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/2Iterator/MonMaillon.java @@ -0,0 +1,29 @@ +/** + MonMaillon code un maillon d'un brin d'ADN. + plusieurs instances 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. + +*/ +public class MonMaillon { + + //Le constructeur de base retourne un brin à une base; + public MonMaillon(Base 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){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public Base getBase(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public MonMaillon getSuiteMaillon(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + +} + + diff --git a/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/Base.java b/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/Base.java new file mode 100644 index 0000000..5e6a4cf --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/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/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/Exemple.java b/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/Exemple.java new file mode 100644 index 0000000..b4afd21 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/Exemple.java @@ -0,0 +1,58 @@ +// Fichier Exemple pour le dernier exercice sur l'ADN (Iterable) + +public class Exemple{ + + public static void main(String[] args) { + + // codon GCT code l'analine https://en.wikipedia.org/wiki/DNA_codon_table + // codon CAT code Histidine + // codon CGT code Arginine + // codon GCC code Analine + // stop codon TAG, voir https://en.wikipedia.org/wiki/Stop_codon + + System.out.println("construction du brin CGT CAT CGT GCC CAT GCT TAG"); + MonBrin l = new MonBrin(Base.G); + l = new MonBrin(Base.A,l); + l = new MonBrin(Base.T,l); + // + l = new MonBrin(Base.T,l); + l = new MonBrin(Base.C,l); + l = new MonBrin(Base.G,l); + // + l = new MonBrin(Base.T,l); + l = new MonBrin(Base.A,l); + l = new MonBrin(Base.C,l); + // + l = new MonBrin(Base.C,l); + l = new MonBrin(Base.C,l); + l = new MonBrin(Base.G,l); + // + l = new MonBrin(Base.T,l); + l = new MonBrin(Base.G,l); + l = new MonBrin(Base.C,l); + // + l = new MonBrin(Base.T,l); + l = new MonBrin(Base.A,l); + l = new MonBrin(Base.C,l); + // + l = new MonBrin(Base.T,l); + l = new MonBrin(Base.G,l); + l = new MonBrin(Base.C,l); + // + + System.out.println("l'affichage par défaut ne va toujours pas vous plaire"); + System.out.println(l.toString()); + + System.out.println("On peut afficher en itérant avec forEach (une méthode proposée par Iterable, regardez la doc)"); + l.forEach(b -> System.out.println(b)); + + System.out.println("On a découplé la navigation de la structuration en implémentant iterable plutôt que iterator. On peut maintenant naviguer 2 fois facilement, c'est vraiment trop fort."); + l.forEach(b -> System.out.println(b)); + + System.out.println("On peut même utiliser les boucles avancées de Java 8 et notre code en devient presque pythonesque"); + for(Base b: l){ + System.out.println(b); + } + } + +} diff --git a/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/MonBrin.java b/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/MonBrin.java new file mode 100644 index 0000000..6cd0ad1 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/MonBrin.java @@ -0,0 +1,83 @@ +import java.util.Iterator; +import java.util.NoSuchElementException; + +/** +MonBrin code un brin d'ADN sous forme de tableaux. Dynamiquement, la taille du tableau est augmentée en cas de besoin (la taille est initialement 3*4 elle est multipliée ensuite pour être toujours de la forme 3*2^n). +On utilise System.arraycopy et java.util.Arrays.copyOfRange pour faire ça efficacement. +voir +https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#arraycopy-java.lang.Object-int-java.lang.Object-int-int- +https://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#copyOfRange-T:A-int-int- + +Cette version est correcte : la structuration et la navigation sont dans 2 classes séparées. +La classe MonBrin implémente Iterable au sens où elle peut générer à la demande un objet Iterator. + +NB : Notez que j'implémente Iterable plutôt que Iterable qui n'était pas tout à fait propre +c'est un peu technique et c'est lié aux types génériques. + Il y a des détails ici +https://stackoverflow.com/questions/20790770/why-cant-i-assign-a-raw-type-to-a-parameterized-type-java?rq=1 +*/ + +public class MonBrin implements Iterable { + + /** + C'est le constructeur de base (pun intended) qui construit un brin à une base + + @param b : la base + + Ici je pourrais mettre un commentaire plus long sur le fonctionement détaillé de mon super constructeur. + + */ + public MonBrin(Base b){ + + } + + /** + C'est le constructeur évolué qui construit un brin en ajoutant la base donnée en argument devant le brin donné en argument. + + @param b : la base qui va aller devant + @param l : le brin qui sera à la suite + + NB. Ce constructeur est un peu obsolète avec la nouvelle structure interne. + On devrait en ajouter un qui prend en paramètre un tableau de bases. + */ + public MonBrin(Base b, MonBrin l){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public Base getBase(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public int length(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public int limit(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public int capacity(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public Base getBase(int i){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + public Base[] getBases(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + /** Pour naviguer? + On implémente l'interface iterator de java.util ici + L'avantage c'est que c'est standard et tout le monde comprendra sans trop de mal comment la navigation fonctionne. + **/ + @Override + public Iterator iterator() { + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + +} + + diff --git a/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/MonBrinIterator.java b/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/MonBrinIterator.java new file mode 100644 index 0000000..363d355 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/3IteratorDifferentInnerStructure/MonBrinIterator.java @@ -0,0 +1,33 @@ +import java.util.Iterator; +import java.util.NoSuchElementException; + +/** +MonBrinIterator + +gère la navigation dans un Brin d'ADN + +*/ +public class MonBrinIterator implements Iterator { + + //Le constructeur de base retourne un brin à une base; + public MonBrinIterator(MonBrin brin){ + } + + /** Pour naviguer? + On implémente l'interface iterable de java.util ici + L'avantage c'est que c'est standard et tout le monde comprendra sans trop de mal comment la navigation fonctionne. + **/ + + @Override + public boolean hasNext(){ + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + + @Override + public Base next() { + throw new UnsupportedOperationException("cette méthode n'est pas implémentée"); + } + +} + + diff --git a/DEV/DEV3.4/TP01/stub/explication.txt b/DEV/DEV3.4/TP01/stub/explication.txt new file mode 100644 index 0000000..9254e46 --- /dev/null +++ b/DEV/DEV3.4/TP01/stub/explication.txt @@ -0,0 +1,20 @@ +Les biologistes sont des gens étranges pour lesquels les string n'ont que 4 lettres : A,C,G ou T. +Ils ne connaissent pas les String, ils parlent d'ADN. + + +Le Brin est une succession de Maillons. +Il suffit de connaître le premier maillon pour définir un brin d'ADN. + + +----------+ + | maillon | + | | _____ next __> autre Maillon + | | + +----+-----+ + | + | val + \|/ + +----------+ + | Base | + | A | + | | + +----+-----+ diff --git a/SCR/SCR3.2/TP00/answer.txt b/SCR/SCR3.2/TP00/answer.txt new file mode 100644 index 0000000..9fd213d --- /dev/null +++ b/SCR/SCR3.2/TP00/answer.txt @@ -0,0 +1,25 @@ +S3 -> S4 +S4 -> S3 +S4 -> S5 +S5 -> S3 +S5 -> S6 +S5 -> S7 +S5 -> S8 +S5 -> S9 +S6 -> S3 +S6 -> S6 +S6 -> S7 +S6 -> S8 +S6 -> S9 +S7 -> S6 +S7 -> S8 +S7 -> S9 + +- PC3 : +10.32.0.0/17 10.16.0.254 + +- PC4 : +10.16.0.0/17 10.32.0.254 +10.48.0.0/17 10.32.0.255 + +- PC5 diff --git a/SCR/SCR3.2/TP00/tp00.SCR.3.2.imn b/SCR/SCR3.2/TP00/tp00.SCR.3.2.imn new file mode 100644 index 0000000..2045e03 --- /dev/null +++ b/SCR/SCR3.2/TP00/tp00.SCR.3.2.imn @@ -0,0 +1,645 @@ +node n2 { + type lanswitch + network-config { + hostname switch3 + ! + } + canvas c0 + iconcoords {96 528} + labelcoords {97 556} + interface-peer {e0 n10} + interface-peer {e1 n19} + interface-peer {e2 n0} +} + +node n3 { + type lanswitch + network-config { + hostname switch4 + ! + } + canvas c0 + iconcoords {120 72} + labelcoords {75 55} + interface-peer {e0 n10} + interface-peer {e1 n11} + interface-peer {e2 n20} +} + +node n4 { + type lanswitch + network-config { + hostname switch5 + ! + } + canvas c0 + iconcoords {360 288} + labelcoords {341 309} + interface-peer {e0 n9} + interface-peer {e1 n11} + interface-peer {e2 n21} + interface-peer {e3 n1} +} + +node n5 { + type lanswitch + network-config { + hostname switch6 + ! + } + canvas c0 + iconcoords {816 48} + labelcoords {765 27} + interface-peer {e0 n9} + interface-peer {e1 n22} +} + +node n6 { + type lanswitch + network-config { + hostname switch7 + ! + } + canvas c0 + iconcoords {816 264} + labelcoords {810 232} + interface-peer {e0 n9} + interface-peer {e1 n12} + interface-peer {e2 n23} + interface-peer {e3 n8} +} + +node n7 { + type lanswitch + network-config { + hostname switch8 + ! + } + canvas c0 + iconcoords {528 312} + labelcoords {513 289} + interface-peer {e0 n12} + interface-peer {e1 n13} + interface-peer {e2 n14} +} + +node n9 { + type host + network-config { + hostname P5 + ! + interface eth3 + mac address 42:00:aa:00:00:09 + ip address 10.80.0.254/17 + ! + interface eth2 + mac address 42:00:aa:00:00:04 + ip address 10.64.0.254/17 + ! + interface eth1 + mac address 42:00:aa:00:00:03 + ip address 10.48.0.254/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + canvas c0 + iconcoords {576 96} + labelcoords {543 52} + interface-peer {eth1 n4} + interface-peer {eth2 n5} + interface-peer {eth3 n6} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + + ip addr add 10.48.0.254/17 dev eth1 + ip addr add 10.64.0.254/17 dev eth2 + ip addr add 10.80.0.254/17 dev eth3 + ip -6 addr add ::1/128 dev lo0 + + + iptables -t nat -A POSTROUTING -o eth3 -s 10.48.0.0/17 -j SNAT --to-source 10.80.0.254 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n10 { + type host + network-config { + hostname P3 + ! + interface eth1 + mac address 42:00:aa:00:00:06 + ip address 10.32.0.254/17 + ! + interface eth0 + mac address 42:00:aa:00:00:05 + ip address 10.16.0.254/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + canvas c0 + iconcoords {240 288} + labelcoords {246 328} + interface-peer {eth0 n2} + interface-peer {eth1 n3} +} + +node n11 { + type host + network-config { + hostname P4 + ! + interface eth1 + mac address 42:00:aa:00:00:08 + ip address 10.48.0.255/17 + ! + interface eth0 + mac address 42:00:aa:00:00:07 + ip address 10.32.0.255/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + canvas c0 + iconcoords {312 96} + labelcoords {319 52} + interface-peer {eth0 n3} + interface-peer {eth1 n4} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 10.32.0.255/17 dev eth0 + ip addr add 10.48.0.255/17 dev eth1 + ip -6 addr add ::1/128 dev lo0 + + + iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 10.32.0.255 + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 10.48.0.255 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n12 { + type host + network-config { + hostname P6 + ! + interface eth0 + mac address 42:00:aa:00:00:0a + ip address 10.80.0.255/17 + ! + interface eth1 + mac address 42:00:aa:00:00:0b + ip address 102.103.104.255/15 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + } + canvas c0 + iconcoords {792 456} + labelcoords {751 479} + interface-peer {eth0 n6} + interface-peer {eth1 n7} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 10.80.0.255/17 dev eth0 + ip addr add 102.103.104.255/15 dev eth1 + ip -6 addr add ::1/128 dev lo0 + + + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 102.103.104.255 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n13 { + type router + model quagga + network-config { + hostname router1 + ! + interface eth1 + mac address 42:00:aa:00:00:0e + ip address 202.203.204.254/11 + ! + interface eth0 + mac address 42:00:aa:00:00:0c + ip address 102.103.104.254/15 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + router rip + redistribute static + redistribute connected + redistribute ospf + network 0.0.0.0/0 + ! + router ripng + redistribute static + redistribute connected + redistribute ospf6 + network ::/0 + ! + } + canvas c0 + iconcoords {792 576} + labelcoords {792 601} + interface-peer {eth0 n7} + interface-peer {eth1 n15} +} + +node n14 { + type host + network-config { + hostname host2 + ! + interface eth0 + mac address 42:00:aa:00:00:0d + ip address 102.103.104.104/15 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + canvas c0 + iconcoords {384 456} + labelcoords {369 415} + interface-peer {eth0 n7} +} + +node n15 { + type host + network-config { + hostname host3 + ! + interface eth0 + mac address 42:00:aa:00:00:0f + ip address 202.203.204.204/11 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + } + canvas c0 + iconcoords {408 552} + labelcoords {408 588} + interface-peer {eth0 n13} +} + +node n19 { + type pc + network-config { + hostname pc3 + ! + interface eth0 + mac address 42:00:aa:00:00:13 + ip address 10.16.0.3/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 10.32.0.0/17 10.16.0.254 + ! + } + canvas c0 + iconcoords {264 432} + labelcoords {264 463} + interface-peer {eth0 n2} +} + +node n20 { + type pc + network-config { + hostname pc4 + ! + interface eth0 + mac address 42:00:aa:00:00:14 + ip address 10.32.0.4/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 10.16.0.0/17 10.32.0.254 + ip route 10.48.0.0/17 10.32.0.255 + ! + } + canvas c0 + iconcoords {48 264} + labelcoords {48 295} + interface-peer {eth0 n3} +} + +node n21 { + type pc + network-config { + hostname pc5 + ! + interface eth0 + mac address 42:00:aa:00:00:15 + ip address 10.48.0.5/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 0.0.0.0/0 10.48.0.5 + ! + } + canvas c0 + iconcoords {528 216} + labelcoords {528 247} + interface-peer {eth0 n4} +} + +node n22 { + type pc + network-config { + hostname pc6 + ! + interface eth0 + mac address 42:00:aa:00:00:16 + ip address 10.64.0.6/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + canvas c0 + iconcoords {768 144} + labelcoords {768 175} + interface-peer {eth0 n5} +} + +node n23 { + type pc + network-config { + hostname pc7 + ! + interface eth0 + mac address 42:00:aa:00:00:17 + ip address 10.80.0.7/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + canvas c0 + iconcoords {624 216} + labelcoords {624 247} + interface-peer {eth0 n6} +} + +node n0 { + type host + network-config { + hostname host1 + ! + interface eth0 + mac address 42:00:aa:00:00:00 + ip address 10.16.0.200/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + canvas c0 + iconcoords {48 360} + labelcoords {31 327} + interface-peer {eth0 n2} +} + +node n1 { + type pc + network-config { + hostname pc6-5 + ! + interface eth0 + mac address 42:00:aa:00:00:01 + ip address 10.48.0.6/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {456 72} + labelcoords {429 41} + interface-peer {eth0 n4} +} + +node n8 { + type pc + network-config { + hostname pc8 + ! + interface eth0 + mac address 42:00:aa:00:00:02 + ip address 10.80.0.8/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {648 288} + labelcoords {648 319} + interface-peer {eth0 n6} +} + +link l3 { + nodes {n9 n4} + bandwidth 0 +} + +link l4 { + nodes {n5 n9} + bandwidth 0 +} + +link l5 { + nodes {n10 n2} + bandwidth 0 +} + +link l6 { + nodes {n3 n10} + bandwidth 0 +} + +link l7 { + nodes {n11 n3} + bandwidth 0 +} + +link l8 { + nodes {n4 n11} + bandwidth 0 +} + +link l9 { + nodes {n6 n9} + bandwidth 0 +} + +link l10 { + nodes {n6 n12} + bandwidth 0 +} + +link l11 { + nodes {n7 n12} + bandwidth 0 +} + +link l12 { + nodes {n13 n7} + bandwidth 0 +} + +link l13 { + nodes {n7 n14} + bandwidth 0 +} + +link l14 { + nodes {n15 n13} + bandwidth 0 +} + +link l18 { + nodes {n19 n2} + bandwidth 0 +} + +link l19 { + nodes {n20 n3} + bandwidth 0 +} + +link l20 { + nodes {n4 n21} + bandwidth 0 +} + +link l21 { + nodes {n5 n22} + bandwidth 0 +} + +link l22 { + nodes {n6 n23} + bandwidth 0 +} + +link l0 { + nodes {n2 n0} + bandwidth 0 +} + +link l1 { + nodes {n1 n4} + bandwidth 0 +} + +link l2 { + nodes {n6 n8} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses yes + node_labels yes + link_labels yes + background_images no + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} + diff --git a/SCR/SCR3.2/TP00/tp00.SCR.3.2.pdf b/SCR/SCR3.2/TP00/tp00.SCR.3.2.pdf new file mode 100644 index 0000000..0f33157 Binary files /dev/null and b/SCR/SCR3.2/TP00/tp00.SCR.3.2.pdf differ diff --git a/SCR/SCR3.2/TP01/answer.txt b/SCR/SCR3.2/TP01/answer.txt new file mode 100644 index 0000000..c15f21b --- /dev/null +++ b/SCR/SCR3.2/TP01/answer.txt @@ -0,0 +1,25 @@ +II. + +1. + +- Dans les machines de S1 (table de routage) : +172.16.2.0/24 172.16.1.254 + +2. + +Ajouter ce script dans la configuration de la passerelle : + +ip addr add 127.0.0.1/8 dev lo0 +ip addr add 172.16.1.254/24 dev eth0 +ip addr add 172.16.2.254/24 dev eth1 + +iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.254 + +rpcbind +inetd + +-> Avec ça, si une machine du S2 renvoie une information à la passerelle, on modifie l'adresse source par l'adresse de la passerelle pour que la réponse puisse arriver à la machine de destination. + +III. + +S3 ne peut pas ping S1, mais peut ping S2, je ne comprends pas. diff --git a/SCR/SCR3.2/TP01/one-gateway.imn b/SCR/SCR3.2/TP01/one-gateway.imn new file mode 100644 index 0000000..38ec9f4 --- /dev/null +++ b/SCR/SCR3.2/TP01/one-gateway.imn @@ -0,0 +1,208 @@ +node n0 { + type pc + network-config { + hostname pc1-1 + ! + interface eth0 + mac address 42:00:aa:00:00:02 + ip address 172.16.1.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + ! + ip route 172.16.2.0/24 172.16.1.254 + ! + } + auto_default_routes enabled + canvas c0 + iconcoords {72 528} + labelcoords {72 559} + interface-peer {eth0 n5} +} + +node n1 { + type pc + network-config { + hostname pc1-2 + ! + interface eth0 + mac address 42:00:aa:00:00:03 + ip address 172.16.1.2/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + ip route 172.16.2.0/24 172.16.1.254 + ! + } + auto_default_routes enabled + canvas c0 + iconcoords {288 528} + labelcoords {288 559} + interface-peer {eth0 n5} +} + +node n2 { + type pc + network-config { + hostname pc2-1 + ! + interface eth0 + mac address 42:00:aa:00:00:00 + ip address 172.16.2.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + } + auto_default_routes enabled + canvas c0 + iconcoords {600 528} + labelcoords {600 559} + interface-peer {eth0 n6} +} + +node n3 { + type pc + network-config { + hostname pc2-2 + ! + interface eth0 + mac address 42:00:aa:00:00:01 + ip address 172.16.2.2/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + } + auto_default_routes enabled + canvas c0 + iconcoords {816 528} + labelcoords {816 559} + interface-peer {eth0 n6} +} + +node n4 { + type host + network-config { + hostname host1 + ! + interface eth1 + mac address 42:00:aa:00:00:05 + ip address 172.16.2.254/24 + ! + interface eth0 + mac address 42:00:aa:00:00:04 + ip address 172.16.1.254/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + } + canvas c0 + iconcoords {456 96} + labelcoords {456 132} + interface-peer {eth0 n5} + interface-peer {eth1 n6} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.1.254/24 dev eth0 + ip addr add 172.16.2.254/24 dev eth1 + + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.254 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n5 { + type lanswitch + network-config { + hostname switch1 + ! + } + canvas c0 + iconcoords {192 312} + labelcoords {192 335} + interface-peer {e0 n0} + interface-peer {e1 n1} + interface-peer {e2 n4} +} + +node n6 { + type lanswitch + network-config { + hostname switch2 + ! + } + canvas c0 + iconcoords {720 312} + labelcoords {720 335} + interface-peer {e0 n2} + interface-peer {e1 n3} + interface-peer {e2 n4} +} + +link l0 { + nodes {n6 n2} + bandwidth 0 +} + +link l1 { + nodes {n6 n3} + bandwidth 0 +} + +link l2 { + nodes {n5 n0} + bandwidth 0 +} + +link l3 { + nodes {n5 n1} + bandwidth 0 +} + +link l4 { + nodes {n4 n5} + bandwidth 0 +} + +link l5 { + nodes {n4 n6} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses yes + node_labels yes + link_labels yes + background_images no + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} + diff --git a/SCR/SCR3.2/TP01/two-gateway.imn b/SCR/SCR3.2/TP01/two-gateway.imn new file mode 100644 index 0000000..50f1a4e --- /dev/null +++ b/SCR/SCR3.2/TP01/two-gateway.imn @@ -0,0 +1,323 @@ +node n0 { + type pc + network-config { + hostname A + ! + interface eth0 + mac address 42:00:aa:00:00:00 + ip address 172.16.1.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + ip route 0.0.0.0/0 172.16.1.254 + ! + } + canvas c0 + iconcoords {96 96} + labelcoords {96 127} + interface-peer {eth0 n3} +} + +node n1 { + type pc + network-config { + hostname B + ! + interface eth0 + mac address 42:00:aa:00:00:01 + ip address 172.16.2.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + ip route 0.0.0.0/0 172.16.2.252 + ! + } + canvas c0 + iconcoords {96 432} + labelcoords {96 463} + interface-peer {eth0 n7} +} + +node n2 { + type pc + network-config { + hostname C + ! + interface eth0 + mac address 42:00:aa:00:00:05 + ip address 172.16.3.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + ip route 0.0.0.0/0 172.16.3.251 + ! + } + canvas c0 + iconcoords {768 192} + labelcoords {768 223} + interface-peer {eth0 n6} +} + +node n3 { + type lanswitch + network-config { + hostname switch1 + ! + } + canvas c0 + iconcoords {288 96} + labelcoords {288 119} + interface-peer {e0 n0} + interface-peer {e2 n4} +} + +node n4 { + type host + network-config { + hostname P1 + ! + interface eth1 + mac address 42:00:aa:00:00:03 + ip address 172.16.2.253/24 + ! + interface eth0 + mac address 42:00:aa:00:00:02 + ip address 172.16.1.254/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + } + canvas c0 + iconcoords {288 264} + labelcoords {288 300} + interface-peer {eth0 n3} + interface-peer {eth1 n7} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.1.254/24 dev eth0 + ip addr add 172.16.2.253/24 dev eth1 + + iptables -t nat -A POSTROUTING -j SNAT --to-source 172.16.2.253 + iptables -t filter -A FORWARD -d 172.16.3.0/24 -j DROP + iptables -t filter -A FORWARD -d 172.16.1.0/24 -s 172.16.2.0/24 -j DROP + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n5 { + type host + network-config { + hostname P2 + ! + interface eth2 + mac address 42:00:aa:00:00:08 + ip address 10.0.0.250/8 + ! + interface eth1 + mac address 42:00:aa:00:00:06 + ip address 172.16.3.251/24 + ! + interface eth0 + mac address 42:00:aa:00:00:04 + ip address 172.16.2.252/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + } + canvas c0 + iconcoords {528 432} + labelcoords {528 468} + interface-peer {eth1 n6} + interface-peer {eth0 n7} + interface-peer {eth2 n8} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.3.251/24 dev eth1 + ip addr add 172.16.2.252/24 dev eth0 + ip addr add 10.0.0.250/8 dev eth2 + + iptables -t filter -A FORWARD -d 172.16.1.0/24,172.16.2.0/24 -j DROP + + rpcbind + inetd + + } + } + } + custom-selected default +} + +node n6 { + type lanswitch + network-config { + hostname switch3 + ! + } + canvas c0 + iconcoords {528 192} + labelcoords {528 215} + interface-peer {e0 n2} + interface-peer {e1 n5} +} + +node n7 { + type lanswitch + network-config { + hostname switch2 + ! + } + canvas c0 + iconcoords {288 432} + labelcoords {288 455} + interface-peer {e0 n1} + interface-peer {e1 n4} + interface-peer {e2 n5} +} + +node n8 { + type router + model quagga + network-config { + hostname router1 + ! + interface eth1 + mac address 42:00:aa:00:00:09 + ip address 10.0.7.1/24 + ! + interface eth0 + mac address 42:00:aa:00:00:07 + ip address 10.0.0.250/8 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + router rip + redistribute static + redistribute connected + redistribute ospf + network 0.0.0.0/0 + ! + router ripng + redistribute static + redistribute connected + redistribute ospf6 + network ::/0 + ! + } + canvas c0 + iconcoords {768 432} + labelcoords {768 457} + interface-peer {eth0 n5} + interface-peer {eth1 n9} +} + +node n9 { + type pc + network-config { + hostname D + ! + interface eth0 + mac address 42:00:aa:00:00:0a + ip address 10.0.7.20/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ! + ip route 0.0.0.0/0 10.0.0.250 + ! + } + auto_default_routes enabled + canvas c0 + iconcoords {864 576} + labelcoords {864 607} + interface-peer {eth0 n8} +} + +link l0 { + nodes {n3 n0} + bandwidth 0 +} + +link l2 { + nodes {n4 n3} + bandwidth 0 +} + +link l4 { + nodes {n6 n2} + bandwidth 0 +} + +link l5 { + nodes {n5 n6} + bandwidth 0 +} + +link l1 { + nodes {n7 n1} + bandwidth 0 +} + +link l3 { + nodes {n4 n7} + bandwidth 0 +} + +link l6 { + nodes {n7 n5} + bandwidth 0 +} + +link l7 { + nodes {n8 n5} + bandwidth 0 +} + +link l8 { + nodes {n8 n9} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses yes + node_labels yes + link_labels yes + background_images yes + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} +