diff --git a/src/input/Person.java b/src/input/Person.java new file mode 100644 index 0000000..fe97153 --- /dev/null +++ b/src/input/Person.java @@ -0,0 +1,66 @@ +package input; + +public class Person implements Input{ + public String lastName; + public String firstName[]; + public Gender gender; + public Person spouse; + //public Society society; + public String function; + + public Person(String lastName, String[] firstName, Gender gender, Person spouse, String function) { + this.lastName = lastName; + this.firstName = firstName; + this.gender = gender; + this.spouse = spouse; + //this.society = society + this.function = function; + } + + @Override + public String toString(Presentation presentation, Order order) { + String out = ""; + String firstNames = ""; + switch (presentation) { + case SHORT: + for (String i: firstName) + firstNames += i.charAt(0) + ". "; + if (order == Order.FIRST_LAST) + out = firstNames + lastName; + else + out = lastName + " " + firstNames; + break; + case SIMPLE: + out = gender == Gender.MEN ? "Mr. " : "Ms. " ; + for (int i = 0; i < firstName.length-1; i++) + firstNames += firstName[i].charAt(0) + ". "; + firstNames += firstName[firstName.length-1]; + if (order == Order.FIRST_LAST) + out += firstNames + " " + lastName; + else + out += lastName + " " + firstNames; + /*if (society != null) + out += " (" + society.socialReason + ")";*/ + break; + case COMPLETE: + out = gender == Gender.MEN ? "Mr. " : "Ms. " ; + for (String i: firstName) + firstNames += i + " "; + if (order == Order.FIRST_LAST) + out = firstNames + " " + lastName + "\n"; + else + out = lastName + " " + firstNames + "\n"; + /*if (society != null) + out += "\t- Society: " + society.socialReason + "\n";*/ + if (!function.equals("")) + out += "\t- Function: " + function; + break; + } + return out; + } + + @Override + public boolean research(String search) { + return false; + } +}