Package com.persistit

Examples of com.persistit.Exchange


        private boolean isExpanded() {
            return true;
        }

        private Row getNextRow(final boolean forward) throws PersistitException {
            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];
View Full Code Here


            return new Row(keyBytes);
        }

        private String getValueTypeString() {
            try {
                final Exchange ex = setupExchange();
                if (ex.getKey().getEncodedSize() == 0)
                    return "";
                ex.fetch();
                final Value value = ex.getValue();
                if (!value.isDefined())
                    return "undefined";
                return value.getType().getName();
            } catch (final PersistitException de) {
                return de.toString();
View Full Code Here

            }
        }

        private String getValueString() {
            try {
                final Exchange ex = setupExchange();
                if (ex.getKey().getEncodedSize() == 0)
                    return "";
                ex.fetch();
                final Value value = ex.getValue();
                if (value.getEncodedSize() > 50000) {
                    return "Too long to display: " + value.getEncodedSize();
                } else {
                    return value.toString();
                }
View Full Code Here

                return de.toString();
            }
        }

        private Key getKey() {
            final Exchange ex = setupExchange();
            return ex.getKey();
        }
View Full Code Here

            final Exchange ex = setupExchange();
            return ex.getKey();
        }

        private Value getValue() throws PersistitException, IOException {
            final Exchange ex = setupExchange();
            ex.fetch();
            return ex.getValue();
        }
View Full Code Here

            ex.fetch();
            return ex.getValue();
        }

        private String getKeyString() {
            final Exchange ex = setupExchange();
            ex.getKey().setIndex(0);
            return ex.getKey().toString();
        }
View Full Code Here

            ex.getKey().setIndex(0);
            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

  @SuppressWarnings("rawtypes")
  public Set keySet(Object key) {
    try {
      Set<Object> keys = Sets.newLinkedHashSet();
      exchange.clear();
      Exchange iteratorExchange = new Exchange(exchange);
      iteratorExchange.append(key);
      iteratorExchange.append(Key.BEFORE);
      while (iteratorExchange.next(false)) {
        keys.add(iteratorExchange.getKey().indexTo(-1).decode());
      }
      return keys;
    } catch (Exception e) {
      throw new IllegalStateException("Fail to get keys from cache " + name, e);
    }
View Full Code Here

  @SuppressWarnings("rawtypes")
  public Set keySet(Object firstKey, Object secondKey) {
    try {
      Set<Object> keys = Sets.newLinkedHashSet();
      exchange.clear();
      Exchange iteratorExchange = new Exchange(exchange);
      iteratorExchange.append(firstKey);
      iteratorExchange.append(secondKey);
      iteratorExchange.append(Key.BEFORE);
      while (iteratorExchange.next(false)) {
        keys.add(iteratorExchange.getKey().indexTo(-1).decode());
      }
      return keys;
    } catch (Exception e) {
      throw new IllegalStateException("Fail to get keys from cache " + name, e);
    }
View Full Code Here

   */
  public Set<Object> keySet() {
    try {
      Set<Object> keys = Sets.newLinkedHashSet();
      exchange.clear();
      Exchange iteratorExchange = new Exchange(exchange);
      iteratorExchange.append(Key.BEFORE);
      while (iteratorExchange.next(false)) {
        keys.add(iteratorExchange.getKey().indexTo(-1).decode());
      }
      return keys;
    } catch (Exception e) {
      throw new IllegalStateException("Fail to get keys from cache " + name, e);
    }
View Full Code Here

TOP

Related Classes of com.persistit.Exchange

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.