Commit 05465f92 authored by Arne Styve's avatar Arne Styve
Browse files

Removed unsused methods in the AddressBook class for simplification. Ready to release bugfix v0.3.1

parent 02167312
/out/ /out/
addressbook.dat addressbook.dat
.idea/sonarlint .idea/sonarlint
/vpproject/
/contactsdb/
*.vpdm
\ No newline at end of file
...@@ -33,28 +33,6 @@ public class AddressBook implements Serializable, Iterable<ContactDetails> { ...@@ -33,28 +33,6 @@ public class AddressBook implements Serializable, Iterable<ContactDetails> {
book = new TreeMap<>(); book = new TreeMap<>();
} }
/**
* Searches for a contact matching the phone number given by the parameter.
* The found contact is returned. If no contact found, <code>null</code>
* is returned.
*
* @param phoneNumber The number to be looked up.
* @return The details corresponding to the phone number.
*/
public ContactDetails findContactByPhoneNumber(String phoneNumber) {
return book.get(phoneNumber);
}
/**
* Return whether or not the current phone number is in use.
*
* @param phoneNumber The name or phone number to be looked up.
* @return true if the phoneNumber is in use, false otherwise.
*/
public boolean keyInUse(String phoneNumber) {
return book.containsKey(phoneNumber);
}
/** /**
* Add a new contact to the address book. * Add a new contact to the address book.
* *
...@@ -66,31 +44,6 @@ public class AddressBook implements Serializable, Iterable<ContactDetails> { ...@@ -66,31 +44,6 @@ public class AddressBook implements Serializable, Iterable<ContactDetails> {
} }
} }
/**
* Change the contact previously stored under the given key.
*
* @param oldKey One of the keys used to store the contact.
* This should be a key that is currently in use.
* @param contact The replacement contact.
*/
public void changeDetails(String oldKey,
ContactDetails contact) {
if (keyInUse(oldKey) && contact != null) {
removeContact(oldKey);
addContact(contact);
}
}
/**
* Return the number of entries currently in the
* address book.
*
* @return The number of entries.
*/
public int getNumberOfEntries() {
return this.book.size();
}
/** /**
* Remove the contact with the given phonenumber from the address book. * Remove the contact with the given phonenumber from the address book.
* The phone number should be one that is currently in use. * The phone number should be one that is currently in use.
...@@ -98,9 +51,7 @@ public class AddressBook implements Serializable, Iterable<ContactDetails> { ...@@ -98,9 +51,7 @@ public class AddressBook implements Serializable, Iterable<ContactDetails> {
* @param phoneNumber The phone number to the contact to remove * @param phoneNumber The phone number to the contact to remove
*/ */
public void removeContact(String phoneNumber) { public void removeContact(String phoneNumber) {
if (keyInUse(phoneNumber)) {
this.book.remove(phoneNumber); this.book.remove(phoneNumber);
}
} }
/** /**
......
...@@ -32,7 +32,7 @@ import no.ntnu.idata2001.contacts.model.ContactDetails; ...@@ -32,7 +32,7 @@ import no.ntnu.idata2001.contacts.model.ContactDetails;
*/ */
public class ContactsApp extends Application { public class ContactsApp extends Application {
private static final String VERSION = "0.3"; private static final String VERSION = "0.3.1";
private MainController mainController; private MainController mainController;
private AddressBook addressBook; private AddressBook addressBook;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment