private Cluster<DendrogramModel> toCluster(Clustering<DendrogramModel> clustering,DBIDRef lead){
  final String name;
  if (children.size() > 1) {
    name="mrg_" + DBIDUtil.toString(lead) + "_"+ depth;
  }
 else   if (newids.size() == 1) {
    name="obj_" + DBIDUtil.toString(lead);
  }
 else   if (!Double.isNaN(depth)) {
    name="clu_" + DBIDUtil.toString(lead) + "_"+ depth;
  }
 else {
    name="clu_" + DBIDUtil.toString(lead);
  }
  Cluster<DendrogramModel> cluster=new Cluster<>(name,DBIDUtil.newArray(newids),new DendrogramModel(depth));
  for (  Cluster<DendrogramModel> child : children) {
    clustering.addChildCluster(cluster,child);
  }
  newids.clear();
  children.clear();
  return cluster;
}

private Cluster < DendrogramModel > toCluster ( Clustering < DendrogramModel > clustering , DBIDRef lead ) { final String name ; if ( children . size ( ) > 1 ) { name = "mrg_" + DBIDUtil . toString ( lead ) + "_" + depth ; } else if ( newids . size ( ) == 1 ) { name = "obj_" + DBIDUtil . toString ( lead ) ; } else if ( ! Double . isNaN ( depth ) ) { name = "clu_" + DBIDUtil . toString ( lead ) + "_" + depth ; } else { name = "clu_" + DBIDUtil . toString ( lead ) ; } Cluster < DendrogramModel > cluster = new Cluster < > ( name , DBIDUtil . newArray ( newids ) , new DendrogramModel ( depth ) ) ; for ( Cluster < DendrogramModel > child : children ) { clustering . addChildCluster ( cluster , child ) ; } newids . clear ( ) ; children . clear ( ) ; return cluster ; }
make the cluster for the given object
