TP2: cast double to int the compare method returned value.
[TP_POO.git] / TP2 / Image.java
index d508e75d4fc647d58f38bfa97432a46c8d29c4ff..65d0929e69f9cadae3daa7096ad43b3f9d5d2edf 100644 (file)
@@ -1,6 +1,8 @@
 import java.util.Comparator;
 
-public class Image extends Forme implements Compactable, Comparable<Image>, Comparator<Image> {
+public class Image extends Forme implements Compactable,
+                                            Comparable<Image>,
+                                            Comparator<Image> {
     final int IMAGE_MAX_SIZE = 100;
     Forme[] formeCollection;
     int formeNumber;
@@ -90,7 +92,7 @@ public class Image extends Forme implements Compactable, Comparable<Image>, Comp
     }
 
     public int compare(Image image1, Image image2) {
-        return image1.getSize() - image2.getSize();
+        return (int)(image1.getpOri().getY() - image2.getpOri().getY());
     }
 
 }