jklustor-all-api-0.0.7-20140619012755 (ChemAxon)


com.chemaxon.clustering.common
Class IDBasedClusterBuilder

Object
  extended by com.chemaxon.clustering.common.IDBasedClusterBuilder

@Beta
public final class IDBasedClusterBuilder
extends Object

Builder for ID based non-hierarchic clustering.

The represented clustering have the following properties:

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.

Author:
Gabor Imre

Constructor Summary
IDBasedClusterBuilder()
          Instantiate an empty builder.
 
Method Summary
 int addNewCluster()
          Allocate a new cluster.
 void addStructuresToCluster(Collection<Integer> structureIDs, int clusterID)
          Add multiple structures to a cluster.
 void addStructureToCluster(int structureID, int clusterID)
          Set a structure to be a part of a cluster as a leaf.
 IDBasedSingleLevelClustering build()
          Build immutable clustering representation.
 void removeStructure(int structureID)
          Remove a structure from its respective cluster.
static String toDetailedString(IDBasedSingleLevelClustering clustering)
          Utility method to create a detailed string representation of a clustering.
 void updateRepresentant(int structureID, int clusterID)
          Set/update the cluster representant structure.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDBasedClusterBuilder

public IDBasedClusterBuilder()
Instantiate an empty builder.

Throws:
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.

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

updateRepresentant

public void updateRepresentant(int structureID,
                               int clusterID)
Set/update the cluster representant structure.

Parameters:
structureID - Structure to pintpoint as representant
clusterID - Associated cluster

addStructureToCluster

public void addStructureToCluster(int structureID,
                                  int clusterID)
Set a structure to be a part of a cluster as a leaf.

Parameters:
structureID - ID of the structure to add
clusterID - ID of the cluster of the structure
Throws:
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.

Parameters:
structureIDs - Structure IDs to add
clusterID - ID of the immediate parent cluster for the structures
Throws:
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.

Parameters:
structureID - ID of the structure to add
Throws:
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.

Parameters:
clustering - Clustering to traverse
Returns:
Detailed multiline String representation

build

public IDBasedSingleLevelClustering build()
Build immutable clustering representation.

Returns:
Immutable clustering representation

jklustor-all-api-0.0.7-20140619012755 (ChemAxon)