|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.pdx.cs399J.family.Person
public class Person
This class represents a person in a family tree. Each person has a required unique id. Additionally, a person may have a first, middle, and last name, a date of birth, a date of death, and may be involved in one or more marriages.
| Nested Class Summary | |
|---|---|
static class |
Person.Gender
|
| Field Summary | |
|---|---|
static Person.Gender |
FEMALE
|
static Person.Gender |
MALE
|
static int |
UNKNOWN
A constant representing the id of an unknown person |
| Constructor Summary | |
|---|---|
Person(int id,
Person.Gender gender)
Creates a new Person with a given id and gender. |
|
| Method Summary | |
|---|---|
void |
addMarriage(Marriage marriage)
Makes note of a marriage this person was involved in. |
boolean |
equals(Object o)
Determines whether or not this Person is equal to
another Person. |
Date |
getDateOfBirth()
Returns this person's date of birth. |
Date |
getDateOfDeath()
Returns this person's date of death. |
Person |
getFather()
Returns this person's father. |
int |
getFatherId()
Returns the id of this person's father. |
String |
getFirstName()
Returns this person's first name. |
String |
getFullName()
Returns this person's full (first, middle, and last) name. |
Person.Gender |
getGender()
Returns this person's gender |
int |
getId()
Returns this person's id. |
String |
getLastName()
Returns this person's last name. |
Collection<Marriage> |
getMarriages()
Returns the marriages that this person was involved in. |
String |
getMiddleName()
Returns this person's middle name. |
Person |
getMother()
Returns this person's mother. |
int |
getMotherId()
Returns the id of this person's mother. |
void |
setDateOfBirth(Date dob)
Sets this person's date of birth. |
void |
setDateOfDeath(Date dod)
Sets this person's date of death. |
void |
setFather(Person father)
Sets this person's father. |
void |
setFirstName(String firstName)
Sets this person's first name. |
void |
setLastName(String lastName)
Sets this person's last name. |
void |
setMiddleName(String middleName)
Sets this person's middle name. |
void |
setMother(Person mother)
Sets this person's mother. |
String |
toString()
Returns a brief description of this person. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static Person.Gender MALE
public static Person.Gender FEMALE
public static final int UNKNOWN
| Constructor Detail |
|---|
public Person(int id,
Person.Gender gender)
Person with a given id and gender.
An UNKNOWN person cannot be created.
FamilyTreeException - id is less than 1 or gender is
neither MALE nor FEMALE| Method Detail |
|---|
public int getId()
public Person.Gender getGender()
public void setFirstName(String firstName)
public String getFirstName()
public void setMiddleName(String middleName)
public String getMiddleName()
public void setLastName(String lastName)
public String getLastName()
public String getFullName()
public void setFather(Person father)
FamilyTreeException - father is not MALEpublic int getFatherId()
UNKNOWN, if this person's father is not knownpublic Person getFather()
public void setMother(Person mother)
FamilyTreeException - mother's gender is not FEMALEpublic int getMotherId()
UNKNOWN, if this person's father is not knownpublic Person getMother()
public void setDateOfBirth(Date dob)
public Date getDateOfBirth()
public void setDateOfDeath(Date dod)
FamilyTreeException - If this person's data of birth is known and
dod occurs before it.public Date getDateOfDeath()
public void addMarriage(Marriage marriage)
FamilyTreeException - If this person is not one of the spouses in the marriagepublic Collection<Marriage> getMarriages()
public boolean equals(Object o)
Person is equal to
another Person. Two Persons are
considered equal if they have the same id.
equals in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||