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
ConstructorDescriptionIndexIndexPair
(int sortedIndex, int referenceIndex) Creates an instance of aIndexIndexPair
record class. -
Method Summary
Modifier and TypeMethodDescriptionint
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
Returns the value of thereferenceIndex
record component.int
Returns the value of thesortedIndex
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
IndexIndexPair
public IndexIndexPair(int sortedIndex, int referenceIndex) Creates an instance of aIndexIndexPair
record class.- Parameters:
sortedIndex
- the value for thesortedIndex
record componentreferenceIndex
- the value for thereferenceIndex
record component
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in 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 thesortedIndex
record component.- Returns:
- the value of the
sortedIndex
record component
-
referenceIndex
public int referenceIndex()Returns the value of thereferenceIndex
record component.- Returns:
- the value of the
referenceIndex
record component
-