X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FWeight.java;h=c979f3ddcab3911914e519b71075d4023fe0507a;hb=dcde664f250e05357878e3802a997a81ba93c61a;hp=4b67611af0eef2f07bfa7437e498d9418298af7c;hpb=2bb2aa17b6533b2e8d2fc97997ed76bc38b6931d;p=Persons_Comparator.git diff --git a/src/Weight.java b/src/Weight.java index 4b67611..c979f3d 100644 --- a/src/Weight.java +++ b/src/Weight.java @@ -1,6 +1,6 @@ -public class Weight implements Comparable { +public class Weight { private int min = 2; - private int max = 600; + private int max = 250; private int defaultWeight = 72; private int weight; @@ -48,12 +48,8 @@ public class Weight implements Comparable { return intArray; } - @Override - public int compareTo(Weight weight) { + public int distanceTo(Weight weight) { int distance = weight.getWeight() - this.getWeight(); - if (distance >= 0) - return distance; - else - return -distance; + return Math.abs(distance); } }