Package com.vladsch.flexmark.util.ast
Class Document
java.lang.Object
com.vladsch.flexmark.util.ast.Node
com.vladsch.flexmark.util.ast.ContentNode
com.vladsch.flexmark.util.ast.Block
com.vladsch.flexmark.util.ast.Document
- All Implemented Interfaces:
Content
,DataHolder
,MutableDataHolder
,MutableDataSetter
-
Field Summary
FieldsFields inherited from class com.vladsch.flexmark.util.ast.ContentNode
lineSegments
Fields inherited from class com.vladsch.flexmark.util.ast.Node
AST_ADAPTER, EMPTY_SEGMENTS, firstChild, next, SPLICE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull DataHolder
static @NotNull DataHolder
aggregate
(@Nullable DataHolder other, @Nullable DataHolder overrides) static @NotNull DataHolder
aggregateActions
(@NotNull DataHolder other, @NotNull DataHolder overrides) @NotNull MutableDataHolder
clear()
clear all options out of the data setboolean
contains
(@NotNull DataKeyBase<?> key) @NotNull Map
<? extends DataKeyBase<?>, Object> getAll()
@NotNull Collection
<? extends DataKeyBase<?>> getKeys()
int
int
getLineNumber
(int offset) Get line number at offset@Nullable Object
getOrCompute
(@NotNull DataKeyBase<?> key, @NotNull DataValueFactory<?> factory) Get key if it exists or compute using supplier@NotNull BasedSequence[]
static MutableDataSet
merge
(DataHolder... dataHolders) @NotNull MutableDataSet
remove
(@NotNull DataKeyBase<?> key) Remove the stored value for the key, used to force to default or to force recompute<T> @NotNull MutableDataHolder
Store the given value for the key<T> @NotNull MutableDataHolder
set
(@NotNull NullableDataKey<T> key, T value) Store the given value for the key@NotNull MutableDataSet
setAll
(@NotNull DataHolder other) Copy all values from one data holder to this data holder@NotNull MutableDataSet
setFrom
(@NotNull MutableDataSetter dataSetter) Store the given value for the key@NotNull MutableDataHolder
setIn
(@NotNull MutableDataHolder dataHolder) Set options in given mutable data holder@NotNull MutableDataSet
@NotNull DataSet
@NotNull MutableDataSet
Methods inherited from class com.vladsch.flexmark.util.ast.ContentNode
getContentChars, getContentChars, getContentLines, getContentLines, getLineChars, getSpanningChars, setContent, setContent, setContent, setContentLine, setContentLines
Methods inherited from class com.vladsch.flexmark.util.ast.Node
appendChain, appendChild, astChars, astExtraChars, astString, baseSubSequence, baseSubSequence, countAncestorsOfType, countDirectAncestorsOfType, delimitedSegmentSpan, delimitedSegmentSpanChars, endOfLine, extractChainTo, extractToFirstInChain, getAncestorOfType, getAstExtra, getBaseSequence, getBlankLineSibling, getChars, getCharsFromSegments, getChildChars, getChildIterator, getChildOfType, getChildren, getDescendants, getDocument, getEmptyPrefix, getEmptySuffix, getEndLineNumber, getEndOffset, getEndOfLine, getExactChildChars, getFirstChild, getFirstChildAny, getFirstChildAnyNot, getFirstInChain, getGrandParent, getLastBlankLineChild, getLastChild, getLastChildAny, getLastChildAnyNot, getLastInChain, getLeadSegment, getLineColumnAtEnd, getLineNumber, getNext, getNextAny, getNextAnyNot, getNodeName, getNodeOfTypeIndex, getNodeOfTypeIndex, getOldestAncestorOfTypeAfter, getPrevious, getPreviousAny, getPreviousAnyNot, getReversedChildIterator, getReversedChildren, getReversedDescendants, getSegmentsForChars, getSourceRange, getStartLineNumber, getStartOffset, getStartOfLine, getTextLength, getTrailSegment, hasChildren, hasOrMoreChildren, insertAfter, insertBefore, insertChainAfter, insertChainBefore, isOrDescendantOfType, lineColumnAtIndex, lineColumnAtStart, moveTrailingBlankLines, prependChild, removeChildren, segmentSpan, segmentSpan, segmentSpanChars, segmentSpanChars, segmentSpanChars, segmentSpanCharsToVisible, setChars, setCharsFromContent, setCharsFromContentOnly, setCharsFromSegments, spanningChars, startOfLine, takeChildren, toAstString, toSegmentSpan, toString, toStringAttributes, unlink
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.vladsch.flexmark.util.data.MutableDataHolder
get
-
Field Details
-
NULL
-
dataSet
-
-
Constructor Details
-
Document
-
-
Method Details
-
getSegments
- Specified by:
getSegments
in classNode
-
clear
Description copied from interface:MutableDataHolder
clear all options out of the data set- Specified by:
clear
in interfaceMutableDataHolder
- Returns:
- mutable data holder for chained calls
-
set
@NotNull public <T> @NotNull MutableDataHolder set(@NotNull @NotNull DataKey<T> key, @NotNull T value) Description copied from interface:MutableDataHolder
Store the given value for the key- Specified by:
set
in interfaceMutableDataHolder
- Type Parameters:
T
- data type of the data referred by the key- Parameters:
key
- data keyvalue
- value to store- Returns:
- mutable data holder for chained calls
-
set
@NotNull public <T> @NotNull MutableDataHolder set(@NotNull @NotNull NullableDataKey<T> key, @Nullable T value) Description copied from interface:MutableDataHolder
Store the given value for the key- Specified by:
set
in interfaceMutableDataHolder
- Type Parameters:
T
- data type of the data referred by the key- Parameters:
key
- data keyvalue
- value to store- Returns:
- mutable data holder for chained calls
-
setFrom
Description copied from interface:MutableDataHolder
Store the given value for the key- Specified by:
setFrom
in interfaceMutableDataHolder
- Parameters:
dataSetter
- data setter which will set values- Returns:
- mutable data holder for chained calls
-
setAll
Description copied from interface:MutableDataHolder
Copy all values from one data holder to this data holder- Specified by:
setAll
in interfaceMutableDataHolder
- Parameters:
other
- data holder from which to copy all values- Returns:
- mutable data holder for chained calls
-
merge
-
setIn
Description copied from interface:MutableDataHolder
Set options in given mutable data holder- Specified by:
setIn
in interfaceDataHolder
- Specified by:
setIn
in interfaceMutableDataHolder
- Specified by:
setIn
in interfaceMutableDataSetter
- Parameters:
dataHolder
- data holder where to copy options from this data holder- Returns:
- dataHolder
-
remove
Description copied from interface:MutableDataHolder
Remove the stored value for the key, used to force to default or to force recompute- Specified by:
remove
in interfaceMutableDataHolder
- Parameters:
key
- data key to remove- Returns:
- mutable data holder for chained calls
-
getOrCompute
@Nullable public @Nullable Object getOrCompute(@NotNull @NotNull DataKeyBase<?> key, @NotNull @NotNull DataValueFactory<?> factory) Description copied from interface:DataHolder
Get key if it exists or compute using supplierMethod used by DataKey classes to access data.
NOTE: MutableDataHolders will compute an absent key and add it to its dataSet. DataHolders will return computed value but not change contained dataSet because they are immutable. So value will be computed every time it is requested.
- Specified by:
getOrCompute
in interfaceDataHolder
- Specified by:
getOrCompute
in interfaceMutableDataHolder
- Parameters:
key
- data keyfactory
- factory taking this data holder and computing/providing default value- Returns:
- object value for the key
-
toMutable
- Specified by:
toMutable
in interfaceDataHolder
-
toImmutable
- Specified by:
toImmutable
in interfaceDataHolder
-
toDataSet
- Specified by:
toDataSet
in interfaceDataHolder
-
aggregateActions
@NotNull public static @NotNull DataHolder aggregateActions(@NotNull @NotNull DataHolder other, @NotNull @NotNull DataHolder overrides) -
aggregate
-
aggregate
@NotNull public static @NotNull DataHolder aggregate(@Nullable @Nullable DataHolder other, @Nullable @Nullable DataHolder overrides) -
getAll
- Specified by:
getAll
in interfaceDataHolder
-
getKeys
- Specified by:
getKeys
in interfaceDataHolder
-
contains
- Specified by:
contains
in interfaceDataHolder
-
getLineCount
public int getLineCount()- Specified by:
getLineCount
in interfaceContent
- Overrides:
getLineCount
in classContentNode
-
getLineNumber
public int getLineNumber(int offset) Get line number at offsetNext line starts after the EOL sequence. offsets between \r and \n are considered part of the same line as offset before \r.
- Parameters:
offset
- offset in document text- Returns:
- line number at offset
-