public class SegmentArrayWithData extends SegmentArray
SegmentArray
contract in providing ability to attach additional data to target segment,
i.e. holds mappings like 'index <-> (data, (start; end))'
.
Not thread-safe.INITIAL_SIZE, myEnds, mySegmentCount, myStarts
Constructor and Description |
---|
SegmentArrayWithData(DataStorage storage) |
Modifier and Type | Method and Description |
---|---|
SegmentArrayWithData |
copy() |
DataStorage |
createStorage() |
int |
getSegmentData(int index) |
void |
insert(SegmentArrayWithData segmentArray,
int startIndex) |
int |
packData(IElementType tokenType,
int state,
boolean isRestartableState)
Packs tokenType and lexer state in data
|
protected static int [] |
reallocateArray(int [] array,
int index) |
void |
remove(int startIndex,
int endIndex) |
void |
replace(int startIndex,
int endIndex,
SegmentArrayWithData newData) |
protected void |
replace(int startOffset,
SegmentArrayWithData data,
int len) |
void |
setElementAt(int i,
int startOffset,
int endOffset,
int data) |
int |
unpackStateFromData(int data)
Unpacks state from segment data returned by
|
IElementType |
unpackTokenFromData(int data)
Unpacks token type from segment data returned by
getSegmentData(int) |
changeSegmentLength, findSegmentIndex, getLastValidOffset, getSegmentCount, getSegmentEnd, getSegmentStart, insert, insert, noSegmentsAvailable, offsetOutOfRange, remove, removeAll, replace, segmentNotFound, setElementAt, shiftSegments
public SegmentArrayWithData(DataStorage storage)
public DataStorage createStorage()
public void setElementAt(int i, int startOffset, int endOffset, int data)
public void remove(int startIndex, int endIndex)
remove
in class SegmentArray
public void replace(int startIndex, int endIndex, SegmentArrayWithData newData)
protected void replace(int startOffset, SegmentArrayWithData data, int len)
public void insert(SegmentArrayWithData segmentArray, int startIndex)
public int getSegmentData(int index)
protected static int [] reallocateArray(int [] array, int index)
public SegmentArrayWithData copy()
public int unpackStateFromData(int data)
data
- see getSegmentData(int)
public IElementType unpackTokenFromData(int data)
getSegmentData(int)
data
- to unpackjava.lang.IndexOutOfBoundsException
- if encoded IElementType can not be found in IElementType registrypublic int packData(IElementType tokenType, int state, boolean isRestartableState)
tokenType
- lexer current token typestate
- lexer current stateisRestartableState
- true if state is restartable