|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.xtext.nodemodel.impl.SyntheticCompositeNode
public class SyntheticCompositeNode
Unfolds the array of grammar elements that is associated with a composite node.
| Constructor Summary | |
|---|---|
protected |
SyntheticCompositeNode(CompositeNode delegate,
int grammarElementIdx)
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object obj)
|
BidiTreeIterable<INode> |
getAsTreeIterable()
Returns a tree iterable that uses this node as its origin and root instance. |
BidiIterable<INode> |
getChildren()
Returns an iterable that provides access to the children of the composite node. |
int |
getEndLine()
Returns the line number relative to the complete input where the node ends (one based, excluding hidden tokens). |
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. |
java.lang.Iterable<ILeafNode> |
getLeafNodes()
Returns an iterable for all contained leaf nodes. |
int |
getLength()
Returns the length of this node excluding hidden tokens. |
int |
getLookAhead()
Return the number of tokens that the parser had to peek before it could decide to create this node. |
INode |
getNextSibling()
Returns the next sibling or null. |
int |
getOffset()
Returns the offset of this node excluding hidden tokens. |
ICompositeNode |
getParent()
Returns the parent of the node or null if and only if this is the root node. |
INode |
getPreviousSibling()
Returns the previous sibling or null. |
ICompositeNode |
getRootNode()
Returns the root node of this parse tree. |
org.eclipse.emf.ecore.EObject |
getSemanticElement()
Returns the nearest semantic object that is associated with the subtree of this node. |
int |
getStartLine()
Returns the line number relative to the complete input where the node begins (one based, excluding hidden tokens). |
SyntaxErrorMessage |
getSyntaxErrorMessage()
Returns the directly associated syntax error message or null if none. |
java.lang.String |
getText()
Returns the parsed text that is covered by this node (including hidden tokens). |
int |
getTotalEndLine()
Returns the line number relative to the complete input where the node ends (one based, including hidden tokens). |
int |
getTotalEndOffset()
Returns the end offset (exclusive) of this node including hidden tokens. |
int |
getTotalLength()
Returns the length of this node including hidden tokens. |
int |
getTotalOffset()
Returns the offset of this node including hidden tokens. |
int |
getTotalStartLine()
Returns the line number relative to the complete input where the node begins (one based, including hidden tokens). |
boolean |
hasChildren()
Returns true if this node has any children. |
boolean |
hasDirectSemanticElement()
Returns true if this node as a directly associated semantic element. |
int |
hashCode()
|
boolean |
hasNextSibling()
Returns true if this node is not the last child of its parent. |
boolean |
hasPreviousSibling()
Returns true if this node is not the first child of its parent. |
boolean |
hasSiblings()
Returns true if this node has any siblings. |
BidiTreeIterator<INode> |
iterator()
Returns an iterator that can be used forwards and backwards. |
BidiTreeIterable<INode> |
reverse()
Returns a reverse version of this iterable that can be used forwards and backwards. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected SyntheticCompositeNode(CompositeNode delegate,
int grammarElementIdx)
| Method Detail |
|---|
public ICompositeNode getParent()
INodenull if and only if this is the root node.
getParent in interface INodenull.public boolean hasSiblings()
INodetrue if this node has any siblings.
hasSiblings in interface INodetrue if this node has any siblings.INode.hasPreviousSibling(),
INode.hasNextSibling()public boolean hasPreviousSibling()
INodetrue if this node is not the first child of its parent.
hasPreviousSibling in interface INodetrue if this node has a previous sibling thus INode.getPreviousSibling() will
not return null.public boolean hasNextSibling()
INodetrue if this node is not the last child of its parent.
hasNextSibling in interface INodetrue if this node has a next sibling thus INode.getNextSibling() will
not return null.public INode getPreviousSibling()
INodenull. The result has the same parent
as this node if it is not null.
getPreviousSibling in interface INodenull.INode.hasPreviousSibling(),
INode.hasSiblings()public INode getNextSibling()
INodenull. The result has the same parent
as this node if it is not null.
getNextSibling in interface INodenull.INode.hasNextSibling(),
INode.hasSiblings()public ICompositeNode getRootNode()
INodenull in a consistent tree.
getRootNode in interface INodenull in a consistent tree.public int getTotalOffset()
INode
getTotalOffset in interface INodepublic int getOffset()
INode
getOffset in interface INodepublic int getLength()
INode
getLength in interface INodepublic int getTotalStartLine()
INode
getTotalStartLine in interface INodepublic int getEndLine()
INode
getEndLine in interface INodepublic int getStartLine()
INode
getStartLine in interface INodepublic int getTotalEndLine()
INode
getTotalEndLine in interface INodepublic int getTotalLength()
INode
getTotalLength in interface INodepublic int getTotalEndOffset()
INodeoffset + length
but may be more efficient.
getTotalEndOffset in interface INodepublic java.lang.String getText()
INodenull
but may be empty.
getText in interface INodenull.public org.eclipse.emf.ecore.EObject getGrammarElement()
INodenull in case of unrecoverable syntax
errors. This happens usually when a keyword occurred at an unexpected offset.
getGrammarElement in interface INodenull.public org.eclipse.emf.ecore.EObject getSemanticElement()
INodenull whenever
the parser refused to create any objects due to unrecoverable errors. Implementations will usually walk up the
node tree to find the semantic object. As the node model structure does not reflect the containment structure of
the semantic object graph, clients should usually use the utilities in
NodeModelUtils to
obtain the semantic instance.
getSemanticElement in interface INodenull.INode.hasDirectSemanticElement(),
NodeModelUtils.findActualSemanticObjectFor(INode)public boolean hasDirectSemanticElement()
INodetrue if this node as a directly associated semantic element.
hasDirectSemanticElement in interface INodetrue if this node as a directly associated semantic element.INode.getSemanticElement()public SyntaxErrorMessage getSyntaxErrorMessage()
INodenull if none.
getSyntaxErrorMessage in interface INodenull.public BidiTreeIterable<INode> getAsTreeIterable()
INodeBidiTreeIterator.previous()
or BidiTreeIterator.next() will be this instance.
getAsTreeIterable in interface INodepublic BidiTreeIterator<INode> iterator()
BidiIterable
iterator in interface java.lang.Iterable<INode>iterator in interface BidiIterable<INode>iterator in interface BidiTreeIterable<INode>null.public java.lang.Iterable<ILeafNode> getLeafNodes()
INodenull.
getLeafNodes in interface INodenull.public BidiTreeIterable<INode> reverse()
BidiIterableReturns 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()
and next() invocations to
BidiIterator.hasPrevious() and BidiIterator.previous()
respectively.
This allows clients to iterate backwards by means of the enhanced for-loop:
for(T t: iterable.reverse()) {
// do something with t
}
reverse in interface BidiIterable<INode>reverse in interface BidiTreeIterable<INode>null.public BidiIterable<INode> getChildren()
ICompositeNodenull but may be empty.
getChildren in interface ICompositeNodeICompositeNode.hasChildren(),
ICompositeNode.getFirstChild(),
ICompositeNode.getLastChild()public boolean hasChildren()
ICompositeNodetrue if this node has any children.
hasChildren in interface ICompositeNodetrue if this node has any children.ICompositeNode.getChildren(),
ICompositeNode.getFirstChild(),
ICompositeNode.getLastChild()public INode getFirstChild()
ICompositeNodenull or may be the same as the last child.
getFirstChild in interface ICompositeNodeICompositeNode.hasChildren(),
ICompositeNode.getChildren()public INode getLastChild()
ICompositeNodenull or may be the same as the first child.
getLastChild in interface ICompositeNodeICompositeNode.hasChildren(),
ICompositeNode.getChildren()public int getLookAhead()
ICompositeNodeICompositeNode.getLookAhead().
getLookAhead in interface ICompositeNodepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||