Examples of IClusterLevel


Examples of primitives.cluster.IClusterLevel

  }
 
  private static IClusterLevel lowestCommonAncestor(Node n1, Node n2, IClusterLevel tree){
    Stack<IClusterLevel> toLookAt = new Stack<IClusterLevel>();
    toLookAt.push(tree);
    IClusterLevel deepest = tree;
    while(!toLookAt.isEmpty()){
      IClusterLevel current = toLookAt.pop();
      if(!current.encapsulates()) continue;
      ClusterNode cast = (ClusterNode)current;
      if(current.contains(n1) && current.contains(n2)){
        deepest = current;
        for(IClusterLevel c : cast.getChildren())
          toLookAt.push(c);
      }
     
View Full Code Here

Examples of primitives.cluster.IClusterLevel

  // TODO: make this throw an error when tree is empty.

  public void execute(VecInstruction i) {
    VecInstruction nextInstruction = i;
    IClusterLevel c1, c2;
    switch (nextInstruction.getType()) {
    case MERGE:
      if (nextInstruction.getOperand1() == nextInstruction.getOperand2())
        break;
                        if (nextInstruction.getOperand1() == 0
View Full Code Here

Examples of primitives.cluster.IClusterLevel

    assertTrue(c.getNodes().contains(b));
  }

  @Test
  public void testTree(){
    IClusterLevel leaf1 = new ClusterLeaf();
    leaf1.addNode(b);
    ClusterLeaf leaf2 = new ClusterLeaf();
    leaf2.addNode(a);
    ClusterNode head = new ClusterNode();
    ClusterNode body = new ClusterNode();
    head.addChild(body);
    head.addChild(leaf1);
    body.addChild(leaf2);
    IClusterLevel leaf3 = new ClusterLeaf();
    leaf3.addNode(outsideIn);
    body.addChild(leaf3);
    assertTrue(head.contains(a));
    assertTrue(head.contains(b));
    assertTrue(head.contains(outsideIn));
    head.addNode(outsideOut);
View Full Code Here

Examples of primitives.cluster.IClusterLevel

    g.addNode(c);
    g.addNode(d);
    g.addNode(e);
    g.addNode(f);
    ch = new ClusterHead(g);
    IClusterLevel c1, c2;
    try {
      // c1 = ClusterUtils.lookup(ch, 0);
      // c2 = ClusterUtils.lookup(ch, 1);
      // ClusterUtils.merge(ch, c1, c2);
    } catch (Exception e) {
View Full Code Here

Examples of primitives.cluster.IClusterLevel

    return wastage;
  }

    public void execute(StackInstruction nextInstruction) {

  IClusterLevel c1, c2;
  int op = nextInstruction.getOperand();
  switch (nextInstruction.getType()) {

      // PUSH n
      // where n is a base cluster ID
      // stack = [clusternode $n]:stack
      case PUSH:


    //don't do anything if the operand has already been put on the stack at some point.
    if(seen.contains(op)){
      wastage++;
      break;
    }


    if (op == 0) {
        Logger.getLogger(StackInterpreter.class.getName()).log(Level.INFO, "Attempt to merge with head of cluster tree aborted");
        break;
    }
    try {
        c1 = ClusterUtils.lookupIndexInTree(op, tree);
    } catch (UndefinedIndexException e) {
        Logger.getLogger(StackInterpreter.class.getName()).log(Level.WARNING, "Operand of PUSH not found", e);
        c1 = e.getDefaultNode();

    }


    seen.add(op);
    stack.push(c1);

    break;
      case CLUSTER:
    //take the two elements from the stack
    //they are now in a cluster.
    //push that cluster back onto the stack.

               
    if (stack.size() < 2) {
                        //can't cluster less than 2 items. treat this as a PUSH operand
                   
                    //don't do anything if the operand's been seen.
                    if(seen.contains(op)){
                            wastage++;
                            break;
                    }

                    try {
                                c1 = ClusterUtils.lookupIndexInTree(op, tree);
                    } catch (UndefinedIndexException e) {
                                Logger.getLogger(StackInterpreter.class.getName()).log(Level.WARNING, "Operand of PUSH not found", e);
                                c1 = e.getDefaultNode();
                    }


                    stack.push(c1);
                    seen.add(op);
     
        break;
    }

    c1 = stack.pop();
    c2 = stack.pop();



    if (c1.equals(c2)) {
        break;
    }


View Full Code Here

Examples of primitives.cluster.IClusterLevel

        for(String nodeName : assignments.keySet()){
              String targetCluster = assignments.get(nodeName);
            try{
             

                IClusterLevel home = ClusterUtils.lookup(nodes.get(nodeName), ret);
                IClusterLevel destination =
                        ClusterUtils.lookup
                            (clusterSeeds.get(targetCluster), ret);

                //Logger.getLogger(SILReader.class.getName()).log(Level.INFO, String.format("IDs for home: %s, destination:%s",home.getIDs(),destination.getIDs()));
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.