@Beta @PublicAPI public final class IDBasedClusterBuilder extends Object
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 and Description |
|---|
IDBasedClusterBuilder()
Instantiate an empty builder.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
boolean |
isRepresentantSet(int clusterId)
Check if cluster representant is set.
|
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.
|
public IDBasedClusterBuilder()
throws LicenseException
LicenseException - when appropriate license is not availablepublic int addNewCluster()
Note that it is not necessary to call this method; clusters are added implicitly.
public void updateRepresentant(int structureID,
int clusterID)
structureID - Structure to pintpoint as representantclusterID - Associated clusterpublic boolean isRepresentantSet(int clusterId)
clusterId - Cluster IDtrue when cluster representant structure is set.public void addStructureToCluster(int structureID,
int clusterID)
structureID - ID of the structure to addclusterID - ID of the cluster of the structureIllegalStateException - when structure is already a member of any other clusterpublic void addStructuresToCluster(Collection<Integer> structureIDs, int clusterID)
structureIDs - Structure IDs to addclusterID - ID of the immediate parent cluster for the structuresIllegalStateException - when a structure is already a member of any other clusterpublic void removeStructure(int structureID)
structureID - ID of the structure to addIllegalStateException - when given structure is not a member of any clusterpublic static String toDetailedString(IDBasedSingleLevelClustering clustering)
clustering - Clustering to traversepublic IDBasedSingleLevelClustering build()