Record Class IndexTriple

java.lang.Object
java.lang.Record
org.cicirello.math.rand.IndexTriple
Record Components:
i - an index of the triple
j - another index of the triple
k - and another index of the triple

public record IndexTriple(int i, int j, int k) extends Record
A triple of indexes. Instances of IndexTriple are returned by some methods of other classes, such as RandomIndexer and EnhancedRandomGenerator, that generate random triples of indexes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    IndexTriple(int i, int j, int k)
    Creates an instance of a IndexTriple 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.
    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.
    sorted(int i, int j, int k)
    Factory method to initialize an IndexTriple with sorted indexes.
    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
  • Constructor Details

    • IndexTriple

      public IndexTriple(int i, int j, int k)
      Creates an instance of a IndexTriple record class.
      Parameters:
      i - the value for the i record component
      j - the value for the j record component
      k - the value for the k record component
  • Method Details

    • sorted

      public static IndexTriple sorted(int i, int j, int k)
      Factory method to initialize an IndexTriple with sorted indexes.
      Parameters:
      i - an index of the triple
      j - another index of the triple
      k - and another index of the triple
      Returns:
      an IndexTriple t, such that t.i() == min(i, j, k), t.j() == median(i, j, k), and t.k() == max(i, j, k)
    • 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 '=='.
      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.
    • 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