private IList<ClusterPrototype> MergeClustersIfRequired(IEnumerable<ClusterPrototype> clusters)
{
IList<ClusterPrototype> localClusters = clusters.Where(c => c.PointCount >= settings.MinimalPointsForValidCluster).ToList();
if (localClusters.Count > 1)
{
int clusterCount;
do
{
clusterCount = localClusters.Count;
localClusters = this.mergeStrategy.MergeClustersIfRequired(localClusters);
}
while (localClusters.Count != clusterCount);
}
return localClusters.Where(c => c.PointCount <= settings.MaximalPointsForValidCluster).ToList();
}
}