org.hypergraphdb.query.impl
Class FilteredResultSet

java.lang.Object
  extended by org.hypergraphdb.query.impl.FilteredResultSet
All Implemented Interfaces:
java.util.Iterator, HGSearchResult, TwoWayIterator

public class FilteredResultSet
extends java.lang.Object
implements HGSearchResult

Filter a result set through a predicate.

Author:
Borislav Iordanov

Field Summary
 
Fields inherited from interface org.hypergraphdb.HGSearchResult
EMPTY
 
Constructor Summary
FilteredResultSet(HyperGraph hg, HGSearchResult searchResult, HGAtomPredicate predicate, int lookahead)
           The constructor assumes the underlying set is already positioned to the first matching entity.
 
Method Summary
 void close()
          Free all system resources held up by the result set and invalidate it for further use.
 java.lang.Object current()
          Returns the current element in the result set.
 boolean hasNext()
           
 boolean hasPrev()
           Return true if there is a previous element in the current iteration state and false otherwise.
 boolean isOrdered()
          Return true if the elements in this search result are in ordered and false otherwise.
 java.lang.Object next()
           
 java.lang.Object prev()
           Returns the previous element in this iteration.
 void remove()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteredResultSet

public FilteredResultSet(HyperGraph hg,
                         HGSearchResult searchResult,
                         HGAtomPredicate predicate,
                         int lookahead)

The constructor assumes the underlying set is already positioned to the first matching entity.

Parameters:
hg - The
searchResult -
predicate -
Method Detail

close

public void close()
Description copied from interface: HGSearchResult

Free all system resources held up by the result set and invalidate it for further use.

Specified by:
close in interface HGSearchResult

current

public java.lang.Object current()
Description copied from interface: HGSearchResult

Returns the current element in the result set. If there is no current element, java.util.NoSuchElementException is thrown. There is no current element in one of two cases: either the result set is empty or the next method was never invoked.

Specified by:
current in interface HGSearchResult
Returns:
The current element in a HGSearchResult.

hasPrev

public boolean hasPrev()
Description copied from interface: TwoWayIterator

Return true if there is a previous element in the current iteration state and false otherwise. After the iterator has been initialized, the value of hasPrev will always be false.

Specified by:
hasPrev in interface TwoWayIterator

prev

public java.lang.Object prev()
Description copied from interface: TwoWayIterator

Returns the previous element in this iteration.

Specified by:
prev in interface TwoWayIterator

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

isOrdered

public boolean isOrdered()
Description copied from interface: HGSearchResult

Return true if the elements in this search result are in ordered and false otherwise. It is assumed that when elements are ordered, they are instances of java.lang.Comparable

Specified by:
isOrdered in interface HGSearchResult