public class Document extends Block implements MutableDataHolder
lineSegmentsEMPTY_SEGMENTS, SPLICE| Constructor and Description |
|---|
Document(DataHolder options,
BasedSequence chars) |
| Modifier and Type | Method and Description |
|---|---|
MutableDataHolder |
clear()
clear all options out of the data set
|
boolean |
contains(DataKey<?> key) |
<T> T |
get(DataKey<T> key)
Get the given key, if it does not exist then use the key's factory to create a new value and put it into the collection
so that the following get of the same key will find a value
|
Map<DataKey<?>,Object> |
getAll() |
Collection<DataKey<?>> |
getKeys() |
int |
getLineCount() |
int |
getLineNumber(int offset)
Get line number at offset
|
<T> T |
getOrCompute(DataKey<T> key)
Will return the value previously set or generate a new value using the given factory.
|
BasedSequence[] |
getSegments() |
<T> MutableDataHolder |
remove(DataKey<T> key)
Remove the stored value for the key, used to force to default or to force recompute
|
<T> MutableDataHolder |
set(DataKey<? extends T> key,
T value)
Store the given value for the key
|
MutableDataHolder |
setAll(DataHolder other)
Copy all values from one data holder to this data holder
|
MutableDataHolder |
setFrom(MutableDataSetter dataSetter)
Store the given value for the key
|
MutableDataHolder |
setIn(MutableDataHolder dataHolder)
Set options in given mutable data hoer
|
DataHolder |
toImmutable() |
MutableDataHolder |
toMutable() |
getContentChars, getContentChars, getContentLines, getContentLines, getLineChars, getSpanningChars, setContent, setContent, setContent, setContentLine, setContentLinesappendChain, appendChild, astChars, astExtraChars, astString, countAncestorsOfType, countDirectAncestorsOfType, delimitedSegmentSpan, delimitedSegmentSpanChars, deNullify, extractChainTo, extractToFirstInChain, getAncestorOfType, getAstExtra, getBlankLineSibling, getChars, getCharsFromSegments, getChildChars, getChildIterator, getChildOfType, getChildren, getDescendants, getDocument, getEndLineNumber, getEndOffset, getExactChildChars, getFirstChild, getFirstChildAny, getFirstChildAnyNot, getFirstInChain, getLastBlankLineChild, getLastChild, getLastChildAny, getLastChildAnyNot, getLastInChain, getLeadSegment, getLineNumber, getNext, getNextAny, getNextAnyNot, getNodeName, getNodeOfTypeIndex, getNodeOfTypeIndex, getOldestAncestorOfTypeAfter, getPrevious, getPreviousAny, getPreviousAnyNot, getReversedChildIterator, getReversedChildren, getReversedDescendants, getSegmentsForChars, getStartLineNumber, getStartOffset, getTextLength, getTrailSegment, hasChildren, hasOrMoreChildren, insertAfter, insertBefore, insertChainAfter, insertChainBefore, isOrDescendantOfType, moveTrailingBlankLines, prependChild, removeChildren, segmentSpan, segmentSpan, segmentSpanChars, segmentSpanChars, segmentSpanChars, setChars, setCharsFromContent, setCharsFromContentOnly, setCharsFromSegments, spanningChars, takeChildren, toAstString, toSegmentSpan, toString, toStringAttributes, unlinkclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitkeySetpublic Document(DataHolder options, BasedSequence chars)
public BasedSequence[] getSegments()
getSegments in class Nodepublic Map<DataKey<?>,Object> getAll()
getAll in interface DataHolderpublic Collection<DataKey<?>> getKeys()
getKeys in interface DataHolderpublic boolean contains(DataKey<?> key)
contains in interface DataHolderpublic <T> T get(DataKey<T> key)
MutableDataHolderget in interface DataHolderget in interface MutableDataHolderkey - data keypublic MutableDataHolder setIn(MutableDataHolder dataHolder)
MutableDataHoldersetIn in interface MutableDataHoldersetIn in interface MutableDataSetterdataHolder - data holder where to copy options from this data holderpublic int getLineCount()
getLineCount in interface ContentgetLineCount in class ContentNodepublic int getLineNumber(int offset)
Next line starts after the EOL sequence. offsets between \r and \n are considered part of the same line as offset before \r.
offset - offset in document textpublic <T> T getOrCompute(DataKey<T> key)
MutableDataHolderNOTE: if a new value is generated it will be stored for the given key so that subsequent calls with the same parameters will return the same value as the first call that generated the new value.
getOrCompute in interface MutableDataHolderT - data type of the data referred by the keykey - data key identifying the datapublic <T> MutableDataHolder remove(DataKey<T> key)
MutableDataHolderremove in interface MutableDataHolderT - data type of the data referred by the keykey - data key to removepublic <T> MutableDataHolder set(DataKey<? extends T> key, T value)
MutableDataHolderset in interface MutableDataHolderT - data type of the data referred by the keykey - data keyvalue - value to storepublic MutableDataHolder setFrom(MutableDataSetter dataSetter)
MutableDataHoldersetFrom in interface MutableDataHolderdataSetter - data setter which will set valuespublic MutableDataHolder setAll(DataHolder other)
MutableDataHoldersetAll in interface MutableDataHolderother - data holder from which to copy all valuespublic MutableDataHolder toMutable()
toMutable in interface DataHolderpublic DataHolder toImmutable()
toImmutable in interface DataHolderpublic MutableDataHolder clear()
MutableDataHolderclear in interface MutableDataHolderCopyright © 2019. All rights reserved.