Code cleanup : fix C style array declaration.
[TP_POO.git] / Structure / Entiers.java
index b2c9247076410f0d2d6a21740cbccc3d12df20dc..a98c79c4d89cfcac2420683d4b2248e065c47c91 100644 (file)
@@ -1,6 +1,6 @@
 
 class Entiers extends Structure {
-    private int int_array[];
+    private int[] int_array;
     private int array_size;
     private int current_size;
 
@@ -60,13 +60,14 @@ class Entiers extends Structure {
 
     private int binarySearch(int first, int last, int value) {
         if (last < first)
+            //FIXME: should not return an integer
             return -1;
         int middle = (first + last) / 2;
         if (value == int_array[middle])
             return middle;
         else if (value > int_array[middle])
             return binarySearch((middle + 1), last, value);
-        return binarySearch(first, (middle -1), value);
+        return binarySearch(first, (middle - 1), value);
     }
 
     public boolean supprimer(int value) {
@@ -97,9 +98,10 @@ class Entiers extends Structure {
     }
 
     public void afficher() {
-        System.out.println("----");
+        String className = this.getClass().getSimpleName();
+        System.out.println("---- " + className + " ----");
         for (int i = 0; i < getCurrentSize(); i++) {
-            System.out.println("element " + i + " " + int_array[i]);
+            System.out.println("element " + i + " " + int_array[i]);
         }
     }