// Path: Java/src/com/yourtion/Pattern01/PersonExpanded.java
// public class PersonExpanded implements Comparable<PersonExpanded> {
// 	private String firstName;
// 	private String lastName;
// 	private String midName;
// 
// 	public PersonExpanded(String firstName, String midName, String lastName) {
// 		this.firstName = firstName;
// 		this.lastName = lastName;
// 		this.midName = midName;
// 	}
// 
// 	public String getFirstName() {
// 		return firstName;
// 	}
// 
// 	public void setFirstName(String firstName) {
// 		this.firstName = firstName;
// 	}
// 
// 	public String getLastName() {
// 		return lastName;
// 	}
// 
// 	public void setLastName(String lastName) {
// 		this.lastName = lastName;
// 	}
// 
// 	public String getMidName() {
// 		return midName;
// 	}
// 
// 	public void setMidName(String middleName) {
// 		this.midName = middleName;
// 	}
// 
// 	@Override
// 	public int compareTo(PersonExpanded otherPerson) {
// 		return this.lastName.compareTo(otherPerson.lastName);
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return firstName + " " + midName + " " + lastName;
// 	}
// 
// }


import com.yourtion.Pattern01.PersonExpanded;
import java.util.Comparator;
package com.yourtion.Pattern02;



/**
 * Created by Yourtion on 9/8/16.
 */
public class PersonExampleCC {
    public void run() {
        Comparator<PersonExpanded> firstAndLastNameComparator =
                new ComposedComparator<PersonExpanded>(
                        new FirstNameComparator(),
                        new LastNameComparator());

        PersonExpanded personOne = new PersonExpanded("John", "", "Adams");
        PersonExpanded personTwo = new PersonExpanded("John", "Quincy", "Adams");

        System.out
                .println(firstAndLastNameComparator.compare(personOne, personTwo));
    }
}

class FirstNameComparator implements Comparator<PersonExpanded> {
    @Override
    public int compare(PersonExpanded personOne, PersonExpanded personTwo) {
        return personOne.getFirstName().compareTo(personTwo.getFirstName());
    }
}

class LastNameComparator implements Comparator<PersonExpanded> {
    @Override
// Path: Java/src/com/yourtion/Pattern01/PersonExpanded.java
// public class PersonExpanded implements Comparable<PersonExpanded> {
// 	private String firstName;
// 	private String lastName;
// 	private String midName;
// 
// 	public PersonExpanded(String firstName, String midName, String lastName) {
// 		this.firstName = firstName;
// 		this.lastName = lastName;
// 		this.midName = midName;
// 	}
// 
// 	public String getFirstName() {
// 		return firstName;
// 	}
// 
// 	public void setFirstName(String firstName) {
// 		this.firstName = firstName;
// 	}
// 
// 	public String getLastName() {
// 		return lastName;
// 	}
// 
// 	public void setLastName(String lastName) {
// 		this.lastName = lastName;
// 	}
// 
// 	public String getMidName() {
// 		return midName;
// 	}
// 
// 	public void setMidName(String middleName) {
// 		this.midName = middleName;
// 	}
// 
// 	@Override
// 	public int compareTo(PersonExpanded otherPerson) {
// 		return this.lastName.compareTo(otherPerson.lastName);
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return firstName + " " + midName + " " + lastName;
// 	}
// 
// }


// Path: Java/src/com/yourtion/Pattern02/PersonExampleCC.java
import com.yourtion.Pattern01.PersonExpanded;
import java.util.Comparator;

package com.yourtion.Pattern02;



/**
 * Created by Yourtion on 9/8/16.
 */
public class PersonExampleCC {
    public void run() {
        Comparator<PersonExpanded> firstAndLastNameComparator =
                new ComposedComparator<PersonExpanded>(
                        new FirstNameComparator(),
                        new LastNameComparator());

        PersonExpanded personOne = new PersonExpanded("John", "", "Adams");
        PersonExpanded personTwo = new PersonExpanded("John", "Quincy", "Adams");

        System.out
                .println(firstAndLastNameComparator.compare(personOne, personTwo));
    }
}

class FirstNameComparator implements Comparator<PersonExpanded> {
    @Override
    public int compare(PersonExpanded personOne, PersonExpanded personTwo) {
        return personOne.getFirstName().compareTo(personTwo.getFirstName());
    }
}

class LastNameComparator implements Comparator<PersonExpanded> {
    @Override
    public int compare(PersonExpanded personOne, PersonExpanded personTwo) {