Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
public class Origin implements Comparable<Origin> {
+ private String continent;
private String country;
- Origin(String country) {
+ Origin(String continent, String country) {
setCountry(country);
+ setContinent(continent);
+ }
+
+ public String getContinent() {
+ return continent;
+ }
+
+ public void setContinent(String continent) {
+ this.continent = continent;
}
public String getCountry() {
@Override
public int compareTo(Person person) {
- return 0;
+ return this.firstname.compareTo(person.getFirstname()) + this.origin.compareTo(person.getOrigin())
+ + this.size.compareTo(person.getPersonSize()) + this.weight.compareTo(person.getWeight())
+ + this.eye.compareTo(person.getEye());
}
}
@Override
public int compareTo(Size size) {
- return 0;
+ int distance = size.size - this.getSize();
+ if (distance >= 0)
+ return distance;
+ else
+ return -distance;
+
}
}
@Override
public int compareTo(Weight weight) {
- return 0;
+ int distance = weight.weight - this.getWeight();
+ if (distance >= 0)
+ return distance;
+ else
+ return -distance;
}
}