Examples of Bitfield


Examples of org.h2.util.BitField

            }
        }
    }

    private void testRandomSetRange() {
        BitField bits = new BitField();
        BitSet set = new BitSet();
        Random random = new Random(1);
        int maxOffset = 500;
        int maxLen = 500;
        int total = maxOffset + maxLen;
        int count = 10000;
        for (int i = 0; i < count; i++) {
            int offset = random.nextInt(maxOffset);
            int len = random.nextInt(maxLen);
            boolean val = random.nextBoolean();
            set.set(offset, offset + len, val);
            bits.set(offset, offset + len, val);
            for (int j = 0; j < total; j++) {
                assertEquals(set.get(j), bits.get(j));
            }
        }
    }
View Full Code Here

Examples of org.h2.util.BitField

                setting.setIntValue(Constants.BUILD_ID);
                addDatabaseObject(systemSession, setting);
            }
            // mark all ids used in the page store
            if (pageStore != null) {
                BitField f = pageStore.getObjectIds();
                for (int i = 0, len = f.length(); i < len; i++) {
                    if (f.get(i) && !objectIds.get(i)) {
                        trace.info("unused object id: " + i);
                        objectIds.set(i);
                    }
                }
            }
View Full Code Here

Examples of org.h2.util.BitField

        writer.println("-- [" + entryCount + "] child: " + children[entryCount] + " rowCount: " + rowCount);
    }

    private int dumpPageFreeList(PrintWriter writer, Data s, long pageId, long pageCount) {
        int pagesAddressed = PageFreeList.getPagesAddressed(pageSize);
        BitField used = new BitField();
        for (int i = 0; i < pagesAddressed; i += 8) {
            int x = s.readByte() & 255;
            for (int j = 0; j < 8; j++) {
                if ((x & (1 << j)) != 0) {
                    used.set(i + j);
                }
            }
        }
        int free = 0;
        for (long i = 0, j = pageId; i < pagesAddressed && j < pageCount; i++, j++) {
            if (i == 0 || j % 100 == 0) {
                if (i > 0) {
                    writer.println();
                }
                writer.print("-- " + j + " ");
            } else if (j % 20 == 0) {
                writer.print(" - ");
            } else if (j % 10 == 0) {
                writer.print(' ');
            }
            writer.print(used.get((int) i) ? '1' : '0');
            if (!used.get((int) i)) {
                free++;
            }
        }
        writer.println();
        return free;
View Full Code Here

Examples of org.h2.util.BitField

    private PageFreeList(PageStore store, int pageId) {
        setPos(pageId);
        this.store = store;
        pageCount = (store.getPageSize() - DATA_START) * 8;
        used = new BitField(pageCount);
        used.set(0);
    }
View Full Code Here

Examples of org.h2.util.BitField

                throw e;
            }
        } catch (IOException e) {
            trace.debug("log recovery completed");
        }
        undo = new BitField();
        if (stage == RECOVERY_STAGE_REDO) {
            usedLogPages = null;
        }
    }
View Full Code Here

Examples of org.h2.util.BitField

     */
    void checkpoint() {
        Data buffer = getBuffer();
        buffer.writeByte((byte) CHECKPOINT);
        write(buffer);
        undo = new BitField();
        logSectionId++;
        logPos = 0;
        pageOut.flush();
        pageOut.fillPage();
        int currentDataPage = pageOut.getCurrentDataPageId();
View Full Code Here

Examples of org.h2.util.BitField

            checkClosed();
            if (outParameters == null) {
                maxOutParameters = Math.min(
                        getParameterMetaData().getParameterCount(),
                        getCheckedMetaData().getColumnCount());
                outParameters = new BitField();
            }
            checkIndexBounds(parameterIndex);
            ParameterInterface param = command.getParameters().get(--parameterIndex);
            if (param.getParamValue() == null) {
                param.setValue(ValueNull.INSTANCE, false);
View Full Code Here

Examples of org.h2.util.BitField

    public void setLockFile(boolean lockFile) {
        this.lockFile = lockFile;
    }

    public BitField getObjectIds() {
        BitField f = new BitField();
        Cursor cursor = metaIndex.find(systemSession, null, null);
        while (cursor.next()) {
            Row row = cursor.get();
            int id = row.getValue(0).getInt();
            if (id > 0) {
                f.set(id);
            }
        }
        return f;
    }
View Full Code Here

Examples of org.h2.util.BitField

            checkClosed();
            if (outParameters == null) {
                maxOutParameters = Math.min(
                        getParameterMetaData().getParameterCount(),
                        getCheckedMetaData().getColumnCount());
                outParameters = new BitField();
            }
            checkIndexBounds(parameterIndex);
            ParameterInterface param = command.getParameters().get(--parameterIndex);
            if (param.getParamValue() == null) {
                param.setValue(ValueNull.INSTANCE, false);
View Full Code Here

Examples of org.h2.util.BitField

    public void setLockFile(boolean lockFile) {
        this.lockFile = lockFile;
    }

    public BitField getObjectIds() {
        BitField f = new BitField();
        Cursor cursor = metaIndex.find(systemSession, null, null);
        while (cursor.next()) {
            Row row = cursor.get();
            int id = row.getValue(0).getInt();
            if (id > 0) {
                f.set(id);
            }
        }
        return f;
    }
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.