Class IDBasedClusterBuilder

  • @Beta
    public final class IDBasedClusterBuilder
    extends Object
    Builder for ID based non-hierarchic clustering. The represented clustering have the following properties:
    • Cluster and structure IDs are nonnegative integers
    • All clusters are contained from 0 ID to the highest cluster ID ever added
    • No empty clusters allowed

    Licensing: this class is part of the JKlustor suite; it can be used with valid JKlustor license.

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

    • Constructor Detail

      • IDBasedClusterBuilder

        public IDBasedClusterBuilder()
                              throws chemaxon.license.LicenseException
        Instantiate an empty builder.
        chemaxon.license.LicenseException - when appropriate license is not available
    • Method Detail

      • addNewCluster

        public int addNewCluster()
        Allocate a new cluster.

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

        ID of a new empty cluster, considered as root.
      • updateRepresentant

        public void updateRepresentant​(int structureID,
                                       int clusterID)
        Set/update the cluster representant structure.
        structureID - Structure to pintpoint as representant
        clusterID - Associated cluster
      • isRepresentantSet

        public boolean isRepresentantSet​(int clusterId)
        Check if cluster representant is set.
        clusterId - Cluster ID
        true when cluster representant structure is set.
      • addStructureToCluster

        public void addStructureToCluster​(int structureID,
                                          int clusterID)
        Set a structure to be a part of a cluster as a leaf.
        structureID - ID of the structure to add
        clusterID - ID of the cluster of the structure
        IllegalStateException - when structure is already a member of any other cluster
      • addStructuresToCluster

        public void addStructuresToCluster​(Collection<Integer> structureIDs,
                                           int clusterID)
        Add multiple structures to a cluster.
        structureIDs - Structure IDs to add
        clusterID - ID of the immediate parent cluster for the structures
        IllegalStateException - when a structure is already a member of any other cluster
      • removeStructure

        public void removeStructure​(int structureID)
        Remove a structure from its respective cluster.
        structureID - ID of the structure to add
        IllegalStateException - when given structure is not a member of any cluster
      • toDetailedString

        public static String toDetailedString​(IDBasedSingleLevelClustering clustering)
        Utility method to create a detailed string representation of a clustering.
        clustering - Clustering to traverse
        Detailed multiline String representation
      • build

        public IDBasedSingleLevelClustering build()
        Build immutable clustering representation.
        Immutable clustering representation