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 printItems(){ int itemCount = getItemCount(); log.debug("Child node " + nodeIndex + " contains " + itemCount + " child items:"); for(int item = 0; item < itemCount; ++item){ // recursively will print all node items below this node childItems.get(item).print(); } }
BPTreeChildNodeItem childItem = new BPTreeChildNodeItem(item, key, childNode); thisNode.insertItem(childItem);
BPTreeChildNodeItem childItem = new BPTreeChildNodeItem(item, key, childNode); thisNode.insertItem(childItem);
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 printItems(){ int itemCount = getItemCount(); log.debug("Child node " + nodeIndex + " contains " + itemCount + " child items:"); for(int item = 0; item < itemCount; ++item){ // recursively will print all node items below this node childItems.get(item).print(); } }
BPTreeChildNodeItem childItem = new BPTreeChildNodeItem(item, key, childNode); thisNode.insertItem(childItem);
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 printItems(){ int itemCount = getItemCount(); log.debug("Child node " + nodeIndex + " contains " + itemCount + " child items:"); for(int item = 0; item < itemCount; ++item){ // recursively will print all node items below this node childItems.get(item).print(); } }
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 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); } } }
BPTreeNode childNode = childItem.getChildNode();
BPTreeNode childNode = childItem.getChildNode();
BPTreeNode childNode = childItem.getChildNode();
BPTreeNode childNode = childItem.getChildNode();
BPTreeNode childNode = childItem.getChildNode();
BPTreeNode childNode = childItem.getChildNode();