From: Roland Haeder Date: Mon, 20 Jul 2015 11:52:56 +0000 (+0200) Subject: sorted members X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2ecaa18b72f4286559991ecbf43e5b8d0c4b8396;p=jbonuscard-lib.git sorted members Signed-off-by:Roland Häder --- diff --git a/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java b/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java index 0b31e2f..419436d 100644 --- a/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java +++ b/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java @@ -16,6 +16,7 @@ */ package org.mxchange.addressbook.manager.contact; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; @@ -73,30 +74,13 @@ public class ContactManager extends BaseManager implements ManageableContact { } /** - * Adds given contact to address book and flushes all entries to database + * Adds given Contact instance to list * - * @param contact Contact being added - * @todo Add check for book size + * @param contact Contact instance to add */ @Override - public void registerContact (final Contact contact) { - // Check if contact is found - if (this.isContactAlreadyAdded(contact)) { - // Contact already added - // @todo Do something here - } else if ((contact.isOwnContact()) && (this.isOwnContactAdded())) { - // Own contact already added - // @todo Do something - } - - // Debug message - /* NOISY-DEBUG: */ this.getLogger().debug("Adding '" + contact.getSurname() + "' '" + contact.getFamilyName() + "' at pos '" + this.size () + "' ..."); - - // Add contact to internal list - this.addContact(contact); - - // Flush whole list - this.flush(); + public void addContact (final Contact contact) { + this.contacts.add(contact); } /** @@ -306,23 +290,40 @@ public class ContactManager extends BaseManager implements ManageableContact { } /** - * Getter for size + * Adds given contact to address book and flushes all entries to database * - * @return size of contact "book" + * @param contact Contact being added + * @todo Add check for book size */ @Override - public int size () { - return this.contacts.size(); + public void registerContact (final Contact contact) { + // Check if contact is found + if (this.isContactAlreadyAdded(contact)) { + // Contact already added + // @todo Do something here + } else if ((contact.isOwnContact()) && (this.isOwnContactAdded())) { + // Own contact already added + // @todo Do something + } + + // Debug message + /* NOISY-DEBUG: */ this.getLogger().debug(MessageFormat.format("Adding '{0}' '{1}' at pos '{2}' ...", contact.getSurname(), contact.getFamilyName(), this.size())); + + // Add contact to internal list + this.addContact(contact); + + // Flush whole list + this.flush(); } /** - * Adds given Contact instance to list - * - * @param contact Contact instance to add + * Getter for size + * + * @return size of contact "book" */ @Override - public void addContact (final Contact contact) { - this.contacts.add(contact); + public int size () { + return this.contacts.size(); } /**