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
ConstructorsConstructorDescriptionDoubleIndexPair(int index, double doubleValue) Creates an instance of aDoubleIndexPairrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintdoubleReturns the value of thedoubleValuerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intindex()Returns the value of theindexrecord component.toString()Returns a string containing the index and double value.
-
Constructor Details
-
DoubleIndexPair
public DoubleIndexPair(int index, double doubleValue) Creates an instance of aDoubleIndexPairrecord class.- Parameters:
index- the value for theindexrecord componentdoubleValue- the value for thedoubleValuerecord component
-
-
Method Details
-
compareTo
- Specified by:
compareToin 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 theindexrecord component.- Returns:
- the value of the
indexrecord component
-
doubleValue
public double doubleValue()Returns the value of thedoubleValuerecord component.- Returns:
- the value of the
doubleValuerecord component
-