public class SortedIntersectionResult<T> extends Object implements HGSearchResult<T>
Combines two ordered result sets into a (ordered) result representing their set theoretical intersection.
It assumes that the objects contained in the result sets being intersected
are java.lang.Comparable
instances.
Modifier and Type | Class and Description |
---|---|
static class |
SortedIntersectionResult.Combiner<T> |
EMPTY
Constructor and Description |
---|
SortedIntersectionResult(HGSearchResult<T> left,
HGSearchResult<T> right) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Free all system resources held up by the result set and invalidate
it for further use.
|
T |
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. |
T |
next() |
T |
prev()
Returns the previous element in this iteration.
|
void |
remove() |
public SortedIntersectionResult(HGSearchResult<T> left, HGSearchResult<T> right)
public T current()
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 if the next
method was never invoked.
current
in interface HGSearchResult<T>
HGSearchResult
.public void close()
HGSearchResult
Free all system resources held up by the result set and invalidate it for further use.
close
in interface HGSearchResult<T>
close
in interface CloseMe
public boolean hasPrev()
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
.
hasPrev
in interface TwoWayIterator<T>
public T prev()
TwoWayIterator
Returns the previous element in this iteration.
prev
in interface TwoWayIterator<T>
public boolean isOrdered()
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
isOrdered
in interface HGSearchResult<T>
Copyright © 2015. All rights reserved.