Class Distance
java.lang.Object
ffx.numerics.clustering.Distance
- All Implemented Interfaces:
Cloneable, Comparable<Distance>
Simple value object storing a distance and an optional weight used during
linkage computations; comparable by distance and cloneable.
- Since:
- 1.0
- Author:
- Lars Behnke, 2013, Michael J. Schnieders
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a clone of this Distance.intCompares by distance value, with null other treated as greater (this < other).Gets the distance value.Gets the weight.booleanisNaN()Checks whether the distance value is NaN or undefined.voidsetDistance(Double distance) Sets the distance value.voidSets the weight.toString()Returns a string containing distance and weight values.
-
Constructor Details
-
Distance
public Distance()Creates a Distance with value 0 and weight 1. -
Distance
Creates a Distance with the given value and unit weight.- Parameters:
distance- the distance value
-
Distance
-
-
Method Details
-
getDistance
-
setDistance
Sets the distance value.- Parameters:
distance- the distance value to set
-
getWeight
-
setWeight
-
isNaN
public boolean isNaN()Checks whether the distance value is NaN or undefined.- Returns:
- true if the distance is null or NaN; false otherwise
-
compareTo
Compares by distance value, with null other treated as greater (this < other).- Specified by:
compareToin interfaceComparable<Distance>- Parameters:
distance- the other Distance to compare to- Returns:
- negative, zero, or positive per Comparable contract
-
toString
-
clone
-