Package ffx.utilities

Record Class IndexIndexPair

java.lang.Object
java.lang.Record
ffx.utilities.IndexIndexPair
Record Components:
sortedIndex - Value to be sorted upon.
referenceIndex - Original index.
All Implemented Interfaces:
Comparable<Object>

public record IndexIndexPair(int sortedIndex, int referenceIndex) extends Record implements Comparable<Object>
The IndexIndexPair record.

Pass in an int to be sorted on, then an int referring to some original list. Enables sorting based on one integer value while remembering where it was in the original list.

Since:
1.0
Author:
Jacob M. Litman
  • Constructor Details

    • IndexIndexPair

      public IndexIndexPair(int sortedIndex, int referenceIndex)
      Creates an instance of a IndexIndexPair record class.
      Parameters:
      sortedIndex - the value for the sortedIndex record component
      referenceIndex - the value for the referenceIndex record component
  • Method Details

    • compareTo

      public int compareTo(Object o)
      Specified by:
      compareTo in interface Comparable<Object>
    • 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.
    • sortedIndex

      public int sortedIndex()
      Returns the value of the sortedIndex record component.
      Returns:
      the value of the sortedIndex record component
    • referenceIndex

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