Package org.chaidb.db.helper

Examples of org.chaidb.db.helper.BitMap


    private static final int BLOCK_SIZE = BTreeSpec.PAGE_SIZE;

    public BTreeChanges(int treeid) throws ChaiDBException {
        this.treeid = treeid;
        bitMaps = new LinkedHashMap(1);
        BitMap bitMap = new BitMap(INIT_CAP);
        bitMaps.put(new Integer(0), bitMap);
        btreepath = pbm.getBTreeName(treeid);
        trackName = btreepath + EXT;

        // init bitMap from file
View Full Code Here


    }

    // for backup use
    public BTreeChanges(String btreename) throws ChaiDBException {
        bitMaps = new LinkedHashMap(1);
        BitMap bitMap = new BitMap(INIT_CAP);
        bitMaps.put(new Integer(0), bitMap);
        this.btreepath = btreename;
        trackName = btreename + EXT;
        reading = true;
View Full Code Here

        }
        PageNumber pno = (PageNumber) change;
        if (pno.getTreeId() != treeid) {
            return;
        }
        BitMap bm;
        Integer pageInFile = new Integer(pno.getFileNumber());
        bm = (BitMap) bitMaps.get(pageInFile);
        if (bm == null) {
            bm = new BitMap(INIT_CAP);
            bitMaps.put(pageInFile, bm);
        }
        bm.set(pno.getPageInFile());
    }
View Full Code Here

                        } else { // init a track file, write treeid
                            raf.seek(TREEID_OFF);
                            raf.writeInt(this.treeid);
                        }

                        BitMap bm = (BitMap) bitMaps.get(new Integer(0));
                        long len = f.length() - DATA_OFF;
                        if (len > 0x10000) {
                            len -= 0x10000;
                        }
                        bm.read(raf, (int) len);
                        return;
                    }
                }
            }
        } finally {
View Full Code Here

    }

    private void readAFile(int pageInFile, RandomAccessFile raf) throws IOException {
        raf.seek(DATA_OFF + MAX_BITMAP_SIZE * pageInFile);
        Integer fnum = new Integer(pageInFile);
        BitMap bm = (BitMap) bitMaps.get(fnum);
        if (bm == null) {
            bm = new BitMap(INIT_CAP);
        }
        bm.read(raf);
    }
View Full Code Here

TOP

Related Classes of org.chaidb.db.helper.BitMap

Copyright © 2018 www.massapicom. 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.