Module aya.base
Package org.aya.terck

Record Class CallMatrix<Def,Param>

java.lang.Object
java.lang.Record
org.aya.terck.CallMatrix<Def,Param>
All Implemented Interfaces:
org.aya.pretty.doc.Docile, Selector.Candidate<CallMatrix<Def,Param>>

public record CallMatrix<Def,Param>(@NotNull Callable callable, Def domain, Def codomain, @NotNull kala.collection.immutable.ImmutableSeq<Param> domainTele, @NotNull kala.collection.immutable.ImmutableSeq<Param> codomainTele, @NotNull Relation[][] matrix) extends Record implements org.aya.pretty.doc.Docile, Selector.Candidate<CallMatrix<Def,Param>>
A call matrix for a call `f --> g` has dimensions `arity(g) * arity(f)`. Each row corresponds to one argument in the call to `g` (the codomain). Each column corresponds to one formal argument of caller `f` (the domain).
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    CallMatrix(@NotNull Callable callable, Def domain, Def codomain, @NotNull kala.collection.immutable.ImmutableSeq<Param> domainTele, @NotNull kala.collection.immutable.ImmutableSeq<Param> codomainTele)
     
    CallMatrix(@NotNull Callable callable, Def domain, Def codomain, @NotNull kala.collection.immutable.ImmutableSeq<Param> domainTele, @NotNull kala.collection.immutable.ImmutableSeq<Param> codomainTele, @NotNull Relation[][] matrix)
    Creates an instance of a CallMatrix record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Callable
    Returns the value of the callable record component.
    Returns the value of the codomain record component.
    @NotNull kala.collection.immutable.ImmutableSeq<Param>
    Returns the value of the codomainTele record component.
    int
     
    static <Def, Param>
    @NotNull CallMatrix<Def,Param>
    combine(@NotNull CallMatrix<Def,Param> A, @NotNull CallMatrix<Def,Param> B)
    Combine two call matrices if there exists an indirect call, for example: If `f` calls `g` with call matrix `A` and `g` calls `h` with call matrix `B`, the `f` indirectly calls `h` with call matrix `combine(A, B)` or `AB` in matrix notation.
    compare(@NotNull CallMatrix<Def,Param> other)
    Compare two call matrices by their decrease amount.
    Returns the value of the domain record component.
    @NotNull kala.collection.immutable.ImmutableSeq<Param>
    Returns the value of the domainTele 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 Relation[][]
    Returns the value of the matrix record component.
    int
     
    void
    set(Param domain, Param codomain, @NotNull Relation relation)
     
    @NotNull org.aya.pretty.doc.Doc
     
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.aya.terck.Selector.Candidate

    notWorseThan
  • Constructor Details

    • CallMatrix

      public CallMatrix(@NotNull @NotNull Callable callable, @NotNull Def domain, @NotNull Def codomain, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<Param> domainTele, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<Param> codomainTele)
    • CallMatrix

      public CallMatrix(@NotNull @NotNull Callable callable, @NotNull Def domain, @NotNull Def codomain, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<Param> domainTele, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<Param> codomainTele, @NotNull @NotNull Relation[][] matrix)
      Creates an instance of a CallMatrix record class.
      Parameters:
      callable - the value for the callable record component
      domain - the value for the domain record component
      codomain - the value for the codomain record component
      domainTele - the value for the domainTele record component
      codomainTele - the value for the codomainTele record component
      matrix - the value for the matrix record component
  • Method Details

    • rows

      public int rows()
    • cols

      public int cols()
    • set

      public void set(@NotNull Param domain, @NotNull Param codomain, @NotNull @NotNull Relation relation)
    • compare

      @NotNull public Selector.DecrOrd compare(@NotNull @NotNull CallMatrix<Def,Param> other)
      Compare two call matrices by their decrease amount.
      Specified by:
      compare in interface Selector.Candidate<Def>
    • combine

      @Contract(pure=true) @NotNull public static <Def, Param> @NotNull CallMatrix<Def,Param> combine(@NotNull @NotNull CallMatrix<Def,Param> A, @NotNull @NotNull CallMatrix<Def,Param> B)
      Combine two call matrices if there exists an indirect call, for example: If `f` calls `g` with call matrix `A` and `g` calls `h` with call matrix `B`, the `f` indirectly calls `h` with call matrix `combine(A, B)` or `AB` in matrix notation.
    • toDoc

      @NotNull public @NotNull org.aya.pretty.doc.Doc toDoc()
      Specified by:
      toDoc in interface org.aya.pretty.doc.Docile
    • 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.
    • callable

      @NotNull public @NotNull Callable callable()
      Returns the value of the callable record component.
      Returns:
      the value of the callable record component
    • domain

      @NotNull public Def domain()
      Returns the value of the domain record component.
      Returns:
      the value of the domain record component
    • codomain

      @NotNull public Def codomain()
      Returns the value of the codomain record component.
      Returns:
      the value of the codomain record component
    • domainTele

      @NotNull public @NotNull kala.collection.immutable.ImmutableSeq<Param> domainTele()
      Returns the value of the domainTele record component.
      Returns:
      the value of the domainTele record component
    • codomainTele

      @NotNull public @NotNull kala.collection.immutable.ImmutableSeq<Param> codomainTele()
      Returns the value of the codomainTele record component.
      Returns:
      the value of the codomainTele record component
    • matrix

      @NotNull public @NotNull Relation[][] matrix()
      Returns the value of the matrix record component.
      Returns:
      the value of the matrix record component