org.hypergraphdb.indexing
Class TargetToTargetIndexer

java.lang.Object
  extended by org.hypergraphdb.indexing.HGIndexer
      extended by org.hypergraphdb.indexing.HGValueIndexer
          extended by org.hypergraphdb.indexing.TargetToTargetIndexer

public class TargetToTargetIndexer
extends HGValueIndexer


Constructor Summary
TargetToTargetIndexer()
           
TargetToTargetIndexer(HGHandle type, int fromTarget, int toTarget)
           
 
Method Summary
 boolean equals(java.lang.Object other)
          Declared to enforce implementation.
 java.util.Comparator<?> getComparator(HyperGraph graph)
           Return a comparator used to compare key values return by this indexer.
 ByteArrayConverter<?> getConverter(HyperGraph graph)
          Return a ByteArrayConverter capable of translating keys returned by this indexer to/from a byte[].
 int getFromTarget()
           
 java.lang.Object getKey(HyperGraph graph, java.lang.Object atom)
           Returns an index key for the given atom.
 int getToTarget()
           
 java.lang.Object getValue(HyperGraph graph, java.lang.Object atom)
           Return the value of an index entry based on the passed in atom.
 ByteArrayConverter<HGHandle> getValueConverter(HyperGraph graph)
           Return a ByteArrayConverter capable of converting index entry values to/from byte arrays.
 int hashCode()
          Declared to enforce implementation.
 void setFromTarget(int fromTarget)
           
 void setToTarget(int toTarget)
           
 
Methods inherited from class org.hypergraphdb.indexing.HGIndexer
getType, setType
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TargetToTargetIndexer

public TargetToTargetIndexer()

TargetToTargetIndexer

public TargetToTargetIndexer(HGHandle type,
                             int fromTarget,
                             int toTarget)
Method Detail

getFromTarget

public int getFromTarget()

setFromTarget

public void setFromTarget(int fromTarget)

getToTarget

public int getToTarget()

setToTarget

public void setToTarget(int toTarget)

getKey

public java.lang.Object getKey(HyperGraph graph,
                               java.lang.Object atom)
Description copied from class: HGIndexer

Returns an index key for the given atom.

Specified by:
getKey in class HGIndexer
Parameters:
graph - The current HyperGraph instance.
atom - The atom being indexed.
Returns:
The index key. If the return value is not a byte[], a non-null ByteArrayConverter must be provided by the getConverter method.

getValue

public java.lang.Object getValue(HyperGraph graph,
                                 java.lang.Object atom)
Description copied from class: HGValueIndexer

Return the value of an index entry based on the passed in atom.

Specified by:
getValue in class HGValueIndexer

getValueConverter

public ByteArrayConverter<HGHandle> getValueConverter(HyperGraph graph)
Description copied from class: HGValueIndexer

Return a ByteArrayConverter capable of converting index entry values to/from byte arrays.

Specified by:
getValueConverter in class HGValueIndexer
Returns:

getComparator

public java.util.Comparator<?> getComparator(HyperGraph graph)
Description copied from class: 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.

Specified by:
getComparator in class HGIndexer
Parameters:
graph - The current HyperGraph instance.
Returns:
A comparator used to compare key values return by this indexer or null to use a default byte-by-byte comparison of keys.

getConverter

public ByteArrayConverter<?> getConverter(HyperGraph graph)
Description copied from class: HGIndexer

Return a ByteArrayConverter capable of translating keys returned by this indexer to/from a byte[].

Specified by:
getConverter in class HGIndexer
Parameters:
graph - The current HyperGraph instance.
Returns:
The ByteArrayConverter for type of index keys return by this indexer or null if keys are of type byte[].

hashCode

public int hashCode()
Description copied from class: HGIndexer

Declared to enforce implementation.

Specified by:
hashCode in class HGIndexer

equals

public boolean equals(java.lang.Object other)
Description copied from class: HGIndexer

Declared to enforce implementation.

Specified by:
equals in class HGIndexer