repositories
/
Persons_Comparator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix .compareTo() calculation in Size and Weight classes.
[Persons_Comparator.git]
/
src
/
Weight.java
diff --git
a/src/Weight.java
b/src/Weight.java
index e79d1025a9e35977344ab5003e129df1aa88ff03..5e33327fac7ec77eac23a14ec0aa46a6b4e65342 100644
(file)
--- a/
src/Weight.java
+++ b/
src/Weight.java
@@
-1,6
+1,9
@@
public class Weight implements Comparable<Weight> {
private int weight;
public class Weight implements Comparable<Weight> {
private int weight;
+ Weight() {
+ }
+
Weight(int weight) {
setWeight(weight);
}
Weight(int weight) {
setWeight(weight);
}
@@
-23,7
+26,7
@@
public class Weight implements Comparable<Weight> {
@Override
public int compareTo(Weight weight) {
@Override
public int compareTo(Weight weight) {
- int distance = weight.
weight
- this.getWeight();
+ int distance = weight.
getWeight()
- this.getWeight();
if (distance >= 0)
return distance;
else
if (distance >= 0)
return distance;
else