Package ffx.numerics.clustering
Class ClusterPair
java.lang.Object
ffx.numerics.clustering.ClusterPair
- All Implemented Interfaces:
Comparable<ClusterPair>
Immutable-like holder describing a pair of clusters and the linkage distance
between them; used as entries within the DistanceMap during agglomeration.
- Since:
- 1.0
- Author:
- Lars Behnke, 2013, Michael J. Schnieders
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty ClusterPair.ClusterPair(Cluster left, Cluster right, Double distance) Creates a ClusterPair linking two clusters at a given distance. -
Method Summary
Modifier and TypeMethodDescriptionagglomerate(int clusterIdx) Agglomerates left and right clusters under an auto-generated name.agglomerate(String name) Agglomerates left and right clusters into a new parent with the given name.intGets the left cluster.Gets the linkage distance.Returns the opposite cluster of the provided one in this pair.Gets the right cluster.reverse()Creates a new ClusterPair with left and right clusters swapped.voidsetlCluster(Cluster lCluster) Sets the left cluster.voidsetLinkageDistance(Double distance) Sets the linkage distance.voidsetrCluster(Cluster rCluster) Sets the right cluster.toString()
-
Constructor Details
-
ClusterPair
public ClusterPair()Creates an empty ClusterPair. -
ClusterPair
Creates a ClusterPair linking two clusters at a given distance.- Parameters:
left- the left clusterright- the right clusterdistance- the linkage distance between clusters
-
-
Method Details
-
getOtherCluster
Returns the opposite cluster of the provided one in this pair.- Parameters:
c- one cluster in this pair- Returns:
- the other cluster in the pair
-
getlCluster
Gets the left cluster.- Returns:
- the left cluster
-
setlCluster
Sets the left cluster.- Parameters:
lCluster- the left cluster
-
getrCluster
Gets the right cluster.- Returns:
- the right cluster
-
setrCluster
Sets the right cluster.- Parameters:
rCluster- the right cluster
-
getLinkageDistance
Gets the linkage distance.- Returns:
- the linkage distance
-
setLinkageDistance
Sets the linkage distance.- Parameters:
distance- the linkage distance to set
-
reverse
Creates a new ClusterPair with left and right clusters swapped.- Returns:
- a new ClusterPair with the two left/right inverted
-
compareTo
- Specified by:
compareToin interfaceComparable<ClusterPair>
-
agglomerate
Agglomerates left and right clusters under an auto-generated name.- Parameters:
clusterIdx- index appended to the generated cluster name- Returns:
- the new parent Cluster
-
agglomerate
Agglomerates left and right clusters into a new parent with the given name.- Parameters:
name- name of the new parent cluster- Returns:
- the new parent Cluster
-
toString
-