X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2FCard.java;h=53ae972a5803d38482333acae7e7fe565e45e34d;hb=176a83279a5aafb7e44cc7c34bf78f0bc35225fe;hp=4c4e5d174e419bb47c9037e2f4477a08438a3b73;hpb=78e4af97505df331618f9c13dd5d98440d364764;p=jvcard.git diff --git a/src/be/nikiroo/jvcard/Card.java b/src/be/nikiroo/jvcard/Card.java index 4c4e5d1..53ae972 100644 --- a/src/be/nikiroo/jvcard/Card.java +++ b/src/be/nikiroo/jvcard/Card.java @@ -86,6 +86,31 @@ public class Card { public Contact get(int index) { return contacts.get(index); } + + /** + * Add a new {@link Contact} in this {@link Card}. + * + * @param contact + * the new contact + */ + public void add(Contact contact) { + contact.setParent(this); + contact.setDirty(); + contacts.add(contact); + } + + /** + * Remove the given {@link Contact} from its this {@link Card} if it is in. + * + * @return TRUE in case of success + */ + public boolean remove(Contact contact) { + if (contacts.remove(contact)) { + setDirty(); + } + + return false; + } /** * Save the {@link Card} to the given {@link File} with the given @@ -196,16 +221,6 @@ public class Card { } } - /** - * Return the full list of {@link Contact}s. Please use responsibly (this is - * the original list). - * - * @return the list of {@link Contact}s - */ - List getContactsList() { - return contacts; - } - /** * Notify that this element has unsaved changes. */