package sample.sample19;

import java.util.ArrayList;
import java.util.List;

public class DataFinder {
	private PersonDataAccessor accessor = new Aさんが作っているPersonDataAccessor();

	public List<Person> findPerson(String name) {
		List<Person> allPersons = accessor.getAllPersons();
		List<Person> resultList = new ArrayList<Person>();

		for (Person person : allPersons) {
			if (person.getName().contains(name)) {
				resultList.add(person);
			}
		}

		return resultList;
	}

	public void setAccessor(PersonDataAccessor accessor) {
		this.accessor = accessor;
	}
}
