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 cgOffset,
int lgOffset,
int index,
boolean trackLastGroup) |
void |
applyExploded(int[] array,
int cgOffset,
int lgOffset,
int index,
boolean trackLastGroup,
boolean dontOverwriteLastGroup) |
void |
applyToResultFactory(PreCalculatedResultFactory resultFactory,
int index,
boolean trackLastGroup)
Updates a resultFactory in respect to a single transition and index.
|
byte[] |
clearsToByteArray() |
static GroupBoundaries[] |
createCachedGroupBoundaries() |
boolean |
equals(Object obj) |
TBitSet |
getClearIndices()
Directly returns the
TBitSet used to store the indices of all capture group
boundaries that should be cleared when traversed. |
static GroupBoundaries |
getEmptyInstance(RegexLanguage language) |
int |
getLastGroup() |
static GroupBoundaries |
getStaticInstance(RegexLanguage language,
TBitSet updateIndices,
TBitSet clearIndices)
Used for deduplication of very common instances of this class.
|
TBitSet |
getUpdateIndices()
Directly returns the
TBitSet used to store the indices of all capture group
boundaries that should be updated when traversed. |
int |
hashCode() |
boolean |
hasIndexClears() |
boolean |
hasIndexUpdates() |
boolean |
hasLastGroup() |
JsonArray |
indexUpdateSourceSectionsToJson(RegexAST ast) |
boolean |
isEmpty() |
void |
materializeArrays() |
JsonValue |
toJson() |
String |
toString() |
void |
updateBitSets(TBitSet foreignUpdateIndices,
TBitSet foreignClearIndices)
Updates the given
TBitSets with the values contained in this GroupBoundaries
object. |
byte[] |
updatesToByteArray() |
public static GroupBoundaries[] createCachedGroupBoundaries()
public static GroupBoundaries getStaticInstance(RegexLanguage language, TBitSet updateIndices, TBitSet clearIndices)
public static GroupBoundaries getEmptyInstance(RegexLanguage language)
public boolean isEmpty()
public byte[] updatesToByteArray()
public byte[] clearsToByteArray()
public void materializeArrays()
public TBitSet getUpdateIndices()
TBitSet used to store the indices of all capture group
boundaries that should be updated when traversed. public TBitSet getClearIndices()
TBitSet used to store the indices of all capture group
boundaries that should be cleared when traversed. public boolean hasIndexUpdates()
public boolean hasIndexClears()
public boolean hasLastGroup()
public void updateBitSets(TBitSet foreignUpdateIndices, TBitSet foreignClearIndices)
TBitSets with the values contained in this GroupBoundaries
object.public int getLastGroup()
public void applyToResultFactory(PreCalculatedResultFactory resultFactory, int index, boolean trackLastGroup)
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 applyExploded(int[] array,
int cgOffset,
int lgOffset,
int index,
boolean trackLastGroup,
boolean dontOverwriteLastGroup)
public void apply(int[] array,
int cgOffset,
int lgOffset,
int index,
boolean trackLastGroup)
public JsonValue toJson()
toJson in interface JsonConvertible