Class FamilyTree

java.lang.Object
edu.pdx.cs410J.family.FamilyTree
All Implemented Interfaces:
Serializable

public class FamilyTree extends Object implements 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 Details

    • FamilyTree

      public FamilyTree()
      Creates an empty family tree.
  • Method Details

    • getPeople

      Returns a collection of Persons that are in this family tree.
    • containsPerson

      public boolean containsPerson(int id)
      Returns whether or not this family tree contains a person with the given id.
    • getPerson

      public Person getPerson(int id)
      Returns a person in this family tree with a given id. If no person with that id exists in this family tree, then null is returned.
    • addPerson

      public void addPerson(Person person)
      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

      public String toString()
      Overrides:
      toString in class Object