X-Git-Url: https://git.piment-noir.org/?p=Persons_Comparator.git;a=blobdiff_plain;f=src%2FWeight.java;h=82fa712ce3f75a78b36ce2b2d185eae46b844745;hp=4b67611af0eef2f07bfa7437e498d9418298af7c;hb=5687dc10a68b52d28b63151d8c16a45775ef2e77;hpb=9b3bfcdd95253a04ed12a676ee29a9d777c1e496 diff --git a/src/Weight.java b/src/Weight.java index 4b67611..82fa712 100644 --- a/src/Weight.java +++ b/src/Weight.java @@ -1,4 +1,4 @@ -public class Weight implements Comparable { +public class Weight { private int min = 2; private int max = 600; private int defaultWeight = 72; @@ -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); } }