|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hypergraphdb.indexing.HGIndexer
public abstract class HGIndexer
An HGIndexer represents an atom used internally
by HyperGraphDB to manage indices. All indexers apply to a
specific atom types. All indexers are responsible for producing
a key for the given atom instance being indexed. In addition,
when the keys produced are NOT of type byte[], an indexer
must provide a ByteArrayConverter capable of translating
a key to/from a byte[].
Because indexers are stored as HyperGraphDB atoms, they must obey the Java Beans conventions of having a default constructor and getter/setter pair for each property that must be recorded into storage.
Implementations may also provide a Comparator for keys for
sorted indices and when the default byte[] comparator is not
suitable.
IMPORTANT:Instances of HGIndexer are frequently used to perform lookup on
existing indices. For example, when trying to determine whether an atom of
a complex type is being indexed by some projection, one constructs a
ByPartIndexer and performs a lookup in the index manager. Thus, it
is essential that implementation of HGIndexer provide proper hashCode
and equals methods.
| Constructor Summary | |
|---|---|
HGIndexer()
|
|
HGIndexer(HGHandle type)
|
|
| Method Summary | |
|---|---|
abstract boolean |
equals(java.lang.Object other)
Declared to enforce implementation. |
abstract java.util.Comparator<?> |
getComparator(HyperGraph graph)
Return a comparator used to compare key values return by this indexer. |
abstract ByteArrayConverter<?> |
getConverter(HyperGraph graph)
Return a ByteArrayConverter capable of translating keys
returned by this indexer to/from a byte[]. |
abstract java.lang.Object |
getKey(HyperGraph graph,
java.lang.Object atom)
Returns an index key for the given atom. |
HGHandle |
getType()
|
abstract int |
hashCode()
Declared to enforce implementation. |
void |
setType(HGHandle type)
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HGIndexer()
public HGIndexer(HGHandle type)
| Method Detail |
|---|
public HGHandle getType()
public void setType(HGHandle type)
public abstract java.lang.Object getKey(HyperGraph graph,
java.lang.Object atom)
Returns an index key for the given atom.
graph - The current HyperGraph instance.atom - The atom being indexed.
byte[],
a non-null ByteArrayConverter must be provided by the
getConverter method.public abstract ByteArrayConverter<?> getConverter(HyperGraph graph)
Return a ByteArrayConverter capable of translating keys
returned by this indexer to/from a byte[].
graph - The current HyperGraph instance.
ByteArrayConverter for type of index keys
return by this indexer or null if keys are of type byte[].public abstract java.util.Comparator<?> getComparator(HyperGraph graph)
Return a comparator used to compare key values return by this indexer.
Note that the comparator's compare method will be invoked
with byte[] parameters. It is the comparator's responsibility
to convert them to the appropriate run-time type for performing the comparison
if need be.
The method may return null if a default byte-by-byte comparator is to be
used.
graph - The current HyperGraph instance.
null to use a default byte-by-byte comparison of keys.public abstract int hashCode()
Declared to enforce implementation.
hashCode in class java.lang.Objectpublic abstract boolean equals(java.lang.Object other)
Declared to enforce implementation.
equals in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||