From: Jérôme Benoit Date: Thu, 5 Apr 2018 09:02:57 +0000 (+0200) Subject: exo2: Fix and simplify the introspection. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=cc162028bdb820adfbb30037091557f057980abd;p=Project_POO.git exo2: Fix and simplify the introspection. Signed-off-by: Jérôme Benoit --- 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