Creates the mapping of classes to clusters,
it is public so it can be called forcibly
which will be handy if it's done in some
cache-warmup task.
186542
public function generateMap()
    {
        $map = array();
        $database = $this->binding->getDatabase()->getData();

        foreach ($database->classes as $class) {
            $map[$class->name] = $class->clusters;
        }

        $this->map = $map;
        $this->cache->save($this->getCacheKey(), $map);
    }
957051
def _build_mappings(
        self, classes: Sequence[type]
    ) -> Tuple[Mapping[type, Sequence[type]], Mapping[type, Sequence[type]]]:
        
        parents_to_children: MutableMapping[type, Set[type]] = {}
        children_to_parents: MutableMapping[type, Set[type]] = {}
        visited_classes: Set[type] = set()
        class_stack = list(classes)
        while class_stack:
            class_ = class_stack.pop()
            if class_ in visited_classes:
                continue
            visited_classes.add(class_)
            for base in class_.__bases__:
                if base not in visited_classes:
                    class_stack.append(base)
                parents_to_children.setdefault(base, set()).add(class_)
                children_to_parents.setdefault(class_, set()).add(base)
        sorted_parents_to_children: MutableMapping[
            type, List[type]
        ] = collections.OrderedDict()
        for parent, children in sorted(
            parents_to_children.items(), key=lambda x: (x[0].__module__, x[0].__name__)
        ):
            sorted_parents_to_children[parent] = sorted(
                children, key=lambda x: (x.__module__, x.__name__)
            )
        sorted_children_to_parents: MutableMapping[
            type, List[type]
        ] = collections.OrderedDict()
        for child, parents in sorted(
            children_to_parents.items(), key=lambda x: (x[0].__module__, x[0].__name__)
        ):
            sorted_children_to_parents[child] = sorted(
                parents, key=lambda x: (x.__module__, x.__name__)
            )
        return sorted_parents_to_children, sorted_children_to_parents
796008
@Override
	public Map<Object, Object> getCachableMap(final Class<?> clas) {
		this.logger.debug("@getCachableMap for class ", clas.getName());
		Map<Object, Object> map = this.cachablesMaps.get(clas);
		if (map == null) {
			this.logger.debug("Cachable map not found , create one");
			map = new HashMap<>();
			this.cachablesMaps.put(clas, map);
		} else {
			// logger.debug("map found : ".concat(map.keySet().toString()));
		}
		return map;
	}
395294
private MultiThreadedServiceFactory<AuthDataStore> createDataStoreServiceFactory(String cluster, MetricRegistry metricRegistry) {
        HttpClientConfiguration clientConfig = new HttpClientConfiguration();
        clientConfig.setKeepAlive(Duration.seconds(1));
        clientConfig.setConnectionTimeout(Duration.seconds(10));
        clientConfig.setTimeout(Duration.minutes(5));

        return DataStoreClientFactory.forClusterAndHttpConfiguration(cluster, clientConfig, metricRegistry);
    }
1361678
private Mapper createMapper(Type type) {
    lock.lock();
    try {
      Mapper mapper = cache.get(type);
      if (mapper != null) {
        return mapper;
      }
      if (type instanceof Class) {
        mapper = createMapper((Class<?>) type);
      } else if (type instanceof ParameterizedType) {
        mapper = createMapper((ParameterizedType) type);
      } else {
        throw new IllegalArgumentException(
            String.format("Type %s is neither a Class nor ParameterizedType", type));
      }
      cache.put(type, mapper);
      return mapper;
    } finally {
      lock.unlock();
    }
  }
1200842
public <E extends Edge> MultiMap<Integer,Integer> cluster(
                      final Graph<E> graph, int numClusters, Properties props) {
        return singleLink(graph, numClusters);
        // throw new Error();
    }
1343327
function cluster(points) {
    // number of clusters has to be smaller or equal the number of data points
    if (points.length < k) {
      throw 'Too many clusters';
    }

    // create the initial clusters
    var clusters = chooseInitialCenters(points);

    // create an array containing the latest assignment of a point to a cluster
    // no need to initialize the array, as it will be filled with the first assignment
    var assignments = new Int32Array(points.length);
    assignPointsToClusters(clusters, points, assignments);
    // iterate through updating the centers until we're done
    var max = (maxIterations < 0) ? Number.MAX_VALUE : maxIterations;
    for (var count = 0; count < max; count++) {
      var emptyCluster = false;
      var newClusters = [];
      for (var clusterIndex = 0; clusterIndex < clusters.length; clusterIndex++) {
        var cluster = clusters[clusterIndex];
        var newCenter;
        if (cluster.getPoints().length === 0) {
          newCenter = getPointFromLargestVarianceCluster(clusters);
          emptyCluster = true;
        } else {
          newCenter = centroidOf(cluster.getPoints(), cluster.getCenter().getPoint().size());
        }
        newClusters.push(new CentroidCluster(newCenter));
      }
      var changes = assignPointsToClusters(newClusters, points, assignments);
      clusters = newClusters;

      // if there were no more changes in the point-to-cluster assignment
      // and there are no empty clusters left, return the current clusters
      if (changes === 0 && !emptyCluster) {
        return clusters;
      }
    }
    return clusters;
  }
1068564
function Cluster(markerClusterer) {
  this.markerClusterer_ = markerClusterer;
  this.map_ = markerClusterer.getMap();
  this.gridSize_ = markerClusterer.getGridSize();
  this.minClusterSize_ = markerClusterer.getMinClusterSize();
  this.averageCenter_ = markerClusterer.isAverageCenter();
  this.center_ = null;
  this.markers_ = [];
  this.bounds_ = null;
  this.clusterIcon_ = new ClusterIcon(this, markerClusterer.getStyles(),
      markerClusterer.getGridSize());
}
1114545
def describe_cache_clusters(name=None, conn=None, region=None, key=None,
                            keyid=None, profile=None, **args):
    '''
    
    '''
    return _describe_resource(name=name, name_param='CacheClusterId', res_type='cache_cluster',
                              info_node='CacheClusters', conn=conn, region=region, key=key,
                              keyid=keyid, profile=profile, **args)
733093
private Map<Key, Array> store(Class clazz) {
	Method[] methods = clazz.getMethods();
	Map<Key, Array> methodsMap = new ConcurrentHashMap<Key, Array>();
	for (int i = 0; i < methods.length; i++) {
	    storeMethod(methods[i], methodsMap);

	}
	map.put(clazz, methodsMap);
	return methodsMap;
    }
1105919
public <T> Mapping<T> getMapping(Class<T> clazz) {
        return (cache != null) ? cache.getMapping(clazz, annotationSet)
                : new Mapping<T>(clazz, annotationSet);
    }
1346435
private ObjectMapper createObjectMapper() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new JodaModule());
        mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
        return mapper;
    }
278847
def allocClusters(start, num = 1)
      first = 0; clus = 0
      if start == 0 # Start chain.
        first = getNextAvailableCluster(@rootCluster)
        putFatEntry(first, CC_END_MARK)
        clus = first; num -= 1
      else # Allocate on chain - seek to end.
        clus = start
        # while (nxt = getFatEntry(clus)) <= CC_END_OF_CHAIN do clus = nxt end
        loop do
          nxt = getFatEntry(clus)
          break if nxt > CC_END_OF_CHAIN
          clus = nxt
        end
      end
      # Allocate num clusters, put end mark at end.
      num.times do
        nxt = getNextAvailableCluster(clus)
        first = nxt if first == 0
        putFatEntry(clus, nxt)
        putCluster(nxt, MemoryBuffer.create(@bytesPerCluster))
        clus = nxt
        putFatEntry(clus, CC_END_MARK)
      end
      first
    end
40605
private void createClassLoader() {
        if (!Utils.isNullOrEmpty(settings.getJarFiles())) {
            try {
                String[] files = settings.getJarFiles().split(";");
                List<URL> urls = newArrayList();
                for (String path : files) {
                    File file = new File(path);
                    if (file.isFile()) {
                        urls.add(file.toURI().toURL());
                    }
                }
                classLoader = new Java4CppClassLoader(urls.toArray(new URL[files.length]), classLoader);
            } catch (Exception e) {
                throw new RuntimeException("Failed to load jar " + e.getMessage());
            }
        }
    }
134307
def classes_to_clusters(self):
        
        array = javabridge.call(self.jobject, "getClassesToClusters", "()[I")
        if array is None:
            return None
        else:
            return javabridge.get_env().get_int_array_elements(array)
827627
@Override
    protected Map createInstance() {
        if (applicationContext.containsBean(UrlMappingFactoryBean.URL_MAP_BEAN)) {
            Object o = applicationContext.getBean(UrlMappingFactoryBean.URL_MAP_BEAN);
            if (o instanceof Map) {
                mappings.putAll((Map)o);
            }
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("[UrlMappingFactoryBean] Creating URL mappings as...");
            for (Object key : mappings.keySet()) {
                LOG.debug("[UrlMappingFactoryBean] " + key + "=" + mappings.get(key));
            }
        }
        return mappings;
    }
441212
@SuppressWarnings("unchecked")
	public static <K, V> Map<K, V> createMap(Class<?> mapType) {
		if (mapType.isAssignableFrom(AbstractMap.class)) {
			return new HashMap<>();
		} else {
			return (Map<K, V>) ReflectUtil.newInstance(mapType);
		}
	}