Examples of Cluster


Examples of com.heatonresearch.aifh.kmeans.Cluster

            kmeans.initForgy(observations);
            final int iterations = kmeans.iteration(1000);
            System.out.println("Finished after " + iterations + " iterations.");

            for (int i = 0; i < kmeans.getK(); i++) {
                final Cluster cluster = kmeans.getClusters().get(i);
                System.out.println("* * * Cluster #" + i);
                for (final BasicData d : cluster.getObservations()) {
                    System.out.println(d.toString());
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

Examples of com.jengine.orm.model.cluster.Cluster

        System.out.println("** Test 11: Cluster testing");

        clearData();
        loadData();

        check( new Cluster(Transaction.cls).ljoin(Book.cls).field("Transaction.id").select().one() != null );
        check( new Cluster("Transaction << Book", list("Transaction.id")).select().one() != null );
        check( new Cluster("Transaction << Book", list("Transaction.id", "Book.id", "Book.title")).select("Book.title").one() != null );
        Cluster cluster = new Cluster("Transaction << Book", list("Transaction.id", "Book.id", "Book.title")).filterCluster(" Book.title = ? ", "The Shining");
        check( cluster.select("Book.title").one() != null );
        check( new Cluster("Transaction << Book").fields("Transaction.id").select().<Long>one() == 1l );
        check( new Cluster("Transaction >> Book").fields("Transaction.id").select().list().size() == 4 );
        check( new Cluster("Transaction >> Book").fields("Transaction.id").select().list().get(3) == null );
        check( new Cluster("Transaction >> Book").fields("Transaction.id").select().<Long>one() == 1l );
        check( new Cluster("Transaction && Book").fields("Transaction.id").select().list().equals(list(1l, 2l, 3l)) );
        check( new Cluster("(Transaction && Book) << Book").fields("Transaction.id").select().list().equals(list(1l, 2l, 3l)) );
        check( new Cluster("(Transaction << Book << Library) >> Author_books << Author").fields("Author_books.id").select().one() != null );
        check( new Cluster("(Transaction << Book) >> Author_books, Author").fields("Author_books.id").select().one() != null );
        check( new Cluster("(Transaction << Book) >> Author_books, Author").alias("Author_books", "books").fields("books.id").select().one() != null );
        check( new Cluster("(Transaction << Book) >> Author_books, Author").alias(0, "t").fields("t.id").select().list().equals(list(1l, 1l, 1l)) );
        check( new Cluster("(Transaction << Book) >> Author_books, Author").restriction(0, "Transaction.book", "Book.id").fields("Transaction.id").select().list().equals(list(1l, 1l, 1l)) );
        Cluster cluster1 = new Cluster("Transaction << Book", list("Book.title"));
        check( cluster1.select().distinct("Book.title").order("Book.title").list().equals(list("The Dark Tower", "The Shining")) );
        check( cluster1.select().distinct("Book.title").order("Book.title", "DESC").page(0, 2).list().equals(list("The Shining", "The Dark Tower")));
        check( cluster1.select().distinct("Book.title").order("Book.title", "DESC").page(0, 1).list().equals(list("The Shining")));
        check( cluster1.<Long>max("Book.id") == 2l);
        check( cluster1.<Long>min("Transaction.id") == 1l);
        check( cluster1.<Double>avg("Transaction.id") == 2.0);
        check( cluster1.<Long>sum("Transaction.id") == 6);
        check( cluster1.count() == 3);
        check( cluster1.count("Book.id") == 3);
//        check( cluster1.<Long>calc("%s + 10", "Transaction.id") > 0);
//        check( new Cluster("Transaction >> Book").fields("Transaction.id", new Calc("calc_field", Long.class, "%s + 10", "Transaction.id")).select().list() != null );
        check( new Cluster("Transaction >> Book").fields("Transaction.id", new Calc("calc_field", Long.class, "%s + 10", "Transaction.id")).select().list()
                .equals(list(list(1l, 11l), list(2l, 12l), list(3l, 13l), list(null, null))) );
        check( new Cluster("Transaction >> Book").fields("Transaction.id""Book.id", "Book.title", new Max("Transaction.id")).select().group("Book.title").list()
                .equals(list(list(1l, 1l, "The Dark Tower", 1l), list(2l, 2l, "The Shining", 3l), list(null, 3l, "Vingt mille lieues sous les mers", null))) );
        check( new Cluster("Transaction >> Book").fields("Transaction.id""Book.id", "Book.title", new Max("Transaction.id")).groupCluster("Book.title").select().list()
                .equals(list(list(1l, 1l, "The Dark Tower", 1l), list(2l, 2l, "The Shining", 3l), list(null, 3l, "Vingt mille lieues sous les mers", null))) );
        check( new Cluster("Transaction << Book").select().filter("Book.id > 1").list().size() == 2);
    }
View Full Code Here

Examples of com.netflix.astyanax.Cluster

      createColumnFamily(ctx, ks, cf, comparator, keyValidator, defValidator, false);
    }
   
    public static void createColumnFamily(AstyanaxContext<Cluster> ctx,String ks, String cf, String comparator,
        String keyValidator, String defValidator, boolean dropFirst) throws ConnectionException{
        Cluster cluster = ctx.getEntity();
        KeyspaceDefinition keyspace = cluster.describeKeyspace(ks);
        if(keyspace != null){
            LOG.warn("Keyspace {} already exists.", ks);
        } else{
            LOG.warn("Creating keyspace '{}'", ks);
            KeyspaceDefinition ksDef = cluster.makeKeyspaceDefinition();
            Map<String, String> stratOptions = new HashMap<String, String>();
            stratOptions.put("replication_factor", "1");
            ksDef.setName(ks)
                    .setStrategyClass("SimpleStrategy")
                    .setStrategyOptions(stratOptions);
            cluster.addKeyspace(ksDef);
        }
       
        if (dropFirst){
            LOG.warn("Dropping {} column family.", cf);
            try{
          cluster.dropColumnFamily(ks,cf);
            } catch (BadRequestException bre){
              LOG.warn("Could not drop column family, likely doesn't exist. [" + bre.getMessage() + "]");
            }
        }
       
        LOG.warn("Adding column family: '{}'", cf);
        try {
        cluster.addColumnFamily(cluster.makeColumnFamilyDefinition().setKeyspace(ks).setName(cf).setComparatorType(comparator)
                .setKeyValidationClass(keyValidator).setDefaultValidationClass(defValidator));
        } catch (BadRequestException bre){
          LOG.warn("Could not create column family [" + bre.getMessage() + "]");
        }
    }
View Full Code Here

Examples of com.netflix.genie.common.model.Cluster

    public Cluster getCluster(final String id) throws GenieException {
        if (StringUtils.isEmpty(id)) {
            throw new GeniePreconditionException("No id entered.");
        }
        LOG.debug("Called with id " + id);
        final Cluster cluster = this.clusterRepo.findOne(id);
        if (cluster != null) {
            return cluster;
        } else {
            throw new GenieNotFoundException("No cluster with id " + id + " exists.");
        }
View Full Code Here

Examples of com.netflix.simianarmy.conformity.Cluster

    @Test
    public void testCheckSoloInstances() throws Exception {
        Set<String> list = Sets.newHashSet();
        list.add(VPC_INSTANCE_ID);
        list.add(INSTANCE_ID);
        Cluster cluster = new Cluster("SoloInstances", REGION, list);
        Conformity result = instanceInVPC.check(cluster);
        Assert.assertNotNull(result);
        Assert.assertEquals(result.getRuleId(), instanceInVPC.getName());
        Assert.assertEquals(result.getFailedComponents().size(), 1);
        Assert.assertEquals(result.getFailedComponents().iterator().next(), INSTANCE_ID);
View Full Code Here

Examples of com.ontology2.haruhi.Cluster

    @Override
    protected void _run(String[] arguments) throws Exception {
        NewPersistentClusterOptions options=extractOptions(arguments);

        Cluster cluster=options.clusterId.isEmpty() ? defaultCluster : applicationContext.getBean(options.clusterId,Cluster.class);
        if (!(cluster instanceof AmazonEMRCluster)) {
            throw new UsageException("the -clusterId must specify an Amazon EMR Cluster");
        }

        String name=((AmazonEMRCluster) cluster).createPersistentCluster("Persistent Cluster");
View Full Code Here

Examples of com.sequenceiq.cloudbreak.domain.Cluster

    @Autowired
    private JsonHelper jsonHelper;

    public Cluster convert(ClusterRequest clusterRequest) {
        Cluster cluster = new Cluster();
        try {
            cluster.setBlueprint(blueprintRepository.findOne(clusterRequest.getBlueprintId()));
        } catch (AccessDeniedException e) {
            throw new AccessDeniedException(String.format("Access to blueprint '%s' is denied or blueprint doesn't exist.", clusterRequest.getBlueprintId()), e);
        }
        cluster.setName(clusterRequest.getName());
        cluster.setStatus(Status.REQUESTED);
        cluster.setDescription(clusterRequest.getDescription());
        cluster.setEmailNeeded(clusterRequest.getEmailNeeded());
        return cluster;
    }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Cluster

  }
    }

    public static boolean isGMSAvailableAndClusterHeartbeatEnabled()
    {
  Cluster cluster = null;
  boolean result =
      (loadClass("com.sun.enterprise.ee.cms.core.GMSFactory") != null)
      && (cluster = getCluster()) != null
      && isClusterHeartbeatEnabled(cluster);
  return result;
View Full Code Here

Examples of com.sun.enterprise.ee.admin.lbadmin.beans.Cluster

        }
       
        if ((cRdrs != null) && (cRdrs.length > 0) ){
            Cluster[] cls = new Cluster[cRdrs.length];
            for (int i =0; i < cRdrs.length; i++) {
                cls[i] = new Cluster();
                cRdrs[i].accept(new ClusterVisitor(cls[i]));
            }
            _lb.setCluster(cls);
        }
    }
View Full Code Here

Examples of com.sun.hotspot.igv.layout.Cluster

    public Cluster getCluster() {
        if (getSource().getSourceNodes().size() == 0) {
            assert false : "Should never reach here, every figure must have at least one source node!";
            return null;
        } else {
            Cluster result = diagram.getBlock(diagram.getGraph().getBlock(getSource().getSourceNodes().get(0)));
            assert result != null;
            return result;
        }
    }
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.