TP2: Use a Compactable array for testing purpose.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 4 Mar 2018 22:08:13 +0000 (23:08 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 4 Mar 2018 22:08:13 +0000 (23:08 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TP2/Main.java

index 05eb447e7ade78ca54bb5ed47542e55ba5a38284..229b6390ba4f5888c0384e0f9352fe8a7e50298e 100644 (file)
@@ -100,7 +100,7 @@ class Main {
 
     public static void main4() {
 
 
     public static void main4() {
 
-        Structure[] structure = new Structure[10];
+        Compactable[] compactable = new Compactable[10];
 
         Point p1 = new Point(1, 2);
         Point p2 = new Point(2, 7);
 
         Point p1 = new Point(1, 2);
         Point p2 = new Point(2, 7);
@@ -126,20 +126,19 @@ class Main {
         liste.inserer(5);
         liste.inserer(4);
 
         liste.inserer(5);
         liste.inserer(4);
 
-        for (int i = 0; i < 10; i++) {
-            structure[i] = entiers;
-            structure[i].afficher();
-            structure[i].compacter(1);
-            structure[i].afficher();
-
-            structure[i] = liste;
-            structure[i].afficher();
-            structure[i].compacter(1);
-            structure[i].afficher();
-        }
+        compactable[0] = entiers;
+        entiers.afficher();
+        compactable[0].compacter(1);
+        entiers.afficher();
+
+        compactable[1] = liste;
+        liste.afficher();
+        compactable[1].compacter(1);
+        liste.afficher();
 
 
+        compactable[2] = image;
         image.afficher();
         image.afficher();
-        image.compacter(1);
+        compactable[2].compacter(1);
         image.afficher();
     }
 
         image.afficher();
     }