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
public class Document extends Block implements MutableDataHolder
-
-
Field Summary
Fields Modifier and Type Field Description static Document
NULL
-
Fields inherited from class com.vladsch.flexmark.util.ast.ContentNode
lineSegments
-
Fields inherited from class com.vladsch.flexmark.util.ast.Node
AST_ADAPTER, EMPTY_SEGMENTS, SPLICE
-
-
Constructor Summary
Constructors Constructor Description Document(DataHolder options, BasedSequence chars)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DataHolder
aggregate()
static DataHolder
aggregate(DataHolder other, DataHolder overrides)
static DataHolder
aggregateActions(DataHolder other, DataHolder overrides)
MutableDataHolder
clear()
clear all options out of the data setboolean
contains(DataKeyBase<?> key)
java.util.Map<? extends DataKeyBase<?>,java.lang.Object>
getAll()
java.util.Collection<? extends DataKeyBase<?>>
getKeys()
int
getLineCount()
int
getLineNumber(int offset)
Get line number at offsetjava.lang.Object
getOrCompute(DataKeyBase<?> key, DataValueFactory<?> factory)
Get key if it exists or compute using supplierBasedSequence[]
getSegments()
static MutableDataSet
merge(DataHolder... dataHolders)
MutableDataSet
remove(DataKeyBase<?> key)
Remove the stored value for the key, used to force to default or to force recompute<T> MutableDataHolder
set(DataKey<T> key, T value)
Store the given value for the key<T> MutableDataHolder
set(NullableDataKey<T> key, T value)
Store the given value for the keyMutableDataSet
setAll(DataHolder other)
Copy all values from one data holder to this data holderMutableDataSet
setFrom(MutableDataSetter dataSetter)
Store the given value for the keyMutableDataHolder
setIn(MutableDataHolder dataHolder)
Set options in given mutable data holderMutableDataSet
toDataSet()
DataSet
toImmutable()
MutableDataSet
toMutable()
-
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 Detail
-
NULL
public static final Document NULL
-
-
Constructor Detail
-
Document
public Document(DataHolder options, BasedSequence chars)
-
-
Method Detail
-
getSegments
@NotNull public BasedSequence[] getSegments()
- Specified by:
getSegments
in classNode
-
clear
@NotNull public MutableDataHolder 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> MutableDataHolder set(@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> MutableDataHolder set(@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
@NotNull public MutableDataSet setFrom(@NotNull MutableDataSetter dataSetter)
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
@NotNull public MutableDataSet setAll(@NotNull DataHolder other)
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
public static MutableDataSet merge(DataHolder... dataHolders)
-
setIn
@NotNull public MutableDataHolder setIn(@NotNull MutableDataHolder dataHolder)
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
@NotNull public MutableDataSet remove(@NotNull DataKeyBase<?> key)
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 java.lang.Object getOrCompute(@NotNull DataKeyBase<?> key, @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
@NotNull public MutableDataSet toMutable()
- Specified by:
toMutable
in interfaceDataHolder
-
toImmutable
@NotNull public DataSet toImmutable()
- Specified by:
toImmutable
in interfaceDataHolder
-
toDataSet
@NotNull public MutableDataSet toDataSet()
- Specified by:
toDataSet
in interfaceDataHolder
-
aggregateActions
@NotNull public static DataHolder aggregateActions(@NotNull DataHolder other, @NotNull DataHolder overrides)
-
aggregate
@NotNull public DataHolder aggregate()
-
aggregate
@NotNull public static DataHolder aggregate(@Nullable DataHolder other, @Nullable DataHolder overrides)
-
getAll
@NotNull public java.util.Map<? extends DataKeyBase<?>,java.lang.Object> getAll()
- Specified by:
getAll
in interfaceDataHolder
-
getKeys
@NotNull public java.util.Collection<? extends DataKeyBase<?>> getKeys()
- Specified by:
getKeys
in interfaceDataHolder
-
contains
public boolean contains(@NotNull DataKeyBase<?> key)
- 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
-
-