X-Git-Url: https://git.piment-noir.org/?p=Persons_Comparator.git;a=blobdiff_plain;f=src%2FSize.java;h=e665140b9f83c020a1f23ea1dc973ea45ccdbd22;hp=c2392073b34662affdc474f619a1ab27519e2a98;hb=b974e749af3a4b2df3737b2d361233c704dcc4d8;hpb=416b4c77ff435499154345f4992f27c12ac0933c diff --git a/src/Size.java b/src/Size.java index c239207..e665140 100644 --- a/src/Size.java +++ b/src/Size.java @@ -3,6 +3,9 @@ public class Size implements Comparable { private int min = 20; private int size; + Size() { + } + Size(int size) { setSize(size); } @@ -15,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