Package com.orbit.parse
Record Class Quantifier
java.lang.Object
java.lang.Record
com.orbit.parse.Quantifier
- All Implemented Interfaces:
Expr
public record Quantifier(Expr child, int min, OptionalInt max, boolean possessive, boolean lazy)
extends Record
implements Expr
Represents a quantified sub-expression with optional laziness or possessive semantics.
The lazy and possessive fields are mutually exclusive: if
possessive is true, lazy must be false. A greedy
quantifier has both fields false.
Instances are immutable and safe for use by multiple concurrent threads.
-
Constructor Summary
ConstructorsConstructorDescriptionQuantifier(Expr child, int min, OptionalInt max, boolean possessive) Creates a greedy quantifier (neither lazy nor possessive).Quantifier(Expr child, int min, OptionalInt max, boolean possessive, boolean lazy) Creates a Quantifier, validating all invariants. -
Method Summary
Modifier and TypeMethodDescriptionchild()Returns the value of thechildrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanlazy()Returns the value of thelazyrecord component.max()Returns the value of themaxrecord component.intmin()Returns the value of theminrecord component.booleanReturns the value of thepossessiverecord component.span()Returns the source location information for this expression.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Quantifier
Creates a Quantifier, validating all invariants. -
Quantifier
Creates a greedy quantifier (neither lazy nor possessive).- Parameters:
child- the quantified sub-expression; must not be nullmin- the minimum repetition count; must be >= 0max- the maximum repetition count; empty means unboundedpossessive-truefor possessive (atomic) semantics
-
-
Method Details
-
span
Description copied from interface:ExprReturns the source location information for this expression. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
child
Returns the value of thechildrecord component.- Returns:
- the value of the
childrecord component
-
min
public int min()Returns the value of theminrecord component.- Returns:
- the value of the
minrecord component
-
max
Returns the value of themaxrecord component.- Returns:
- the value of the
maxrecord component
-
possessive
public boolean possessive()Returns the value of thepossessiverecord component.- Returns:
- the value of the
possessiverecord component
-
lazy
public boolean lazy()Returns the value of thelazyrecord component.- Returns:
- the value of the
lazyrecord component
-