edu.harvard.deas.hyperenc
Class BasicContactList

java.lang.Object
  extended by edu.harvard.deas.hyperenc.ContactList
      extended by edu.harvard.deas.hyperenc.BasicContactList
All Implemented Interfaces:
Iterable<Contact>

public class BasicContactList
extends ContactList

A contact list backed by a standard List.


Constructor Summary
BasicContactList(Contact owner)
          Creates a new, empty BasicContactList.
 
Method Summary
 void addContact(Contact c)
          Appends c to the list.
 Contact get(int index)
          Returns the contact at index index in the list.
 Contact getContact(Address a)
          Returns the Contact in this list with e-mail address a.
 Iterator<Contact> iterator()
          Returns an Iterator over the Contacts in this list.
 void removeContact(Contact c)
          Removes c from the list.
 int size()
          Returns the number of contacts in the list.
 
Methods inherited from class edu.harvard.deas.hyperenc.ContactList
isEmpty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicContactList

public BasicContactList(Contact owner)
Creates a new, empty BasicContactList.

Parameters:
owner - the owner of this list (usually the Contact corresponding to the user of the hyper-encryption application)
Method Detail

addContact

public void addContact(Contact c)
Description copied from class: ContactList
Appends c to the list.

Specified by:
addContact in class ContactList
Parameters:
c - the contact to be added

get

public Contact get(int index)
Description copied from class: ContactList
Returns the contact at index index in the list.

Specified by:
get in class ContactList
Parameters:
index - an integer index between 0 and this.size() - 1
Returns:
the contact at the specified index

getContact

public Contact getContact(Address a)
Description copied from class: ContactList
Returns the Contact in this list with e-mail address a.

Specified by:
getContact in class ContactList
Parameters:
a - e-mail address
Returns:
the Contact with the given e-mail address

removeContact

public void removeContact(Contact c)
Description copied from class: ContactList
Removes c from the list.

Specified by:
removeContact in class ContactList
Parameters:
c - the contact to be removed

size

public int size()
Description copied from class: ContactList
Returns the number of contacts in the list.

Specified by:
size in class ContactList
Returns:
the size of this list

iterator

public Iterator<Contact> iterator()
Description copied from class: ContactList
Returns an Iterator over the Contacts in this list. The Iterator returns Contacts in the order in which they appear in this list, that is, starting from index 0 and going in increasing order.

Specified by:
iterator in interface Iterable<Contact>
Specified by:
iterator in class ContactList