Module aya.base

Record Class PatUnify

java.lang.Object
java.lang.Record
org.aya.core.pat.PatUnify

public record PatUnify(@NotNull Subst lhsSubst, @NotNull Subst rhsSubst, @NotNull LocalCtx ctx) extends Record
The unification of patterns. This is not pattern unification.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    PatUnify(@NotNull Subst lhsSubst, @NotNull Subst rhsSubst, @NotNull LocalCtx ctx)
    Creates an instance of a PatUnify record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull LocalCtx
    ctx()
    Returns the value of the ctx record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    @NotNull Subst
    Returns the value of the lhsSubst record component.
    @NotNull Subst
    Returns the value of the rhsSubst record component.
    final String
    Returns a string representation of this record class.
    static @NotNull LocalCtx
    unifyPat(@NotNull kala.collection.SeqLike<Pat> lpats, @NotNull kala.collection.SeqLike<Pat> rpats, @NotNull Subst lhsSubst, @NotNull Subst rhsSubst, @NotNull LocalCtx ctx)
    The unification of patterns.

    Methods inherited from class java.lang.Object

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

    • PatUnify

      public PatUnify(@NotNull @NotNull Subst lhsSubst, @NotNull @NotNull Subst rhsSubst, @NotNull @NotNull LocalCtx ctx)
      Creates an instance of a PatUnify record class.
      Parameters:
      lhsSubst - the value for the lhsSubst record component
      rhsSubst - the value for the rhsSubst record component
      ctx - the value for the ctx record component
  • Method Details

    • unifyPat

      @NotNull public static @NotNull LocalCtx unifyPat(@NotNull @NotNull kala.collection.SeqLike<Pat> lpats, @NotNull @NotNull kala.collection.SeqLike<Pat> rpats, @NotNull @NotNull Subst lhsSubst, @NotNull @NotNull Subst rhsSubst, @NotNull @NotNull LocalCtx ctx)
      The unification of patterns. Assumes well-typedness, homogeneous-ness and positive success.
      Parameters:
      lhsSubst - the substitutions that would turn the lhs pattern to the rhs one.
      rhsSubst - the substitutions that would turn the rhs pattern to the lhs one.
      Returns:
      a ctx that contains all variables that are not unified.
      Throws:
      IllegalArgumentException - if failed
      See Also:
      • visitAs(LocalVar, org.aya.core.pat.Pat)
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • lhsSubst

      @NotNull public @NotNull Subst lhsSubst()
      Returns the value of the lhsSubst record component.
      Returns:
      the value of the lhsSubst record component
    • rhsSubst

      @NotNull public @NotNull Subst rhsSubst()
      Returns the value of the rhsSubst record component.
      Returns:
      the value of the rhsSubst record component
    • ctx

      @NotNull public @NotNull LocalCtx ctx()
      Returns the value of the ctx record component.
      Returns:
      the value of the ctx record component