*/\r
package org.mxchange.addressbook.manager.contact;\r
\r
+import java.text.MessageFormat;\r
import java.util.ArrayList;\r
import java.util.Collections;\r
import java.util.Iterator;\r
}\r
\r
/**\r
- * Adds given contact to address book and flushes all entries to database\r
+ * Adds given Contact instance to list\r
*\r
- * @param contact Contact being added\r
- * @todo Add check for book size\r
+ * @param contact Contact instance to add\r
*/\r
@Override\r
- public void registerContact (final Contact contact) {\r
- // Check if contact is found\r
- if (this.isContactAlreadyAdded(contact)) {\r
- // Contact already added\r
- // @todo Do something here\r
- } else if ((contact.isOwnContact()) && (this.isOwnContactAdded())) {\r
- // Own contact already added\r
- // @todo Do something\r
- }\r
-\r
- // Debug message\r
- /* NOISY-DEBUG: */ this.getLogger().debug("Adding '" + contact.getSurname() + "' '" + contact.getFamilyName() + "' at pos '" + this.size () + "' ...");\r
-\r
- // Add contact to internal list\r
- this.addContact(contact);\r
-\r
- // Flush whole list\r
- this.flush();\r
+ public void addContact (final Contact contact) {\r
+ this.contacts.add(contact);\r
}\r
\r
/**\r
}\r
\r
/**\r
- * Getter for size\r
+ * Adds given contact to address book and flushes all entries to database\r
*\r
- * @return size of contact "book"\r
+ * @param contact Contact being added\r
+ * @todo Add check for book size\r
*/\r
@Override\r
- public int size () {\r
- return this.contacts.size();\r
+ public void registerContact (final Contact contact) {\r
+ // Check if contact is found\r
+ if (this.isContactAlreadyAdded(contact)) {\r
+ // Contact already added\r
+ // @todo Do something here\r
+ } else if ((contact.isOwnContact()) && (this.isOwnContactAdded())) {\r
+ // Own contact already added\r
+ // @todo Do something\r
+ }\r
+ \r
+ // Debug message\r
+ /* NOISY-DEBUG: */ this.getLogger().debug(MessageFormat.format("Adding '{0}' '{1}' at pos '{2}' ...", contact.getSurname(), contact.getFamilyName(), this.size()));\r
+ \r
+ // Add contact to internal list\r
+ this.addContact(contact);\r
+ \r
+ // Flush whole list\r
+ this.flush();\r
}\r
\r
/**\r
- * Adds given Contact instance to list\r
- * \r
- * @param contact Contact instance to add\r
+ * Getter for size\r
+ *\r
+ * @return size of contact "book"\r
*/\r
@Override\r
- public void addContact (final Contact contact) {\r
- this.contacts.add(contact);\r
+ public int size () {\r
+ return this.contacts.size();\r
}\r
\r
/**\r