Examples of Cluster


Examples of com.tangosol.net.Cluster

  private void initTypeMap() {
    if (USE_PUBLIC_CACHE_CONFIG) {
      typeMap = CacheFactory.getCache(AUTO_POF_MAPPING);
    }
    else {
      Cluster cluster = CacheFactory.getCluster();
      if (cluster.getServiceInfo(AUTO_POF_SERVICE) != null) {
        CacheService service = (CacheService) cluster.getService(AUTO_POF_SERVICE);
        typeMap = service.ensureCache(AUTO_POF_MAPPING, null);
      }
      else {
        XmlElement xml = XmlHelper.loadXml(XML_FRAGMENT);
        typeMap = new DefaultConfigurableCacheFactory(xml).ensureCache(AUTO_POF_MAPPING, null);
View Full Code Here

Examples of com.taobao.metamorphosis.cluster.Cluster

     *
     * @param zkClient
     * @return
     */
    public Cluster getCluster() {
        final Cluster cluster = new Cluster();
        final List<String> nodes = ZkUtils.getChildren(this.zkClient, this.brokerIdsPath);
        for (final String node : nodes) {
            // String brokerZKString = readData(zkClient, brokerIdsPath + "/" +
            // node);
            final int brokerId = Integer.parseInt(node);
            final Set<Broker> brokers = this.getBrokersById(brokerId);
            if (brokers != null && !brokers.isEmpty()) {
                cluster.addBroker(brokerId, brokers);
            }
        }
        return cluster;
    }
View Full Code Here

Examples of com.threerings.whirled.spot.data.Cluster

            return false;
        }

        // if this is a brand new cluster, just make it 2x2 and be done
        // with it
        Cluster cl = clrec.getCluster();
        if (cl.width == 0) {
            cl.width = 2;
            cl.height = 2;
//             Log.info("Created new cluster for " + body.who() +
//                      " (" + cl + ").");
            return true;
        }

//         Log.info("Maybe adding "  + body.who() + " to " + cl + ".");

        // if the cluster is already big enough, we're groovy
        int target = TARGET_SIZE[clrec.size()+1];
        if (cl.width >= target) {
            return true;
        }

        // make an expanded footprint and try to fit it somewhere
        int expand = target-cl.width;
        Rectangle rect = null;
        for (int ii = 0; ii < X_OFF.length; ii++) {
            rect = new Rectangle(cl.x + expand*X_OFF[ii],
                                 cl.y + expand*Y_OFF[ii],
                                 cl.width+expand, cl.height+expand);

            // if this rect overlaps objects, other clusters, portals or
            // impassable tiles, it's no good
            if (checkIntersects(_ssobj.clusters, rect, cl) ||
                checkIntersects(_footprints, rect, cl) ||
                checkPortals(rect) || checkViolatesPassability(rect)) {
                rect = null;
            } else {
                break;
            }
        }

        // if we couldn't expand in any direction, it's no go
        if (rect == null) {
//            Log.info("Couldn't expand cluster " + cl + ".");
            return false;
        }

        // now look to see if we just expanded our cluster over top of any
        // unsuspecting standers by and if so, attempt to subsume them
        for (int bodyOid : _loners.keySet()) {
            // skip ourselves
            if (bodyOid == body.getOid()) {
                continue;
            }

            // do the right thing with a person standing right on the
            // cluster (they're the person we're clustering with)
            Rectangle trect = _loners.get(bodyOid);
            if (trect.equals(cl)) {
                continue;
            }

            if (trect.intersects(rect)) {
                // make sure this person isn't already in our cluster
                ClusterObject clobj = clrec.getClusterObject();
                if (clobj != null && clobj.occupants.contains(bodyOid)) {
                    log.warning("Ignoring stale occupant [where=" + where() +
                                ", cluster=" + cl + ", occ=" + bodyOid + "].");
                    continue;
                }

                // make sure the subsumee exists
                final BodyObject bobj = (BodyObject)_omgr.getObject(bodyOid);
                if (bobj == null) {
                    log.warning("Can't subsume disappeared body " +
                                "[where=" + where() + ", cluster=" + cl +
                                ", boid=" + bodyOid + "].");
                    continue;
                }

                // we subsume nearby pirates by queueing up their addition
                // to our cluster to be processed after we finish adding
                // ourselves to this cluster
                final ClusterRecord fclrec = clrec;
                _omgr.postRunnable(new Runnable() {
                    public void run () {
                        try {
                            log.info("Subsuming " + bobj.who() +
                                     " into " + fclrec.getCluster() + ".");
                            fclrec.addBody(bobj);

                        } catch (InvocationException ie) {
                            log.info("Unable to subsume neighbor " +
                                     "[cluster=" + fclrec.getCluster() +
                                     ", neighbor=" + bobj.who() +
                                     ", cause=" + ie.getMessage() + "].");
                        }
                    }
                });
            }
        }

//         Log.info("Expanding cluster [cluster=" + cl +
//                  ", rect=" + rect + "].");
        cl.setBounds(rect);

        return true;
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.driver.Cluster

            final String host = args.length == 0 ? "localhost" : args[0];

            final int clients = 2;
            final int requests = 10000;
            final Cluster cluster = Cluster.build(host)
                    .minConnectionPoolSize(64)
                    .maxConnectionPoolSize(128)
                    .nioPoolSize(clients)
                    .workerPoolSize(clients * 4).create();

            // let all the clients fully init before starting to send messages
            final CyclicBarrier barrier = new CyclicBarrier(clients);

            final List<Thread> threads = IntStream.range(0, clients).mapToObj(t -> new Thread(() -> {
                try {
                    final CountDownLatch latch = new CountDownLatch(requests);

                    final Client client = cluster.connect();
                    client.init();

                    barrier.await();
                    final long start = System.nanoTime();

View Full Code Here

Examples of com.twitter.cassie.Cluster

public class ClusterTest {
  public Cluster cluster;

  @Before
  public void before() throws Exception {
    cluster = new Cluster("host1,host2", NullStatsReceiver$.MODULE$).mapHostsEvery(new Duration(0));
  }
View Full Code Here

Examples of edu.gslis.ttg.clusters.Cluster

        clusterMembership.put(topic, new Clusters());
        JSONArray clusters = (JSONArray) ((JSONObject) topicObj.get(topic)).get("clusters");
        Iterator<JSONArray> clusterIt = clusters.iterator();
        while (clusterIt.hasNext()) { // for each cluster in the topic
          JSONArray cluster = (JSONArray) clusterIt.next();
          Cluster c = new Cluster();
          Iterator<String> clusterMemberIt = cluster.iterator();
          while (clusterMemberIt.hasNext()) { // for each docId in the cluster
            String member = clusterMemberIt.next();
            long memberId = Long.parseLong(member);
            c.add(memberId);
          }
          clusterMembership.get(topic).add(c);
        }
      }
    } catch (Exception e) {
      err.println("Error reading training data.");
      e.printStackTrace();
      System.exit(-1);
    }
   
    // instantiate search client
    TrecSearchThriftClient client = new TrecSearchThriftClient(params.getParamValue(HOST_OPTION),
        trainingPort, group, token);

    SimpleSearcher searcher = new SimpleSearcher(client, numResults);
   
    err.println("=== Train Queries ===");
   
    List<Double> thresholds = new ArrayList<Double>();
    double averageThreshold = 0;
    Iterator<GQuery> queryIterator = trainingQueries.iterator();
    while(queryIterator.hasNext()) {
      GQuery query = queryIterator.next();
     
      Map<Long, TResult> seenResults = searcher.search(query);
     
      SimpleJaccardClusterer clusterer = new SimpleJaccardClusterer(new ArrayList<TResult>(seenResults.values()));
     
      // sweep through jaccard steps, calculating F1
      double maxF1 = 0;
      double maxF1Threshold = 1;
      for (double j = 1.0; j >= 0.0; j -= stepSize) { // for each jaccard threshold step
        Clusters clusters = clusterer.cluster(j);
       
        // all clusters are created now, get a finalized set of results
        Set<Long> allResults = new HashSet<Long>(seenResults.keySet());
        allResults.removeAll(clusters.getAllClusteredResults()); // allResults includes unclustered plus one representative from each cluster
        for (Cluster c : clusters) {
          allResults.add(c.getFirstMember());
        }
       
        // calculate f1 on the finalized set
        Clusters seenClusters = new Clusters();
        Clusters trueClusters = clusterMembership.get(query.getTitle());
        Iterator<Long> resultIt = allResults.iterator();
        while (resultIt.hasNext()) {
          long result = resultIt.next();
          Cluster trueCluster = trueClusters.findCluster(result);
          if (trueCluster != null) { // if it is relevant, it will have a true cluster; if this is null, it's non-relevant
            seenClusters.add(trueCluster);
          }
        }
       
View Full Code Here

Examples of flex.messaging.cluster.Cluster

    {
        ClusterManager clm = getMessageBroker().getClusterManager();
        String serviceType = getClass().getName();
        MessageDestination dest = (MessageDestination) getDestination(destinationId);

        Cluster cluster = clm.getCluster(serviceType, destinationId);
        if (cluster != null)
            cluster.addRemoveNodeListener(dest.getRemoteSubscriptionManager());

        List members = clm.getClusterMemberAddresses(serviceType, destinationId);
        for (int i = 0; i < members.size(); i++)
        {
            Object addr = members.get(i);
View Full Code Here

Examples of image.processing.patterns.cluster.Cluster

               
    // SPECIAL CASE: If only one vector
    if (vectors.size() == 1) {
      // Create a single cluster and return it
      DoubleArray vector = vectors.get(0);
      Cluster cluster = new Cluster(vectorsSize);
      cluster.addVector(vector);
      clusters.add(cluster);
      return clusters;
    }
   
    // (1) Randomly generate k empty clusters with a random mean (cluster
    // center)
    for(int i=0; i< k; i++){
      DoubleArray meanVector = generateRandomVector(minValue, maxValue, vectorsSize);
      Cluster cluster = new Cluster(vectorsSize);
      cluster.setMean(meanVector);
      clusters.add(cluster);
    }

    // (2) Repeat the two next steps until the assignment hasn't changed
    boolean changed;
    while(true) {
      iterationCount++;
      changed = false;
      // (2.1) Assign each point to the nearest cluster center.

      // / for each vector
      for (DoubleArray vector : vectors) {
        // find the nearest cluster and the cluster containing the item
        Cluster nearestCluster = null;
        Cluster containingCluster = null;
        double distanceToNearestCluster = Double.MAX_VALUE;

        // for each cluster
        for (Cluster cluster : clusters) {
          // calculate the distance of the cluster mean to the vector
          double distance = euclideanDistance(cluster.getmean(), vector);
          // if it is the smallest distance until now, record this cluster
          // and the distance
          if (distance < distanceToNearestCluster) {
            nearestCluster = cluster;
            distanceToNearestCluster = distance;
          }
          // if the cluster contain the vector already,
          // remember that too!
          if (cluster.contains(vector)) {
            containingCluster = cluster;
          }
        }

        // if the nearest cluster is not the cluster containing
        // the vector
        if (containingCluster != nearestCluster) {
          // remove the vector from the containing cluster
          if (containingCluster != null) {
            containingCluster.remove(vector);
          }
          // add the vector to the nearest cluster
          nearestCluster.addVector(vector);
          changed = true;
        }
View Full Code Here

Examples of io.s4.comm.util.ConfigParser.Cluster

            String clusterName, ClusterType clusterType, boolean isStatic) {
        ConfigParser parser = new ConfigParser();
        ConfigParser.Config config = parser.parse(configFilename);

        // find the requested cluster
        Cluster cluster = null;
        for (Cluster checkCluster : config.getClusters()) {
            if (checkCluster.getName().equals(clusterName)
                    && checkCluster.getType().equals(clusterType)) {
                cluster = checkCluster;
                break;
View Full Code Here

Examples of lcmc.cluster.domain.Cluster

        return (HostBrowser) super.getBrowser();
    }

    @Override
    public ImageIcon getMenuIcon(final Application.RunMode runMode) {
        final Cluster cl = host.getCluster();
        if (cl != null) {
            return HostBrowser.HOST_IN_CLUSTER_ICON_RIGHT_SMALL;
        }
        return HostBrowser.HOST_ICON;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.