Top Inners Fields Constructors Methods
com.vladsch.flexmark.util.sequence.builder

public Class SegmentBuilderBase<S extends SegmentBuilderBase<S>>

extends Object
implements ISegmentBuilder<S extends SegmentBuilderBase<S>>
Class Inheritance
All Implemented Interfaces
com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder, java.lang.Iterable
Known Direct Subclasses
com.vladsch.flexmark.util.sequence.builder.BasedSegmentBuilder, com.vladsch.flexmark.util.sequence.builder.PlainSegmentBuilder
Annotations
@SuppressWarnings:UnusedReturnValue
Imports
com.vladsch.flexmark.util.misc.DelimitedBuilder, com.vladsch.flexmark.util.sequence.Range, .SequenceUtils, org.jetbrains.annotations.NotNull, .Nullable, java.util.Arrays, .Iterator, java.util.function.Function

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
protected int
public static final int[]
protected int
protected int
protected int
public static final int
protected final int
protected @NotNull int[]
protected int
protected int
protected final SegmentStats
protected final StringBuilder
protected final SegmentStats

Constructor Summary

AccessConstructor and Description
protected
protected
SegmentBuilderBase(int options)

Method Summary

Modifier and TypeMethod and Description
private void
addSeg(int startOffset, int endOffset)

private void
public S

Returns:

this
append
(@NotNull Range
range in original sequence
range
)

append range in original sequence coordinates, no checking is done other than overlap with tail range fast

public S

Returns:

this
append
(int
start offset in original sequence
startOffset
,
int
end offset in original sequence
endOffset
)

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.append.

append range in original sequence coordinates, no checking is done other than overlap with tail range fast

public S
public S
append(char c)

public S
append(char c, int repeat)

public S

Returns:

this
appendAnchor
(int
offset in original sequence
offset
)

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.appendAnchor.

append anchor in original sequence coordinates, no checking is done other than overlap with tail range fast

private void
private int
private static int[]
ensureCapacity(@NotNull int[] prev, int size)

private void
ensureCapacity(int size)

public @Nullable Range
public int
public int
public int
public @NotNull Object
getPart(int index)

private @NotNull Seg
getSeg(int index)

public @NotNull Iterable<Seg>
private @Nullable Seg
getSegOrNull(int index)

pack-priv @NotNull Seg
getSegPart(int index)

public int

Returns:

-ve if no information in the list, or span of offsets
getSpan
()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getSpan.

Span for offsets of this list

public int
public int
public SegmentStats
public CharSequence
public int
public int
public int
public int
public int
public int
protected Object[]
protected boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public @NotNull Iterator<Object>
iterator()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.iterator.

Return iterator over segment parts Range - BASE CharSequence - TEXT

private @Nullable Seg
public int
public boolean
public boolean
public int
protected Object[]
private void
processParts(int segStart, int segEnd, boolean resolveOverlap, boolean nullNextRange, @NotNull Function<Object[], Object[]> transform)

private void
setSegEnd(int index, int endOffset)

public int
public @NotNull String
public @NotNull String
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public String
public @NotNull String
public @NotNull String
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

anchorsSizeback to summary
protected int anchorsSize
EMPTY_PARTSback to summary
public static final int[] EMPTY_PARTS
endOffsetback to summary
protected int endOffset
immutableOffsetback to summary
protected int immutableOffset
lengthback to summary
protected int length
MIN_PART_CAPACITYback to summary
public static final int MIN_PART_CAPACITY
optionsback to summary
protected final int options
partsback to summary
protected @NotNull int[] parts
Annotations
@NotNull
partsSizeback to summary
protected int partsSize
startOffsetback to summary
protected int startOffset
statsback to summary
protected final SegmentStats stats
textback to summary
protected final StringBuilder text
textStatsback to summary
protected final SegmentStats textStats

Constructor Detail

SegmentBuilderBaseback to summary
protected SegmentBuilderBase()
SegmentBuilderBaseback to summary
protected SegmentBuilderBase(int options)

Method Detail

addSegback to summary
private void addSeg(int startOffset, int endOffset)
addTextback to summary
private void addText(CharSequence optText)
appendback to summary
public S append(@NotNull Range range)

append range in original sequence coordinates, no checking is done other than overlap with tail range fast

Parameters
range:@NotNull Range

range in original sequence

Returns:S

this

Annotations
@NotNull
appendback to summary
public S append(int startOffset, int endOffset)

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.append.

append range in original sequence coordinates, no checking is done other than overlap with tail range fast

Parameters
startOffset:int

start offset in original sequence

endOffset:int

end offset in original sequence

Returns:S

this

Annotations
@NotNull
appendback to summary
public S append(@NotNull CharSequence text)

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.append.

Annotations
@NotNull
appendback to summary
public S append(char c)
Annotations
@NotNull
appendback to summary
public S append(char c, int repeat)
Annotations
@NotNull
appendAnchorback to summary
public S appendAnchor(int offset)

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.appendAnchor.

append anchor in original sequence coordinates, no checking is done other than overlap with tail range fast

Parameters
offset:int

offset in original sequence

Returns:S

this

Annotations
@NotNull
commitTextback to summary
private void commitText()
computeLengthback to summary
private int computeLength()
ensureCapacityback to summary
private static int[] ensureCapacity(@NotNull int[] prev, int size)
ensureCapacityback to summary
private void ensureCapacity(int size)
getBaseSubSequenceRangeback to summary
public @Nullable Range getBaseSubSequenceRange()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getBaseSubSequenceRange.

Annotations
@Nullable
@Override
getEndOffsetback to summary
public int getEndOffset()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getEndOffset.

Annotations
@Override
getEndOffsetIfNeededback to summary
public int getEndOffsetIfNeeded()
getOptionsback to summary
public int getOptions()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getOptions.

Annotations
@Override
getPartback to summary
public @NotNull Object getPart(int index)
Annotations
@NotNull
getSegback to summary
private @NotNull Seg getSeg(int index)
Annotations
@NotNull
getSegmentsback to summary
public @NotNull Iterable<Seg> getSegments()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getSegments.

Doc from com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getSegments.

Return iterator over segments

Returns:@NotNull Iterable<Seg>

iterator over segment builder segments

Annotations
@Override
@NotNull
getSegOrNullback to summary
private @Nullable Seg getSegOrNull(int index)
Annotations
@Nullable
getSegPartback to summary
pack-priv @NotNull Seg getSegPart(int index)
Annotations
@NotNull
getSpanback to summary
public int getSpan()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getSpan.

Span for offsets of this list

Returns:int

-ve if no information in the list, or span of offsets

Annotations
@Override
getStartOffsetback to summary
public int getStartOffset()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getStartOffset.

Annotations
@Override
getStartOffsetIfNeededback to summary
public int getStartOffsetIfNeeded()
getStatsback to summary
public SegmentStats getStats()
getTextback to summary
public CharSequence getText()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getText.

Annotations
@Override
getTextFirst256Lengthback to summary
public int getTextFirst256Length()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getTextFirst256Length.

Annotations
@Override
getTextFirst256Segmentsback to summary
public int getTextFirst256Segments()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getTextFirst256Segments.

Annotations
@Override
getTextLengthback to summary
public int getTextLength()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getTextLength.

Annotations
@Override
getTextSegmentsback to summary
public int getTextSegments()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getTextSegments.

Annotations
@Override
getTextSpaceLengthback to summary
public int getTextSpaceLength()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getTextSpaceLength.

Annotations
@Override
getTextSpaceSegmentsback to summary
public int getTextSpaceSegments()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.getTextSpaceSegments.

Annotations
@Override
handleOverlapback to summary
protected Object[] handleOverlap(@NotNull Object[] parts)
haveDanglingTextback to summary
protected boolean haveDanglingText()
haveOffsetsback to summary
public boolean haveOffsets()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.haveOffsets.

Annotations
@Override
isBaseSubSequenceRangeback to summary
public boolean isBaseSubSequenceRange()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.isBaseSubSequenceRange.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.isEmpty.

Annotations
@Override
isIncludeAnchorsback to summary
public boolean isIncludeAnchors()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.isIncludeAnchors.

Annotations
@Override
isTrackTextFirst256back to summary
public boolean isTrackTextFirst256()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.isTrackTextFirst256.

Annotations
@Override
iteratorback to summary
public @NotNull Iterator<Object> iterator()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.iterator.

Doc from com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.iterator.

Return iterator over segment parts Range - BASE CharSequence - TEXT

Returns:@NotNull Iterator<Object>

iterator over segment builder parts

Annotations
@Override
@NotNull
lastSegOrNullback to summary
private @Nullable Seg lastSegOrNull()
Annotations
@Nullable
lengthback to summary
public int length()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.length.

Annotations
@Override
needEndOffsetback to summary
public boolean needEndOffset()
needStartOffsetback to summary
public boolean needStartOffset()
noAnchorsSizeback to summary
public int noAnchorsSize()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.noAnchorsSize.

Annotations
@Override
optimizeTextback to summary
protected Object[] optimizeText(@NotNull Object[] parts)
processPartsback to summary
private void processParts(int segStart, int segEnd, boolean resolveOverlap, boolean nullNextRange, @NotNull Function<Object[], Object[]> transform)
setSegEndback to summary
private void setSegEnd(int index, int endOffset)
sizeback to summary
public int size()

Implements com.vladsch.flexmark.util.sequence.builder.ISegmentBuilder.size.

Annotations
@Override
toStringback to summary
public @NotNull String toString(@NotNull CharSequence chars, @NotNull CharSequence rangePrefix, @NotNull CharSequence rangeSuffix, @NotNull Function<CharSequence, CharSequence> textMapper)
Annotations
@NotNull
toStringback to summary
public @NotNull String toString(@NotNull CharSequence chars)
Annotations
@NotNull
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
toStringPrepback to summary
public String toStringPrep()
toStringWithRangesback to summary
public @NotNull String toStringWithRanges(@NotNull CharSequence chars)
Annotations
@NotNull
toStringWithRangesVisibleWhitespaceback to summary
public @NotNull String toStringWithRangesVisibleWhitespace(@NotNull CharSequence chars)
Annotations
@NotNull
trimToSizeback to summary
public void trimToSize()
com.vladsch.flexmark.util.sequence.builder back to summary

pack-priv Class SegmentBuilderBase.PartsIterator

extends Object
implements Iterator<Object>
Class Inheritance
  • java.lang.Object
  • com.vladsch.flexmark.util.sequence.builder.SegmentBuilderBase.PartsIterator
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
pack-priv final SegmentBuilderBase<?>
pack-priv int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public Object
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

builderback to summary
pack-priv final SegmentBuilderBase<?> builder
nextIndexback to summary
pack-priv int nextIndex

Constructor Detail

PartsIteratorback to summary
public PartsIterator(SegmentBuilderBase<?> builder)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public Object next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Object

the next element in the iteration

Annotations
@Override
com.vladsch.flexmark.util.sequence.builder back to summary

pack-priv Class SegmentBuilderBase.SegIterable

extends Object
implements Iterable<Seg>
Class Inheritance
  • java.lang.Object
  • com.vladsch.flexmark.util.sequence.builder.SegmentBuilderBase.SegIterable
All Implemented Interfaces
java.lang.Iterable

Field Summary

Modifier and TypeField and Description
pack-priv final SegmentBuilderBase<?>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public @NotNull Iterator<Seg>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

builderback to summary
pack-priv final SegmentBuilderBase<?> builder

Constructor Detail

SegIterableback to summary
public SegIterable(SegmentBuilderBase<?> builder)

Method Detail

iteratorback to summary
public @NotNull Iterator<Seg> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:@NotNull Iterator<Seg>

an Iterator.

Annotations
@NotNull
@Override
com.vladsch.flexmark.util.sequence.builder back to summary

pack-priv Class SegmentBuilderBase.SegIterator

extends Object
implements Iterator<Seg>
Class Inheritance
  • java.lang.Object
  • com.vladsch.flexmark.util.sequence.builder.SegmentBuilderBase.SegIterator
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
pack-priv final SegmentBuilderBase<?>
pack-priv int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public Seg
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

builderback to summary
pack-priv final SegmentBuilderBase<?> builder
nextIndexback to summary
pack-priv int nextIndex

Constructor Detail

SegIteratorback to summary
public SegIterator(SegmentBuilderBase<?> builder)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public Seg next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Seg

the next element in the iteration

Annotations
@Override