org.eclipse.xtext.nodemodel.impl
Class CompositeNode

java.lang.Object
  extended by org.eclipse.xtext.nodemodel.impl.AbstractNode
      extended by org.eclipse.xtext.nodemodel.impl.CompositeNode
All Implemented Interfaces:
java.lang.Iterable<INode>, BidiIterable<INode>, BidiTreeIterable<INode>, ICompositeNode, INode
Direct Known Subclasses:
CompositeNodeWithSemanticElement, CompositeNodeWithSyntaxError

public class CompositeNode
extends AbstractNode
implements ICompositeNode

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

Constructor Summary
CompositeNode()
           
 
Method Summary
 BidiIterable<AbstractNode> basicGetChildren()
           
protected  AbstractNode basicGetFirstChild()
           
protected  AbstractNode basicGetLastChild()
           
protected  void basicSetFirstChild(AbstractNode firstChild)
           
protected  void basicSetLookAhead(int lookAhead)
           
 BidiIterable<INode> getChildren()
          Returns an iterable that provides access to the children of the composite node.
 INode getFirstChild()
          Returns the first child of this node.
 org.eclipse.emf.ecore.EObject getGrammarElement()
          Returns the grammar element that created this node.
 INode getLastChild()
          Returns the last child of this node.
 int getLookAhead()
          Return the number of tokens that the parser had to peek before it could decide to create this node.
 int getTotalLength()
          Returns the length of this node including hidden tokens.
 int getTotalOffset()
          Returns the offset of this node including hidden tokens.
 boolean hasChildren()
          Returns true if this node has any children.
protected  boolean isFolded()
           
protected  boolean isFolded(java.lang.Object grammarElementOrArray)
           
 ICompositeNode resolveAsParent()
           
 
Methods inherited from class org.eclipse.xtext.nodemodel.impl.AbstractNode
basicGetGrammarElement, basicGetLineOfOffset, basicGetNextSibling, basicGetParent, basicGetPreviousSibling, basicGetSemanticElement, basicHasNextSibling, basicHasPreviousSibling, basicHasSiblings, basicIterator, basicSetGrammarElement, basicSetNextSibling, basicSetParent, basicSetPreviousSibling, getAsTreeIterable, getEndLine, getLeafNodes, getLength, getNextSibling, getOffset, getParent, getPreviousSibling, getRootNode, getSemanticElement, getStartLine, getSyntaxErrorMessage, getText, getTotalEndLine, getTotalEndOffset, getTotalStartLine, hasDirectSemanticElement, hasNextSibling, hasPreviousSibling, hasSiblings, iterator, reverse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.xtext.nodemodel.INode
getAsTreeIterable, getEndLine, getLeafNodes, getLength, getNextSibling, getOffset, getParent, getPreviousSibling, getRootNode, getSemanticElement, getStartLine, getSyntaxErrorMessage, getText, getTotalEndLine, getTotalEndOffset, getTotalStartLine, hasDirectSemanticElement, hasNextSibling, hasPreviousSibling, hasSiblings
 

Constructor Detail

CompositeNode

public CompositeNode()
Method Detail

getChildren

public BidiIterable<INode> getChildren()
Description copied from interface: ICompositeNode
Returns an iterable that provides access to the children of the composite node. Will never return null but may be empty.

Specified by:
getChildren in interface ICompositeNode
Returns:
an iterable that provides access to the children of the composite node.
See Also:
ICompositeNode.hasChildren(), ICompositeNode.getFirstChild(), ICompositeNode.getLastChild()

basicGetChildren

public BidiIterable<AbstractNode> basicGetChildren()

hasChildren

public boolean hasChildren()
Description copied from interface: ICompositeNode
Returns true if this node has any children.

Specified by:
hasChildren in interface ICompositeNode
Returns:
true if this node has any children.
See Also:
ICompositeNode.getChildren(), ICompositeNode.getFirstChild(), ICompositeNode.getLastChild()

getLookAhead

public int getLookAhead()
Description copied from interface: ICompositeNode
Return the number of tokens that the parser had to peek before it could decide to create this node. Never negative. Clients will usually not have to deal with ICompositeNode.getLookAhead().

Specified by:
getLookAhead in interface ICompositeNode
Returns:
the number of tokens that the parser had to peek before it could decide to create this node.

getTotalLength

public int getTotalLength()
Description copied from interface: INode
Returns the length of this node including hidden tokens.

Specified by:
getTotalLength in interface INode
Returns:
the length of this node including hidden tokens.

getTotalOffset

public int getTotalOffset()
Description copied from interface: INode
Returns the offset of this node including hidden tokens.

Specified by:
getTotalOffset in interface INode
Returns:
the offset of this node including hidden tokens.

basicSetLookAhead

protected void basicSetLookAhead(int lookAhead)

getFirstChild

public INode getFirstChild()
Description copied from interface: ICompositeNode
Returns the first child of this node. May be null or may be the same as the last child.

Specified by:
getFirstChild in interface ICompositeNode
Returns:
the first child of this node if any.
See Also:
ICompositeNode.hasChildren(), ICompositeNode.getChildren()

basicGetFirstChild

protected AbstractNode basicGetFirstChild()

basicSetFirstChild

protected void basicSetFirstChild(AbstractNode firstChild)

getLastChild

public INode getLastChild()
Description copied from interface: ICompositeNode
Returns the last child of this node. May be null or may be the same as the first child.

Specified by:
getLastChild in interface ICompositeNode
Returns:
the last child of this node if any.
See Also:
ICompositeNode.hasChildren(), ICompositeNode.getChildren()

basicGetLastChild

protected AbstractNode basicGetLastChild()

isFolded

protected boolean isFolded()

isFolded

protected boolean isFolded(java.lang.Object grammarElementOrArray)

resolveAsParent

public ICompositeNode resolveAsParent()

getGrammarElement

public org.eclipse.emf.ecore.EObject getGrammarElement()
Description copied from interface: INode
Returns the grammar element that created this node. May return null in case of unrecoverable syntax errors. This happens usually when a keyword occurred at an unexpected offset.

Specified by:
getGrammarElement in interface INode
Overrides:
getGrammarElement in class AbstractNode
Returns:
the grammar element that created this node. May return null.