And add a better test case.
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
public void afficher() {
System.out.println("---- liste ----");
if (isEmpty()) {
- System.out.println("Liste vide");
+ return;
} else if (headNode.getNext() == null) {
System.out.println("element 0 : " + headNode.getData());
} else {
}
public void afficher() {
+ String className = this.getClass().getSimpleName();
+ System.out.println("---- " + className + " ----");
System.out.println(super.getpOri().toString() + " " + rayon);
}
private int binarySearch(int first, int last, int value) {
if (last < first)
- //FIXME: should not return an integer
+ //FIXME: should not return an integer
return -1;
int middle = (first + last) / 2;
if (value == int_array[middle])
}
public void afficher() {
- System.out.println("---- entiers ----");
+ String className = this.getClass().getSimpleName();
+ System.out.println("---- " + className + " ----");
for (int i = 0; i < getCurrentSize(); i++) {
System.out.println("element " + i + " : " + int_array[i]);
}
}
public void afficher() {
- System.out.println("---- liste ----");
+ String className = this.getClass().getSimpleName();
+ System.out.println("---- " + className + " ----");
if (isEmpty()) {
- System.out.println("Liste vide");
+ return;
} else if (headNode.getNext() == null) {
System.out.println("element 0 : " + headNode.getData());
} else {
transformations.depiler();
}
+ public static void main3() {
+
+ Affichable[] affichable = new Affichable[10];
+
+ Point p1 = new Point(1, 2);
+ Point p2 = new Point(2, 7);
+ Point p3 = new Point(1, 5);
+
+ Entiers entiers = new Entiers(5);
+ entiers.inserer(3);
+ entiers.inserer(1);
+ entiers.inserer(5);
+
+ Liste liste = new Liste();
+ liste.inserer(3);
+ liste.inserer(1);
+ liste.inserer(5);
+
+ for (int i = 0; i < 10; i++) {
+ affichable[i] = entiers;
+ affichable[i].afficher();
+
+ affichable[i] = liste;
+ affichable[i].afficher();
+
+ affichable[i] = new Segment(p1, p2);
+ affichable[i].afficher();
+
+ affichable[i] = new Cercle(p3, 5.5);
+ affichable[i].afficher();
+ }
+
+ }
+
public static void main(String[] args) {
- main2();
+ main3();
}
}
public void afficher() {
+ String className = this.getClass().getSimpleName();
+ System.out.println("---- " + className + " ----");
System.out.println(super.getpOri().toString() + " " + pDest.toString());
}