Package ffx.utilities
Record Class DoubleIndexPair
java.lang.Object
java.lang.Record
ffx.utilities.DoubleIndexPair
- Record Components:
index
- the original index of this double.doubleValue
- the double value.
- All Implemented Interfaces:
Comparable<DoubleIndexPair>
public record DoubleIndexPair(int index, double doubleValue)
extends Record
implements Comparable<DoubleIndexPair>
DoubleIndexPair record.
Allows sorting of floating-point values while retaining knowledge of where that value was in some original list or array.
- Since:
- 1.0
- Author:
- Jacob M. Litman
-
Constructor Summary
ConstructorDescriptionDoubleIndexPair
(int index, double doubleValue) Creates an instance of aDoubleIndexPair
record class. -
Method Summary
Modifier and TypeMethodDescriptionint
double
Returns the value of thedoubleValue
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
index()
Returns the value of theindex
record component.toString()
Returns a string containing the index and double value.
-
Constructor Details
-
DoubleIndexPair
public DoubleIndexPair(int index, double doubleValue) Creates an instance of aDoubleIndexPair
record class.- Parameters:
index
- the value for theindex
record componentdoubleValue
- the value for thedoubleValue
record component
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<DoubleIndexPair>
-
toString
Returns a string containing the index and double value. -
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 '=='. -
index
public int index()Returns the value of theindex
record component.- Returns:
- the value of the
index
record component
-
doubleValue
public double doubleValue()Returns the value of thedoubleValue
record component.- Returns:
- the value of the
doubleValue
record component
-