java.lang.Object
org.entityfs.util.itr.AbstractIterator<T,U>
- All Implemented Interfaces:
- Iterator<U>
- Direct Known Subclasses:
- DepthFirstIteratorImpl, DepthLastIteratorImpl, LocationAwareDepthFirstIteratorImpl, LocationAwareDepthLastIteratorImpl
public abstract class AbstractIterator<T extends org.entityfs.util.itr.IteratorContext<U>,U>
- extends Object
- implements Iterator<U>
This is an abstract class that can be inherited by EntityView iterator
implementations. It implements a recursive iterator that can be configured to
do the following things:
- Recurse directories depth first or depth last.
- Sort the entities returned from a directory. The entities are either
sorted in their natural order (see
Entity
), or using a
supplied Comparator
.
- Return the root entity or not.
- Filter the returned entities, just like
FilteringIterator
.
Subclasses implement the
createChildIteratorContext(Object, IteratorContext)
to create child
directory iterators.
EntityFS iterators are not thread safe. Don't use them concurrently from
several threads without synchronizing access to them.
- Since:
- 1.0
- Author:
- Karl Gustafsson
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractIterator
protected AbstractIterator(Filter<? super EntityView> f,
T firstOnStack)
getContextStack
protected LinkedList<T> getContextStack()
getFilter
protected Filter<? super EntityView> getFilter()
setNext
protected void setNext(U ev)
createChildIteratorContext
protected abstract T createChildIteratorContext(U dv,
T parentContext)
testAndSetNextSubdirectory
protected boolean testAndSetNextSubdirectory(T curContext)
testAndSetNextChildEntity
protected boolean testAndSetNextChildEntity(T curContext)
testAndSetNext
protected abstract boolean testAndSetNext()
next
public U next()
- Specified by:
next
in interface Iterator<U>
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator<U>
remove
public void remove()
throws UnsupportedOperationException
- Specified by:
remove
in interface Iterator<U>
- Throws:
UnsupportedOperationException
- Always.