X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FSize.java;h=e665140b9f83c020a1f23ea1dc973ea45ccdbd22;hb=b974e749af3a4b2df3737b2d361233c704dcc4d8;hp=20e96f6b47f04c7c9e330aec7a271e4b54aad289;hpb=613054ac3144a04ab284e159b610317eacf67e1f;p=Persons_Comparator.git diff --git a/src/Size.java b/src/Size.java index 20e96f6..e665140 100644 --- a/src/Size.java +++ b/src/Size.java @@ -1,10 +1,11 @@ -import java.util.Comparator; - public class Size implements Comparable { private int max = 240; private int min = 20; private int size; + Size() { + } + Size(int size) { setSize(size); } @@ -17,12 +18,12 @@ public class Size implements Comparable { if (validateSize(size)) { this.size = size; } else { - throw new IllegalArgumentException("Size must be between" + this.min + " and " + this.max); + throw new IllegalArgumentException("Size must be between " + this.min + " and " + this.max); } } private boolean validateSize(int size) { - return (size > max || size < min); + return (size >= min && size <= max); } @Override