Class Document

All Implemented Interfaces:
Content, DataHolder, MutableDataHolder, MutableDataSetter

public class Document extends Block implements MutableDataHolder
  • Field Details

  • Constructor Details

  • Method Details

    • getSegments

      @NotNull public @NotNull BasedSequence[] getSegments()
      Specified by:
      getSegments in class Node
    • clear

      @NotNull public @NotNull MutableDataHolder clear()
      Description copied from interface: MutableDataHolder
      clear all options out of the data set
      Specified by:
      clear in interface MutableDataHolder
      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 interface MutableDataHolder
      Type Parameters:
      T - data type of the data referred by the key
      Parameters:
      key - data key
      value - 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 interface MutableDataHolder
      Type Parameters:
      T - data type of the data referred by the key
      Parameters:
      key - data key
      value - value to store
      Returns:
      mutable data holder for chained calls
    • setFrom

      @NotNull public @NotNull MutableDataSet setFrom(@NotNull @NotNull MutableDataSetter dataSetter)
      Description copied from interface: MutableDataHolder
      Store the given value for the key
      Specified by:
      setFrom in interface MutableDataHolder
      Parameters:
      dataSetter - data setter which will set values
      Returns:
      mutable data holder for chained calls
    • setAll

      @NotNull public @NotNull MutableDataSet setAll(@NotNull @NotNull DataHolder other)
      Description copied from interface: MutableDataHolder
      Copy all values from one data holder to this data holder
      Specified by:
      setAll in interface MutableDataHolder
      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 @NotNull MutableDataHolder setIn(@NotNull @NotNull MutableDataHolder dataHolder)
      Description copied from interface: MutableDataHolder
      Set options in given mutable data holder
      Specified by:
      setIn in interface DataHolder
      Specified by:
      setIn in interface MutableDataHolder
      Specified by:
      setIn in interface MutableDataSetter
      Parameters:
      dataHolder - data holder where to copy options from this data holder
      Returns:
      dataHolder
    • remove

      @NotNull public @NotNull MutableDataSet remove(@NotNull @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 interface MutableDataHolder
      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 supplier

      Method 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 interface DataHolder
      Specified by:
      getOrCompute in interface MutableDataHolder
      Parameters:
      key - data key
      factory - factory taking this data holder and computing/providing default value
      Returns:
      object value for the key
    • toMutable

      @NotNull public @NotNull MutableDataSet toMutable()
      Specified by:
      toMutable in interface DataHolder
    • toImmutable

      @NotNull public @NotNull DataSet toImmutable()
      Specified by:
      toImmutable in interface DataHolder
    • toDataSet

      @NotNull public @NotNull MutableDataSet toDataSet()
      Specified by:
      toDataSet in interface DataHolder
    • aggregateActions

      @NotNull public static @NotNull DataHolder aggregateActions(@NotNull @NotNull DataHolder other, @NotNull @NotNull DataHolder overrides)
    • aggregate

      @NotNull public @NotNull DataHolder aggregate()
    • aggregate

      @NotNull public static @NotNull DataHolder aggregate(@Nullable @Nullable DataHolder other, @Nullable @Nullable DataHolder overrides)
    • getAll

      @NotNull public @NotNull Map<? extends DataKeyBase<?>,Object> getAll()
      Specified by:
      getAll in interface DataHolder
    • getKeys

      @NotNull public @NotNull Collection<? extends DataKeyBase<?>> getKeys()
      Specified by:
      getKeys in interface DataHolder
    • contains

      public boolean contains(@NotNull @NotNull DataKeyBase<?> key)
      Specified by:
      contains in interface DataHolder
    • getLineCount

      public int getLineCount()
      Specified by:
      getLineCount in interface Content
      Overrides:
      getLineCount in class ContentNode
    • getLineNumber

      public int getLineNumber(int offset)
      Get line number at offset

      Next 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