exo2: Fix and simplify the introspection.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 5 Apr 2018 09:02:57 +0000 (11:02 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 5 Apr 2018 09:02:57 +0000 (11:02 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
15 files changed:
exo3/Entiers.java
exo3/Main.java
exo4/TP2/Affichable.java [moved from exo4/Affichable.java with 100% similarity]
exo4/TP2/Cercle.java [moved from exo4/Cercle.java with 100% similarity]
exo4/TP2/Compactable.java [moved from exo4/Compactable.java with 100% similarity]
exo4/TP2/Entiers.java [moved from exo4/Entiers.java with 100% similarity]
exo4/TP2/Forme.java [moved from exo4/Forme.java with 100% similarity]
exo4/TP2/Image.java [moved from exo4/Image.java with 100% similarity]
exo4/TP2/Liste.java [moved from exo4/Liste.java with 100% similarity]
exo4/TP2/Main.java [moved from exo4/Main.java with 100% similarity]
exo4/TP2/Makefile [moved from exo4/Makefile with 100% similarity]
exo4/TP2/Piletransformations.java [moved from exo4/Piletransformations.java with 100% similarity]
exo4/TP2/Point.java [moved from exo4/Point.java with 100% similarity]
exo4/TP2/Segment.java [moved from exo4/Segment.java with 100% similarity]
exo4/TP2/Structure.java [moved from exo4/Structure.java with 100% similarity]

index 0d8caa1fd040d27aa4e90cfe4760bad56ab97676..6aa27d55c178b19f182f5d9af46ef017186a5c6a 100644 (file)
@@ -20,7 +20,7 @@ public class Entiers {
         return current_size;
     }
 
-    public Entiers(int size) {
+    Entiers(int size) {
         int_array = new int[size];
         setSize(size);
         setCurrentSize(0);
index 2b5ac8c9c8e5007ad0a4bcb8b1258c47b730d063..e92a5e2ff788d0a7acfc29bb9f320b831461441a 100644 (file)
@@ -75,29 +75,15 @@ class Main {
     public static void main(String[] args) {
         String name = Entiers.class.getName();
         Class cl = null;
-        Object o = null;
+        Entiers o = null;
         try {
             cl = Class.forName(name);
-            Class[] types = new Class[]{Integer.class};
-            Constructor ct = cl.getConstructor(types);
-            o = ct.newInstance(new Integer(100));
+            o = new Entiers(100);
         }
         catch (ClassNotFoundException e) {
             System.out.println("Class name do not exist.");
             System.exit(-1);
         }
-        catch (NoSuchMethodException e) {
-            e.printStackTrace();
-        }
-        catch (InstantiationException e) {
-            e.printStackTrace();
-        }
-        catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
 
         Scanner uInput = null;
         try {
similarity index 100%
rename from exo4/Cercle.java
rename to exo4/TP2/Cercle.java
similarity index 100%
rename from exo4/Entiers.java
rename to exo4/TP2/Entiers.java
similarity index 100%
rename from exo4/Forme.java
rename to exo4/TP2/Forme.java
similarity index 100%
rename from exo4/Image.java
rename to exo4/TP2/Image.java
similarity index 100%
rename from exo4/Liste.java
rename to exo4/TP2/Liste.java
similarity index 100%
rename from exo4/Main.java
rename to exo4/TP2/Main.java
similarity index 100%
rename from exo4/Makefile
rename to exo4/TP2/Makefile
similarity index 100%
rename from exo4/Point.java
rename to exo4/TP2/Point.java
similarity index 100%
rename from exo4/Segment.java
rename to exo4/TP2/Segment.java
similarity index 100%
rename from exo4/Structure.java
rename to exo4/TP2/Structure.java