repositories
/
Persons_Comparator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Finish the WeightView by using a JComboBox.
[Persons_Comparator.git]
/
src
/
Size.java
diff --git
a/src/Size.java
b/src/Size.java
index c2392073b34662affdc474f619a1ab27519e2a98..a61f24cb79769b34c3a8e8b502542621232a81ed 100644
(file)
--- a/
src/Size.java
+++ b/
src/Size.java
@@
-1,12
+1,23
@@
public class Size implements Comparable<Size> {
private int max = 240;
public class Size implements Comparable<Size> {
private int max = 240;
- private int min =
2
0;
+ private int min =
4
0;
private int size;
private int size;
+ Size() {
+ }
+
Size(int size) {
setSize(size);
}
Size(int size) {
setSize(size);
}
+ public int getMin() {
+ return min;
+ }
+
+ public int getMax() {
+ return max;
+ }
+
public int getSize() {
return size;
}
public int getSize() {
return size;
}
@@
-15,17
+26,17
@@
public class Size implements Comparable<Size> {
if (validateSize(size)) {
this.size = size;
} else {
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.getMin() + " and " + this.getMax()
);
}
}
private boolean validateSize(int size) {
}
}
private boolean validateSize(int size) {
- return (size >
max || size < min
);
+ return (size >
= getMin() && size <= getMax()
);
}
@Override
public int compareTo(Size size) {
}
@Override
public int compareTo(Size size) {
- int distance = size.
size
- this.getSize();
+ int distance = size.
getSize()
- this.getSize();
if (distance >= 0)
return distance;
else
if (distance >= 0)
return distance;
else