addressbook
Class Person

java.lang.Object
  extended by addressbook.Person
All Implemented Interfaces:
java.io.Serializable

public class Person
extends java.lang.Object
implements java.io.Serializable

An object of this class maintains information about a single individual in the address book

See Also:
Serialized Form

Nested Class Summary
static class Person.CompareByName
          Comparator for comparing two persons by alphabetical order of name
static class Person.CompareByZip
          Comparator for comparing two persons by order of zip code, with ties broken by name
 
Constructor Summary
Person(java.lang.String firstName, java.lang.String lastName, java.lang.String address, java.lang.String city, java.lang.String state, java.lang.String zip, java.lang.String phone)
          Constructor - attributes specified individually
 
Method Summary
 boolean contains(java.lang.String criterion)
          Test to see whether this person contains a search criterion
 java.lang.String getAddress()
          Accessor for the person's address
 java.lang.String getCity()
          Accessor for the person's city
 java.lang.String getFullName()
          Get the full name of a person in the form last, first
 java.lang.String getPhone()
          Accessor for the person's phone
 java.lang.String getState()
          Accessor for the person's state
 java.lang.String getZip()
          Accessor for the person's zip
 void update(java.lang.String address, java.lang.String city, java.lang.String state, java.lang.String zip, java.lang.String phone)
          Update the person with new information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Person

public Person(java.lang.String firstName,
              java.lang.String lastName,
              java.lang.String address,
              java.lang.String city,
              java.lang.String state,
              java.lang.String zip,
              java.lang.String phone)
Constructor - attributes specified individually

Parameters:
firstName - the person's first name
lastName - the person's last name
address - the person's address
city - the person's city
state - the person's state
zip - the person's zip
phone - the person's phone
Method Detail

getFullName

public java.lang.String getFullName()
Get the full name of a person in the form last, first

Returns:
the person's name

getAddress

public java.lang.String getAddress()
Accessor for the person's address

Returns:
the person's address

getCity

public java.lang.String getCity()
Accessor for the person's city

Returns:
the person's city

getState

public java.lang.String getState()
Accessor for the person's state

Returns:
the person's state

getZip

public java.lang.String getZip()
Accessor for the person's zip

Returns:
the person's zip

getPhone

public java.lang.String getPhone()
Accessor for the person's phone

Returns:
the person's phone

update

public void update(java.lang.String address,
                   java.lang.String city,
                   java.lang.String state,
                   java.lang.String zip,
                   java.lang.String phone)
Update the person with new information. Note that the name cannot be changed, but the other information can be

Parameters:
address - the person's new address
city - the person's new city
state - the person's new state
zip - the person's new zip
phone - the person's new phone

contains

public boolean contains(java.lang.String criterion)
Test to see whether this person contains a search criterion

Parameters:
criterion - the search criterion
Returns:
true if the criterion is contained in any field