public boolean insertItem(BPTreeNodeItem item){ // Quick implementation: assumes all keys are inserted in rank order // todo: verify if need to compare key and insert at rank location childItems.add((BPTreeChildNodeItem)item ); BPTreeNode childNode = ((BPTreeChildNodeItem)item).getChildNode(); // Note: assumes rank order insertions if(childItems.size() == 1 ){ lowestChromKey = childNode.getLowestChromKey(); lowestChromID = childNode.getLowestChromID(); } else { highestChromKey = childNode.getHighestChromKey(); highestChromID = childNode.getHighestChromID(); } return true; // success }
public void print() { log.debug("B+ Tree child node " + itemIndex); log.debug("Key value = " + chromKey); // recursively print chid node items childNode.printItems(); }
public void findAllChromosomeNames( BPTreeNode thisNode, ArrayList<String> chromosomeList){ // search down the tree recursively starting with the root node if(thisNode.isLeaf()) { // add all leaf names int nLeaves = thisNode.getItemCount(); for(int index = 0; index < nLeaves; ++index){ BPTreeLeafNodeItem leaf = (BPTreeLeafNodeItem)thisNode.getItem(index); chromosomeList.add(leaf.getChromKey()); } } else { // get all child nodes int nNodes = thisNode.getItemCount(); for(int index = 0; index < nNodes; ++index){ BPTreeChildNodeItem childItem = (BPTreeChildNodeItem)thisNode.getItem(index); BPTreeNode childNode = childItem.getChildNode(); // keep going until leaf items are extracted findAllChromosomeNames(childNode, chromosomeList); } } }
lowestID = thisNode.getLowestChromID(); if(lowestID > endChromID) return; highestID = thisNode.getHighestChromID(); if(highestID < startChromID) return; if(thisNode.isLeaf()) int nLeaves = thisNode.getItemCount(); for(int index = 0; index < nLeaves; ++index){ BPTreeLeafNodeItem leaf = (BPTreeLeafNodeItem)thisNode.getItem(index); chromID = leaf.getChromID(); int nNodes = thisNode.getItemCount(); for(int index = 0; index < nNodes; ++index){ BPTreeChildNodeItem childItem = (BPTreeChildNodeItem)thisNode.getItem(index); BPTreeNode childNode = childItem.getChildNode(); lowestID = childNode.getLowestChromID(); highestID = childNode.getHighestChromID();
if(thisNode.isLeaf()) int nLeaves = thisNode.getItemCount(); for(int index = 0; index < nLeaves; ++index){ BPTreeLeafNodeItem leaf = (BPTreeLeafNodeItem)thisNode.getItem(index); if(leaf == null){ log.error("Error finding B+ tree leaf nodes, corruption suspected"); int nNodes = thisNode.getItemCount(); for(int index = 0; index < nNodes; ++index){ BPTreeChildNodeItem childItem = (BPTreeChildNodeItem)thisNode.getItem(index); BPTreeNode childNode = childItem.getChildNode(); String lowestKey = childNode.getLowestChromKey(); String highestKey = childNode.getHighestChromKey();
thisNode.insertItem(leafItem); } else { thisNode.insertItem(childItem);
if(thisNode.isLeaf()) int nLeaves = thisNode.getItemCount(); for(int index = 0; index < nLeaves; ++index){ BPTreeLeafNodeItem leaf = (BPTreeLeafNodeItem)thisNode.getItem(index); int nNodes = thisNode.getItemCount(); for(int index = 0; index < nNodes; ++index){ BPTreeChildNodeItem childItem = (BPTreeChildNodeItem)thisNode.getItem(index); BPTreeNode childNode = childItem.getChildNode(); int lowestID = childNode.getLowestChromID(); int highestID = childNode.getHighestChromID();
if(thisNode.isLeaf()) int nLeaves = thisNode.getItemCount(); for(int index = 0; index < nLeaves; ++index){ BPTreeLeafNodeItem leaf = (BPTreeLeafNodeItem)thisNode.getItem(index); if(leaf == null){ log.error("Error finding B+ tree leaf nodes, corruption suspected"); int nNodes = thisNode.getItemCount(); for(int index = 0; index < nNodes; ++index){ BPTreeChildNodeItem childItem = (BPTreeChildNodeItem)thisNode.getItem(index); BPTreeNode childNode = childItem.getChildNode(); String lowestKey = childNode.getLowestChromKey(); String highestKey = childNode.getHighestChromKey();
thisNode.insertItem(leafItem); thisNode.insertItem(childItem);
lowestID = thisNode.getLowestChromID(); if(lowestID > endChromID) return; highestID = thisNode.getHighestChromID(); if(highestID < startChromID) return; if(thisNode.isLeaf()) int nLeaves = thisNode.getItemCount(); for(int index = 0; index < nLeaves; ++index){ BPTreeLeafNodeItem leaf = (BPTreeLeafNodeItem)thisNode.getItem(index); chromID = leaf.getChromID(); int nNodes = thisNode.getItemCount(); for(int index = 0; index < nNodes; ++index){ BPTreeChildNodeItem childItem = (BPTreeChildNodeItem)thisNode.getItem(index); BPTreeNode childNode = childItem.getChildNode(); lowestID = childNode.getLowestChromID(); highestID = childNode.getHighestChromID();
public boolean insertItem(BPTreeNodeItem item){ // Quick implementation: assumes all keys are inserted in rank order // todo: verify if need to compare key and insert at rank location childItems.add((BPTreeChildNodeItem)item ); BPTreeNode childNode = ((BPTreeChildNodeItem)item).getChildNode(); // Note: assumes rank order insertions if(childItems.size() == 1 ){ lowestChromKey = childNode.getLowestChromKey(); lowestChromID = childNode.getLowestChromID(); } else { highestChromKey = childNode.getHighestChromKey(); highestChromID = childNode.getHighestChromID(); } return true; // success }
public void findAllChromosomeNames( BPTreeNode thisNode, ArrayList<String> chromosomeList){ // search down the tree recursively starting with the root node if(thisNode.isLeaf()) { // add all leaf names int nLeaves = thisNode.getItemCount(); for(int index = 0; index < nLeaves; ++index){ BPTreeLeafNodeItem leaf = (BPTreeLeafNodeItem)thisNode.getItem(index); chromosomeList.add(leaf.getChromKey()); } } else { // get all child nodes int nNodes = thisNode.getItemCount(); for(int index = 0; index < nNodes; ++index){ BPTreeChildNodeItem childItem = (BPTreeChildNodeItem)thisNode.getItem(index); BPTreeNode childNode = childItem.getChildNode(); // keep going until leaf items are extracted findAllChromosomeNames(childNode, chromosomeList); } } }
public void print() { log.debug("B+ Tree child node " + itemIndex); log.debug("Key value = " + chromKey); // recursively print chid node items childNode.printItems(); }
thisNode.insertItem(leafItem); thisNode.insertItem(childItem);
if(thisNode.isLeaf()) int nLeaves = thisNode.getItemCount(); for(int index = 0; index < nLeaves; ++index){ BPTreeLeafNodeItem leaf = (BPTreeLeafNodeItem)thisNode.getItem(index); int nNodes = thisNode.getItemCount(); for(int index = 0; index < nNodes; ++index){ BPTreeChildNodeItem childItem = (BPTreeChildNodeItem)thisNode.getItem(index); BPTreeNode childNode = childItem.getChildNode(); int lowestID = childNode.getLowestChromID(); int highestID = childNode.getHighestChromID();
public boolean insertItem(BPTreeNodeItem item){ // Quick implementation: assumes all keys are inserted in rank order // todo: verify if need to compare key and insert at rank location childItems.add((BPTreeChildNodeItem)item ); BPTreeNode childNode = ((BPTreeChildNodeItem)item).getChildNode(); // Note: assumes rank order insertions if(childItems.size() == 1 ){ lowestChromKey = childNode.getLowestChromKey(); lowestChromID = childNode.getLowestChromID(); } else { highestChromKey = childNode.getHighestChromKey(); highestChromID = childNode.getHighestChromID(); } return true; // success }
public void print() { log.debug("B+ Tree child node " + itemIndex); log.debug("Key value = " + chromKey); // recursively print chid node items childNode.printItems(); }
public void print() { // check if read in if(!treeHeader.isHeaderOK()){ int badMagic = treeHeader.getMagic(); log.error("Error reading B+ tree header: bad magic = " + badMagic); return; } // print B+ tree header treeHeader.print(); // print B+ tree node and leaf items - recursively if(rootNode != null) rootNode.printItems(); }
public void print() { // check if read in if (!treeHeader.isHeaderOK()) { int badMagic = treeHeader.getMagic(); log.error("Error reading B+ tree header: bad magic = " + badMagic); return; } // print B+ tree header treeHeader.print(); // print B+ tree node and leaf items - recursively if (rootNode != null) rootNode.printItems(); }
public void print() { // check if read in if(!treeHeader.isHeaderOK()){ int badMagic = treeHeader.getMagic(); log.error("Error reading B+ tree header: bad magic = " + badMagic); return; } // print B+ tree header treeHeader.print(); // print B+ tree node and leaf items - recursively if(rootNode != null) rootNode.printItems(); }