Recursively step through the clusters to build the hulls.

@param clu Current cluster
@param hier Clustering hierarchy
@param hulls Hull map
487646
private DoubleObjPair<Polygon> buildHullsRecursively(Cluster<Model> clu, Hierarchy<Cluster<Model>> hier, Map<Object, DoubleObjPair<Polygon>> hulls, Relation<? extends NumberVector> coords) {
    final DBIDs ids = clu.getIDs();

    FilteredConvexHull2D hull = new FilteredConvexHull2D();
    for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
      hull.add(coords.get(iter).toArray());
    }
    double weight = ids.size();
    if(hier != null) {
      final int numc = hier.numChildren(clu);
      if(numc > 0) {
        for(It<Cluster<Model>> iter = hier.iterChildren(clu); iter.valid(); iter.advance()) {
          final Cluster<Model> iclu = iter.get();
          DoubleObjPair<Polygon> poly = hulls.get(iclu);
          if(poly == null) {
            poly = buildHullsRecursively(iclu, hier, hulls, coords);
          }
          // Add inner convex hull to outer convex hull.
          for(ArrayListIter<double[]> vi = poly.second.iter(); vi.valid(); vi.advance()) {
            hull.add(vi.get());
          }
          weight += poly.first / numc;
        }
      }
    }
    DoubleObjPair<Polygon> pair = new DoubleObjPair<>(weight, hull.getHull());
    hulls.put(clu, pair);
    return pair;
  }
848648
public void stepIn(final IonType containerType) throws IOException
    {
        userState.beforeStepIn(this, containerType);
        user.stepIn(containerType);
    }
552478
public static void applyToHierarchy (Component comp, int depth, ComponentOp op)
    {
        if (comp == null) {
            return;
        }

        op.apply(comp);
        if (comp instanceof Container && --depth >= 0) {
            Container c = (Container) comp;
            int ccount = c.getComponentCount();
            for (int ii = 0; ii < ccount; ii++) {
                applyToHierarchy(c.getComponent(ii), depth, op);
            }
        }
    }
991379
public static void validateClusterStores(final Cluster cluster,
                                             final List<StoreDefinition> storeDefs) {
        // Constructing a StoreRoutingPlan has the (desirable in this
        // case) side-effect of verifying that the store definition is congruent
        // with the cluster definition. If there are issues, exceptions are
        // thrown.
        for(StoreDefinition storeDefinition: storeDefs) {
            new StoreRoutingPlan(cluster, storeDefinition);
        }
        return;
    }
362092
@SuppressWarnings("unchecked")
    public static <T extends Node> void findNodes(List<Node> nodes, Class<T> cls, List<T> results) {
        for (Node n : nodes) {
            if (n instanceof ContainerNode) {
                findNodes(((ContainerNode) n).getNodes(), cls, results);
            }

            if (cls == n.getClass()) {
                results.add((T) n);
            }
        }
    }
497712
protected void registerSuperClassMultipleJoinedTables(ClassDescriptor cld)
    {
        /*
        arminw: Sadly, we can't map to sub class-descriptor, because it's not guaranteed
        that they exist when this method is called. Thus we map the class instance instead
        of the class-descriptor.
        */
        if(cld.getBaseClass() != null)
        {
            try
            {
                Class superClass = ClassHelper.getClass(cld.getBaseClass());
                Class currentClass = cld.getClassOfObject();
                synchronized(descriptorTable)
                {
                    List subClasses = (List) superClassMultipleJoinedTablesMap.get(superClass);
                    if(subClasses == null)
                    {
                        subClasses = new ArrayList();
                        superClassMultipleJoinedTablesMap.put(superClass,  subClasses);
                    }
                    if(!subClasses.contains(currentClass))
                    {
                        if(log.isDebugEnabled())
                        {
                            log.debug("(MultipleJoinedTables): Register sub-class '" + currentClass
                                    + "' for class '" + superClass);
                        }
                        subClasses.add(currentClass);
                    }
                }
            }
            catch(Exception e)
            {
                throw new MetadataException("Can't register super class '" + cld.getBaseClass()
                        + "' for class-descriptor: " + cld, e);
            }
        }
    }
44378
public static void validateCurrentFinalCluster(final Cluster currentCluster,
                                                   final Cluster finalCluster) {
        validateClusterPartitionCounts(currentCluster, finalCluster);
        validateClusterNodeState(currentCluster, finalCluster);

        return;
    }
410181
@Override
    public KeyComponent createClusteringColumnReferenceComponent(Facet parent, PojoBinding<?> pojoBinding, NamingStrategy namingStrategy) {
        throw new HecateException("@ClusteringColumn facet \"%s\" references class with composite keys", parent.getName());
    }
1328866
public void partition(int k) {
        double[][] reps = new double[nodes.size()][];
        int i = 0;
        for (Node neuron : nodes)
            reps[i++] = neuron.w;

        double[][] proximity = new double[nodes.size()][];
        for (i = 0; i < nodes.size(); i++) {
            proximity[i] = new double[i+1];
            for (int j = 0; j < i; j++)
                proximity[i][j] = Math.distance(reps[i], reps[j]);
        }
        
        Linkage linkage = new UPGMALinkage(proximity);
        HierarchicalClustering hc = new HierarchicalClustering(linkage);
        y = hc.partition(k);
    }
656849
public void startNewBatchForCluster(String cluster) {
        // Only start a new batch if the current one is non-empty
        PlanBatch batch = _clusterTails.get(cluster);
        if (batch != null && !batch.getItems().isEmpty()) {
            PlanBatch newBatch = new PlanBatch();
            batch.setNextBatch(newBatch);
            _clusterTails.put(cluster, newBatch);
        }
    }
224037
public void setClusters(java.util.Collection<Cluster> clusters) {
        if (clusters == null) {
            this.clusters = null;
            return;
        }

        this.clusters = new java.util.ArrayList<Cluster>(clusters);
    }
1053653
<T extends Component> List<T> getFormRowChildren(AbstractComponentContainer container, final Class<T> cls) {

        final List<T> result = Lists.newArrayList();
        CmsVaadinUtils.visitDescendants(container, new Predicate<Component>() {

            public boolean apply(Component comp) {

                if (cls.isAssignableFrom(comp.getClass())) {
                    result.add(cls.cast(comp));
                }
                return true;
            }
        });
        return result;
    }
204263
public void setDBClusters(java.util.Collection<DBCluster> dBClusters) {
        if (dBClusters == null) {
            this.dBClusters = null;
            return;
        }

        this.dBClusters = new com.amazonaws.internal.SdkInternalList<DBCluster>(dBClusters);
    }
1213569
public VisualizerContext newContext(ResultHierarchy hier, Result start) {
    Collection<Relation<?>> rels = ResultUtil.filterResults(hier, Relation.class);
    for(Relation<?> rel : rels) {
      if(samplesize == 0) {
        continue;
      }
      if(!ResultUtil.filterResults(hier, rel, SamplingResult.class).isEmpty()) {
        continue;
      }
      if(rel.size() > samplesize) {
        SamplingResult sample = new SamplingResult(rel);
        sample.setSample(DBIDUtil.randomSample(sample.getSample(), samplesize, rnd));
        ResultUtil.addChildResult(rel, sample);
      }
    }
    return new VisualizerContext(hier, start, stylelib, factories);
  }
1000252
public void setHlsManifests(java.util.Collection<HlsManifest> hlsManifests) {
        if (hlsManifests == null) {
            this.hlsManifests = null;
            return;
        }

        this.hlsManifests = new java.util.ArrayList<HlsManifest>(hlsManifests);
    }
537894
@Override
  public void processNewResult(ResultHierarchy hier, Result result) {
    // Get all new clusterings
    // TODO: handle clusterings added later, too. Can we update the result?

    List<Clustering<?>> clusterings = Clustering.getClusteringResults(result);
    // Abort if not enough clusterings to compare
    if(clusterings.size() < 2) {
      return;
    }

    // create segments
    Segments segments = new Segments(clusterings);
    hier.add(result, segments);
  }
1277210
private void initialClustering() {
		//System.out.println("INITIAL CLUSTERING CALLED");
		//printDStreamState();
		// 1. Update the density of all grids in grid_list

		updateGridListDensity();
		//printGridList();
				
		// 2. Assign each dense grid to a distinct cluster
		// and
		// 3. Label all other grids as NO_CLASS	
		Iterator<Map.Entry<DensityGrid, CharacteristicVector>> glIter = this.grid_list.entrySet().iterator();
		HashMap<DensityGrid, CharacteristicVector> newGL = new HashMap<DensityGrid, CharacteristicVector>();
		
		while(glIter.hasNext())
		{
			Map.Entry<DensityGrid, CharacteristicVector> grid = glIter.next();
			DensityGrid dg = grid.getKey();
			CharacteristicVector cvOfG = grid.getValue();

			//System.out.print(dg.toString());
			if(cvOfG.getAttribute() == DENSE)
			{
				int gridClass = this.cluster_list.size();
				cvOfG.setLabel(gridClass);
				GridCluster gc = new GridCluster ((CFCluster)dg, new ArrayList<CFCluster>(), gridClass);
				gc.addGrid(dg);
				this.cluster_list.add(gc);
				//System.out.print(" was dense (class "+gridClass+")");
			}
			else
				cvOfG.setLabel(NO_CLASS);

			//System.out.println();
			newGL.put(dg, cvOfG);
		}

		this.grid_list = newGL;
		//printGridClusters();
		
		// 4. Make changes to grid labels by doing:
		//    a. For each cluster c
		//    b. For each outside grid g of c
		//    c. For each neighbouring grid h of g
		//    d. If h belongs to c', label c and c' with 
		//       the label of the largest cluster
		//    e. Else if h is transitional, assign it to c
		//    f. While changes can be made

		boolean changesMade;

		do{	
			changesMade = adjustLabels();
		}while(changesMade);	// while changes are being made
		
		//printGridList();
		//printGridClusters();
	}