org.jrdf.graph.local.disk.iterator
Class DiskIteratorFactory

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

public final class DiskIteratorFactory
extends Object
implements IteratorFactory

Default implementation of the IteratorFactory. Simply uses the normal iterators and an in memory backend.

Version:
$Id: DiskIteratorFactory.java 1822 2008-01-17 22:20:02Z newmana $
Author:
Andrew Newman

Constructor Summary
DiskIteratorFactory(LongIndex[] newLongIndexes, GraphHandler[] newGraphHandlers, NodePool newNodePool, Localizer newLocalizer, TripleBTree[] newTrees)
           
 
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[] newNodes)
          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

DiskIteratorFactory

public DiskIteratorFactory(LongIndex[] newLongIndexes,
                           GraphHandler[] newGraphHandlers,
                           NodePool newNodePool,
                           Localizer newLocalizer,
                           TripleBTree[] newTrees)
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[] newNodes)
Description copied from interface: IteratorFactory
Return a new FixedIterator - bound by three nodes.

Specified by:
newThreeFixedIterator in interface IteratorFactory
Parameters:
newNodes - 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).