|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Observable addressbook.AddressBook
public class AddressBook
An object of this class maintains the collection of Person objects that constitute an address book
Constructor Summary | |
---|---|
AddressBook()
Constructor - create a new, empty address book |
Method Summary | |
---|---|
void |
addPerson(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)
Add a new Person to the collection |
boolean |
getChangedSinceSaved()
Find out whether this address book has been changed since last open / save |
java.io.File |
getFile()
Get the File this address book was most recently read from or saved to |
java.lang.String[] |
getNames()
Provide a list of the the names of all the persons in the collection |
java.lang.String[] |
getPersonInformation(java.lang.String name)
Provide current information about a person |
java.lang.String |
getTitle()
Get the title of this address book - based on the most recently used file |
void |
printMailingLabels(java.io.PrintWriter writer)
Print the collection of persons in order. |
void |
removePerson(java.lang.String name)
Remove a specific person from the collection |
int |
search(java.lang.String criterion,
int startingIndex)
Search the collection for a person matching given criteria |
void |
setFile(java.io.File file)
Set the File this address book was most recently read from or saved to |
void |
setUnchangedSinceLastSave()
Record that an open/save operation has taken place, rendering this address book unchanged since the last such operation |
void |
sortByName()
Sort the collection by name |
void |
sortByZip()
Sort the collection by ZIP |
void |
updatePerson(java.lang.String name,
java.lang.String address,
java.lang.String city,
java.lang.String state,
java.lang.String zip,
java.lang.String phone)
Update stored information about a person |
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AddressBook()
Method Detail |
---|
public java.lang.String[] getNames()
public void addPerson(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)
firstName
- the person's first namelastName
- the person's last nameaddress
- the person's addresscity
- the person's citystate
- the person's statezip
- the person's zipphone
- the person's phonepublic java.lang.String[] getPersonInformation(java.lang.String name)
name
- the desired name
public void updatePerson(java.lang.String name, java.lang.String address, java.lang.String city, java.lang.String state, java.lang.String zip, java.lang.String phone) throws java.lang.IllegalArgumentException
name
- the name of the person (which cannot be updated)address
- the person's new addresscity
- the person's new citystate
- the person's new statezip
- the person's new zipphone
- the person's new phone
java.lang.IllegalArgumentException
- if the specified person does not existpublic void removePerson(java.lang.String name) throws java.lang.IllegalArgumentException
name
- the desired name
java.lang.IllegalArgumentException
- if the specified person does not existpublic void sortByName()
public void sortByZip()
public int search(java.lang.String criterion, int startingIndex)
criterion
- the criterion for the searchstartingIndex
- the position to start the search from
public java.io.File getFile()
public void setFile(java.io.File file)
file
- the file just used to read or save this objectpublic java.lang.String getTitle()
public void printMailingLabels(java.io.PrintWriter writer)
writer
- the writer to print topublic boolean getChangedSinceSaved()
public void setUnchangedSinceLastSave()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |