Package com.persistit

Examples of com.persistit.Key


     *
     * @param exchange
     */
    public void setExchange(final Exchange exchange) {
        _exchange = exchange;
        _rootKey = new Key(_exchange.getKey());
        _rowCache.clear();
        _rowCountActual = -1;
        _rowCountEstimate = INITIAL_ROW_COUNT_ESTIMATE;
        fireTableChanged(new TableModelEvent(this));
    }
View Full Code Here


            final Exchange ex = setupExchange();
            final boolean expanded = (isExpanded());
            if (!ex.traverse(forward ? Key.GT : Key.LT, expanded)) {
                return null;
            }
            final Key key = ex.getKey();
            if (key.compareKeyFragment(_rootKey, 0, _rootKey.getEncodedSize()) != 0) {
                return null;
            }
            final int keyBytesSize = key.getEncodedSize() - _rootKey.getEncodedSize();
            final byte[] keyBytes = new byte[keyBytesSize];
            System.arraycopy(key.getEncodedBytes(), _rootKey.getEncodedSize(), keyBytes, 0, keyBytesSize);
            return new Row(keyBytes);
        }
View Full Code Here

            return ex.getKey().toString();
        }

        private Exchange setupExchange() {
            final Exchange ex = PersistitTableModel.this.getExchange();
            final Key key = ex.getKey();
            System.arraycopy(_rootKey.getEncodedBytes(), 0, key.getEncodedBytes(), 0, _rootKey.getEncodedSize());
            System.arraycopy(_keyBytes, 0, key.getEncodedBytes(), _rootKey.getEncodedSize(), _keyBytes.length);
            key.setEncodedSize(_rootKey.getEncodedSize() + _keyBytes.length);
            return ex;
        }
View Full Code Here

    class KeyStateRenderer extends AlignedCellRenderer {
        private final Key _key;

        public KeyStateRenderer() {
            super(SwingConstants.LEFT);
            _key = new Key((Persistit) null);
        }
View Full Code Here

   
    @Before
    public void createFileBuffers() {
        os = new ByteArrayOutputStream();
        startKey = new SortKey();
        testKey = new Key ((Persistit)null);
        writer = new KeyWriter(os);
    }
View Full Code Here

    public IndexStatistics loadIndexStatistics(Session session, Index index) {
        RowDef indexRowDef = index.leafMostTable().rowDef();
        RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);
        RowDef indexStatisticsEntryRowDef = getIndexStatsEntryRowDef(session);

        Key hKey = getStore().createKey();
        hKey.append(indexStatisticsRowDef.table().getOrdinal())
            .append((long) indexRowDef.getRowDefId())
            .append((long) index.getIndexId());

        IndexStatistics result = null;
        FDBStoreData storeData = getStore().createStoreData(session, indexStatisticsRowDef.getGroup());
        hKey.copyTo(storeData.persistitKey);
        getStore().groupKeyAndDescendantsIterator(session, storeData, true);
        while(storeData.next()) {
            if(result == null) {
                result = decodeHeader(storeData, indexStatisticsRowDef, index);
            } else {
View Full Code Here

    @Override
    public void removeStatistics(Session session, Index index) {
        RowDef indexRowDef = index.leafMostTable().rowDef();
        RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);

        Key hKey = getStore().createKey();
        hKey.append(indexStatisticsRowDef.table().getOrdinal())
                .append((long) indexRowDef.getRowDefId())
                .append((long) index.getIndexId());

        FDBStoreData storeData = getStore().createStoreData(session, indexStatisticsRowDef.getGroup());
        hKey.copyTo(storeData.persistitKey);
        getStore().groupKeyAndDescendantsIterator(session, storeData, false);
        while(storeData.next()) {
            RowData rowData = new RowData();
            FDBStoreDataHelper.expandRowData(rowData, storeData, false);
            getStore().deleteRow(session, rowData, false); // TODO: Use cascade?
View Full Code Here

    @Override
    // TODO: This is overkill, but several tests rely upon the older PersistitHKey(key#toString()) behavior,
    // See ITBase#compareTwoRows(line 190ff).
    public String toString() {
        Key target = new Key (null, 2047);
        this.copyTo(target);
        return target.toString();
    }
View Full Code Here

    @Test
    public void testCopyFromEmpty() {
        Table customers = ais.getTable("Test", CAOIBuilderFiller.CUSTOMER_TABLE);
        FDBIndexRow row = new FDBIndexRow (testCreator, customerPK);

       Key pkKey = testCreator.createKey();
      
       row.copyFrom(pkKey, null);
      
       assertTrue (row.keyEmpty());
       assertNotNull (row.ancestorHKey(customers));
View Full Code Here

    @Test
    public void testCopyFromEntry() {
        Table customers = ais.getTable("Test", CAOIBuilderFiller.CUSTOMER_TABLE);
        FDBIndexRow row = new FDBIndexRow (testCreator, customerPK);

       Key pkKey = testCreator.createKey();
       pkKey.append (1L);
       pkKey.append(1);
       row.copyFrom(pkKey, null);
      
       assertTrue (!row.keyEmpty());
       HKey hKey = row.ancestorHKey(customers);
       assertNotNull (hKey);
View Full Code Here

TOP

Related Classes of com.persistit.Key

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.