T
- the class of the iterated objectspublic class SearchAbstractObjectIterator<T extends LocalAbstractObject> extends AbstractObjectIterator<T>
Search
and AbstractObjectIterator
.Modifier and Type | Field and Description |
---|---|
protected int |
hasNext
Flag for remembering if next() has been called on
search and its result |
protected Search<T> |
search
Wrapped search instance
|
Constructor and Description |
---|
SearchAbstractObjectIterator(Index<T> index)
Creates a new instance of SearchAbstractObjectIterator for the specified
Index instance. |
SearchAbstractObjectIterator(Index<T> index,
int limit)
Creates a new instance of SearchAbstractObjectIterator for the specified
Index instance. |
SearchAbstractObjectIterator(Search<T> search)
Creates a new instance of SearchAbstractObjectIterator for the specified
Search instance. |
SearchAbstractObjectIterator(Search<T> search,
int limit)
Creates a new instance of SearchAbstractObjectIterator for the specified
Search instance. |
Modifier and Type | Method and Description |
---|---|
int |
getCount()
Returns the current number of iterations.
|
T |
getCurrentObject()
Returns an object returned by the last call to
Iterator.next() . |
int |
getLimit()
Returns the maximal number of iterations; -1 means unlimited.
|
T |
getObjectByAnyLocator(java.util.Set<java.lang.String> locatorURIs,
boolean removeFound)
Returns the first instance of object, that has one of the specified locators.
|
AbstractObjectList<T> |
getRandomObjects(int count,
boolean unique)
Returns a list containing randomly chosen objects from the objects remaining in this iterator.
|
boolean |
hasNext() |
boolean |
isLimitReached()
Returns true if the current number of iterations has reached its maximum.
|
T |
next() |
void |
remove() |
emptyIterator, getIterator, getMatchingObjects, getMatchingObjects, getMatchingObjects, getMatchingObjects, getObjectByData, getObjectByLocator, getObjectByLocator, getObjectByLocatorRegexp, getObjectByPosition, getRandomObject, provideObjects, singleton, skip
protected Search<T extends LocalAbstractObject> search
protected int hasNext
search
and its resultpublic SearchAbstractObjectIterator(Search<T> search, int limit)
Search
instance.search
- the Search
instance to wrap by this iteratorlimit
- limit the number of iterations (use -1 for unlimited number of iterations)public SearchAbstractObjectIterator(Index<T> index, int limit)
Index
instance.index
- the Index
instance the search of which is wrapped by this iteratorlimit
- limit the number of iterations (use -1 for unlimited number of iterations)public SearchAbstractObjectIterator(Search<T> search)
Search
instance.search
- the Search
instance to wrap by this iteratorpublic int getCount()
public int getLimit()
public final boolean isLimitReached()
public T getCurrentObject()
AbstractObjectIterator
Iterator.next()
.getCurrentObject
in class AbstractObjectIterator<T extends LocalAbstractObject>
Iterator.next()
public boolean hasNext()
public T next() throws java.util.NoSuchElementException
java.util.NoSuchElementException
public void remove() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
public T getObjectByAnyLocator(java.util.Set<java.lang.String> locatorURIs, boolean removeFound) throws java.util.NoSuchElementException
AbstractObjectIterator
getObjectByAnyLocator
in class AbstractObjectIterator<T extends LocalAbstractObject>
locatorURIs
- the set of locators that we are searching forremoveFound
- if true the locators which were found are removed from the locatorURIs set, otherwise, locatorURIs is not touchedjava.util.NoSuchElementException
- if there is no object with any of the specified locatorspublic AbstractObjectList<T> getRandomObjects(int count, boolean unique)
AbstractObjectIterator
getRandomObjects
in class AbstractObjectIterator<T extends LocalAbstractObject>
count
- the number of objects to returnunique
- flag if the returned list contains each object only onceAbstractObjectList.randomList(int, boolean, java.util.List, java.util.Iterator)