Package org.eclipse.xtext.nodemodel.impl
Class RootNode
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Iterable<INode>,org.eclipse.emf.common.notify.Adapter,BidiIterable<INode>,BidiTreeIterable<INode>,ICompositeNode,INode
public class RootNode extends CompositeNodeWithSemanticElementAndSyntaxError
- Noextend:
- This class is not intended to be subclassed by clients.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.xtext.nodemodel.impl.AbstractNode
AbstractNode.NodeType
-
-
Constructor Summary
Constructors Constructor Description RootNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int[]basicGetLineBreakOffsets()Returns an array that contains the offsets of each line break in the input.protected AbstractNodebasicGetNextSibling()protected AbstractNodebasicGetPreviousSibling()protected booleanbasicHasNextSibling()protected booleanbasicHasPreviousSibling()protected voidbasicSetCompleteContent(java.lang.String completeContent)protected voidbasicSetNextSibling(AbstractNode next)protected voidbasicSetParent(CompositeNode parent)protected voidbasicSetPreviousSibling(AbstractNode prev)protected int[]computeLineBreaks(java.lang.String text)voidfillGrammarElementToIdMap(java.util.Map<org.eclipse.emf.ecore.EObject,java.lang.Integer> grammarElementToIdMap, java.util.List<java.lang.String> grammarIdToURIMap)java.lang.StringgetCompleteContent()intgetIndex()INodegetNextSibling()Returns the next sibling ornull.protected AbstractNode.NodeTypegetNodeId()CompositeNodegetParent()Returns the parent of the node ornullif and only if this is the root node.INodegetPreviousSibling()Returns the previous sibling ornull.ICompositeNodegetRootNode()Returns the root node of this parse tree.java.lang.StringgetText()Returns the parsed text that is covered by this node (including hidden tokens).intgetTotalLength()Returns the length of this node including hidden tokens.intgetTotalOffset()Returns the offset of this node including hidden tokens.booleanhasNextSibling()Returnstrueif this node is not the last child of its parent.booleanhasPreviousSibling()Returnstrueif this node is not the first child of its parent.booleanhasSiblings()Returnstrueif this node has any siblings.protected voidreadData(java.io.DataInputStream in, DeserializationConversionContext context)-
Methods inherited from class org.eclipse.xtext.nodemodel.impl.CompositeNodeWithSemanticElementAndSyntaxError
basicSetSyntaxErrorMessage, getSyntaxErrorMessage, write
-
Methods inherited from class org.eclipse.xtext.nodemodel.impl.CompositeNodeWithSemanticElement
basicGetSemanticElement, basicSetSemanticElement, getSemanticElement, getTarget, isAdapterForType, notifyChanged, setTarget
-
Methods inherited from class org.eclipse.xtext.nodemodel.impl.CompositeNode
basicGetChildren, basicGetFirstChild, basicGetLastChild, basicSetFirstChild, basicSetLookAhead, getChildren, getFirstChild, getGrammarElement, getLastChild, getLookAhead, hasChildren, isFolded, isFolded, resolveAsParent
-
Methods inherited from class org.eclipse.xtext.nodemodel.impl.AbstractNode
basicGetGrammarElement, basicGetLineOfOffset, basicGetParent, basicHasSiblings, basicIterator, basicSetGrammarElement, getAsTreeIterable, getEndLine, getEndOffset, getLeafNodes, getLength, getOffset, getStartLine, getTextRegion, getTextRegionWithLineInformation, getTextRegionWithLineInformation, getTotalEndLine, getTotalEndOffset, getTotalStartLine, getTotalTextRegion, getTotalTextRegionWithLineInformation, hasDirectSemanticElement, 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, getEndOffset, getLeafNodes, getLength, getOffset, getStartLine, getTextRegion, getTextRegionWithLineInformation, getTotalEndLine, getTotalEndOffset, getTotalStartLine, getTotalTextRegion, getTotalTextRegionWithLineInformation, hasDirectSemanticElement
-
-
-
-
Method Detail
-
getParent
public CompositeNode getParent()
Description copied from interface:INodeReturns the parent of the node ornullif and only if this is the root node.- Specified by:
getParentin interfaceINode- Overrides:
getParentin classAbstractNode- Returns:
nullthe root node does not have any parent.
-
getRootNode
public ICompositeNode getRootNode()
Description copied from interface:INodeReturns the root node of this parse tree. Will not returnnullin a consistent tree.- Specified by:
getRootNodein interfaceINode- Overrides:
getRootNodein classAbstractNode- Returns:
- the root node of this parse tree. Will not return
nullin a consistent tree.
-
getTotalOffset
public int getTotalOffset()
Description copied from interface:INodeReturns the offset of this node including hidden tokens.- Specified by:
getTotalOffsetin interfaceINode- Overrides:
getTotalOffsetin classCompositeNode- Returns:
- the offset of this node including hidden tokens.
-
getTotalLength
public int getTotalLength()
Description copied from interface:INodeReturns the length of this node including hidden tokens.- Specified by:
getTotalLengthin interfaceINode- Overrides:
getTotalLengthin classCompositeNode- Returns:
- the length of this node including hidden tokens.
-
getText
public java.lang.String getText()
Description copied from interface:INodeReturns the parsed text that is covered by this node (including hidden tokens). The result is nevernullbut may be empty.- Specified by:
getTextin interfaceINode- Overrides:
getTextin classAbstractNode- Returns:
- the parsed text that is covered by this node (including hidden tokens). Never
null.
-
getIndex
public int getIndex()
-
basicSetCompleteContent
protected void basicSetCompleteContent(java.lang.String completeContent)
-
basicGetLineBreakOffsets
protected int[] basicGetLineBreakOffsets()
Returns an array that contains the offsets of each line break in the input. Note that the result is not a copy but the actually internal data structure of this node.- Returns:
- an array of offsets of each line break in the input or
nullif thecompleteContenthas not been set. - Since:
- 2.0
-
getCompleteContent
public java.lang.String getCompleteContent()
-
getNextSibling
public INode getNextSibling()
Description copied from interface:INode- Specified by:
getNextSiblingin interfaceINode- Overrides:
getNextSiblingin classAbstractNode- Returns:
- the next sibling or
null. - See Also:
INode.hasNextSibling(),INode.hasSiblings()
-
getPreviousSibling
public INode getPreviousSibling()
Description copied from interface:INodeReturns the previous sibling ornull. The result has the sameparentas this node if it is notnull.- Specified by:
getPreviousSiblingin interfaceINode- Overrides:
getPreviousSiblingin classAbstractNode- Returns:
- the previous sibling or
null. - See Also:
INode.hasPreviousSibling(),INode.hasSiblings()
-
basicGetNextSibling
protected AbstractNode basicGetNextSibling()
- Overrides:
basicGetNextSiblingin classAbstractNode
-
basicGetPreviousSibling
protected AbstractNode basicGetPreviousSibling()
- Overrides:
basicGetPreviousSiblingin classAbstractNode
-
basicHasPreviousSibling
protected boolean basicHasPreviousSibling()
- Overrides:
basicHasPreviousSiblingin classAbstractNode
-
basicHasNextSibling
protected boolean basicHasNextSibling()
- Overrides:
basicHasNextSiblingin classAbstractNode
-
hasPreviousSibling
public boolean hasPreviousSibling()
Description copied from interface:INodeReturnstrueif this node is not the first child of its parent.- Specified by:
hasPreviousSiblingin interfaceINode- Overrides:
hasPreviousSiblingin classAbstractNode- Returns:
trueif this node has a previous sibling thusINode.getPreviousSibling()will not returnnull.
-
hasNextSibling
public boolean hasNextSibling()
Description copied from interface:INodeReturnstrueif this node is not the last child of its parent.- Specified by:
hasNextSiblingin interfaceINode- Overrides:
hasNextSiblingin classAbstractNode- Returns:
trueif this node has a next sibling thusINode.getNextSibling()will not returnnull.
-
hasSiblings
public boolean hasSiblings()
Description copied from interface:INodeReturnstrueif this node has any siblings.- Specified by:
hasSiblingsin interfaceINode- Overrides:
hasSiblingsin classAbstractNode- Returns:
trueif this node has any siblings.- See Also:
INode.hasPreviousSibling(),INode.hasNextSibling()
-
basicSetNextSibling
protected void basicSetNextSibling(AbstractNode next)
- Overrides:
basicSetNextSiblingin classAbstractNode
-
basicSetPreviousSibling
protected void basicSetPreviousSibling(AbstractNode prev)
- Overrides:
basicSetPreviousSiblingin classAbstractNode
-
basicSetParent
protected void basicSetParent(CompositeNode parent)
- Overrides:
basicSetParentin classAbstractNode
-
computeLineBreaks
protected int[] computeLineBreaks(java.lang.String text)
- Parameters:
text- the text whose line-breaks should be computed. May not benull.- Returns:
- the array of line-break offsets in the given text. May be empty but is never
null. - Since:
- 2.0
- See Also:
InternalNodeModelUtils.computeLineBreaks(String)
-
readData
protected void readData(java.io.DataInputStream in, DeserializationConversionContext context) throws java.io.IOException- Overrides:
readDatain classCompositeNodeWithSemanticElementAndSyntaxError- Throws:
java.io.IOException
-
getNodeId
protected AbstractNode.NodeType getNodeId()
- Overrides:
getNodeIdin classCompositeNodeWithSemanticElementAndSyntaxError
-
fillGrammarElementToIdMap
public void fillGrammarElementToIdMap(java.util.Map<org.eclipse.emf.ecore.EObject,java.lang.Integer> grammarElementToIdMap, java.util.List<java.lang.String> grammarIdToURIMap)- Since:
- 2.3
- Noreference:
- This method is not intended to be referenced by clients.
-
-