org.jrdf.graph.local.iterator
Class OrderedIteratorFactoryImpl

java.lang.Object
  extended by org.jrdf.graph.local.iterator.OrderedIteratorFactoryImpl
All Implemented Interfaces:
IteratorFactory

public final class OrderedIteratorFactoryImpl
extends Object
implements IteratorFactory

An ordered version of the iterator factory that sorts all results first.


Constructor Summary
OrderedIteratorFactoryImpl(IteratorFactory newIteratorFactory, Localizer newLocalizer, LongIndex newLongIndex, GraphHandler newGraphHandler, SortedSetFactory newSetFactory)
           
 
Method Summary
 ClosableIterator<Triple> newEmptyClosableIterator()
          Return an new EmptyClosableIterator - indicates no results found.
 ClosableIterator<Triple> newGraphIterator()
          Return an new GraphIterator - result of an unconstrained find.
 ClosableIterator<Triple> newOneFixedIterator(Long fixedFirstNode, int index)
          Return a new FixedIterator - bound by one node.
 ClosableIterator<PredicateNode> newPredicateIterator()
          Return a new PredicateIterator - all unique predicates.
 ClosableIterator<PredicateNode> newPredicateIterator(Long resource)
          Return a new PredicateIterator - all unique predicates for a given resource (subject and object).
 ClosableIterator<Triple> newThreeFixedIterator(Long[] nodes)
          Return a new FixedIterator - bound by three nodes.
 ClosableIterator<Triple> newTwoFixedIterator(Long fixedFirstNode, Long fixedSecondNode, int index)
          Return a new FixedItereator - bound by two nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderedIteratorFactoryImpl

public OrderedIteratorFactoryImpl(IteratorFactory newIteratorFactory,
                                  Localizer newLocalizer,
                                  LongIndex newLongIndex,
                                  GraphHandler newGraphHandler,
                                  SortedSetFactory newSetFactory)
Method Detail

newEmptyClosableIterator

public ClosableIterator<Triple> newEmptyClosableIterator()
Description copied from interface: IteratorFactory
Return an new EmptyClosableIterator - indicates no results found.

Specified by:
newEmptyClosableIterator in interface IteratorFactory
Returns:
an empty closable iterator - always hasNext false and next throws exception.

newGraphIterator

public ClosableIterator<Triple> newGraphIterator()
Description copied from interface: IteratorFactory
Return an new GraphIterator - result of an unconstrained find.

Specified by:
newGraphIterator in interface IteratorFactory
Returns:
a graph iterator - goes through all triples in the graph.

newOneFixedIterator

public ClosableIterator<Triple> newOneFixedIterator(Long fixedFirstNode,
                                                    int index)
Description copied from interface: IteratorFactory
Return a new FixedIterator - bound by one node.

Specified by:
newOneFixedIterator in interface IteratorFactory
Parameters:
fixedFirstNode - the node to find.
index - which index (from the three) to use.
Returns:
a new FixedIterator - goes through the graph and returns all given triples with the given node.

newTwoFixedIterator

public ClosableIterator<Triple> newTwoFixedIterator(Long fixedFirstNode,
                                                    Long fixedSecondNode,
                                                    int index)
Description copied from interface: IteratorFactory
Return a new FixedItereator - bound by two nodes.

Specified by:
newTwoFixedIterator in interface IteratorFactory
Parameters:
fixedFirstNode - the first node to find.
fixedSecondNode - the second node to find.
index - which index (from the three) to use.
Returns:
a new FixedIterator - goes through the graph and returns all given triples with the two given nodes.

newThreeFixedIterator

public ClosableIterator<Triple> newThreeFixedIterator(Long[] nodes)
Description copied from interface: IteratorFactory
Return a new FixedIterator - bound by three nodes.

Specified by:
newThreeFixedIterator in interface IteratorFactory
Parameters:
nodes - the triple to find.
Returns:
a new FixedIterator - either one or none triples.

newPredicateIterator

public ClosableIterator<PredicateNode> newPredicateIterator()
Description copied from interface: IteratorFactory
Return a new PredicateIterator - all unique predicates.

Specified by:
newPredicateIterator in interface IteratorFactory
Returns:
a new PredicateIterator - all unique predicates.

newPredicateIterator

public ClosableIterator<PredicateNode> newPredicateIterator(Long resource)
Description copied from interface: IteratorFactory
Return a new PredicateIterator - all unique predicates for a given resource (subject and object).

Specified by:
newPredicateIterator in interface IteratorFactory
Parameters:
resource - all unique predicate for a given resource.
Returns:
a new PredicateIterator - all unique predicate for a given resource (subject and object).