Class Segment
java.lang.Object
com.vladsch.flexmark.util.sequence.builder.tree.Segment
- Direct Known Subclasses:
Segment.Base
,Segment.Text
SegmentedSequence Segment stored in byte[] in serialized format
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
static enum
(package private) static class
(package private) static class
(package private) static class
(package private) static class
(package private) static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int
protected final byte[]
protected final int
protected final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
addChar
(byte[] bytes, int offset, char c) static int
addCharAscii
(byte[] bytes, int offset, char c) static int
addChars
(byte[] bytes, int offset, @NotNull CharSequence chars, int start, int end) static int
addCharsAscii
(byte[] bytes, int offset, @NotNull CharSequence chars, int start, int end) static int
addIntBytes
(byte[] bytes, int offset, int value, int count) static int
addSegBytes
(byte[] bytes, int offset, @NotNull Seg seg, @NotNull CharSequence textChars) abstract char
charAt
(int index) get char at indexfinal int
final int
byte[]
getBytes()
static char
getChar
(byte[] bytes, int offset) static char
getCharAscii
(byte[] bytes, int offset) abstract CharSequence
final int
abstract int
static int
getInt
(byte[] bytes, int offset, int count) static int
getIntBytes
(int length) static int
getLengthBytes
(int length) static int
getOffsetBytes
(int offset) int
getPos()
static int
getSegByteLength
(@NotNull Seg seg, @NotNull CharSequence textChars) static int
getSegByteLength
(Segment.SegType segType, int segStart, int segLength) static Segment
getSegment
(byte[] bytes, int byteOffset, int pos, int indexOffset, @NotNull BasedSequence basedSequence) static Segment.SegType
getSegType
(@NotNull Seg seg, @NotNull CharSequence textChars) final int
abstract int
final Segment.SegType
getType()
boolean
hasAll
(int flags, int mask) abstract boolean
isAnchor()
abstract boolean
isBase()
abstract boolean
abstract boolean
abstract boolean
isText()
abstract int
length()
boolean
notInSegment
(int index) boolean
offsetNotInSegment
(int offset) toString()
-
Field Details
-
TYPE_MASK
static final int TYPE_MASK- See Also:
-
TYPE_NO_SIZE_BYTES
static final int TYPE_NO_SIZE_BYTES- See Also:
-
TYPE_START_BYTES
static final int TYPE_START_BYTES- See Also:
-
TYPE_LENGTH_BYTES
static final int TYPE_LENGTH_BYTES- See Also:
-
TYPE_ANCHOR
static final int TYPE_ANCHOR- See Also:
-
TYPE_BASE
static final int TYPE_BASE- See Also:
-
TYPE_TEXT
static final int TYPE_TEXT- See Also:
-
TYPE_REPEATED_TEXT
static final int TYPE_REPEATED_TEXT- See Also:
-
TYPE_TEXT_ASCII
static final int TYPE_TEXT_ASCII- See Also:
-
TYPE_REPEATED_ASCII
static final int TYPE_REPEATED_ASCII- See Also:
-
TYPE_REPEATED_SPACE
static final int TYPE_REPEATED_SPACE- See Also:
-
TYPE_REPEATED_EOL
static final int TYPE_REPEATED_EOL- See Also:
-
TYPE_HAS_OFFSET
static final int TYPE_HAS_OFFSET- See Also:
-
TYPE_HAS_LENGTH
static final int TYPE_HAS_LENGTH- See Also:
-
TYPE_HAS_BOTH
static final int TYPE_HAS_BOTH- See Also:
-
TYPE_HAS_CHAR
static final int TYPE_HAS_CHAR- See Also:
-
TYPE_HAS_CHARS
static final int TYPE_HAS_CHARS- See Also:
-
TYPE_HAS_BYTE
static final int TYPE_HAS_BYTE- See Also:
-
TYPE_HAS_BYTES
static final int TYPE_HAS_BYTES- See Also:
-
pos
protected final int pos -
bytes
protected final byte[] bytes -
byteOffset
protected final int byteOffset -
startIndex
protected final int startIndex
-
-
Constructor Details
-
Segment
public Segment(int pos, byte[] bytes, int byteOffset, int startIndex)
-
-
Method Details
-
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
-
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
-
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
-
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 CharSequence textChars) -
getOffsetBytes
public static int getOffsetBytes(int offset) -
getLengthBytes
public static int getLengthBytes(int length) -
getIntBytes
public static int getIntBytes(int length) -
getSegByteLength
-
getSegByteLength
public static int getSegByteLength(@NotNull @NotNull Seg seg, @NotNull @NotNull 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 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 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 CharSequence textChars)
-