public abstract class HGValueIndexer<KeyType,ValueType> extends Object implements HGIndexer<KeyType,ValueType>
An indexer that not only determines the key in an index entry, but the value
as well. By default, HGKeyIndexer
implementation provide a key by
which to index HyperGraph atoms. In other words, atoms are the "default" values
for index entries. A HGValueIndexer
provides also the value in an
index entry in cases where it is not the atom itself.
Constructor and Description |
---|
HGValueIndexer() |
HGValueIndexer(HGHandle type) |
HGValueIndexer(String name,
HGHandle type) |
Modifier and Type | Method and Description |
---|---|
abstract KeyType |
getKey(HyperGraph graph,
Object atom)
Returns an index key for the given atom.
|
String |
getName() |
HGHandle |
getType()
Return the handle of the atom type all of whose instances should be indexed
by this indexer.
|
abstract ValueType |
getValue(HyperGraph graph,
Object atom)
Return the value of an index entry based on the passed in atom.
|
abstract ByteArrayConverter<ValueType> |
getValueConverter(HyperGraph graph)
Return a
ByteArrayConverter capable of converting index
entry values to/from byte arrays. |
void |
index(HyperGraph graph,
HGHandle atomHandle,
Object atom,
HGIndex<KeyType,ValueType> index)
Add a particular atom the the index.
|
void |
setName(String name) |
void |
setType(HGHandle type)
Set the handle of the atom type all of whose instances should be indexed
by this indexer.
|
void |
unindex(HyperGraph graph,
HGHandle atomHandle,
Object atom,
HGIndex<KeyType,ValueType> index)
Remove a particular from the index, assuming it is currently being indexed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, getComparator, getConverter, hashCode
public HGValueIndexer()
public HGValueIndexer(HGHandle type)
public String getName()
public void setName(String name)
public HGHandle getType()
HGIndexer
Return the handle of the atom type all of whose instances should be indexed by this indexer.
public void setType(HGHandle type)
HGIndexer
Set the handle of the atom type all of whose instances should be indexed by this indexer.
public void index(HyperGraph graph, HGHandle atomHandle, Object atom, HGIndex<KeyType,ValueType> index)
HGIndexer
Add a particular atom the the index. This method can safely assume that the atom hasn't been previously added to the index.
public void unindex(HyperGraph graph, HGHandle atomHandle, Object atom, HGIndex<KeyType,ValueType> index)
HGIndexer
Remove a particular from the index, assuming it is currently being indexed.
public abstract ValueType getValue(HyperGraph graph, Object atom)
Return the value of an index entry based on the passed in atom.
public abstract KeyType getKey(HyperGraph graph, 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<ValueType> getValueConverter(HyperGraph graph)
Return a ByteArrayConverter
capable of converting index
entry values to/from byte arrays.
graph
- Copyright © 2015. All rights reserved.