com.venky.clustering.MaxClustersCreated Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Commonly used programming tasks in java
package com.venky.clustering;
import java.util.List;
public class MaxClustersCreated implements StopCriteria{
int maxClusters = 1;
public MaxClustersCreated(){
this(2);
}
public MaxClustersCreated(int maxClusters){
this.maxClusters = maxClusters;
if (maxClusters < 1) {
throw new IllegalArgumentException("MaxClusters must be a positive number");
}
}
@Override
public boolean canStop(List> currentClusters) {
return currentClusters.size() <= maxClusters ;
}
}