Pages

Tuesday, May 4, 2010

HashQueue

HashQueue

public class HashQueue
{
Hashtable ht = new Hashtable();
public void AddHashIndex(string index)
{
Queue q = new Queue();
ht.Add(index, q);
}
public void AddHashQ(object o, string index)
{
((Queue)ht[index]).Enqueue(o);
}
public object GetHashQ(string index)
{
return ((Queue)ht[index]).Dequeue();
}
public ICollection GetKeys()
{
return ht.Keys;
}
public int AllCount
{
get
{
int c = 0;
foreach (Queue q in ht.Values) { c += q.Count; }
return c;
}
}
}