
// ----------------------------------------------------------------------
// This code is developed as part of the Java CoG Kit project
// The terms of the license can be found at http://www.cogkit.org/license
// This message may not be removed or altered.
// ----------------------------------------------------------------------

package org.globus.cog.karajan.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;



public class ContactSet {
	public Map contacts;
	public List cl;

	public ContactSet() {
		contacts = new HashMap();
	}

	public void addContact(BoundContact contact) {
		contacts.put(contact.getHost(), contact);
		if (cl == null) {
			cl = new ArrayList();
		}
		cl.add(contact);
	}

	public void removeContact(BoundContact contact) {
		contacts.remove(contact.getHost());
		cl.remove(contact);
	}

	public BoundContact getContact(String ip) {
		return (BoundContact) contacts.get(ip);
	}

	public int size() {
		return contacts.size();
	}

	public BoundContact get(int index) {
		if (cl == null) {
			return null;
		}
		return (BoundContact) cl.get(index);
	}
	
	public int indexOf(BoundContact contact){
		return cl.indexOf(contact);
	}
	
	public List getContacts() {
		return cl;
	} 
	
	public void setContacts(List cl) {
		this.cl = cl;
		for (Iterator i = cl.iterator(); i.hasNext();) {
			BoundContact contact = (BoundContact) i.next();
			contacts.put(contact.getHost(), contact);
		}
	}
	
	public String toString() {
		return contacts.toString();
	}
}

@@ -491,18 +491,16 @@
 l.Map;%0A%0A
-%0A%0A
 public c
@@ -528,16 +528,37 @@
 blic Map
+%3CString,BoundContact%3E
  contact
@@ -572,16 +572,30 @@
 lic List
+%3CBoundContact%3E
  cl;%0A%0A%09p
@@ -780,16 +780,30 @@
 rrayList
+%3CBoundContact%3E
 ();%0A%09%09%7D%0A
@@ -979,18 +979,24 @@
 (String 
-ip
+hostname
 ) %7B%0A%09%09re
@@ -999,31 +999,16 @@
 %09%09return
- (BoundContact)
  contact
@@ -1017,10 +1017,16 @@
 get(
-ip
+hostname
 );%0A%09
@@ -1165,31 +1165,16 @@
 %09%09return
- (BoundContact)
  cl.get(
@@ -1180,26 +1180,25 @@
 (index);%0A%09%7D%0A
-%09
 %0A
+
 %09public int 
@@ -1257,26 +1257,25 @@
 ontact);%0A%09%7D%0A
-%09
 %0A
+
 %09public List
@@ -1310,11 +1310,9 @@
 ;%0A%09%7D
- %0A%09
+%0A
 %0A%09pu
@@ -1514,17 +1514,16 @@
 %0A%09%09%7D%0A%09%7D%0A
-%09
 %0A%09public

Add generics