Class AbstractNode

    • Constructor Detail

      • AbstractNode

        public AbstractNode()
    • Method Detail

      • getTextRegion

        public org.eclipse.xtext.util.ITextRegion getTextRegion()
        Description copied from interface: INode

        Returns a region for this node excluding hidden tokens:

        • an offset of this region is the same as an offset of this node;
        • and a length of this region is the same as a length of this node.

        This method could be more efficient than calculating an offset and a length of this node separately.

        Specified by:
        getTextRegion in interface INode
        Returns:
        a region for this node excluding hidden tokens
        Since:
        2.5
      • getTotalTextRegion

        public org.eclipse.xtext.util.ITextRegion getTotalTextRegion()
        Description copied from interface: INode

        Returns a region for this node including hidden tokens:

        • an offset of this region is the same as a total offset of this node;
        • and a length of this region is the same as a total length of this node.

        This method could be more efficient than calculating a total offset and a total length of this node separately.

        Specified by:
        getTotalTextRegion in interface INode
        Returns:
        a region for this node including hidden tokens
        Since:
        2.5
      • getTextRegionWithLineInformation

        public org.eclipse.xtext.util.ITextRegionWithLineInformation getTextRegionWithLineInformation()
        Description copied from interface: INode

        Returns a region with line information for this node excluding hidden tokens:

        • an offset of this region is the same as an offset of this node;
        • a length of this region is the same as a length of this node;
        • a line number of this region is the same as a start line of this node;
        • an end line number of this region is the same as an end line of this node.

        A line number and an end line number of the returned region are one based.

        This method could be more efficient than calculating an offset, a length, a start line and an end line of this node separately.

        Specified by:
        getTextRegionWithLineInformation in interface INode
        Returns:
        a region with line information for this node excluding hidden tokens
        Since:
        2.5
      • getTotalTextRegionWithLineInformation

        public org.eclipse.xtext.util.ITextRegionWithLineInformation getTotalTextRegionWithLineInformation()
        Description copied from interface: INode

        Returns a region with line information for this node including hidden tokens:

        • an offset of this region is the same as a total offset of this node;
        • a length of this region is the same as a total length of this node;
        • a line number of this region is the same as a total start line of this node;
        • an end line number of this region is the same as a total end line of this node.

        A line number and an end line number of the returned region are one based.

        This method could be more efficient than calculating a total offset, a total length, a total start line and a total end line of this node separately.

        Specified by:
        getTotalTextRegionWithLineInformation in interface INode
        Returns:
        a region with line information for this node including hidden tokens
        Since:
        2.5
      • getTextRegionWithLineInformation

        protected org.eclipse.xtext.util.ITextRegionWithLineInformation getTextRegionWithLineInformation​(int offset,
                                                                                                         int length)
        Since:
        2.5
      • getParent

        public ICompositeNode getParent()
        Description copied from interface: INode
        Returns the parent of the node or null if and only if this is the root node.
        Specified by:
        getParent in interface INode
        Returns:
        the parent of this node or null.
      • basicSetParent

        protected void basicSetParent​(CompositeNode parent)
      • getLeafNodes

        public java.lang.Iterable<ILeafNode> getLeafNodes()
        Description copied from interface: INode
        Returns an iterable for all contained leaf nodes. Never null.
        Specified by:
        getLeafNodes in interface INode
        Returns:
        an iterable for all contained leaf nodes. Never null.
      • getText

        public java.lang.String getText()
        Description copied from interface: INode
        Returns the parsed text that is covered by this node (including hidden tokens). The result is never null but may be empty.
        Specified by:
        getText in interface INode
        Returns:
        the parsed text that is covered by this node (including hidden tokens). Never null.
      • getTotalStartLine

        public int getTotalStartLine()
        Description copied from interface: INode
        Returns the line number relative to the complete input where the node begins (one based, including hidden tokens).
        Specified by:
        getTotalStartLine in interface INode
        Returns:
        the line number relative to the complete input where the node begins.
      • basicGetLineOfOffset

        protected int basicGetLineOfOffset​(INode rootNode,
                                           int offset)
        Since:
        2.0
      • getStartLine

        public int getStartLine()
        Description copied from interface: INode
        Returns the line number relative to the complete input where the node begins (one based, excluding hidden tokens).
        Specified by:
        getStartLine in interface INode
        Returns:
        the line number relative to the complete input where the node begins.
      • getEndLine

        public int getEndLine()
        Description copied from interface: INode
        Returns the line number relative to the complete input where the node ends (one based, excluding hidden tokens).
        Specified by:
        getEndLine in interface INode
        Returns:
        the line number relative to the complete input where the node ends.
      • getTotalEndLine

        public int getTotalEndLine()
        Description copied from interface: INode
        Returns the line number relative to the complete input where the node ends (one based, including hidden tokens).
        Specified by:
        getTotalEndLine in interface INode
        Returns:
        the line number relative to the complete input where the node ends.
      • getOffset

        public int getOffset()
        Description copied from interface: INode
        Returns the offset of this node excluding hidden tokens. If this node is a hidden leaf node or a composite node that does only contain hidden leaf nodes, the total offset is returned.
        Specified by:
        getOffset in interface INode
        Returns:
        the offset of this node excluding hidden tokens.
      • getLength

        public int getLength()
        Description copied from interface: INode
        Returns the length of this node excluding hidden tokens. If this node is a hidden leaf node, the total length is returned.
        Specified by:
        getLength in interface INode
        Returns:
        the length of this node excluding hidden tokens.
      • getTotalEndOffset

        public int getTotalEndOffset()
        Description copied from interface: INode
        Returns the end offset (exclusive) of this node including hidden tokens. Yields the same result as offset + length but may be more efficient.
        Specified by:
        getTotalEndOffset in interface INode
        Returns:
        the end offset (exclusive) of this node including hidden tokens.
      • getEndOffset

        public int getEndOffset()
        Description copied from interface: INode
        Returns the end offset (exclusive) of this node excluding hidden tokens. Yields the same result as offset + length but may be more efficient.
        Specified by:
        getEndOffset in interface INode
        Returns:
        the end offset (exclusive) of this node excluding hidden tokens.
        Since:
        2.5
      • getRootNode

        public ICompositeNode getRootNode()
        Description copied from interface: INode
        Returns the root node of this parse tree. Will not return null in a consistent tree.
        Specified by:
        getRootNode in interface INode
        Returns:
        the root node of this parse tree. Will not return null in a consistent tree.
      • getSemanticElement

        public org.eclipse.emf.ecore.EObject getSemanticElement()
        Description copied from interface: INode
        Returns the nearest semantic object that is associated with the subtree of this node. May return null 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.
        Specified by:
        getSemanticElement in interface INode
        Returns:
        the nearest semantic object that is associated with the subtree of this node. May return null.
        See Also:
        INode.hasDirectSemanticElement(), NodeModelUtils.findActualSemanticObjectFor(INode)
      • basicGetSemanticElement

        protected org.eclipse.emf.ecore.EObject basicGetSemanticElement()
      • hasDirectSemanticElement

        public boolean hasDirectSemanticElement()
        Description copied from interface: INode
        Returns true if this node as a directly associated semantic element.
        Specified by:
        hasDirectSemanticElement in interface INode
        Returns:
        true if this node as a directly associated semantic element.
        See Also:
        INode.getSemanticElement()
      • 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
        Returns:
        the grammar element that created this node. May return null.
      • basicGetGrammarElement

        protected java.lang.Object basicGetGrammarElement()
      • basicSetGrammarElement

        protected void basicSetGrammarElement​(java.lang.Object grammarElementOrArray)
      • getSyntaxErrorMessage

        public SyntaxErrorMessage getSyntaxErrorMessage()
        Description copied from interface: INode
        Returns the directly associated syntax error message or null if none.
        Specified by:
        getSyntaxErrorMessage in interface INode
        Returns:
        the directly associated syntax error message. May return null.
      • basicGetPreviousSibling

        protected AbstractNode basicGetPreviousSibling()
      • basicSetPreviousSibling

        protected void basicSetPreviousSibling​(AbstractNode prev)
      • basicGetNextSibling

        protected AbstractNode basicGetNextSibling()
      • basicSetNextSibling

        protected void basicSetNextSibling​(AbstractNode next)
      • hasPreviousSibling

        public boolean hasPreviousSibling()
        Description copied from interface: INode
        Returns true if this node is not the first child of its parent.
        Specified by:
        hasPreviousSibling in interface INode
        Returns:
        true if this node has a previous sibling thus INode.getPreviousSibling() will not return null.
      • basicHasPreviousSibling

        protected boolean basicHasPreviousSibling()
      • hasNextSibling

        public boolean hasNextSibling()
        Description copied from interface: INode
        Returns true if this node is not the last child of its parent.
        Specified by:
        hasNextSibling in interface INode
        Returns:
        true if this node has a next sibling thus INode.getNextSibling() will not return null.
      • basicHasNextSibling

        protected boolean basicHasNextSibling()
      • basicHasSiblings

        protected boolean basicHasSiblings()
      • readData

        protected void readData​(java.io.DataInputStream in,
                                DeserializationConversionContext context)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        protected void write​(java.io.DataOutputStream out,
                             SerializationConversionContext scc)
                      throws java.io.IOException
        Throws:
        java.io.IOException