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 Summary
ConstructorsConstructorDescriptionIndexIndexPair(int sortedIndex, int referenceIndex) Creates an instance of aIndexIndexPairrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thereferenceIndexrecord component.intReturns the value of thesortedIndexrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
IndexIndexPair
public IndexIndexPair(int sortedIndex, int referenceIndex) Creates an instance of aIndexIndexPairrecord class.- Parameters:
sortedIndex- the value for thesortedIndexrecord componentreferenceIndex- the value for thereferenceIndexrecord component
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<Object>
-
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 with '=='. -
sortedIndex
public int sortedIndex()Returns the value of thesortedIndexrecord component.- Returns:
- the value of the
sortedIndexrecord component
-
referenceIndex
public int referenceIndex()Returns the value of thereferenceIndexrecord component.- Returns:
- the value of the
referenceIndexrecord component
-