diff --git a/Anglish/MailInstruction.docx b/Anglish/MailInstruction.docx new file mode 100755 index 0000000..6d84616 Binary files /dev/null and b/Anglish/MailInstruction.docx differ diff --git a/DEV/DEV3.2/TP03_Listes/Action.class b/DEV/DEV3.2/TP03_Listes/Action.class index 36c7dd7..d6b1c2c 100644 Binary files a/DEV/DEV3.2/TP03_Listes/Action.class and b/DEV/DEV3.2/TP03_Listes/Action.class differ diff --git a/DEV/DEV3.2/TP03_Listes/Action.java b/DEV/DEV3.2/TP03_Listes/Action.java index 66ec4f2..adb179d 100644 --- a/DEV/DEV3.2/TP03_Listes/Action.java +++ b/DEV/DEV3.2/TP03_Listes/Action.java @@ -4,19 +4,44 @@ import java.awt.event.*; import java.util.*; public class Action implements MouseListener{ - public java.util.List listeParallelogramme; + public ListeParallelogramme listeParallelogramme; + public Point origine; + public JFrame fenetre; - public Action(java.util.List listeParallelogramme){ + public Action(ListeParallelogramme listeParallelogramme, JPanel panel, JFrame fenetre){ this.listeParallelogramme = listeParallelogramme; + this.origine = panel.getLocationOnScreen(); + this.fenetre = fenetre; } @Override public void mouseClicked(MouseEvent e){ - for (Parallelogramme parallelogramme : this.listeParallelogramme){ - if (parallelogramme.forme.contains(e.getPoint())){ - System.out.println("clic"); + Point clic = e.getPoint(); + int x = clic.x - this.origine.x; + int y = clic.y - this.origine.y; + Parallelogramme parallelogramme = this.listeParallelogramme.get(-1); + while ((parallelogramme = this.listeParallelogramme.next(parallelogramme)) != null){ + int[] xPoints = parallelogramme.forme.xpoints; + System.out.print("x=["); + for (int px : xPoints){ + System.out.print(px+","); + } + System.out.print("] "); + int[] yPoints = parallelogramme.forme.ypoints; + System.out.print("y=["); + for (int yx : yPoints){ + System.out.print(yx+","); + } + System.out.print("] "); + System.out.println(" clic=" + x + "," + y); + if (parallelogramme.forme.contains(x, y)){ + System.out.println(parallelogramme.luminance()); + this.listeParallelogramme.delete(parallelogramme); + fenetre.repaint(); + break; } } + System.out.println(); } @Override diff --git a/DEV/DEV3.2/TP03_Listes/Dessin.class b/DEV/DEV3.2/TP03_Listes/Dessin.class index c2225be..017a26f 100644 Binary files a/DEV/DEV3.2/TP03_Listes/Dessin.class and b/DEV/DEV3.2/TP03_Listes/Dessin.class differ diff --git a/DEV/DEV3.2/TP03_Listes/Dessin.java b/DEV/DEV3.2/TP03_Listes/Dessin.java index 05031c5..8bda331 100644 --- a/DEV/DEV3.2/TP03_Listes/Dessin.java +++ b/DEV/DEV3.2/TP03_Listes/Dessin.java @@ -4,9 +4,9 @@ import java.util.*; public class Dessin extends JComponent { - public java.util.List listeParallelogramme; + public ListeParallelogramme listeParallelogramme; - public Dessin(java.util.List listeParallelogramme){ + public Dessin(ListeParallelogramme listeParallelogramme){ this.listeParallelogramme = listeParallelogramme; } @@ -17,7 +17,8 @@ public class Dessin extends JComponent { secondPinceau.setColor(this.getBackground()); secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); } - for (Parallelogramme parallelogramme : this.listeParallelogramme){ + Parallelogramme parallelogramme = this.listeParallelogramme.get(-1); + while ((parallelogramme = this.listeParallelogramme.next(parallelogramme)) != null){ secondPinceau.setColor(parallelogramme.couleur); secondPinceau.fillPolygon(parallelogramme.forme); secondPinceau.setColor(Color.BLACK); diff --git a/DEV/DEV3.2/TP03_Listes/ListeParallelogramme.class b/DEV/DEV3.2/TP03_Listes/ListeParallelogramme.class new file mode 100644 index 0000000..e397c6e Binary files /dev/null and b/DEV/DEV3.2/TP03_Listes/ListeParallelogramme.class differ diff --git a/DEV/DEV3.2/TP03_Listes/ListeParallelogramme.java b/DEV/DEV3.2/TP03_Listes/ListeParallelogramme.java new file mode 100644 index 0000000..b978ec1 --- /dev/null +++ b/DEV/DEV3.2/TP03_Listes/ListeParallelogramme.java @@ -0,0 +1,48 @@ +import java.util.*; + +public class ListeParallelogramme{ + + public List liste; + + public ListeParallelogramme(){ + liste = new ArrayList<>(); + } + + public void add(){ + int taille = this.liste.size(); + if (taille == 0){ + this.liste.add(new Parallelogramme()); + } + else{ + Parallelogramme dernier = this.liste.get(this.liste.size()-1); + this.liste.add(new Parallelogramme(dernier)); + } + } + + public void delete(Parallelogramme parallelogramme){ + Parallelogramme suppr = parallelogramme; + while((parallelogramme = this.next(parallelogramme)) != null){ + parallelogramme.translationGauche(); + } + this.liste.remove(suppr); + } + + public int size(){ + return this.liste.size(); + } + + public Parallelogramme get(int indice){ + if (indice >= 0 && indice < this.liste.size()){ + return this.liste.get(indice); + } + return null; + } + + public Parallelogramme next(Parallelogramme parallelogramme){ + int indice = this.liste.indexOf(parallelogramme); + if (indice+1 < this.liste.size()){ + return this.liste.get(indice+1); + } + return null; + } +} \ No newline at end of file diff --git a/DEV/DEV3.2/TP03_Listes/Main.class b/DEV/DEV3.2/TP03_Listes/Main.class index 44eb60d..2c0ed07 100644 Binary files a/DEV/DEV3.2/TP03_Listes/Main.class and b/DEV/DEV3.2/TP03_Listes/Main.class differ diff --git a/DEV/DEV3.2/TP03_Listes/Main.java b/DEV/DEV3.2/TP03_Listes/Main.java index 7c34d8e..7258541 100644 --- a/DEV/DEV3.2/TP03_Listes/Main.java +++ b/DEV/DEV3.2/TP03_Listes/Main.java @@ -9,20 +9,20 @@ public class Main{ fenetre.setLocation(0, 0); fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - java.util.List listeParallelogramme = new ArrayList<>(); - int i; - Parallelogramme suivant = new Parallelogramme(); - for (i=0; i<10; i++){ - listeParallelogramme.add(suivant); - suivant = new Parallelogramme(suivant); + ListeParallelogramme listeParallelogramme = new ListeParallelogramme(); + for (int i=0; i<10; i++){ + listeParallelogramme.add(); } - Action action = new Action(listeParallelogramme); - fenetre.addMouseListener(action); - Dessin lesDessins = new Dessin(listeParallelogramme); fenetre.add(lesDessins); fenetre.setVisible(true); + + JPanel origine = new JPanel(); + fenetre.add(origine); + + Action action = new Action(listeParallelogramme, origine, fenetre); + fenetre.addMouseListener(action); } } diff --git a/DEV/DEV3.2/TP03_Listes/Parallelogramme.class b/DEV/DEV3.2/TP03_Listes/Parallelogramme.class index a08a8d6..665b44b 100644 Binary files a/DEV/DEV3.2/TP03_Listes/Parallelogramme.class and b/DEV/DEV3.2/TP03_Listes/Parallelogramme.class differ diff --git a/DEV/DEV3.2/TP03_Listes/Parallelogramme.java b/DEV/DEV3.2/TP03_Listes/Parallelogramme.java index cc36c8b..3950f57 100644 --- a/DEV/DEV3.2/TP03_Listes/Parallelogramme.java +++ b/DEV/DEV3.2/TP03_Listes/Parallelogramme.java @@ -25,4 +25,15 @@ public class Parallelogramme{ this.forme.addPoint(gauche+Parallelogramme.marge+Parallelogramme.largeur+Parallelogramme.inclinaison, haut); this.forme.addPoint(gauche+Parallelogramme.marge+Parallelogramme.inclinaison, haut); } + + public void translationGauche(){ + int[] xPoints = this.forme.xpoints; + int nbPoint = this.forme.npoints; + for (int i = 0; i < nbPoint; i++) { + xPoints[i] -= (Parallelogramme.largeur + Parallelogramme.marge); + } + } + public int luminance(){ + return 21*this.couleur.getRed() + 72*this.couleur.getGreen() + 7*this.couleur.getBlue(); + } } \ No newline at end of file diff --git a/DEV/DEV3.2/TP04_Piles/Q1Main.class b/DEV/DEV3.2/TP04_Piles/Q1Main.class new file mode 100644 index 0000000..fffd576 Binary files /dev/null and b/DEV/DEV3.2/TP04_Piles/Q1Main.class differ diff --git a/DEV/DEV3.2/TP04_Piles/Q1Main.java b/DEV/DEV3.2/TP04_Piles/Q1Main.java new file mode 100644 index 0000000..4fc289d --- /dev/null +++ b/DEV/DEV3.2/TP04_Piles/Q1Main.java @@ -0,0 +1,43 @@ +import javax.swing.*; +import java.awt.*; +import java.util.*; + +public class Q1Main{ + public static void main(String[] args) { + + ArrayDeque liste = new ArrayDeque<>(); + int i; + try{ + for (i=0; i{ + + public + + public Q2Liste(){ + + } + + @Override + public void push(T valeur){ + + } + + @Override + public T pop(){ + + } + + @Override + public boolean isEmpty(){ + + } + + public T +} \ No newline at end of file diff --git a/DEV/DEV3.2/TP04_Piles/Q2Maillon.java b/DEV/DEV3.2/TP04_Piles/Q2Maillon.java new file mode 100644 index 0000000..f142a7d --- /dev/null +++ b/DEV/DEV3.2/TP04_Piles/Q2Maillon.java @@ -0,0 +1,11 @@ +public class Q2Maillon { + + T valeur; + Q2Maillon ancien; + + + public Q2Maillon(Q2Maillon ancien, T valeur){ + this.ancien = ancien; + this.valeur = valeur; + } +} \ No newline at end of file diff --git a/DEV/DEV3.2/TP04_Piles/Q2Pile.java b/DEV/DEV3.2/TP04_Piles/Q2Pile.java new file mode 100644 index 0000000..9ba5010 --- /dev/null +++ b/DEV/DEV3.2/TP04_Piles/Q2Pile.java @@ -0,0 +1,5 @@ +public interface Q2Pile { + void push(T valeur); + boolean isEmpty(void); + T pop(void); +} \ No newline at end of file