public final class Sequence extends RegexASTNode implements RegexASTVisitorIterable
Terms.
Sequences are used as the alternatives in a Group. They are the only subtype of
RegexASTNode which does not extend Term. In order to coerce a Sequence into a
Term, wrap it in a Group (as its only alternative).
Corresponds to the goal symbol Alternative in the ECMAScript RegExp syntax.
| Modifier and Type | Method and Description |
|---|---|
void |
add(Term term)
|
Sequence |
copy(RegexAST ast,
boolean recursive)
Copy this node, in one of the following ways:
if
recursive is true, recursively copy this subtree. |
boolean |
equalsSemantic(RegexASTNode obj) |
Term |
get(int i) |
int |
getEnclosedCaptureGroupsHigh() |
int |
getEnclosedCaptureGroupsLow() |
Term |
getFirstTerm() |
Term |
getLastTerm() |
Group |
getParent()
Gets the syntactic parent of this AST node.
|
RegexASTSubtreeRootNode |
getSubTreeParent()
Returns the subtree root node that this node is a part of.
|
ArrayList<Term> |
getTerms()
Returns the list of terms that constitute this
Sequence. |
boolean |
isEmpty() |
boolean |
isFirstInGroup() |
boolean |
isLastInGroup() |
boolean |
isLiteral() |
boolean |
isPenultimateInGroup() |
boolean |
isSingleCharClass() |
void |
removeLastTerm()
|
void |
replace(int index,
Term term)
Replaces the term at position
index with the given Term. |
void |
resetVisitorIterator() |
void |
setParent(RegexASTNode parent)
Sets the syntactic parent of this AST node.
|
int |
size() |
JsonValue |
toJson() |
String |
toString() |
RegexASTNode |
visitorGetNext(boolean reverse) |
boolean |
visitorHasNext() |
asBackReference, asCharacterClass, asGroup, asLookAheadAssertion, asLookAroundAssertion, asLookBehindAssertion, asMatchFound, asPositionAssertion, asQuantifiableTerm, asSequence, astNodeId, endsWithDollar, getFlags, getId, getMaxPath, getMinPath, hasBackReferences, hasCaptureGroups, hasCaret, hasDollar, hasEmptyGuard, hasLookAheads, hasLookBehinds, hasLoops, hasQuantifiers, idInitialized, incMaxPath, incMaxPath, incMinPath, incMinPath, isBackReference, isCaret, isCharacterClass, isDead, isDollar, isExpandedQuantifier, isFlagSet, isGroup, isInLookAheadAssertion, isInLookBehindAssertion, isLookAheadAssertion, isLookAroundAssertion, isLookBehindAssertion, isMatchFound, isPositionAssertion, isPrefix, isQuantifiableTerm, isRoot, isSequence, isSubtreeRoot, markAsDead, setDead, setEmptyGuard, setEndsWithDollar, setEndsWithDollar, setExpandedQuantifier, setFlag, setFlag, setFlags, setHasBackReferences, setHasCaptureGroups, setHasCaret, setHasCaret, setHasDollar, setHasDollar, setHasLookAheads, setHasLookBehinds, setHasLoops, setHasLoops, setHasQuantifiers, setId, setMaxPath, setMinPath, setPrefix, setStartsWithCaret, setStartsWithCaret, startsWithCaret, toJson, toStringWithIDpublic Sequence copy(RegexAST ast, boolean recursive)
RegexASTNoderecursive is true, recursively copy this subtree. This method should
be used instead of CopyVisitor if the copying process is required to be thread-safe.
copy in class RegexASTNodeast - RegexAST the new nodes should belong to.public Group getParent()
RegexASTNodegetParent in class RegexASTNodepublic void setParent(RegexASTNode parent)
RegexASTNodesetParent in class RegexASTNodepublic ArrayList<Term> getTerms()
Sequence.
Note that elements should not be added or removed from this list. Use the methods
Sequence.add(Term) and Sequence.removeLastTerm() instead.
public boolean isEmpty()
public int size()
public Term getFirstTerm()
public Term get(int i)
public Term getLastTerm()
public void add(Term term)
term - public void replace(int index,
Term term)
index with the given Term.term - public void removeLastTerm()
public boolean isFirstInGroup()
public boolean isLastInGroup()
public boolean isPenultimateInGroup()
public boolean isLiteral()
public boolean isSingleCharClass()
public int getEnclosedCaptureGroupsLow()
public int getEnclosedCaptureGroupsHigh()
public RegexASTSubtreeRootNode getSubTreeParent()
RegexASTNodeRegexAST.getNFAAnchoredInitialState(int) and
RegexAST.getNFAUnAnchoredInitialState(int) technically don't belong to the AST, so
they will return null.getSubTreeParent in class RegexASTNodepublic boolean visitorHasNext()
visitorHasNext in interface RegexASTVisitorIterablepublic void resetVisitorIterator()
resetVisitorIterator in interface RegexASTVisitorIterablepublic RegexASTNode visitorGetNext(boolean reverse)
visitorGetNext in interface RegexASTVisitorIterablepublic boolean equalsSemantic(RegexASTNode obj)
equalsSemantic in class RegexASTNodepublic JsonValue toJson()
toJson in interface JsonConvertible