Package net.cscott.jutil
Class Indexer<T>
java.lang.Object
net.cscott.jutil.Indexer<T>
Indexer is an object for extracting unique indices
for a set of objects. It is commonly generated by Factories
for some class of objects, which can then generate and
store unique integers in the objects that they are used to
construct. This way auxilliary data structures can efficiently
index objects that belong to a common Factory without that
data-structure needing an explict dependency on that particular
Factory or Object type.- Author:
- Felix S. Klock II <pnkfelix@mit.edu>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Indexer
public Indexer()
-
-
Method Details
-
getID
Returns the "small" integer uniquely associated withointhis.
requires:ois a member of the set of objects indexed by this
effects: returns the integer uniquely associated withofrom a densely-packed, non-negative set of integers whose smallest element is close to zero. -
getByID
Provides a reverse mapping for the index returned bygetID. The constraint is thatgetByID(getID(o))must equalofor all objects indexed bythis.- Throws:
UnsupportedOperationException- if this functionality is not supported bythis.
-
implementsReverseMapping
public boolean implementsReverseMapping()Tells user whether this particularIndexerimplements thegetByID()method.
-