* Code cleanup;
[Persons_Comparator.git] / src / Person.java
index 5d9d812924ec1daf2c66351c4f90272a397e7bce..6fbdf6ac55a644af4baf0043d23f89c40b240d75 100644 (file)
@@ -3,6 +3,7 @@ import java.util.Comparator;
 public class Person implements Comparator<Person> {
     private Firstname firstname;
     private Origin origin;
+    private Country country;
     private Size size;
     private Weight weight;
     private Eye eye;
@@ -42,6 +43,14 @@ public class Person implements Comparator<Person> {
         return origin;
     }
 
+    public void setCountry(Country country) {
+        this.country = country;
+    }
+
+    public Country getCountry() {
+        return country;
+    }
+
     public void setPersonSize(Size size) {
         this.size = size;
     }
@@ -79,6 +88,7 @@ public class Person implements Comparator<Person> {
         return "Person{" +
                 "firstname=" + firstname.getFirstname() +
                 ", origin=" + origin.getCountry() +
+                ", country=" + country +
                 ", size=" + size.getSize() +
                 ", weight=" + weight.getWeight() +
                 ", eye=" + eye.getStrColor() + "(" + this.getEye().getColor().getRed() + "," + this.getEye().getColor().getGreen() + "," + this.getEye().getColor().getBlue() + ")" +
@@ -88,8 +98,8 @@ public class Person implements Comparator<Person> {
 
     public Integer distanceTo(Person person) {
         return this.getFirstname().distanceTo(person.getFirstname()) + this.getOrigin().distanceTo(person.getOrigin())
-                + this.getPersonSize().distanceTo(person.getPersonSize()) + this.getWeight().distanceTo(person.getWeight())
-                + this.getEye().distanceTo(person.getEye());
+                + this.getCountry().distanceTo(person.getCountry()) + this.getPersonSize().distanceTo(person.getPersonSize())
+                + this.getWeight().distanceTo(person.getWeight()) + this.getEye().distanceTo(person.getEye());
     }
 
     @Override