Class Segment
- java.lang.Object
-
- com.vladsch.flexmark.util.sequence.builder.tree.Segment
-
- Direct Known Subclasses:
Segment.Base,Segment.Text
public abstract class Segment extends java.lang.ObjectSegmentedSequence Segment stored in byte[] in serialized format
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSegment.Basestatic classSegment.SegType(package private) static classSegment.Text(package private) static classSegment.TextAsciiCharSequence(package private) static classSegment.TextCharSequence(package private) static classSegment.TextCharSequenceBase(package private) static classSegment.TextRepeatedSequence
-
Field Summary
Fields Modifier and Type Field Description protected intbyteOffsetprotected byte[]bytesprotected intposprotected intstartIndex(package private) static intTYPE_ANCHOR(package private) static intTYPE_BASE(package private) static intTYPE_HAS_BOTH(package private) static intTYPE_HAS_BYTE(package private) static intTYPE_HAS_BYTES(package private) static intTYPE_HAS_CHAR(package private) static intTYPE_HAS_CHARS(package private) static intTYPE_HAS_LENGTH(package private) static intTYPE_HAS_OFFSET(package private) static intTYPE_LENGTH_BYTES(package private) static intTYPE_MASK(package private) static intTYPE_NO_SIZE_BYTES(package private) static intTYPE_REPEATED_ASCII(package private) static intTYPE_REPEATED_EOL(package private) static intTYPE_REPEATED_SPACE(package private) static intTYPE_REPEATED_TEXT(package private) static intTYPE_START_BYTES(package private) static intTYPE_TEXT(package private) static intTYPE_TEXT_ASCII
-
Constructor Summary
Constructors Constructor Description Segment(int pos, byte[] bytes, int byteOffset, int startIndex)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static intaddChar(byte[] bytes, int offset, char c)static intaddCharAscii(byte[] bytes, int offset, char c)static intaddChars(byte[] bytes, int offset, @NotNull java.lang.CharSequence chars, int start, int end)static intaddCharsAscii(byte[] bytes, int offset, @NotNull java.lang.CharSequence chars, int start, int end)static intaddIntBytes(byte[] bytes, int offset, int value, int count)static intaddSegBytes(byte[] bytes, int offset, @NotNull Seg seg, @NotNull java.lang.CharSequence textChars)abstract charcharAt(int index)get char at indexintgetByteLength()intgetByteOffset()byte[]getBytes()static chargetChar(byte[] bytes, int offset)static chargetCharAscii(byte[] bytes, int offset)abstract java.lang.CharSequencegetCharSequence()intgetEndIndex()abstract intgetEndOffset()static intgetInt(byte[] bytes, int offset, int count)static intgetIntBytes(int length)static intgetLengthBytes(int length)static intgetOffsetBytes(int offset)intgetPos()static intgetSegByteLength(@NotNull Seg seg, @NotNull java.lang.CharSequence textChars)static intgetSegByteLength(Segment.SegType segType, int segStart, int segLength)static SegmentgetSegment(byte[] bytes, int byteOffset, int pos, int indexOffset, @NotNull BasedSequence basedSequence)static Segment.SegTypegetSegType(@NotNull Seg seg, @NotNull java.lang.CharSequence textChars)intgetStartIndex()abstract intgetStartOffset()Segment.SegTypegetType()booleanhasAll(int flags, int mask)abstract booleanisAnchor()abstract booleanisBase()abstract booleanisFirst256Start()abstract booleanisRepeatedTextEnd()abstract booleanisText()abstract intlength()booleannotInSegment(int index)booleanoffsetNotInSegment(int offset)java.lang.StringtoString()
-
-
-
Field Detail
-
TYPE_MASK
static final int TYPE_MASK
- See Also:
- Constant Field Values
-
TYPE_NO_SIZE_BYTES
static final int TYPE_NO_SIZE_BYTES
- See Also:
- Constant Field Values
-
TYPE_START_BYTES
static final int TYPE_START_BYTES
- See Also:
- Constant Field Values
-
TYPE_LENGTH_BYTES
static final int TYPE_LENGTH_BYTES
- See Also:
- Constant Field Values
-
TYPE_ANCHOR
static final int TYPE_ANCHOR
- See Also:
- Constant Field Values
-
TYPE_BASE
static final int TYPE_BASE
- See Also:
- Constant Field Values
-
TYPE_TEXT
static final int TYPE_TEXT
- See Also:
- Constant Field Values
-
TYPE_REPEATED_TEXT
static final int TYPE_REPEATED_TEXT
- See Also:
- Constant Field Values
-
TYPE_TEXT_ASCII
static final int TYPE_TEXT_ASCII
- See Also:
- Constant Field Values
-
TYPE_REPEATED_ASCII
static final int TYPE_REPEATED_ASCII
- See Also:
- Constant Field Values
-
TYPE_REPEATED_SPACE
static final int TYPE_REPEATED_SPACE
- See Also:
- Constant Field Values
-
TYPE_REPEATED_EOL
static final int TYPE_REPEATED_EOL
- See Also:
- Constant Field Values
-
TYPE_HAS_OFFSET
static final int TYPE_HAS_OFFSET
- See Also:
- Constant Field Values
-
TYPE_HAS_LENGTH
static final int TYPE_HAS_LENGTH
- See Also:
- Constant Field Values
-
TYPE_HAS_BOTH
static final int TYPE_HAS_BOTH
- See Also:
- Constant Field Values
-
TYPE_HAS_CHAR
static final int TYPE_HAS_CHAR
- See Also:
- Constant Field Values
-
TYPE_HAS_CHARS
static final int TYPE_HAS_CHARS
- See Also:
- Constant Field Values
-
TYPE_HAS_BYTE
static final int TYPE_HAS_BYTE
- See Also:
- Constant Field Values
-
TYPE_HAS_BYTES
static final int TYPE_HAS_BYTES
- See Also:
- Constant Field Values
-
pos
protected final int pos
-
bytes
protected final byte[] bytes
-
byteOffset
protected final int byteOffset
-
startIndex
protected final int startIndex
-
-
Method Detail
-
hasAll
public boolean hasAll(int flags, int mask)
-
getPos
public int getPos()
-
getBytes
public byte[] getBytes()
-
getByteOffset
public final int getByteOffset()
-
getStartIndex
public final int getStartIndex()
-
getEndIndex
public final int getEndIndex()
-
notInSegment
public boolean notInSegment(int index)
-
offsetNotInSegment
public boolean offsetNotInSegment(int offset)
-
getType
public final Segment.SegType getType()
-
getByteLength
public final int getByteLength()
-
length
public abstract int length()
-
isBase
public abstract boolean isBase()
-
isAnchor
public abstract boolean isAnchor()
-
isText
public abstract boolean isText()
-
isFirst256Start
public abstract boolean isFirst256Start()
-
isRepeatedTextEnd
public abstract boolean isRepeatedTextEnd()
-
getStartOffset
public abstract int getStartOffset()
-
getEndOffset
public abstract int getEndOffset()
-
getCharSequence
public abstract java.lang.CharSequence getCharSequence()
-
charAt
public abstract char charAt(int index)
get char at index- Parameters:
index- index in segmented sequence coordinates. index offset must be subtracted to convert to segment coordinates- Returns:
- character at given index in segmented sequence
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getSegment
public static Segment getSegment(byte[] bytes, int byteOffset, int pos, int indexOffset, @NotNull @NotNull BasedSequence basedSequence)
-
getSegType
public static Segment.SegType getSegType(@NotNull @NotNull Seg seg, @NotNull @NotNull java.lang.CharSequence textChars)
-
getOffsetBytes
public static int getOffsetBytes(int offset)
-
getLengthBytes
public static int getLengthBytes(int length)
-
getIntBytes
public static int getIntBytes(int length)
-
getSegByteLength
public static int getSegByteLength(@NotNull Segment.SegType segType, int segStart, int segLength)
-
getSegByteLength
public static int getSegByteLength(@NotNull @NotNull Seg seg, @NotNull @NotNull java.lang.CharSequence textChars)
-
addIntBytes
public static int addIntBytes(byte[] bytes, int offset, int value, int count)
-
getInt
public static int getInt(byte[] bytes, int offset, int count)
-
addChar
public static int addChar(byte[] bytes, int offset, char c)
-
getChar
public static char getChar(byte[] bytes, int offset)
-
addChars
public static int addChars(byte[] bytes, int offset, @NotNull @NotNull java.lang.CharSequence chars, int start, int end)
-
addCharAscii
public static int addCharAscii(byte[] bytes, int offset, char c)
-
addCharsAscii
public static int addCharsAscii(byte[] bytes, int offset, @NotNull @NotNull java.lang.CharSequence chars, int start, int end)
-
getCharAscii
public static char getCharAscii(byte[] bytes, int offset)
-
addSegBytes
public static int addSegBytes(byte[] bytes, int offset, @NotNull @NotNull Seg seg, @NotNull @NotNull java.lang.CharSequence textChars)
-
-