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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull LocalCtxctx()Returns the value of thectxrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull SubstlhsSubst()Returns the value of thelhsSubstrecord component.@NotNull SubstrhsSubst()Returns the value of therhsSubstrecord component.final StringtoString()Returns a string representation of this record class.static @NotNull LocalCtxunifyPat(@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.
-
Constructor Details
-
PatUnify
public PatUnify(@NotNull @NotNull Subst lhsSubst, @NotNull @NotNull Subst rhsSubst, @NotNull @NotNull LocalCtx ctx) Creates an instance of aPatUnifyrecord class.- Parameters:
lhsSubst- the value for thelhsSubstrecord componentrhsSubst- the value for therhsSubstrecord componentctx- the value for thectxrecord 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
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. All components in this record class are compared withObjects::equals(Object,Object). -
lhsSubst
Returns the value of thelhsSubstrecord component.- Returns:
- the value of the
lhsSubstrecord component
-
rhsSubst
Returns the value of therhsSubstrecord component.- Returns:
- the value of the
rhsSubstrecord component
-
ctx
Returns the value of thectxrecord component.- Returns:
- the value of the
ctxrecord component
-