org.eclipse.xtext.nodemodel.impl
Class BasicNodeTreeIterator

java.lang.Object
  extended by com.google.common.collect.UnmodifiableIterator<AbstractNode>
      extended by org.eclipse.xtext.nodemodel.impl.BasicNodeTreeIterator
All Implemented Interfaces:
java.util.Iterator<AbstractNode>, org.eclipse.emf.common.util.TreeIterator<AbstractNode>, BidiIterator<AbstractNode>, BidiTreeIterator<AbstractNode>

public class BasicNodeTreeIterator
extends com.google.common.collect.UnmodifiableIterator<AbstractNode>
implements BidiTreeIterator<AbstractNode>

Author:
Sebastian Zarnekow - Initial contribution and API
This class is not intended to be subclassed by clients.
This class is not intended to be subclassed by clients.

Constructor Summary
protected BasicNodeTreeIterator(AbstractNode root)
           
 
Method Summary
protected  void afterAdvance()
           
 boolean hasNext()
           
 boolean hasPrevious()
          Returns true if this bidi iterator has more elements when traversing in the reverse direction.
 AbstractNode next()
          
 AbstractNode previous()
          Returns the previous element.
 void prune()
           
 
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
remove
 
Methods inherited from interface java.util.Iterator
remove
 

Constructor Detail

BasicNodeTreeIterator

protected BasicNodeTreeIterator(AbstractNode root)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<AbstractNode>

next

public AbstractNode next()
Description copied from interface: BidiTreeIterator

Intermixed calls to BidiTreeIterator.next() and BidiTreeIterator.previous() may not lead to the very same element since the iterator does not return the parent element when its done with its children but the next sibling of the parent.

Specified by:
next in interface java.util.Iterator<AbstractNode>
Specified by:
next in interface BidiTreeIterator<AbstractNode>

afterAdvance

protected void afterAdvance()

hasPrevious

public boolean hasPrevious()
Description copied from interface: BidiIterator
Returns true if this bidi iterator has more elements when traversing in the reverse direction. (In other words, returns true if previous would return an element rather than throwing an exception.)

Specified by:
hasPrevious in interface BidiIterator<AbstractNode>
Returns:
true if the bidi iterator has more elements when traversing in the reverse direction.

previous

public AbstractNode previous()
Description copied from interface: BidiIterator
Returns the previous element. This method may be called repeatedly to iterate backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Specified by:
previous in interface BidiIterator<AbstractNode>
Specified by:
previous in interface BidiTreeIterator<AbstractNode>
Returns:
the previous element.

prune

public void prune()
Specified by:
prune in interface org.eclipse.emf.common.util.TreeIterator<AbstractNode>