public class DocumentTreeIterator extends Object implements Iterator<DocumentModel>
The tree is traversed from top to bottom and left to right.
TODO: move this in an utility package
Modifier and Type | Field and Description |
---|---|
protected Queue<Iterator<DocumentModel>> |
queue
The sequence queue.
|
protected DocumentModel |
root
Root document.
|
protected Iterator<DocumentModel> |
sequence
The current sequence.
|
protected CoreSession |
session
The document manager session.
|
Constructor and Description |
---|
DocumentTreeIterator(CoreSession session,
DocumentModel root)
Creates the iterator given the tree root.
|
DocumentTreeIterator(CoreSession session,
DocumentModel root,
boolean excludeRoot) |
Modifier and Type | Method and Description |
---|---|
protected Iterator<DocumentModel> |
getNextNonEmptySequence()
Gets next non empty sequence from queue.
|
boolean |
hasNext() |
DocumentModel |
next() |
void |
remove() |
void |
reset()
Resets the iterator back to the tree root and clear any cached data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
protected final CoreSession session
protected final DocumentModel root
protected Iterator<DocumentModel> sequence
protected final Queue<Iterator<DocumentModel>> queue
public DocumentTreeIterator(CoreSession session, DocumentModel root)
public DocumentTreeIterator(CoreSession session, DocumentModel root, boolean excludeRoot)
protected Iterator<DocumentModel> getNextNonEmptySequence()
This will remove from the queue all traversed sequences (the empty ones and the first not empty sequence found).
public boolean hasNext()
hasNext
in interface Iterator<DocumentModel>
public DocumentModel next()
next
in interface Iterator<DocumentModel>
public void remove()
remove
in interface Iterator<DocumentModel>
public void reset()
Copyright © 2016 Nuxeo SA. All rights reserved.