Package org.eclipse.xtext.nodemodel
Interface BidiTreeIterable<E>
-
- All Superinterfaces:
BidiIterable<E>
,java.lang.Iterable<E>
- All Known Implementing Classes:
AbstractNode
,CompositeNode
,CompositeNodeWithSemanticElement
,CompositeNodeWithSemanticElementAndSyntaxError
,CompositeNodeWithSyntaxError
,HiddenLeafNode
,HiddenLeafNodeWithSyntaxError
,LeafNode
,LeafNodeWithSyntaxError
,ReversedBidiTreeIterable
,RootNode
,SyntheticCompositeNode
public interface BidiTreeIterable<E> extends BidiIterable<E>
An iterable over a tree structure that is capable of being iterated in both directions - forwards and backwards. Thetree iterator
returned byiterator()
is capable to prune some parts of the tree if clients are not interested in descending into them.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BidiTreeIterator<E>
iterator()
Returns a tree iterator that can be used forwards and backwards.BidiTreeIterable<E>
reverse()
Returns a reverse version of this iterable that can be used forwards and backwards.
-
-
-
Method Detail
-
iterator
BidiTreeIterator<E> iterator()
Returns a tree iterator that can be used forwards and backwards.- Specified by:
iterator
in interfaceBidiIterable<E>
- Specified by:
iterator
in interfacejava.lang.Iterable<E>
- Returns:
- an iterator. Never returns
null
.
-
reverse
BidiTreeIterable<E> reverse()
Returns a reverse version of this iterable that can be used forwards and backwards. In other words, an iterator provided by the reverse iterable will delegate its
hasNext()
andnext()
invocations toBidiIterator.hasPrevious()
andBidiIterator.previous()
respectively.This allows clients to iterate backwards by means of the enhanced for-loop:
for(T t: iterable.reverse()) { // do something with t }
- Specified by:
reverse
in interfaceBidiIterable<E>
- Returns:
- the reversed iterable. Never returns
null
.
-
-