From cc162028bdb820adfbb30037091557f057980abd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 5 Apr 2018 11:02:57 +0200 Subject: [PATCH] exo2: Fix and simplify the introspection. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- exo3/Entiers.java | 2 +- exo3/Main.java | 18 ++---------------- exo4/{ => TP2}/Affichable.java | 0 exo4/{ => TP2}/Cercle.java | 0 exo4/{ => TP2}/Compactable.java | 0 exo4/{ => TP2}/Entiers.java | 0 exo4/{ => TP2}/Forme.java | 0 exo4/{ => TP2}/Image.java | 0 exo4/{ => TP2}/Liste.java | 0 exo4/{ => TP2}/Main.java | 0 exo4/{ => TP2}/Makefile | 0 exo4/{ => TP2}/Piletransformations.java | 0 exo4/{ => TP2}/Point.java | 0 exo4/{ => TP2}/Segment.java | 0 exo4/{ => TP2}/Structure.java | 0 15 files changed, 3 insertions(+), 17 deletions(-) rename exo4/{ => TP2}/Affichable.java (100%) rename exo4/{ => TP2}/Cercle.java (100%) rename exo4/{ => TP2}/Compactable.java (100%) rename exo4/{ => TP2}/Entiers.java (100%) rename exo4/{ => TP2}/Forme.java (100%) rename exo4/{ => TP2}/Image.java (100%) rename exo4/{ => TP2}/Liste.java (100%) rename exo4/{ => TP2}/Main.java (100%) rename exo4/{ => TP2}/Makefile (100%) rename exo4/{ => TP2}/Piletransformations.java (100%) rename exo4/{ => TP2}/Point.java (100%) rename exo4/{ => TP2}/Segment.java (100%) rename exo4/{ => TP2}/Structure.java (100%) diff --git a/exo3/Entiers.java b/exo3/Entiers.java index 0d8caa1..6aa27d5 100644 --- a/exo3/Entiers.java +++ b/exo3/Entiers.java @@ -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); diff --git a/exo3/Main.java b/exo3/Main.java index 2b5ac8c..e92a5e2 100644 --- a/exo3/Main.java +++ b/exo3/Main.java @@ -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 { diff --git a/exo4/Affichable.java b/exo4/TP2/Affichable.java similarity index 100% rename from exo4/Affichable.java rename to exo4/TP2/Affichable.java diff --git a/exo4/Cercle.java b/exo4/TP2/Cercle.java similarity index 100% rename from exo4/Cercle.java rename to exo4/TP2/Cercle.java diff --git a/exo4/Compactable.java b/exo4/TP2/Compactable.java similarity index 100% rename from exo4/Compactable.java rename to exo4/TP2/Compactable.java diff --git a/exo4/Entiers.java b/exo4/TP2/Entiers.java similarity index 100% rename from exo4/Entiers.java rename to exo4/TP2/Entiers.java diff --git a/exo4/Forme.java b/exo4/TP2/Forme.java similarity index 100% rename from exo4/Forme.java rename to exo4/TP2/Forme.java diff --git a/exo4/Image.java b/exo4/TP2/Image.java similarity index 100% rename from exo4/Image.java rename to exo4/TP2/Image.java diff --git a/exo4/Liste.java b/exo4/TP2/Liste.java similarity index 100% rename from exo4/Liste.java rename to exo4/TP2/Liste.java diff --git a/exo4/Main.java b/exo4/TP2/Main.java similarity index 100% rename from exo4/Main.java rename to exo4/TP2/Main.java diff --git a/exo4/Makefile b/exo4/TP2/Makefile similarity index 100% rename from exo4/Makefile rename to exo4/TP2/Makefile diff --git a/exo4/Piletransformations.java b/exo4/TP2/Piletransformations.java similarity index 100% rename from exo4/Piletransformations.java rename to exo4/TP2/Piletransformations.java diff --git a/exo4/Point.java b/exo4/TP2/Point.java similarity index 100% rename from exo4/Point.java rename to exo4/TP2/Point.java diff --git a/exo4/Segment.java b/exo4/TP2/Segment.java similarity index 100% rename from exo4/Segment.java rename to exo4/TP2/Segment.java diff --git a/exo4/Structure.java b/exo4/TP2/Structure.java similarity index 100% rename from exo4/Structure.java rename to exo4/TP2/Structure.java -- 2.34.1