Class ClusterPair

java.lang.Object
ffx.numerics.clustering.ClusterPair
All Implemented Interfaces:
Comparable<ClusterPair>

public class ClusterPair extends Object implements 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 Details

    • ClusterPair

      public ClusterPair()
      Creates an empty ClusterPair.
    • ClusterPair

      public ClusterPair(Cluster left, Cluster right, Double distance)
      Creates a ClusterPair linking two clusters at a given distance.
      Parameters:
      left - the left cluster
      right - the right cluster
      distance - the linkage distance between clusters
  • Method Details

    • getOtherCluster

      public Cluster getOtherCluster(Cluster c)
      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

      public Cluster getlCluster()
      Gets the left cluster.
      Returns:
      the left cluster
    • setlCluster

      public void setlCluster(Cluster lCluster)
      Sets the left cluster.
      Parameters:
      lCluster - the left cluster
    • getrCluster

      public Cluster getrCluster()
      Gets the right cluster.
      Returns:
      the right cluster
    • setrCluster

      public void setrCluster(Cluster rCluster)
      Sets the right cluster.
      Parameters:
      rCluster - the right cluster
    • getLinkageDistance

      public Double getLinkageDistance()
      Gets the linkage distance.
      Returns:
      the linkage distance
    • setLinkageDistance

      public void setLinkageDistance(Double distance)
      Sets the linkage distance.
      Parameters:
      distance - the linkage distance to set
    • reverse

      public ClusterPair reverse()
      Creates a new ClusterPair with left and right clusters swapped.
      Returns:
      a new ClusterPair with the two left/right inverted
    • compareTo

      public int compareTo(ClusterPair o)
      Specified by:
      compareTo in interface Comparable<ClusterPair>
    • agglomerate

      public Cluster agglomerate(int clusterIdx)
      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

      public Cluster agglomerate(String name)
      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

      public String toString()
      Overrides:
      toString in class Object