Package primitives.cluster

Examples of primitives.cluster.ClusterNode


  }
       
        @Test
        public void testIsCyclic(){
           
            ClusterNode a = new ClusterNode();
            ClusterNode b = new ClusterNode();
            ClusterNode c = new ClusterNode();
           
            a.addChild(b);
            b.addChild(c);
            c.addChild(b);
           
            assertTrue(ClusterUtils.isCyclic(a));
            assertTrue(ClusterUtils.isCyclic(b));
            assertTrue(ClusterUtils.isCyclic(c));
           
            assertFalse(ClusterUtils.isCyclic(new ClusterNode()));
           
        }
View Full Code Here






    ClusterNode parent1, parent2;

    parent1 = ClusterUtils.findParent(c1, tree);
    parent2 = ClusterUtils.findParent(c2, tree);
   
    if(parent1 == parent2 && parent1 != tree){
      break;
    }

    ClusterNode newParent = ClusterUtils.addEmptyIgnoreID(tree, tree);

    newParent.addChild(c1);
    newParent.addChild(c2);
   
    ClusterUtils.move(c1, parent1, newParent, tree, false);
    ClusterUtils.move(c2, parent2, newParent, tree, false);

    Logger.getLogger(StackInterpreter.class.getName()).log(Level.FINEST, String.format("CLUSTER (%s) (%s)", c1, c2));
View Full Code Here

      return String.format("subgraph \"cluster%s\"{\n%s\n}", name, writeCluster(l));
    }

        int c = 0;
        int num = 0;
        ClusterNode cl = (ClusterNode) l;
        String subMods = "";
    //if there is only one child of this cluster then don't print out a box around a box
    if(cl.getChildren().size() == 1){
      //Using Set there is no get so iterate over the 1 element set:
      for(IClusterLevel el: cl.getChildren()){
        return writeCluster(el,name);
      }
    }

        for (IClusterLevel el : cl.getChildren()) {

            if (!el.encapsulates()) {
                c++;
            }
        }

   

        for (IClusterLevel el : cl.getChildren()) {
            String subMod = "";
            //if (!el.encapsulates() && c == 1) {
                // don't do anything, there's more than one clusterleaf
                // so they'll be printed as normal.
               
View Full Code Here

        }
       
        goodTree = new ClusterHead();
       
        for(Node n: g.getNodes()){
            ClusterNode cn = new ClusterNode();
            cn.addNode(n);
            goodTree.addChild(cn);
        }
       
        badTree = new ClusterHead();
       
        for(Node n: g.getNodes()){
            ClusterNode cn = new ClusterNode();
            cn.addNode(n);
            badTree.addChild(cn);
        }
        ClusterNode dummy = new ClusterNode();
        badTree.addChild(dummy);
       
        goodInstance = new BunchTurboMQFitnessFunction();
        badInstance = new BunchTurboMQFitnessFunction();
       
View Full Code Here

 
  @Test
  public void testOneSmallerComponentOneTreeLevel(){
    goodTree = new ClusterHead();
       
        ClusterNode mainThree = new ClusterNode();
    mainThree.addNode(nodes.get(0));
    mainThree.addNode(nodes.get(1));
    mainThree.addNode(nodes.get(2));
   
    ClusterNode separate = new ClusterNode();
    separate.addNode(nodes.get(3));
   
    goodTree.addChild(mainThree);
    goodTree.addChild(separate);
    groovyVersion.setTree(goodTree);
        javaVersion.setTree(goodTree);
View Full Code Here

 
    @Test
  public void testTwoOneElementClustersOneLevel(){
    goodTree = new ClusterHead();
       
        ClusterNode c1 = new ClusterNode();
    c1.addNode(nodes.get(0));
    c1.addNode(nodes.get(1));
   
    ClusterNode c2 = new ClusterNode();
    c2.addNode(nodes.get(2));
   
    ClusterNode separate = new ClusterNode();
    separate.addNode(nodes.get(3));
   
    goodTree.addChild(c1);
    goodTree.addChild(c2);
    goodTree.addChild(separate);
    groovyVersion.setTree(goodTree);
View Full Code Here

 
  @Test
  public void testTwoLevelClustersUnbalanced(){
    goodTree = new ClusterHead();
       
        ClusterNode c1 = new ClusterNode();
    c1.addNode(nodes.get(0));
    c1.addNode(nodes.get(1));
   
    ClusterNode c2 = new ClusterNode();
    c2.addNode(nodes.get(2));
   
    ClusterNode parentOfC1And2 = new ClusterNode();
    parentOfC1And2.addChild(c2);
    parentOfC1And2.addChild(c1);
   
   
    ClusterNode separate = new ClusterNode();
    separate.addNode(nodes.get(3));
   
    goodTree.addChild(parentOfC1And2);
    goodTree.addChild(separate);
    groovyVersion.setTree(goodTree);
        javaVersion.setTree(goodTree);
View Full Code Here

 
    @Test
  public void twoLevelBalancedClusters(){
    goodTree = new ClusterHead();
       
        ClusterNode c1 = new ClusterNode();
    c1.addNode(nodes.get(0));
    c1.addNode(nodes.get(1));
   
    ClusterNode c2 = new ClusterNode();
    c2.addNode(nodes.get(2));
   
    ClusterNode parentOfC1And2 = new ClusterNode();
    parentOfC1And2.addChild(c2);
    parentOfC1And2.addChild(c1);
   
   
    ClusterNode separate = new ClusterNode();
    separate.addNode(nodes.get(3));
   
    goodTree.addChild(parentOfC1And2);
   
    ClusterNode parentOfSeparate = new ClusterNode();
    parentOfSeparate.addChild(separate);
   
    goodTree.addChild(parentOfSeparate);
    groovyVersion.setTree(goodTree);
        javaVersion.setTree(goodTree);
   
View Full Code Here

TOP

Related Classes of primitives.cluster.ClusterNode

Copyright © 2018 www.massapicom. 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.