public BPTreeHeader(SeekableStream fis, long fileOffset, boolean isLowToHigh) { long itemsCount; // save the seekable file handle and B+ Tree file offset headerOffset = fileOffset; // Note: a bad B+ Tree header will result in false returned headerOK = readHeader(fis, headerOffset, isLowToHigh); }
public BPTree(SeekableStream fis, long fileOffset, boolean isLowToHigh) { // Save the seekable file handle and B+ Tree file offset // Note: the offset is the B+ Tree Header Table E file location this.fis = fis; treeOffset = fileOffset; // read in B+ tree header - verify the B+ tree info exits treeHeader = new BPTreeHeader(this.fis, treeOffset, isLowToHigh); // log error if header not found and throw exception if(!treeHeader.isHeaderOK()){ int badMagic = treeHeader.getMagic(); log.error("Error reading B+ tree header: bad magic = " + badMagic); throw new RuntimeException("Error reading B+ tree header: bad magic = " + badMagic); } // assign B+ tree specifications from the header blockSize = treeHeader.getBlockSize(); keySize = treeHeader.getKeySize(); valueSize = treeHeader.getValSize(); itemCount = treeHeader.getItemCount(); // populate the tree - read in the nodes long nodeOffset = treeOffset + treeHeader.BPTREE_HEADER_SIZE; BPTreeNode parentNode = null; // parent node of the root is itself, or null // get the root node - which recursively populates the remaining nodes rootNode = readBPTreeNode(this.fis, nodeOffset, parentNode, isLowToHigh); }
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 BPTree(SeekableStream fis, long fileOffset, boolean isLowToHigh) { // Save the seekable file handle and B+ Tree file offset // Note: the offset is the B+ Tree Header Table E file location this.fis = fis; treeOffset = fileOffset; // read in B+ tree header - verify the B+ tree info exits treeHeader = new BPTreeHeader(this.fis, treeOffset, isLowToHigh); // log error if header not found and throw exception if(!treeHeader.isHeaderOK()){ int badMagic = treeHeader.getMagic(); log.error("Error reading B+ tree header: bad magic = " + badMagic); throw new RuntimeException("Error reading B+ tree header: bad magic = " + badMagic); } // assign B+ tree specifications from the header blockSize = treeHeader.getBlockSize(); keySize = treeHeader.getKeySize(); valueSize = treeHeader.getValSize(); itemCount = treeHeader.getItemCount(); // populate the tree - read in the nodes long nodeOffset = treeOffset + treeHeader.BPTREE_HEADER_SIZE; BPTreeNode parentNode = null; // parent node of the root is itself, or null // get the root node - which recursively populates the remaining nodes rootNode = readBPTreeNode(this.fis, nodeOffset, parentNode, isLowToHigh); }
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 BPTree(SeekableStream fis, long fileOffset, boolean isLowToHigh) { // Save the seekable file handle and B+ Tree file offset // Note: the offset is the B+ Tree Header Table E file location this.fis = fis; treeOffset = fileOffset; idChromMap = new HashMap<>(); chromIdMap = new HashMap<>(); // read in B+ tree header - verify the B+ tree info exits treeHeader = new BPTreeHeader(this.fis, treeOffset, isLowToHigh); // log error if header not found and throw exception if (!treeHeader.isHeaderOK()) { int badMagic = treeHeader.getMagic(); log.error("Error reading B+ tree header: bad magic = " + badMagic); throw new RuntimeException("Error reading B+ tree header: bad magic = " + badMagic); } // assign B+ tree specifications from the header blockSize = treeHeader.getBlockSize(); keySize = treeHeader.getKeySize(); valueSize = treeHeader.getValSize(); itemCount = treeHeader.getItemCount(); // populate the tree - read in the nodes long nodeOffset = treeOffset + treeHeader.BPTREE_HEADER_SIZE; BPTreeNode parentNode = null; // parent node of the root is itself, or null // get the root node - which recursively populates the remaining nodes rootNode = readBPTreeNode(this.fis, nodeOffset, parentNode, isLowToHigh); }
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 BPTreeHeader(SeekableStream fis, long fileOffset, boolean isLowToHigh) { long itemsCount; // save the seekable file handle and B+ Tree file offset headerOffset = fileOffset; // Note: a bad B+ Tree header will result in false returned headerOK = readHeader(fis, headerOffset, isLowToHigh); }
public BPTreeHeader(SeekableStream fis, long fileOffset, boolean isLowToHigh) { long itemsCount; // save the seekable file handle and B+ Tree file offset headerOffset = fileOffset; // Note: a bad B+ Tree header will result in false returned headerOK = readHeader(fis, headerOffset, isLowToHigh); }