From 62e26730c12aa80689e068908090d801869ab701 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 11 Jan 2019 15:13:59 +0100 Subject: [PATCH] Fix .compareTo() calculation in Size and Weight classes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .idea/compiler.xml | 9 ++------- .idea/kotlinc.xml | 3 +++ src/EyeView.java | 2 +- src/Size.java | 2 +- src/Weight.java | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) 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 -- 2.34.1