From 2ecaa18b72f4286559991ecbf43e5b8d0c4b8396 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 20 Jul 2015 13:52:56 +0200 Subject: [PATCH] =?utf8?q?sorted=20members=20Signed-off-by:Roland=20H?= =?utf8?q?=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../manager/contact/ContactManager.java | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) 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(); } /** -- 2.39.5