Class SequenceBuilder
- java.lang.Object
-
- com.vladsch.flexmark.util.sequence.builder.SequenceBuilder
-
- All Implemented Interfaces:
ISequenceBuilder<SequenceBuilder,BasedSequence>,Appendable
public class SequenceBuilder extends Object implements ISequenceBuilder<SequenceBuilder,BasedSequence>
A Builder for Segmented BasedSequences
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull SequenceBuilderaddByLength(int startOffset, int textLength)@NotNull SequenceBuilderaddByOffsets(int startOffset, int endOffset)@NotNull SequenceBuilderaddRange(@NotNull Range range)@NotNull SequenceBuilderappend(char c)@NotNull SequenceBuilderappend(char c, int count)@NotNull SequenceBuilderappend(int startOffset, int endOffset)@NotNull SequenceBuilderappend(@NotNull Range chars)@NotNull SequenceBuilderappend(@Nullable CharSequence chars, int startIndex, int endIndex)charcharAt(int index)static @NotNull SequenceBuilderemptyBuilder(@NotNull BasedSequence base)static @NotNull SequenceBuilderemptyBuilder(@NotNull BasedSequence base, int options)static @NotNull SequenceBuilderemptyBuilder(@NotNull BasedSequence base, int options, @NotNull SegmentOptimizer optimizer)static @NotNull SequenceBuilderemptyBuilder(@NotNull BasedSequence base, @NotNull SegmentOptimizer optimizer)@NotNull BasedSequencegetBaseSequence()@NotNull SequenceBuildergetBuilder()@Nullable RangegetLastRangeOrNull()@NotNull BasedSegmentBuildergetSegmentBuilder()@Nullable BasedSequencegetSingleBasedSequence()NOTE: returns non-null value if the underlyingISegmentBuilder.getBaseSubSequenceRange()returns non-null valueintlength()@NotNull BasedSequencetoSequence()@NotNull BasedSequencetoSequence(@NotNull BasedSequence altSequence)Construct sequence from this builder using another based sequence which is character identical to this builder's baseSeq@NotNull BasedSequencetoSequence(@NotNull BasedSequence altSequence, @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimStart, @Nullable com.vladsch.flexmark.util.misc.CharPredicate ignoreCharDiff)Construct sequence from this builder using another based sequence which is character identical to this builder's baseSeq@NotNull BasedSequencetoSequenceByIndex(@NotNull BasedSequence altSequence, @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimStart, @Nullable com.vladsch.flexmark.util.misc.CharPredicate ignoreCharDiff)Construct sequence from this builder using another based sequence which is character identical to this builder's baseSeq by length@NotNull StringtoString()@NotNull StringtoStringNoAddedSpaces()@NotNull StringtoStringWithRanges()@NotNull StringtoStringWithRanges(boolean toVisibleWhiteSpace)-
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.sequence.builder.ISequenceBuilder
add, addAll, append, append, append, isEmpty, isNotEmpty
-
-
-
-
Method Detail
-
getBaseSequence
@NotNull public @NotNull BasedSequence getBaseSequence()
-
getSegmentBuilder
@NotNull public @NotNull BasedSegmentBuilder getSegmentBuilder()
-
getLastRangeOrNull
@Nullable public @Nullable Range getLastRangeOrNull()
-
getSingleBasedSequence
@Nullable public @Nullable BasedSequence getSingleBasedSequence()
Description copied from interface:ISequenceBuilderNOTE: returns non-null value if the underlyingISegmentBuilder.getBaseSubSequenceRange()returns non-null value- Specified by:
getSingleBasedSequencein interfaceISequenceBuilder<SequenceBuilder,BasedSequence>- Returns:
- sub-sequence of base representing the single segment or null if sequence not representable by a single subsequence
-
getBuilder
@NotNull public @NotNull SequenceBuilder getBuilder()
- Specified by:
getBuilderin interfaceISequenceBuilder<SequenceBuilder,BasedSequence>
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfaceISequenceBuilder<SequenceBuilder,BasedSequence>
-
append
@NotNull public @NotNull SequenceBuilder append(@Nullable @Nullable CharSequence chars, int startIndex, int endIndex)
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfaceISequenceBuilder<SequenceBuilder,BasedSequence>
-
append
@NotNull public @NotNull SequenceBuilder append(char c)
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfaceISequenceBuilder<SequenceBuilder,BasedSequence>
-
append
@NotNull public @NotNull SequenceBuilder append(char c, int count)
- Specified by:
appendin interfaceISequenceBuilder<SequenceBuilder,BasedSequence>
-
append
@NotNull public @NotNull SequenceBuilder append(int startOffset, int endOffset)
-
append
@NotNull public @NotNull SequenceBuilder append(@NotNull @NotNull Range chars)
-
addRange
@NotNull public @NotNull SequenceBuilder addRange(@NotNull @NotNull Range range)
-
addByOffsets
@NotNull public @NotNull SequenceBuilder addByOffsets(int startOffset, int endOffset)
-
addByLength
@NotNull public @NotNull SequenceBuilder addByLength(int startOffset, int textLength)
-
toSequence
@NotNull public @NotNull BasedSequence toSequence()
- Specified by:
toSequencein interfaceISequenceBuilder<SequenceBuilder,BasedSequence>
-
toSequence
@NotNull public @NotNull BasedSequence toSequence(@NotNull @NotNull BasedSequence altSequence)
Construct sequence from this builder using another based sequence which is character identical to this builder's baseSeq- Parameters:
altSequence- based sequence which is character identical to this builder's baseSeq- Returns:
- builder with offsets mapped to altSequence
-
toSequence
@NotNull public @NotNull BasedSequence toSequence(@NotNull @NotNull BasedSequence altSequence, @Nullable @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimStart, @Nullable @Nullable com.vladsch.flexmark.util.misc.CharPredicate ignoreCharDiff)
Construct sequence from this builder using another based sequence which is character identical to this builder's baseSeq- Parameters:
altSequence- based sequence which is character identical to this builder's baseSeqtrimStart- character set of characters to trimignoreCharDiff- chars which should be treated as equivalent for verification purposes (Space, Tab, EOL, usually)- Returns:
- builder with offsets mapped to altSequence
-
toSequenceByIndex
@NotNull public @NotNull BasedSequence toSequenceByIndex(@NotNull @NotNull BasedSequence altSequence, @Nullable @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimStart, @Nullable @Nullable com.vladsch.flexmark.util.misc.CharPredicate ignoreCharDiff)
Construct sequence from this builder using another based sequence which is character identical to this builder's baseSeq by length- Parameters:
altSequence- based sequence which is character identical to this builder's baseSeqtrimStart- character set of characters to trimignoreCharDiff- chars which should be treated as equivalent for verification purposes (Space, Tab, EOL, usually)- Returns:
- builder with offsets mapped to altSequence
-
length
public int length()
- Specified by:
lengthin interfaceISequenceBuilder<SequenceBuilder,BasedSequence>
-
toStringWithRanges
@NotNull public @NotNull String toStringWithRanges()
-
toStringWithRanges
@NotNull public @NotNull String toStringWithRanges(boolean toVisibleWhiteSpace)
-
toStringNoAddedSpaces
@NotNull public @NotNull String toStringNoAddedSpaces()
-
emptyBuilder
@NotNull public static @NotNull SequenceBuilder emptyBuilder(@NotNull @NotNull BasedSequence base)
-
emptyBuilder
@NotNull public static @NotNull SequenceBuilder emptyBuilder(@NotNull @NotNull BasedSequence base, @NotNull @NotNull SegmentOptimizer optimizer)
-
emptyBuilder
@NotNull public static @NotNull SequenceBuilder emptyBuilder(@NotNull @NotNull BasedSequence base, int options)
-
emptyBuilder
@NotNull public static @NotNull SequenceBuilder emptyBuilder(@NotNull @NotNull BasedSequence base, int options, @NotNull @NotNull SegmentOptimizer optimizer)
-
-