esmska.data
Class Contacts

java.lang.Object
  extended by esmska.data.Contacts

public class Contacts
extends java.lang.Object

Class managing all program contacts


Field Summary
static int ACTION_ADD_CONTACT
          new contact added
static int ACTION_CHANGE_CONTACT
          properties of some contact changed
static int ACTION_CLEAR_CONTACTS
          all contacts removed
static int ACTION_REMOVE_CONTACT
          existing contact removed
 
Method Summary
 boolean add(Contact contact)
          Add new contact
 void addActionListener(java.awt.event.ActionListener actionListener)
           
 boolean addAll(java.util.Collection<Contact> contacts)
          Add new contacts
 void clear()
          Remove all contacts
 boolean contains(Contact contact)
          Search for an existing contact
 java.util.SortedSet<Contact> getAll()
          Get unmodifiable collection of all contacts sorted by name
static Contacts getInstance()
          Get shared instance
 boolean isEmpty()
          Return if there are no contacts
 boolean remove(Contact contact)
          Remove existing contact
 void removeActionListener(java.awt.event.ActionListener actionListener)
           
 boolean removeAll(java.util.Collection<Contact> contacts)
          Remove existing contacts
 int size()
          Return number of contacts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_ADD_CONTACT

public static final int ACTION_ADD_CONTACT
new contact added

See Also:
Constant Field Values

ACTION_REMOVE_CONTACT

public static final int ACTION_REMOVE_CONTACT
existing contact removed

See Also:
Constant Field Values

ACTION_CLEAR_CONTACTS

public static final int ACTION_CLEAR_CONTACTS
all contacts removed

See Also:
Constant Field Values

ACTION_CHANGE_CONTACT

public static final int ACTION_CHANGE_CONTACT
properties of some contact changed

See Also:
Constant Field Values
Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener actionListener)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener actionListener)

getInstance

public static Contacts getInstance()
Get shared instance


getAll

public java.util.SortedSet<Contact> getAll()
Get unmodifiable collection of all contacts sorted by name


add

public boolean add(Contact contact)
Add new contact

Parameters:
contact - new contact, not null
Returns:
See Collection.add(E)

addAll

public boolean addAll(java.util.Collection<Contact> contacts)
Add new contacts

Parameters:
contacts - collection of contacts, not null
Returns:
See Collection.addAll(java.util.Collection)

remove

public boolean remove(Contact contact)
Remove existing contact

Parameters:
contact - contact to be removed, not null
Returns:
See Collection.remove(java.lang.Object)

removeAll

public boolean removeAll(java.util.Collection<Contact> contacts)
Remove existing contacts

Parameters:
contacts - collection of contacts to be removed, not null
Returns:
See Collection.removeAll(java.util.Collection)

clear

public void clear()
Remove all contacts


contains

public boolean contains(Contact contact)
Search for an existing contact

Parameters:
contact - contact to be searched, not null
Returns:
See Collection.contains(java.lang.Object)

size

public int size()
Return number of contacts

Returns:
See Collection.size()

isEmpty

public boolean isEmpty()
Return if there are no contacts

Returns:
See Collection.isEmpty()