Class Node

    • Field Detail

      • EMPTY_SEGMENTS

        public static final BasedSequence[] EMPTY_SEGMENTS
      • AST_ADAPTER

        public static final AstNode<Node> AST_ADAPTER
      • parent

        @Nullable
        private @Nullable Node parent
      • firstChild

        @Nullable
        @Nullable Node firstChild
      • lastChild

        @Nullable
        private @Nullable Node lastChild
      • prev

        @Nullable
        private @Nullable Node prev
      • next

        @Nullable
        @Nullable Node next
    • Constructor Detail

      • Node

        public Node()
    • Method Detail

      • getStartOffset

        public int getStartOffset()
      • getEndOffset

        public int getEndOffset()
      • getTextLength

        public int getTextLength()
      • getSourceRange

        public Range getSourceRange()
      • baseSubSequence

        public BasedSequence baseSubSequence​(int startIndex,
                                             int endIndex)
      • baseSubSequence

        public BasedSequence baseSubSequence​(int startIndex)
      • getStartOfLine

        public int getStartOfLine()
      • getEndOfLine

        public int getEndOfLine()
      • startOfLine

        public int startOfLine​(int index)
      • endOfLine

        public int endOfLine​(int index)
      • lineColumnAtIndex

        public Pair<java.lang.Integer,​java.lang.Integer> lineColumnAtIndex​(int index)
      • lineColumnAtStart

        public Pair<java.lang.Integer,​java.lang.Integer> lineColumnAtStart()
      • getLineColumnAtEnd

        public Pair<java.lang.Integer,​java.lang.Integer> getLineColumnAtEnd()
      • getAncestorOfType

        @Nullable
        public @Nullable Node getAncestorOfType​(@NotNull
                                                @NotNull java.lang.Class<?>... classes)
      • countAncestorsOfType

        public int countAncestorsOfType​(@NotNull
                                        @NotNull java.lang.Class<?>... classes)
      • countDirectAncestorsOfType

        public int countDirectAncestorsOfType​(@Nullable
                                              @Nullable java.lang.Class<?> skip,
                                              @NotNull
                                              @NotNull java.lang.Class<?>... classes)
      • getOldestAncestorOfTypeAfter

        @Nullable
        public @Nullable Node getOldestAncestorOfTypeAfter​(@NotNull
                                                           @NotNull java.lang.Class<?> ancestor,
                                                           @NotNull
                                                           @NotNull java.lang.Class<?> after)
      • getChildOfType

        @Nullable
        public @Nullable Node getChildOfType​(@NotNull
                                             @NotNull java.lang.Class<?>... classes)
      • getNodeOfTypeIndex

        public static int getNodeOfTypeIndex​(@NotNull
                                             @NotNull Node node,
                                             @NotNull
                                             @NotNull java.lang.Class<?>... classes)
      • isOrDescendantOfType

        public boolean isOrDescendantOfType​(@NotNull
                                            @NotNull java.lang.Class<?>... classes)
      • getNodeOfTypeIndex

        public int getNodeOfTypeIndex​(@NotNull
                                      @NotNull java.lang.Class<?>... classes)
      • getLastBlankLineChild

        @Nullable
        public @Nullable Node getLastBlankLineChild()
        Overridden by ListBlock and any others whose children propagate their blank line to parent
        Returns:
        return a child block that can contain the parent's last blank line
      • removeChildren

        public void removeChildren()
      • hasChildren

        public boolean hasChildren()
      • hasOrMoreChildren

        public boolean hasOrMoreChildren​(int childCount)
      • getDocument

        @NotNull
        public @NotNull Document getDocument()
      • setChars

        public void setChars​(@NotNull
                             @NotNull BasedSequence chars)
      • getNext

        @Nullable
        public @Nullable Node getNext()
      • getLastInChain

        @NotNull
        public @NotNull Node getLastInChain()
      • getPrevious

        @Nullable
        public @Nullable Node getPrevious()
      • extractToFirstInChain

        public void extractToFirstInChain​(@NotNull
                                          @NotNull Node node)
      • extractChainTo

        public void extractChainTo​(@NotNull
                                   @NotNull Node node)
      • getFirstInChain

        @NotNull
        public @NotNull Node getFirstInChain()
      • getPreviousAnyNot

        @Nullable
        public @Nullable Node getPreviousAnyNot​(@NotNull
                                                @NotNull java.lang.Class<?>... classes)
      • getPreviousAny

        @Nullable
        public @Nullable Node getPreviousAny​(@NotNull
                                             @NotNull java.lang.Class<?>... classes)
      • getNextAnyNot

        @Nullable
        public @Nullable Node getNextAnyNot​(@NotNull
                                            @NotNull java.lang.Class<?>... classes)
      • getNextAny

        @Nullable
        public @Nullable Node getNextAny​(@NotNull
                                         @NotNull java.lang.Class<?>... classes)
      • getFirstChild

        @Nullable
        public @Nullable Node getFirstChild()
      • getFirstChildAnyNot

        @Nullable
        public @Nullable Node getFirstChildAnyNot​(@NotNull
                                                  @NotNull java.lang.Class<?>... classes)
      • getFirstChildAny

        @Nullable
        public @Nullable Node getFirstChildAny​(@NotNull
                                               @NotNull java.lang.Class<?>... classes)
      • getLastChild

        @Nullable
        public @Nullable Node getLastChild()
      • getLastChildAnyNot

        @Nullable
        public @Nullable Node getLastChildAnyNot​(@NotNull
                                                 @NotNull java.lang.Class<?>... classes)
      • getLastChildAny

        @Nullable
        public @Nullable Node getLastChildAny​(@NotNull
                                              @NotNull java.lang.Class<?>... classes)
      • getParent

        @Nullable
        public @Nullable Node getParent()
      • getGrandParent

        @Nullable
        public @Nullable Node getGrandParent()
      • setParent

        protected void setParent​(@Nullable
                                 @Nullable Node parent)
      • appendChild

        public void appendChild​(Node child)
      • prependChild

        public void prependChild​(@NotNull
                                 @NotNull Node child)
      • unlink

        public void unlink()
      • insertAfter

        public void insertAfter​(@NotNull
                                @NotNull Node sibling)
      • insertBefore

        public void insertBefore​(Node sibling)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getAstExtra

        public void getAstExtra​(@NotNull
                                @NotNull java.lang.StringBuilder out)
      • astExtraChars

        public void astExtraChars​(@NotNull
                                  @NotNull java.lang.StringBuilder out)
      • astChars

        public static void astChars​(@NotNull
                                    @NotNull java.lang.StringBuilder out,
                                    @NotNull
                                    @NotNull java.lang.CharSequence chars,
                                    @NotNull
                                    @NotNull java.lang.String name)
      • toStringAttributes

        @NotNull
        protected @NotNull java.lang.String toStringAttributes()
      • getSegments

        @NotNull
        public abstract @NotNull BasedSequence[] getSegments()
      • setCharsFromContentOnly

        public void setCharsFromContentOnly()
      • setCharsFromContent

        public void setCharsFromContent()
      • segmentSpan

        public static void segmentSpan​(@NotNull
                                       @NotNull java.lang.StringBuilder out,
                                       int startOffset,
                                       int endOffset,
                                       @Nullable
                                       @Nullable java.lang.String name)
      • segmentSpanChars

        public static void segmentSpanChars​(@NotNull
                                            @NotNull java.lang.StringBuilder out,
                                            int startOffset,
                                            int endOffset,
                                            @Nullable
                                            @Nullable java.lang.String name,
                                            @NotNull
                                            @NotNull java.lang.String chars)
      • segmentSpanChars

        public static void segmentSpanChars​(@NotNull
                                            @NotNull java.lang.StringBuilder out,
                                            int startOffset,
                                            int endOffset,
                                            @Nullable
                                            @Nullable java.lang.String name,
                                            @NotNull
                                            @NotNull java.lang.String chars1,
                                            @NotNull
                                            @NotNull java.lang.String splice,
                                            @NotNull
                                            @NotNull java.lang.String chars2)
      • segmentSpan

        public static void segmentSpan​(@NotNull
                                       @NotNull java.lang.StringBuilder out,
                                       @NotNull
                                       @NotNull BasedSequence sequence,
                                       @Nullable
                                       @Nullable java.lang.String name)
      • segmentSpanChars

        public static void segmentSpanChars​(@NotNull
                                            @NotNull java.lang.StringBuilder out,
                                            @NotNull
                                            @NotNull BasedSequence sequence,
                                            @NotNull
                                            @NotNull java.lang.String name)
      • segmentSpanCharsToVisible

        public static void segmentSpanCharsToVisible​(@NotNull
                                                     @NotNull java.lang.StringBuilder out,
                                                     @NotNull
                                                     @NotNull BasedSequence sequence,
                                                     @NotNull
                                                     @NotNull java.lang.String name)
      • delimitedSegmentSpan

        public static void delimitedSegmentSpan​(@NotNull
                                                @NotNull java.lang.StringBuilder out,
                                                @NotNull
                                                @NotNull BasedSequence openingSequence,
                                                @NotNull
                                                @NotNull BasedSequence sequence,
                                                @NotNull
                                                @NotNull BasedSequence closingSequence,
                                                @NotNull
                                                @NotNull java.lang.String name)
      • delimitedSegmentSpanChars

        public static void delimitedSegmentSpanChars​(@NotNull
                                                     @NotNull java.lang.StringBuilder out,
                                                     @NotNull
                                                     @NotNull BasedSequence openingSequence,
                                                     @NotNull
                                                     @NotNull BasedSequence sequence,
                                                     @NotNull
                                                     @NotNull BasedSequence closingSequence,
                                                     @NotNull
                                                     @NotNull java.lang.String name)
      • takeChildren

        public void takeChildren​(@NotNull
                                 @NotNull Node node)
      • getNodeName

        @NotNull
        public @NotNull java.lang.String getNodeName()
      • astString

        public void astString​(@NotNull
                              @NotNull java.lang.StringBuilder out,
                              boolean withExtra)
      • toAstString

        @NotNull
        public @NotNull java.lang.String toAstString​(boolean withExtra)
      • toSegmentSpan

        @NotNull
        public static @NotNull java.lang.String toSegmentSpan​(@NotNull
                                                              @NotNull BasedSequence sequence,
                                                              @Nullable
                                                              @Nullable java.lang.String name)
      • getBlankLineSibling

        @NotNull
        public @NotNull Node getBlankLineSibling()
      • moveTrailingBlankLines

        public void moveTrailingBlankLines()
      • getLineNumber

        public int getLineNumber()
      • getStartLineNumber

        public int getStartLineNumber()
      • getEndLineNumber

        public int getEndLineNumber()
      • getSegmentsForChars

        @NotNull
        public @NotNull BasedSequence[] getSegmentsForChars()
        Get the segments making up the node's characters.

        Used to get segments after the some of the node's elements were modified

        Returns:
        array of segments
      • getCharsFromSegments

        @NotNull
        public @NotNull BasedSequence getCharsFromSegments()
        Get the char sequence from segments making up the node's characters.

        Used to get segments after the some of the node's elements were modified

        Returns:
        concatenated string of all segments
      • setCharsFromSegments

        public void setCharsFromSegments()
        Set the node's char string from segments making up the node's characters.

        Used to get segments after the some of the node's elements were modified

      • appendChain

        public void appendChain​(@NotNull
                                @NotNull Node firstNode)
        Append all from child to end of chain to this node
        Parameters:
        firstNode - first child in chain
      • insertChainAfter

        public void insertChainAfter​(@NotNull
                                     @NotNull Node firstNode)
        Append all from child to end of chain to this node
        Parameters:
        firstNode - first child in chain
      • insertChainBefore

        public void insertChainBefore​(@NotNull
                                      @NotNull Node firstNode)
        Append all from child to end of chain to this node
        Parameters:
        firstNode - first child in chain