AtomType
- public class DirectValueIndexer<AtomType> extends HGKeyIndexer<AtomType>
Index atoms directly by their values serialized as byte[]. The type of the atoms
indexed is assumed to be an instance of HGPrimitiveType
so that a
ByteArrayConverter
and a Comparator
are made available.
Constructor and Description |
---|
DirectValueIndexer() |
DirectValueIndexer(HGHandle type) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object x)
Declared to enforce implementation.
|
Comparator<byte[]> |
getComparator(HyperGraph graph)
Return a comparator used to compare key values return by this indexer.
|
ByteArrayConverter<AtomType> |
getConverter(HyperGraph graph)
Return a
ByteArrayConverter capable of translating keys
returned by this indexer to/from a byte[] . |
AtomType |
getKey(HyperGraph graph,
Object atom)
Returns an index key for the given atom.
|
int |
hashCode()
Declared to enforce implementation.
|
public DirectValueIndexer()
public DirectValueIndexer(HGHandle type)
public ByteArrayConverter<AtomType> getConverter(HyperGraph graph)
HGIndexer
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 Comparator<byte[]> getComparator(HyperGraph graph)
HGIndexer
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 AtomType getKey(HyperGraph graph, Object atom)
HGKeyIndexer
Returns an index key for the given atom.
getKey
in class HGKeyIndexer<AtomType>
graph
- The current HyperGraph
instance.atom
- The atom being indexed.byte[]
,
a non-null ByteArrayConverter
must be provided by the
getConverter
method.public int hashCode()
HGIndexer
Declared to enforce implementation.
Copyright © 2015. All rights reserved.