Package com.persistit

Examples of com.persistit.Key


            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

     *
     * @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

    return doClear();
  }

  private Cache<V> doClear() {
    try {
      Key to = new Key(exchange.getKey());
      to.append(Key.AFTER);
      exchange.removeKeyRange(exchange.getKey(), to);
      return this;
    } catch (Exception e) {
      throw new IllegalStateException("Fail to clear values from cache " + name, e);
    }
View Full Code Here

      } catch (PersistitException e) {
        throw new IllegalStateException(e);
      }
      if (exchange.getValue().isDefined()) {
        T value = (T) exchange.getValue().get();
        Key key = exchange.getKey();
        Object[] array = new Object[key.getDepth()];
        for (int i = 0; i < key.getDepth(); i++) {
          array[i] = key.indexTo(i - key.getDepth()).decode();
        }
        return new Entry<T>(array, value);
      }
      throw new NoSuchElementException();
    }
View Full Code Here

    class KeyStateRenderer extends AlignedCellRenderer {
        private Key _key;

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

     *
     * @param exchange
     */
    public void setExchange(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

            Exchange ex = setupExchange();
            boolean expanded = (isExpanded());
            if (!ex.traverse(forward ? Key.GT : Key.LT, expanded)) {
                return null;
            }
            Key key = ex.getKey();
            if (key.compareKeyFragment(_rootKey, 0, _rootKey.getEncodedSize()) != 0) {
                return null;
            }
            int keyBytesSize = key.getEncodedSize() - _rootKey.getEncodedSize();
            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() {
            Exchange ex = PersistitTableModel.this.getExchange();
            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

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.