Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IDATx2001-2020
Contacts
Commits
05465f92
Commit
05465f92
authored
Mar 26, 2020
by
Arne Styve
Browse files
Removed unsused methods in the AddressBook class for simplification. Ready to release bugfix v0.3.1
parent
02167312
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
05465f92
/out/
addressbook.dat
.idea/sonarlint
/vpproject/
/contactsdb/
*.vpdm
\ No newline at end of file
src/no/ntnu/idata2001/contacts/model/AddressBook.java
View file @
05465f92
...
...
@@ -33,28 +33,6 @@ public class AddressBook implements Serializable, Iterable<ContactDetails> {
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.
*
...
...
@@ -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.
* The phone number should be one that is currently in use.
...
...
@@ -98,9 +51,7 @@ public class AddressBook implements Serializable, Iterable<ContactDetails> {
* @param phoneNumber The phone number to the contact to remove
*/
public
void
removeContact
(
String
phoneNumber
)
{
if
(
keyInUse
(
phoneNumber
))
{
this
.
book
.
remove
(
phoneNumber
);
}
}
/**
...
...
src/no/ntnu/idata2001/contacts/views/ContactsApp.java
View file @
05465f92
...
...
@@ -32,7 +32,7 @@ import no.ntnu.idata2001.contacts.model.ContactDetails;
*/
public
class
ContactsApp
extends
Application
{
private
static
final
String
VERSION
=
"0.3"
;
private
static
final
String
VERSION
=
"0.3
.1
"
;
private
MainController
mainController
;
private
AddressBook
addressBook
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment