From: Jérôme Benoit Date: Fri, 11 Jan 2019 14:13:59 +0000 (+0100) Subject: Fix .compareTo() calculation in Size and Weight classes. X-Git-Url: https://git.piment-noir.org/?p=Persons_Comparator.git;a=commitdiff_plain;h=62e26730c12aa80689e068908090d801869ab701 Fix .compareTo() calculation in Size and Weight classes. Signed-off-by: Jérôme Benoit --- diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 217af47..586e00a 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,8 +1,6 @@ - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 0dd4b35..ae8a337 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,5 +1,8 @@ + + diff --git a/src/EyeView.java b/src/EyeView.java index ad0c2fa..bf047c7 100644 --- a/src/EyeView.java +++ b/src/EyeView.java @@ -12,7 +12,7 @@ public class EyeView extends JComponent { setEyeObj(eyeObj); this.label = new JLabel(); this.label.setText("Eyes color"); - this.colorsList = new JList(getEyeObj().getColorsList()); + this.colorsList = new JList(this.getEyeObj().getColorsList()); this.colorsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.colorsList.setLayoutOrientation(JList.VERTICAL); add(label); diff --git a/src/Size.java b/src/Size.java index e665140..6946e5a 100644 --- a/src/Size.java +++ b/src/Size.java @@ -28,7 +28,7 @@ public class Size implements Comparable { @Override public int compareTo(Size size) { - int distance = size.size - this.getSize(); + int distance = size.getSize() - this.getSize(); if (distance >= 0) return distance; else diff --git a/src/Weight.java b/src/Weight.java index 47547ba..5e33327 100644 --- a/src/Weight.java +++ b/src/Weight.java @@ -26,7 +26,7 @@ public class Weight implements Comparable { @Override public int compareTo(Weight weight) { - int distance = weight.weight - this.getWeight(); + int distance = weight.getWeight() - this.getWeight(); if (distance >= 0) return distance; else