Package edu.pdx.cs410J.family
Class FamilyTree
java.lang.Object
edu.pdx.cs410J.family.FamilyTree
- All Implemented Interfaces:
Serializable
This class represents a family tree. Essentially, it is a
collection of people. Family trees are always rooted at the person
with id 1.
- Author:
- David Whitlock
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a person to this family tree.booleancontainsPerson(int id) Returns whether or not this family tree contains a person with the given id.Returns a collection ofPersons that are in this family tree.getPerson(int id) Returns a person in this family tree with a given id.toString()
-
Constructor Details
-
FamilyTree
public FamilyTree()Creates an empty family tree.
-
-
Method Details
-
getPeople
Returns a collection ofPersons that are in this family tree. -
containsPerson
Returns whether or not this family tree contains a person with the given id. -
getPerson
Returns a person in this family tree with a given id. If no person with that id exists in this family tree, thennullis returned. -
addPerson
Adds a person to this family tree. If a person with the same id as the person being added already exists in this family tree, the old person is removed and replaced with the new. -
toString
-