java.lang.Object
java.lang.Record
org.aya.core.pat.PatMatcher
public record PatMatcher(@NotNull Subst subst, boolean inferMeta, @NotNull UnaryOperator<@NotNull Term> pre)
extends Record
Matches a term with a pattern.
- API Note:
- Use
tryBuildSubstTerms(boolean, kala.collection.immutable.ImmutableSeq<org.aya.core.pat.Pat>, kala.collection.SeqView<org.aya.core.term.Term>)instead of instantiating the class directly. - Implementation Note:
- The substitution built is made from parallel substitutions.
-
Constructor Summary
ConstructorsConstructorDescriptionPatMatcher(@NotNull Subst subst, boolean inferMeta, @NotNull UnaryOperator<@NotNull Term> pre) Creates an instance of aPatMatcherrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theinferMetarecord component.@NotNull UnaryOperator<@NotNull Term>pre()Returns the value of theprerecord component.@NotNull Substsubst()Returns the value of thesubstrecord component.final StringtoString()Returns a string representation of this record class.tryBuildSubstTerms(boolean inferMeta, @NotNull kala.collection.immutable.ImmutableSeq<@NotNull Pat> pats, @NotNull kala.collection.SeqView<@NotNull Term> terms) tryBuildSubstTerms(boolean inferMeta, @NotNull kala.collection.immutable.ImmutableSeq<@NotNull Pat> pats, @NotNull kala.collection.SeqView<@NotNull Term> terms, @NotNull UnaryOperator<Term> pre)
-
Constructor Details
-
PatMatcher
public PatMatcher(@NotNull @NotNull Subst subst, boolean inferMeta, @NotNull @NotNull UnaryOperator<@NotNull Term> pre) Creates an instance of aPatMatcherrecord class.- Parameters:
subst- the value for thesubstrecord componentinferMeta- the value for theinferMetarecord componentpre- the value for theprerecord component
-
-
Method Details
-
tryBuildSubstTerms
-
tryBuildSubstTerms
public static kala.control.Result<Subst,Boolean> tryBuildSubstTerms(boolean inferMeta, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<@NotNull Pat> pats, @NotNull @NotNull kala.collection.SeqView<@NotNull Term> terms, @NotNull @NotNull UnaryOperator<Term> pre) - Parameters:
inferMeta- true only if we expect the presence ofMetaPatTerm- Returns:
- ok if the term matches the pattern, err(false) if fails positively, err(true) if fails negatively
-
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 '=='. -
subst
Returns the value of thesubstrecord component.- Returns:
- the value of the
substrecord component
-
inferMeta
public boolean inferMeta()Returns the value of theinferMetarecord component.- Returns:
- the value of the
inferMetarecord component
-
pre
Returns the value of theprerecord component.- Returns:
- the value of the
prerecord component
-