Make Person class and attributes implements Comparable.
[Persons_Comparator.git] / src / Size.java
index 0cecada6c98192f7cfa94f874f937e1fe9831276..a526fab6a01a3fb9ce5d5ce31b5f39aef3d3bae2 100644 (file)
@@ -1,5 +1,6 @@
+import java.util.Comparator;
 
-public class Size {
+public class Size implements Comparable<Size> {
     private int max = 240;
     private int min = 20;
     private int size;
@@ -15,10 +16,17 @@ public class Size {
     public void setSize(int size) {
         if (validateSize(size)) {
             this.size = size;
-        } /* FIXME: raise an error */
+        } else {
+            throw new IllegalArgumentException("Size must be between" + this.min + " and " + this.max);
+        }
     }
 
     private boolean validateSize(int size) {
         return (size > max || size < min);
     }
+
+    @Override
+    public int compareTo(Size size) {
+        return 0;
+    }
 }