Package org.eclipse.xtext.nodemodel.util
Class NodeIterable
- java.lang.Object
-
- org.eclipse.xtext.nodemodel.util.NodeIterable
-
- All Implemented Interfaces:
java.lang.Iterable<INode>
,BidiIterable<INode>
public class NodeIterable extends java.lang.Object implements BidiIterable<INode>
-
-
Constructor Summary
Constructors Constructor Description NodeIterable(INode startWith)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BidiIterator<INode>
iterator()
Returns an iterator that can be used forwards and backwards.BidiIterable<INode>
reverse()
Returns a reverse version of this iterable that can be used forwards and backwards.
-
-
-
Constructor Detail
-
NodeIterable
public NodeIterable(INode startWith)
-
-
Method Detail
-
iterator
public BidiIterator<INode> iterator()
Description copied from interface:BidiIterable
Returns an iterator that can be used forwards and backwards.- Specified by:
iterator
in interfaceBidiIterable<INode>
- Specified by:
iterator
in interfacejava.lang.Iterable<INode>
- Returns:
- an iterator. Never returns
null
.
-
reverse
public BidiIterable<INode> reverse()
Description copied from interface:BidiIterable
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<INode>
- Returns:
- the reversed iterable. Never returns
null
.
-
-