com.hdcookbook.grin.util
Class IndexedSet<T>

java.lang.Object
  extended by com.hdcookbook.grin.util.IndexedSet<T>

public class IndexedSet<T>
extends java.lang.Object

This class represents a set of objects of type T that are assigned indexes. It is used for canonicalizing instances of an arbitrary type T, provided that T obeys the Object.equals()/Object.hashCode() contract.


Constructor Summary
IndexedSet()
           
 
Method Summary
 int getIndex(T element)
          Get the index of element in the set, adding it if necessary.
 int size()
           
 T[] toArray(java.lang.Class type)
          Convert the set to an array, indexed by the index of each element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedSet

public IndexedSet()
Method Detail

getIndex

public int getIndex(T element)
Get the index of element in the set, adding it if necessary.


toArray

public T[] toArray(java.lang.Class type)
Convert the set to an array, indexed by the index of each element.


size

public int size()