|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
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 |
getChangedSinceLastSave()
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 |
getFullNameOfPerson(int index)
Provide the full name of a person |
int |
getNumberOfPersons()
Get the current size of the collection |
java.lang.String[] |
getOtherPersonInformation(int index)
Provide the rest of the current information about a person |
java.lang.String |
getTitle()
Get the title of this address book - based on the most recently used file |
void |
printAll()
Print the collection of persons in order. |
void |
removePerson(int index)
Remove a specific person from the collection |
void |
setChangedSinceLastSave(boolean changedSinceLastSave)
Record a change in the saved status of this address book |
void |
setFile(java.io.File file)
Set the File this address book was most recently read from or saved to |
void |
sortByName()
Sort the collection by name |
void |
sortByZip()
Sort the collection by ZIP |
void |
updatePerson(int index,
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 int getNumberOfPersons()
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 getFullNameOfPerson(int index)
index
- the position of the desired person
public java.lang.String[] getOtherPersonInformation(int index)
index
- the position of the desired person
public void updatePerson(int index, java.lang.String address, java.lang.String city, java.lang.String state, java.lang.String zip, java.lang.String phone)
index
- the position of the desired personaddress
- the person's new addresscity
- the person's new citystate
- the person's new statezip
- the person's new zipphone
- the person's new phonepublic void removePerson(int index)
index
- the position of the desired personpublic void sortByName()
public void sortByZip()
public void printAll()
public java.io.File getFile()
public java.lang.String getTitle()
public void setFile(java.io.File file)
file
- the file just used to read or save this objectpublic boolean getChangedSinceLastSave()
public void setChangedSinceLastSave(boolean changedSinceLastSave)
changedSinceLastSave
- the new status
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |