Class MappedBasedSequence

All Implemented Interfaces:
BasedOptionsHolder, BasedSequence, IRichSequence<BasedSequence>, MappedSequence<BasedSequence>, ReplacedBasedSequence, SequenceUtils, CharSequence, Comparable<CharSequence>

public final class MappedBasedSequence extends BasedSequenceImpl implements MappedSequence<BasedSequence>, ReplacedBasedSequence
A BasedSequence which maps characters according to CharMapper
  • Field Details

  • Constructor Details

  • Method Details

    • getCharMapper

      @NotNull public @NotNull CharMapper getCharMapper()
      Specified by:
      getCharMapper in interface MappedSequence<BasedSequence>
    • charAt

      public char charAt(int index)
      Specified by:
      charAt in interface CharSequence
    • getCharSequence

      @NotNull public @NotNull BasedSequence getCharSequence()
      Specified by:
      getCharSequence in interface MappedSequence<BasedSequence>
    • length

      public int length()
      Specified by:
      length in interface CharSequence
    • toMapped

      @NotNull public @NotNull BasedSequence toMapped(CharMapper mapper)
      Specified by:
      toMapped in interface IRichSequence<BasedSequence>
      Overrides:
      toMapped in class BasedSequenceImpl
    • getOptionFlags

      public int getOptionFlags()
      Description copied from interface: BasedOptionsHolder
      Options test for options for this sequence

      default reports true for global default options (if any) , variation available on BasedSequenceWithOptions

      Specified by:
      getOptionFlags in interface BasedOptionsHolder
      Returns:
      option flags for this sequence
    • allOptions

      public boolean allOptions(int options)
      Description copied from interface: BasedOptionsHolder
      Options test for options for this sequence

      default reports true for global default options (if any) , variation available on BasedSequenceWithOptions

      Specified by:
      allOptions in interface BasedOptionsHolder
      Parameters:
      options - option flags
      Returns:
      true if all option flags passed are set for this sequence
    • anyOptions

      public boolean anyOptions(int options)
      Description copied from interface: BasedOptionsHolder
      Options test for options for this sequence

      default reports true for global default options (if any) , variation available on BasedSequenceWithOptions

      Specified by:
      anyOptions in interface BasedOptionsHolder
      Parameters:
      options - option flags
      Returns:
      true if any option flags passed are set for this sequence
    • getOption

      public <T> T getOption(DataKeyBase<T> dataKey)
      Description copied from interface: BasedOptionsHolder
      Options holder, default has none, only available on BasedSequenceWithOptions
      Specified by:
      getOption in interface BasedOptionsHolder
      Type Parameters:
      T - type of value held by key
      Parameters:
      dataKey - in options
      Returns:
      true if data key is available
    • getOptions

      @Nullable public @Nullable DataHolder getOptions()
      Description copied from interface: BasedOptionsHolder
      Options holder, default has none, only available on BasedSequenceWithOptions
      Specified by:
      getOptions in interface BasedOptionsHolder
      Returns:
      data holder with options or null if none for this sequence
    • sequenceOf

      @NotNull public @NotNull BasedSequence sequenceOf(@Nullable @Nullable CharSequence baseSeq, int startIndex, int endIndex)
      Description copied from interface: IRichSequence
      Factory function
      Specified by:
      sequenceOf in interface IRichSequence<BasedSequence>
      Overrides:
      sequenceOf in class BasedSequenceImpl
      Parameters:
      baseSeq - char sequence from which to construct a rich char sequence
      startIndex - start index of the sequence to use
      endIndex - end index of the sequence to use
      Returns:
      rich char sequence from given inputs
    • subSequence

      @NotNull public @NotNull BasedSequence subSequence(int startIndex, int endIndex)
      Description copied from interface: IRichSequence
      Get a portion of this sequence

      NOTE: the returned value should only depend on start/end indices. If a subsequence of this sequence with matching start/end should equal (using equals()) all such subsequences of this sequence.

      Specified by:
      subSequence in interface BasedSequence
      Specified by:
      subSequence in interface CharSequence
      Specified by:
      subSequence in interface IRichSequence<BasedSequence>
      Parameters:
      startIndex - offset from startIndex of this sequence
      endIndex - offset from startIndex of this sequence
      Returns:
      based sequence whose contents reflect the selected portion
    • getBase

      @NotNull public @NotNull Object getBase()
      Description copied from interface: BasedSequence
      Get the underlying object on which this sequence contents are based
      Specified by:
      getBase in interface BasedSequence
      Returns:
      underlying object containing original text
    • getBaseSequence

      @NotNull public @NotNull BasedSequence getBaseSequence()
      Description copied from interface: BasedSequence
      Get the base sequence for the text
      Specified by:
      getBaseSequence in interface BasedSequence
      Returns:
      base sequence
    • getStartOffset

      public int getStartOffset()
      Description copied from interface: BasedSequence
      Get the start offset of this sequence into BasedSequence.getBaseSequence() and BasedSequence.getBase() original text source.
      Specified by:
      getStartOffset in interface BasedSequence
      Returns:
      start offset in original text
    • getEndOffset

      public int getEndOffset()
      Description copied from interface: BasedSequence
      Get the end offset of this sequence into BasedSequence.getBaseSequence() and BasedSequence.getBase() original text source.
      Specified by:
      getEndOffset in interface BasedSequence
      Returns:
      end offset in original text
    • getIndexOffset

      public int getIndexOffset(int index)
      Description copied from interface: BasedSequence
      Get the offset of index in this sequence mapped to offset into BasedSequence.getBaseSequence() and BasedSequence.getBase() original text source. NOTE: if the character at given index does not equal the corresponding character in the base sequence then this method should return -1 otherwise segmented based sequence will be created for original base character
      Specified by:
      getIndexOffset in interface BasedSequence
      Parameters:
      index - index for which to get the offset in original source
      Returns:
      offset of index of this sequence in original text
    • addSegments

      public void addSegments(@NotNull @NotNull IBasedSegmentBuilder<?> builder)
      Description copied from interface: BasedSequence
      Add segments for this sequence, replacing out of base characters with strings
      Specified by:
      addSegments in interface BasedSequence
      Overrides:
      addSegments in class BasedSequenceImpl
      Parameters:
      builder - builder
    • getSourceRange

      @NotNull public @NotNull Range getSourceRange()
      Description copied from interface: BasedSequence
      Get the range of this sequence in original BasedSequence.getBaseSequence() and BasedSequence.getBase() original text source.
      Specified by:
      getSourceRange in interface BasedSequence
      Returns:
      Range of start offset and end offset
    • mappedOf

      @NotNull public static @NotNull BasedSequence mappedOf(@NotNull @NotNull BasedSequence baseSeq, @NotNull @NotNull CharMapper mapper)