Class IDBasedHierarchicClusterBuidler

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

@Beta @PublicAPI @Deprecated(forRemoval=true) @SubjectToRemoval(date=JAN_01_2025) public final class IDBasedHierarchicClusterBuidler extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Fixed a typo in the name of the class, use IDBasedHierarchicClusterBuilder instead.
Builder for integer ID based hierarchic cluster building.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    New builder instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addChildCluster(int childClusterID, int parentClusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add a cluster to another cluster as a child cluster.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Allocate a new cluster.
    void
    addStructureToCluster(int structureID, int parentClusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add a structure to a cluster as an immediate leaf.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Build the immutable clustering representation.
    build(IDBasedAssignerBuilder assignerBuilder)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Build an immutable snapshot of the clustering.
    com.chemaxon.clustering.common.IDBasedClusterBuilderSpec
    cluster(int representedClusterId)
    Deprecated, for removal: This API element is subject to removal in a future version.
    A spec for a clusterId.
    int
    clusterOf(int structureID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Look up immediate parent of a structure present in the clustering.
    void
    detachToRootCluster(int clusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Remove a cluster from its current parent cluster.
    int[]
    getAllLeaves(int clusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Return the IDs of all immediate and transitive leaves.
    int[]
    getChildClusters(int clusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Return the IDs of child cluster IDs.
    int
    getClusterRepresentant(int clusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Retrieve cluster representant ID.
    int[]
    getImmediateLeaves(int clusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Return the IDs of immediate leaves.
    int
    getParentClusterID(int clusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Looks up a clusters parent cluster ID.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Look up structure's immediate parent cluster ID.
    boolean
    hasParent(int clusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Check if a cluster has parent cluster id set.
    boolean
    isClusterRepresentantSet(int clusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Check if cluster representant is present.
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Check if the tree is empty.
    boolean
    isStructurePresent(int structureId)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Check if a given structure ID is present in the clustering.
    com.chemaxon.clustering.common.IDBasedClusterBuilderSpec
    Deprecated, for removal: This API element is subject to removal in a future version.
    Allocates a new cluster and returns a spec to it.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Convenience method.
    com.chemaxon.clustering.common.IDBasedClusterBuilderSpec
    Deprecated, for removal: This API element is subject to removal in a future version.
    Allocates a new cluster and returns a spec to it.
    void
    removeStructure(int structureID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Remove a structure from its current parent cluster.
    void
    setClusterPreferredLevel(int clusterID, double level)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set cluster level of preferred level assigner.
    void
    setClusterRepresentant(int structureID, int clusterID)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set cluster representant ID.
    void
    setLeafPreferredLevel(int leafID, double level)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set leaf level of preferred level assigner.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a detailed multiline String representation of the builder state.
    static String
    Deprecated, for removal: This API element is subject to removal in a future version.
    Utility method to create a detailed string representation of a clustering.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IDBasedHierarchicClusterBuidler

      public IDBasedHierarchicClusterBuidler(HierarchicClustering.Alignment alignment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      New builder instance.
      Parameters:
      alignment - Alignment of the clustering hierarchy
      Throws:
      LicenseException - when appropriate license is not available
  • Method Details

    • newRootAlignedIdDBasedHierarchicClusterBuilder

      public static IDBasedHierarchicClusterBuidler newRootAlignedIdDBasedHierarchicClusterBuilder()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Convenience method.
      Returns:
      new builder
    • addNewCluster

      public int addNewCluster()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Allocate a new cluster.

      Note that it is not necessary to call this method; clusters are added implicitly.

      Returns:
      ID of a new empty cluster, considered as root.
    • clusterOf

      public int clusterOf(int structureID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Look up immediate parent of a structure present in the clustering.

      Opposed to HierarchicClustering.clusterOf(java.lang.Object) this method expects the given structure to be present in the current state of the clustering.

      Parameters:
      structureID - Structure ID to look up
      Returns:
      Immediate parent cluster index of the structure
      Throws:
      IllegalArgumentException - when the given structure is not part of the clustering
    • hasParent

      public boolean hasParent(int clusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if a cluster has parent cluster id set.

      This method expects the given cluster to be part of the current state of the clusteing.

      Parameters:
      clusterID - ClusterID to look up
      Returns:
      True if a parent cluster id set, otherwise false
      Throws:
      IllegalArgumentException - when the given cluster is not part of the clustering
    • getImmediateLeaves

      public int[] getImmediateLeaves(int clusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return the IDs of immediate leaves.
      Parameters:
      clusterID - Cluster ID
      Returns:
      A (possibly) empty list of immediate leaf IDs of the given cluster
      Throws:
      IllegalArgumentException - when the given cluster is not part of the clustering
    • getAllLeaves

      public int[] getAllLeaves(int clusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return the IDs of all immediate and transitive leaves.
      Parameters:
      clusterID - Cluster ID
      Returns:
      A (possibly) empty list of immediate and transitive leaf IDs of the given cluster
      Throws:
      IllegalArgumentException - when the given cluster is not part of the clustering
    • getChildClusters

      public int[] getChildClusters(int clusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return the IDs of child cluster IDs.
      Parameters:
      clusterID - Cluster DI
      Returns:
      A (possibly) empty list of immediate children IDs of the given cluster
      Throws:
      IllegalArgumentException - when the given cluster is not part of the clustering
    • getParentClusterID

      public int getParentClusterID(int clusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Looks up a clusters parent cluster ID.
      Parameters:
      clusterID - Cluster ID to look up
      Returns:
      ID of the parent cluster
      Throws:
      IllegalArgumentException - when the given cluster is not part of the clustering or it has no parent associated
    • isStructurePresent

      public boolean isStructurePresent(int structureId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if a given structure ID is present in the clustering.
      Parameters:
      structureId - Structure ID to check
      Returns:
      true when given structure is present in the clustering
    • removeStructure

      public void removeStructure(int structureID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Remove a structure from its current parent cluster.

      This modification operation ensures valid and consistent state by throwing exception when given structure is not part of any cluster. Cluster representant references are also removed.

      Parameters:
      structureID - StructureID to remove
    • getStructureImmediateParentCluster

      public int getStructureImmediateParentCluster(int structureID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Look up structure's immediate parent cluster ID.
      Parameters:
      structureID - StructureID
      Returns:
      ClusterID of the immediate parent cluster.
      Throws:
      IllegalArgumentException - when given structure is not present
    • isEmpty

      public boolean isEmpty()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if the tree is empty.
      Returns:
      True when no structures contained
    • detachToRootCluster

      public void detachToRootCluster(int clusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Remove a cluster from its current parent cluster.

      This modification operation expects that the given cluster is a child of another cluster

      Parameters:
      clusterID - clusterID to remove
    • isClusterRepresentantSet

      public boolean isClusterRepresentantSet(int clusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if cluster representant is present.
      Parameters:
      clusterID - cluster ID
      Returns:
      true if cluster representant structure is set for the given cluster
      Throws:
      IllegalArgumentException - when given cluster is not assigned
    • getClusterRepresentant

      public int getClusterRepresentant(int clusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Retrieve cluster representant ID.
      Parameters:
      clusterID - cluster ID
      Returns:
      cluster representant structure index if set for the given cluster
      Throws:
      IllegalArgumentException - when given cluster has no cluster representant set
    • setClusterRepresentant

      public void setClusterRepresentant(int structureID, int clusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set cluster representant ID.
      Parameters:
      structureID - Cluster representant structure ID
      clusterID - Associated cluster
    • setClusterPreferredLevel

      public void setClusterPreferredLevel(int clusterID, double level)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set cluster level of preferred level assigner.

      Forwarded to IDBasedAssignerBuilder.setClusterLevel(int, double) of the optional IDBasedAssignerBuilder.

      Parameters:
      clusterID - Cluster ID
      level - Level
    • setLeafPreferredLevel

      public void setLeafPreferredLevel(int leafID, double level)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set leaf level of preferred level assigner.

      Forward to IDBasedAssignerBuilder.setLeafLevel(int, double) of the optional IDBasedAssignerBuilder.

      Parameters:
      leafID - Leaf ID
      level - Level
    • newCluster

      public com.chemaxon.clustering.common.IDBasedClusterBuilderSpec newCluster()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Allocates a new cluster and returns a spec to it.

      This method delegates to addNewCluster() then returns a wrapper for further operations.

      Returns:
      Spec for the new cluster
    • newRootCluster

      public com.chemaxon.clustering.common.IDBasedClusterBuilderSpec newRootCluster()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Allocates a new cluster and returns a spec to it.

      This method delegates to addNewCluster() then returns a wrapper for further operations.

      Returns:
      Spec for the new cluster
    • cluster

      public com.chemaxon.clustering.common.IDBasedClusterBuilderSpec cluster(int representedClusterId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      A spec for a clusterId.
      Parameters:
      representedClusterId - Cluster ID to represent
      Returns:
      Spec for the given cluster
    • addStructureToCluster

      public void addStructureToCluster(int structureID, int parentClusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add a structure to a cluster as an immediate leaf.
      Parameters:
      structureID - Structure ID to add
      parentClusterID - Associated parent cluster
      Throws:
      IllegalArgumentException - when structure is already added to another cluster
    • addChildCluster

      public void addChildCluster(int childClusterID, int parentClusterID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add a cluster to another cluster as a child cluster.
      Parameters:
      childClusterID - Cluster ID to add as a child
      parentClusterID - Associated parent cluster
      Throws:
      IllegalArgumentException - when structure is already added to another cluster
    • toDetailedString

      public String toDetailedString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a detailed multiline String representation of the builder state.
      Returns:
      Detailed multiline String representation of the current state
    • build

      public IDBasedHierarchicClustering build(IDBasedAssignerBuilder assignerBuilder)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Build an immutable snapshot of the clustering.

      Derive the preferred level assigner (HierarchicClustering.getPreferredAssigner()) from the given assigner builder.

      Parameters:
      assignerBuilder - Preferred level assignment source.
      Returns:
      A hierarchic clustering snapshot with a given suggested lebel assigner.
      Throws:
      IllegalStateException - when a preferred level info is set to any cluster or leaf
    • build

      Deprecated, for removal: This API element is subject to removal in a future version.
      Build the immutable clustering representation.

      When any level info is previously set then it will be the preferred assigner. Otherwise the preferred level assigner (returned by HierarchicClustering.getPreferredAssigner()) will be the graph depth based level assigner HierarchicClustering.unitPathAssigner().

      Returns:
      An immutable clustering representation.
    • toDetailedString

      public static String toDetailedString(IDBasedHierarchicClustering c)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Utility method to create a detailed string representation of a clustering.
      Parameters:
      c - Clustering to traverse
      Returns:
      Detailed multiline String representation