Package aleph.dir

Examples of aleph.dir.DirectoryManager.open()


      DirectoryManager locator = HyFlow.getLocator();
      String next = HEAD;
      String prev = null;
      boolean right = true;
      do
        Node node = (Node)locator.open(next, "s");
        if(value >= node.getValue(__transactionContext__)){
          prev = next;
          next = node.getRightChild(__transactionContext__);
          right = true;
        }else{
View Full Code Here


          next = node.getLeftChild(__transactionContext__);
          right = false;
        }
      }while(next!=null);
     
      Node prevNode = (Node)locator.open(prev);    //open previous node for write
     
      String newNodeId =  Network.getInstance().getID() + "-" + Math.random()// generate random id
      new Node(newNodeId, value)// create the node
     
      if(right)
View Full Code Here

      String next = HEAD;
      String prev = null;
      boolean right = true;
      Node node;
      do{
        node = (Node)locator.open(next, "s");
        if(value > node.getValue(__transactionContext__)){
          prev = next;
          next = node.getRightChild(__transactionContext__);
          right = true;
        }else if(value < node.getValue(__transactionContext__)){
View Full Code Here

        }else if(value < node.getValue(__transactionContext__)){
          prev = next;
          next = node.getLeftChild(__transactionContext__);
          right = false;
        }else{
          Node prevNode = (Node)locator.open(prev);    //open previous node for write
          Node deletedNode = (Node)locator.open(next)//reopen for write to be deleted
          String replacement;
          if(deletedNode.getLeftChild(__transactionContext__)==null){
  //          System.err.println("replace with right child");
            replacement = deletedNode.getRightChild(__transactionContext__);
View Full Code Here

          prev = next;
          next = node.getLeftChild(__transactionContext__);
          right = false;
        }else{
          Node prevNode = (Node)locator.open(prev);    //open previous node for write
          Node deletedNode = (Node)locator.open(next)//reopen for write to be deleted
          String replacement;
          if(deletedNode.getLeftChild(__transactionContext__)==null){
  //          System.err.println("replace with right child");
            replacement = deletedNode.getRightChild(__transactionContext__);
          }else if(deletedNode.getRightChild(__transactionContext__)==null){
View Full Code Here

            Node prevNode2 = null;
            do{
              prevNode2 = currNode2;
              replacement = next2;
             
              currNode2 = (Node)locator.open(next2, "r");
              next2 = currNode2.getLeftChild(__transactionContext__);
            }while(next2!=null);
            if(prevNode2!=null){  // disconnect replacement node from its parent
              Node prevNode2w = (Node)locator.open(prevNode2.getId())//open previous node for write
              prevNode2w.setLeftChild(currNode2.getRightChild(__transactionContext__), __transactionContext__);
View Full Code Here

             
              currNode2 = (Node)locator.open(next2, "r");
              next2 = currNode2.getLeftChild(__transactionContext__);
            }while(next2!=null);
            if(prevNode2!=null){  // disconnect replacement node from its parent
              Node prevNode2w = (Node)locator.open(prevNode2.getId())//open previous node for write
              prevNode2w.setLeftChild(currNode2.getRightChild(__transactionContext__), __transactionContext__);
            }
            Node currNode2w = (Node)locator.open(replacement)//replace
            currNode2w.setLeftChild(node.getLeftChild(__transactionContext__), __transactionContext__);
            if(!replacement.equals(node.getRightChild(__transactionContext__)))
View Full Code Here

            }while(next2!=null);
            if(prevNode2!=null){  // disconnect replacement node from its parent
              Node prevNode2w = (Node)locator.open(prevNode2.getId())//open previous node for write
              prevNode2w.setLeftChild(currNode2.getRightChild(__transactionContext__), __transactionContext__);
            }
            Node currNode2w = (Node)locator.open(replacement)//replace
            currNode2w.setLeftChild(node.getLeftChild(__transactionContext__), __transactionContext__);
            if(!replacement.equals(node.getRightChild(__transactionContext__)))
              currNode2w.setRightChild(node.getRightChild(__transactionContext__), __transactionContext__);
          }
          if(right)
View Full Code Here

          locator.delete(deletedNode);
          return true;
        }
      }while(next!=null);
  //    System.err.println("Nothing to Delete....");
      Node last = ((Node)locator.open(node.getId(), "r"))// reopen last node for read
      last.getValue(__transactionContext__)// force add to the readset
      Logger.debug("Nothing to Delete....");
      return false;
    } finally{
      try {
View Full Code Here

    String prev = null;
    Node node = null;
    try{
      String next = HEAD;
      do
        node = (Node)locator.open(next, "s");
        if(value > node.getValue(__transactionContext__)){
          prev = next;
          next = node.getRightChild(__transactionContext__);
        }else if(value < node.getValue(__transactionContext__)){
          prev = next;
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.