|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.cscott.jutil.Indexer<T>
public abstract class 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.
Constructor Summary | |
---|---|
Indexer()
|
Method Summary | |
---|---|
T |
getByID(int id)
Provides a reverse mapping for the index returned by getID . |
abstract int |
getID(T o)
Returns the "small" integer uniquely associated with o in this . |
boolean |
implementsReverseMapping()
Tells user whether this particular Indexer implements
the getByID() method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Indexer()
Method Detail |
---|
public abstract int getID(T o)
o
in this
.
o
is a member of the set of
objects indexed by this
o
from a densely-packed, non-negative
set of integers whose smallest element is close to zero.
public T getByID(int id)
getID
. The constraint is that
getByID(getID(o))
must equal o
for all objects indexed by this
.
UnsupportedOperationException
- if this functionality
is not supported by this
.public boolean implementsReverseMapping()
Indexer
implements
the getByID()
method.
|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |