public class GroupBoundaries extends Object implements JsonConvertible
NFAStateTransition or ASTTransition. The boundaries of one capture group
correspond to its opening and closing brackets. All capture group boundaries are mapped to
indices according to Group.getBoundaryIndexStart() and
Group.getBoundaryIndexEnd(). A transition may update or clear any
boundary when traversed. RegexAST. Due to the deduplication, every
instance must be treated as immutable!ASTTransition,
NFAStateTransition,
RegexAST| Modifier and Type | Method and Description |
|---|---|
void |
apply(int[] array,
int offset,
int index) |
void |
applyToResultFactory(PreCalculatedResultFactory resultFactory,
int index)
Updates a resultFactory in respect to a single transition and index.
|
byte[] |
clearsToPartialTransitionArray(int targetArray)
Creates a byte array suitable to be part of the
indexClears parameter passed to
DFACaptureGroupPartialTransition.create(DFAGenerator, byte[], byte[], byte[][], byte[][], byte)
from this object. |
boolean |
equals(Object obj) |
CompilationFinalBitSet |
getClearIndices()
Directly returns the
CompilationFinalBitSet used to store the indices of all capture
group boundaries that should be cleared when traversed. |
byte[] |
getClearIndicesArray() |
static GroupBoundaries |
getEmptyInstance() |
CompilationFinalBitSet |
getUpdateIndices()
Directly returns the
CompilationFinalBitSet used to store the indices of all capture
group boundaries that should be updated when traversed. |
byte[] |
getUpdateIndicesArray() |
int |
hashCode() |
boolean |
hasIndexClears() |
boolean |
hasIndexUpdates() |
boolean |
isEmpty() |
void |
materializeArrays() |
JsonValue |
toJson() |
String |
toString() |
void |
updateBitSets(CompilationFinalBitSet foreignUpdateIndices,
CompilationFinalBitSet foreignClearIndices)
Updates the given
CompilationFinalBitSets with the values contained in this
GroupBoundaries object. |
byte[] |
updatesToPartialTransitionArray(int targetArray)
Creates a byte array suitable to be part of the
indexUpdates parameter passed to
DFACaptureGroupPartialTransition.create(DFAGenerator, byte[], byte[], byte[][], byte[][], byte)
from this object. |
public static GroupBoundaries getEmptyInstance()
public boolean isEmpty()
public byte[] updatesToPartialTransitionArray(int targetArray)
indexUpdates parameter passed to
DFACaptureGroupPartialTransition.create(DFAGenerator, byte[], byte[], byte[][], byte[][], byte)
from this object.targetArray - the index of the row to be targeted.DFACaptureGroupPartialTransition.create(DFAGenerator, byte[], byte[], byte[][],
byte[][], byte)public byte[] clearsToPartialTransitionArray(int targetArray)
indexClears parameter passed to
DFACaptureGroupPartialTransition.create(DFAGenerator, byte[], byte[], byte[][], byte[][], byte)
from this object.targetArray - the index of the row to be targeted.DFACaptureGroupPartialTransition.create(DFAGenerator, byte[], byte[], byte[][],
byte[][], byte)public void materializeArrays()
public CompilationFinalBitSet getUpdateIndices()
CompilationFinalBitSet used to store the indices of all capture
group boundaries that should be updated when traversed. public CompilationFinalBitSet getClearIndices()
CompilationFinalBitSet used to store the indices of all capture
group boundaries that should be cleared when traversed. public byte[] getUpdateIndicesArray()
public byte[] getClearIndicesArray()
public boolean hasIndexUpdates()
public boolean hasIndexClears()
public void updateBitSets(CompilationFinalBitSet foreignUpdateIndices, CompilationFinalBitSet foreignClearIndices)
CompilationFinalBitSets with the values contained in this
GroupBoundaries object.public void applyToResultFactory(PreCalculatedResultFactory resultFactory, int index)
resultFactory - the resultFactory to update.index - current index. All group boundaries contained in this object will be set to this
value in the resultFactory.public void apply(int[] array,
int offset,
int index)
public JsonValue toJson()
toJson in interface JsonConvertible