Package com.vladsch.flexmark.util.ast
Class Node
- java.lang.Object
-
- com.vladsch.flexmark.util.ast.Node
-
- Direct Known Subclasses:
ContentNode
public abstract class Node extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static com.vladsch.flexmark.util.visitor.AstNode<Node>AST_ADAPTERstatic com.vladsch.flexmark.util.sequence.BasedSequence[]EMPTY_SEGMENTSstatic StringSPLICE
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidappendChain(@NotNull Node firstNode)Append all from child to end of chain to this nodevoidappendChild(Node child)static voidastChars(@NotNull StringBuilder out, @NotNull CharSequence chars, @NotNull String name)voidastExtraChars(@NotNull StringBuilder out)voidastString(@NotNull StringBuilder out, boolean withExtra)com.vladsch.flexmark.util.sequence.BasedSequencebaseSubSequence(int startIndex)com.vladsch.flexmark.util.sequence.BasedSequencebaseSubSequence(int startIndex, int endIndex)intcountAncestorsOfType(@NotNull Class<?>... classes)intcountDirectAncestorsOfType(@Nullable Class<?> skip, @NotNull Class<?>... classes)static voiddelimitedSegmentSpan(@NotNull StringBuilder out, @NotNull com.vladsch.flexmark.util.sequence.BasedSequence openingSequence, @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @NotNull com.vladsch.flexmark.util.sequence.BasedSequence closingSequence, @NotNull String name)static voiddelimitedSegmentSpanChars(@NotNull StringBuilder out, @NotNull com.vladsch.flexmark.util.sequence.BasedSequence openingSequence, @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @NotNull com.vladsch.flexmark.util.sequence.BasedSequence closingSequence, @NotNull String name)intendOfLine(int index)voidextractChainTo(@NotNull Node node)voidextractToFirstInChain(@NotNull Node node)@Nullable NodegetAncestorOfType(@NotNull Class<?>... classes)voidgetAstExtra(@NotNull StringBuilder out)com.vladsch.flexmark.util.sequence.BasedSequencegetBaseSequence()@NotNull NodegetBlankLineSibling()@NotNull com.vladsch.flexmark.util.sequence.BasedSequencegetChars()@NotNull com.vladsch.flexmark.util.sequence.BasedSequencegetCharsFromSegments()Get the char sequence from segments making up the node's characters.com.vladsch.flexmark.util.sequence.BasedSequencegetChildChars()@NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterator<Node>getChildIterator()@Nullable NodegetChildOfType(@NotNull Class<?>... classes)@NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterable<Node>getChildren()@NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterable<Node>getDescendants()@NotNull DocumentgetDocument()com.vladsch.flexmark.util.sequence.BasedSequencegetEmptyPrefix()com.vladsch.flexmark.util.sequence.BasedSequencegetEmptySuffix()intgetEndLineNumber()intgetEndOffset()intgetEndOfLine()com.vladsch.flexmark.util.sequence.BasedSequencegetExactChildChars()@Nullable NodegetFirstChild()@Nullable NodegetFirstChildAny(@NotNull Class<?>... classes)@Nullable NodegetFirstChildAnyNot(@NotNull Class<?>... classes)@NotNull NodegetFirstInChain()@Nullable NodegetGrandParent()@Nullable NodegetLastBlankLineChild()Overridden by ListBlock and any others whose children propagate their blank line to parent@Nullable NodegetLastChild()@Nullable NodegetLastChildAny(@NotNull Class<?>... classes)@Nullable NodegetLastChildAnyNot(@NotNull Class<?>... classes)@NotNull NodegetLastInChain()static @NotNull com.vladsch.flexmark.util.sequence.BasedSequencegetLeadSegment(@NotNull com.vladsch.flexmark.util.sequence.BasedSequence[] segments)com.vladsch.flexmark.util.misc.Pair<Integer,Integer>getLineColumnAtEnd()intgetLineNumber()@Nullable NodegetNext()@Nullable NodegetNextAny(@NotNull Class<?>... classes)@Nullable NodegetNextAnyNot(@NotNull Class<?>... classes)@NotNull StringgetNodeName()static intgetNodeOfTypeIndex(@NotNull Node node, @NotNull Class<?>... classes)intgetNodeOfTypeIndex(@NotNull Class<?>... classes)@Nullable NodegetOldestAncestorOfTypeAfter(@NotNull Class<?> ancestor, @NotNull Class<?> after)@Nullable NodegetParent()@Nullable NodegetPrevious()@Nullable NodegetPreviousAny(@NotNull Class<?>... classes)@Nullable NodegetPreviousAnyNot(@NotNull Class<?>... classes)@NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterator<Node>getReversedChildIterator()@NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterable<Node>getReversedChildren()@NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterable<Node>getReversedDescendants()abstract @NotNull com.vladsch.flexmark.util.sequence.BasedSequence[]getSegments()@NotNull com.vladsch.flexmark.util.sequence.BasedSequence[]getSegmentsForChars()Get the segments making up the node's characters.com.vladsch.flexmark.util.sequence.RangegetSourceRange()intgetStartLineNumber()intgetStartOffset()intgetStartOfLine()intgetTextLength()static @NotNull com.vladsch.flexmark.util.sequence.BasedSequencegetTrailSegment(com.vladsch.flexmark.util.sequence.BasedSequence[] segments)booleanhasChildren()booleanhasOrMoreChildren(int childCount)voidinsertAfter(@NotNull Node sibling)voidinsertBefore(Node sibling)voidinsertChainAfter(@NotNull Node firstNode)Append all from child to end of chain to this nodevoidinsertChainBefore(@NotNull Node firstNode)Append all from child to end of chain to this nodebooleanisOrDescendantOfType(@NotNull Class<?>... classes)com.vladsch.flexmark.util.misc.Pair<Integer,Integer>lineColumnAtIndex(int index)com.vladsch.flexmark.util.misc.Pair<Integer,Integer>lineColumnAtStart()voidmoveTrailingBlankLines()voidprependChild(@NotNull Node child)voidremoveChildren()static voidsegmentSpan(@NotNull StringBuilder out, int startOffset, int endOffset, @Nullable String name)static voidsegmentSpan(@NotNull StringBuilder out, @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @Nullable String name)static voidsegmentSpanChars(@NotNull StringBuilder out, int startOffset, int endOffset, @Nullable String name, @NotNull String chars)static voidsegmentSpanChars(@NotNull StringBuilder out, int startOffset, int endOffset, @Nullable String name, @NotNull String chars1, @NotNull String splice, @NotNull String chars2)static voidsegmentSpanChars(@NotNull StringBuilder out, @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @NotNull String name)static voidsegmentSpanCharsToVisible(@NotNull StringBuilder out, @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @NotNull String name)voidsetChars(@NotNull com.vladsch.flexmark.util.sequence.BasedSequence chars)voidsetCharsFromContent()voidsetCharsFromContentOnly()voidsetCharsFromSegments()Set the node's char string from segments making up the node's characters.protected voidsetParent(@Nullable Node parent)static @NotNull com.vladsch.flexmark.util.sequence.BasedSequencespanningChars(com.vladsch.flexmark.util.sequence.BasedSequence... segments)intstartOfLine(int index)voidtakeChildren(@NotNull Node node)@NotNull StringtoAstString(boolean withExtra)static @NotNull StringtoSegmentSpan(@NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @Nullable String name)StringtoString()protected @NotNull StringtoStringAttributes()voidunlink()
-
-
-
Field Detail
-
EMPTY_SEGMENTS
public static final com.vladsch.flexmark.util.sequence.BasedSequence[] EMPTY_SEGMENTS
-
SPLICE
public static final String SPLICE
- See Also:
- Constant Field Values
-
AST_ADAPTER
public static final com.vladsch.flexmark.util.visitor.AstNode<Node> AST_ADAPTER
-
-
Method Detail
-
getStartOffset
public int getStartOffset()
-
getEndOffset
public int getEndOffset()
-
getTextLength
public int getTextLength()
-
getBaseSequence
public com.vladsch.flexmark.util.sequence.BasedSequence getBaseSequence()
-
getSourceRange
public com.vladsch.flexmark.util.sequence.Range getSourceRange()
-
baseSubSequence
public com.vladsch.flexmark.util.sequence.BasedSequence baseSubSequence(int startIndex, int endIndex)
-
baseSubSequence
public com.vladsch.flexmark.util.sequence.BasedSequence baseSubSequence(int startIndex)
-
getEmptyPrefix
public com.vladsch.flexmark.util.sequence.BasedSequence getEmptyPrefix()
-
getEmptySuffix
public com.vladsch.flexmark.util.sequence.BasedSequence getEmptySuffix()
-
getStartOfLine
public int getStartOfLine()
-
getEndOfLine
public int getEndOfLine()
-
startOfLine
public int startOfLine(int index)
-
endOfLine
public int endOfLine(int index)
-
lineColumnAtIndex
public com.vladsch.flexmark.util.misc.Pair<Integer,Integer> lineColumnAtIndex(int index)
-
getLineColumnAtEnd
public com.vladsch.flexmark.util.misc.Pair<Integer,Integer> getLineColumnAtEnd()
-
getAncestorOfType
@Nullable public @Nullable Node getAncestorOfType(@NotNull @NotNull Class<?>... classes)
-
countAncestorsOfType
public int countAncestorsOfType(@NotNull @NotNull Class<?>... classes)
-
countDirectAncestorsOfType
public int countDirectAncestorsOfType(@Nullable @Nullable Class<?> skip, @NotNull @NotNull Class<?>... classes)
-
getOldestAncestorOfTypeAfter
@Nullable public @Nullable Node getOldestAncestorOfTypeAfter(@NotNull @NotNull Class<?> ancestor, @NotNull @NotNull Class<?> after)
-
getChildOfType
@Nullable public @Nullable Node getChildOfType(@NotNull @NotNull Class<?>... classes)
-
getNodeOfTypeIndex
public static int getNodeOfTypeIndex(@NotNull @NotNull Node node, @NotNull @NotNull Class<?>... classes)
-
isOrDescendantOfType
public boolean isOrDescendantOfType(@NotNull @NotNull Class<?>... classes)
-
getNodeOfTypeIndex
public int getNodeOfTypeIndex(@NotNull @NotNull 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
-
getChildren
@NotNull public @NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterable<Node> getChildren()
-
getReversedChildren
@NotNull public @NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterable<Node> getReversedChildren()
-
getDescendants
@NotNull public @NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterable<Node> getDescendants()
-
getReversedDescendants
@NotNull public @NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterable<Node> getReversedDescendants()
-
getChildIterator
@NotNull public @NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterator<Node> getChildIterator()
-
getReversedChildIterator
@NotNull public @NotNull com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterator<Node> getReversedChildIterator()
-
getChars
@NotNull public @NotNull com.vladsch.flexmark.util.sequence.BasedSequence getChars()
-
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 com.vladsch.flexmark.util.sequence.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 Class<?>... classes)
-
getPreviousAny
@Nullable public @Nullable Node getPreviousAny(@NotNull @NotNull Class<?>... classes)
-
getFirstChild
@Nullable public @Nullable Node getFirstChild()
-
getFirstChildAnyNot
@Nullable public @Nullable Node getFirstChildAnyNot(@NotNull @NotNull Class<?>... classes)
-
getFirstChildAny
@Nullable public @Nullable Node getFirstChildAny(@NotNull @NotNull Class<?>... classes)
-
getLastChild
@Nullable public @Nullable Node getLastChild()
-
getLastChildAnyNot
@Nullable public @Nullable Node getLastChildAnyNot(@NotNull @NotNull Class<?>... classes)
-
getLastChildAny
@Nullable public @Nullable Node getLastChildAny(@NotNull @NotNull 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)
-
getAstExtra
public void getAstExtra(@NotNull @NotNull StringBuilder out)
-
astExtraChars
public void astExtraChars(@NotNull @NotNull StringBuilder out)
-
astChars
public static void astChars(@NotNull @NotNull StringBuilder out, @NotNull @NotNull CharSequence chars, @NotNull @NotNull String name)
-
toStringAttributes
@NotNull protected @NotNull String toStringAttributes()
-
getSegments
@NotNull public abstract @NotNull com.vladsch.flexmark.util.sequence.BasedSequence[] getSegments()
-
getLeadSegment
@NotNull public static @NotNull com.vladsch.flexmark.util.sequence.BasedSequence getLeadSegment(@NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence[] segments)
-
getTrailSegment
@NotNull public static @NotNull com.vladsch.flexmark.util.sequence.BasedSequence getTrailSegment(com.vladsch.flexmark.util.sequence.BasedSequence[] segments)
-
spanningChars
@NotNull public static @NotNull com.vladsch.flexmark.util.sequence.BasedSequence spanningChars(com.vladsch.flexmark.util.sequence.BasedSequence... segments)
-
setCharsFromContentOnly
public void setCharsFromContentOnly()
-
setCharsFromContent
public void setCharsFromContent()
-
segmentSpan
public static void segmentSpan(@NotNull @NotNull StringBuilder out, int startOffset, int endOffset, @Nullable @Nullable String name)
-
segmentSpanChars
public static void segmentSpanChars(@NotNull @NotNull StringBuilder out, int startOffset, int endOffset, @Nullable @Nullable String name, @NotNull @NotNull String chars)
-
segmentSpanChars
public static void segmentSpanChars(@NotNull @NotNull StringBuilder out, int startOffset, int endOffset, @Nullable @Nullable String name, @NotNull @NotNull String chars1, @NotNull @NotNull String splice, @NotNull @NotNull String chars2)
-
segmentSpan
public static void segmentSpan(@NotNull @NotNull StringBuilder out, @NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @Nullable @Nullable String name)
-
segmentSpanChars
public static void segmentSpanChars(@NotNull @NotNull StringBuilder out, @NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @NotNull @NotNull String name)
-
segmentSpanCharsToVisible
public static void segmentSpanCharsToVisible(@NotNull @NotNull StringBuilder out, @NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @NotNull @NotNull String name)
-
delimitedSegmentSpan
public static void delimitedSegmentSpan(@NotNull @NotNull StringBuilder out, @NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence openingSequence, @NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence closingSequence, @NotNull @NotNull String name)
-
delimitedSegmentSpanChars
public static void delimitedSegmentSpanChars(@NotNull @NotNull StringBuilder out, @NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence openingSequence, @NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence closingSequence, @NotNull @NotNull String name)
-
takeChildren
public void takeChildren(@NotNull @NotNull Node node)
-
getNodeName
@NotNull public @NotNull String getNodeName()
-
astString
public void astString(@NotNull @NotNull StringBuilder out, boolean withExtra)
-
toAstString
@NotNull public @NotNull String toAstString(boolean withExtra)
-
toSegmentSpan
@NotNull public static @NotNull String toSegmentSpan(@NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence sequence, @Nullable @Nullable String name)
-
getChildChars
public com.vladsch.flexmark.util.sequence.BasedSequence getChildChars()
-
getExactChildChars
public com.vladsch.flexmark.util.sequence.BasedSequence getExactChildChars()
-
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 com.vladsch.flexmark.util.sequence.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 com.vladsch.flexmark.util.sequence.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
-
-