Module aya.base

Record Class PatMatcher

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

    Constructors
    Constructor
    Description
    PatMatcher(@NotNull Subst subst, boolean inferMeta, @NotNull UnaryOperator<@NotNull Term> pre)
    Creates an instance of a PatMatcher record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the inferMeta record component.
    @NotNull UnaryOperator<@NotNull Term>
    pre()
    Returns the value of the pre record component.
    @NotNull Subst
    Returns the value of the subst record component.
    final String
    Returns a string representation of this record class.
    static kala.control.Result<Subst,Boolean>
    tryBuildSubstTerms(boolean inferMeta, @NotNull kala.collection.immutable.ImmutableSeq<@NotNull Pat> pats, @NotNull kala.collection.SeqView<@NotNull Term> terms)
     
    static kala.control.Result<Subst,Boolean>
    tryBuildSubstTerms(boolean inferMeta, @NotNull kala.collection.immutable.ImmutableSeq<@NotNull Pat> pats, @NotNull kala.collection.SeqView<@NotNull Term> terms, @NotNull UnaryOperator<Term> pre)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PatMatcher

      public PatMatcher(@NotNull @NotNull Subst subst, boolean inferMeta, @NotNull @NotNull UnaryOperator<@NotNull Term> pre)
      Creates an instance of a PatMatcher record class.
      Parameters:
      subst - the value for the subst record component
      inferMeta - the value for the inferMeta record component
      pre - the value for the pre record component
  • Method Details

    • 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)
    • 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 of MetaPatTerm
      Returns:
      ok if the term matches the pattern, err(false) if fails positively, err(true) if fails negatively
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • subst

      @NotNull public @NotNull Subst subst()
      Returns the value of the subst record component.
      Returns:
      the value of the subst record component
    • inferMeta

      public boolean inferMeta()
      Returns the value of the inferMeta record component.
      Returns:
      the value of the inferMeta record component
    • pre

      @NotNull public @NotNull UnaryOperator<@NotNull Term> pre()
      Returns the value of the pre record component.
      Returns:
      the value of the pre record component