Record Class TetradInt

java.lang.Object
java.lang.Record
edu.cmu.tetrad.search.utils.TetradInt
Record Components:
i - The first node.
j - The second node.
k - The third node.
l - The fourth node.
All Implemented Interfaces:
TetradSerializable, Serializable

public record TetradInt(int i, int j, int k, int l) extends Record implements TetradSerializable
Represents an ordered tetrad (quartet) of nodes, where the order of nodes within {i, j} and {k, l} does not matter, but the order of the pairs <{i, j}, {k, l}> does matter.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    TetradInt(int i, int j, int k, int l)
    Initializes a TetradInt record while ensuring that all provided nodes are distinct.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this TetradInt object with the specified object for equality.
    int
    Computes the hash code for this TetradInt instance.
    int
    i()
    Returns the value of the i record component.
    int
    j()
    Returns the value of the j record component.
    int
    k()
    Returns the value of the k record component.
    int
    l()
    Returns the value of the l record component.
    Returns a string representation of this TetradInt object.

    Methods inherited from class java.lang.Object

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

    • TetradInt

      public TetradInt(int i, int j, int k, int l)
      Initializes a TetradInt record while ensuring that all provided nodes are distinct.
      Parameters:
      i - The first node of the tetrad.
      j - The second node of the tetrad.
      k - The third node of the tetrad.
      l - The fourth node of the tetrad.
      Throws:
      IllegalArgumentException - If any two nodes among i, j, k, and l are not distinct.
  • Method Details

    • hashCode

      public int hashCode()
      Computes the hash code for this TetradInt instance. The hash code calculation takes into account the unordered pairs {i, j} and {k, l}, ensuring that the order of nodes within each pair does not affect the result. However, the order of the two pairs <{i, j}, {k, l}> impacts the hash code.
      Specified by:
      hashCode in class Record
      Returns:
      The hash code for this TetradInt instance based on the sorted pairs of nodes <{i, j}, {k, l}>.
    • equals

      public boolean equals(Object o)
      Compares this TetradInt object with the specified object for equality. Two TetradInt objects are considered equal if their unordered pairs {i, j} and {k, l} are identical, in the same order or reversed, but the order of the pairs <{i, j}, {k, l}> must match.
      Specified by:
      equals in class Record
      Parameters:
      o - The object to compare with this TetradInt for equality.
      Returns:
      true if the specified object is equal to this TetradInt, false otherwise.
    • toString

      public String toString()
      Returns a string representation of this TetradInt object. The string format represents the sets of pairs <{i, j}, {k, l}> where the individual pairs are sorted in ascending order, ensuring consistent representation regardless of the original order of the individual nodes i, j, k, and l.
      Specified by:
      toString in class Record
      Returns:
      A string representation of this TetradInt instance, displaying the ordered pairs of nodes.
    • i

      public int i()
      Returns the value of the i record component.
      Returns:
      the value of the i record component
    • j

      public int j()
      Returns the value of the j record component.
      Returns:
      the value of the j record component
    • k

      public int k()
      Returns the value of the k record component.
      Returns:
      the value of the k record component
    • l

      public int l()
      Returns the value of the l record component.
      Returns:
      the value of the l record component