Class IDBasedAssignerBuilder

java.lang.Object
com.chemaxon.clustering.common.IDBasedAssignerBuilder

@Beta @PublicAPI public class IDBasedAssignerBuilder extends Object
An ID based cluster level assigner builder.

Please note that the following must be satisfied:

  • root aligned clusterings:
    • 0 level must have assigned to all root clusters
    • Child clusters must have assigned no lower level than their respective parents
    • Leaves must have assigned no lower level than their parents
  • leaves aligned clusterings:
    • 0 level must have assigned to all leaves.
    • Child clusters must have assigned no greater level than their respective parents
    • It is ok to not assign explicitly zero levels for leaves

Checking of the above conditions are not enforced during setup.

Please note that this class is marked with Beta annotation, so it can be subject of incompatible changes or removal in later releases.

  • Constructor Details

    • IDBasedAssignerBuilder

      public IDBasedAssignerBuilder()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Check if no level info set.

      Typical use case is to check if an associated assigner builder has been invoked.

      Returns:
      false when at least one setClusterLevel(int, double) or setLeafLevel(int, double) invocation occurred.
    • setClusterLevel

      public void setClusterLevel(int clusterID, double level)
      Set the level of a specific cluster.

      If level information for a specific cluster is already set it will be overwritten. Note that 0 level must be explicitly set for roots when clustering is root aligned.

      Parameters:
      clusterID - ID of cluster
      level - Level to assign
    • getClusterLevel

      public double getClusterLevel(int clusterID)
      Get the current associated level for a cluster.
      Parameters:
      clusterID - ID of a cluster
      Returns:
      Associated level for the cluster
      Throws:
      IllegalArgumentException - when no level set for the given cluster
    • getLeafLevel

      public double getLeafLevel(int leafID)
      Get the current associated level for a leaf.
      Parameters:
      leafID - ID of a leaf
      Returns:
      Associated level of the leaf
      Throws:
      IllegalArgumentException - when no level set for the given leaf
    • setLeafLevel

      public void setLeafLevel(int leafID, double level)
      Set the level of a specific leaf node.

      If level information for a specific leaf is already set it will be overwritten. Note that explicitly setting 0 level of leaves for leaf aligned clusterings is not needed. Mixed setting is also possible.

      Parameters:
      leafID - ID of the leaf
      level - Level to assign