Codota Logo
Cursor
Code IndexAdd Codota to your IDE (free)

How to use
Cursor
in
org.h2.mvstore

Best Java code snippets using org.h2.mvstore.Cursor (Showing top 20 results out of 315)

  • Common ways to obtain Cursor
private void myMethod () {
Cursor c =
  • Codota IconMVMap mVMap;Object from;mVMap.cursor(from)
  • Smart code suggestions by Codota
}
origin: andsel/moquette

@Override
public List<Subscription> listAllSubscriptions() {
  LOG.debug("Retrieving existing subscriptions");
  List<Subscription> results = new ArrayList<>();
  Cursor<String, Subscription> mapCursor = subscriptions.cursor(null);
  while (mapCursor.hasNext()) {
    String subscriptionStr = mapCursor.next();
    results.add(mapCursor.getValue());
  }
  LOG.debug("Loaded {} subscriptions", results.size());
  return results;
}
origin: com.h2database/h2

/**
 * Iterate over a number of keys.
 *
 * @param from the first key to return
 * @return the iterator
 */
public Iterator<K> keyIterator(K from) {
  return new Cursor<K, V>(this, root, from);
}
origin: com.h2database/h2

/**
 * Skip over that many entries. This method is relatively fast (for this map
 * implementation) even if many entries need to be skipped.
 *
 * @param n the number of entries to skip
 */
public void skip(long n) {
  if (!hasNext()) {
    return;
  }
  if (n < 10) {
    while (n-- > 0) {
      fetchNext();
    }
    return;
  }
  long index = map.getKeyIndex(current);
  K k = map.getKey(index + n);
  pos = null;
  min(root, k);
  fetchNext();
}
origin: com.h2database/h2

@Override
public boolean hasNext() {
  if (!initialized) {
    min(root, from);
    initialized = true;
    fetchNext();
  }
  return current != null;
}
origin: com.h2database/h2

@Override
public K next() {
  hasNext();
  K c = current;
  last = current;
  lastValue = currentValue;
  lastPage = pos == null ? null : pos.page;
  fetchNext();
  return c;
}
origin: com.h2database/h2

Cursor<Object, Object> cursor = map.cursor(null);
Page lastPage = null;
while (cursor.hasNext()) {
  cursor.next();
  Page p = cursor.getPage();
  if (p == lastPage) {
    continue;
origin: com.h2database/h2

private void fetchNext() {
  while (cursor.hasNext()) {
    K k;
    try {
      k = cursor.next();
    } catch (IllegalStateException e) {
        if (!cursor.hasNext()) {
          break;
        cursor.next();
        if (!cursor.hasNext()) {
          break;
        k = cursor.next();
      } else {
        throw e;
origin: com.h2database/h2

/**
 * Fetch the next entry if there is one.
 */
@SuppressWarnings("unchecked")
private void fetchNext() {
  while (pos != null) {
    if (pos.index < pos.page.getKeyCount()) {
      int index = pos.index++;
      current = (K) pos.page.getKey(index);
      currentValue = (V) pos.page.getValue(index);
      return;
    }
    pos = pos.parent;
    if (pos == null) {
      break;
    }
    if (pos.index < map.getChildPageCount(pos.page)) {
      min(pos.page.getChildPage(pos.index++), null);
    }
  }
  current = null;
}
origin: org.wowtools/h2

Cursor<Object, Object> cursor = map.cursor(null);
Page lastPage = null;
while (cursor.hasNext()) {
  cursor.next();
  Page p = cursor.getPage();
  if (p == lastPage) {
    continue;
origin: com.h2database/h2

private void fetchNext() {
  while (cursor.hasNext()) {
    transaction.store.rwLock.readLock().lock();
    try {
      K k;
      try {
        k = cursor.next();
      } catch (IllegalStateException e) {
          if (!cursor.hasNext()) {
            break;
          cursor.next();
          if (!cursor.hasNext()) {
            break;
          k = cursor.next();
        } else {
          throw e;
origin: org.wowtools/h2

@Override
public K next() {
  hasNext();
  K c = current;
  last = current;
  lastValue = currentValue;
  lastPage = pos == null ? null : pos.page;
  fetchNext();
  return c;
}
origin: com.eventsourcing/h2

@Override
public boolean hasNext() {
  if (!initialized) {
    min(root, from);
    initialized = true;
    fetchNext();
  }
  return current != null;
}
origin: com.eventsourcing/h2

/**
 * Fetch the next entry if there is one.
 */
@SuppressWarnings("unchecked")
private void fetchNext() {
  while (pos != null) {
    if (pos.index < pos.page.getKeyCount()) {
      int index = pos.index++;
      current = (K) pos.page.getKey(index);
      currentValue = (V) pos.page.getValue(index);
      return;
    }
    pos = pos.parent;
    if (pos == null) {
      break;
    }
    if (pos.index < map.getChildPageCount(pos.page)) {
      min(pos.page.getChildPage(pos.index++), null);
    }
  }
  current = null;
}
origin: com.h2database/h2

private Set<Integer> collectReferencedChunks() {
  long testVersion = lastChunk.version;
  DataUtils.checkArgument(testVersion > 0, "Collect references on version 0");
  long readCount = getFileStore().readCount.get();
  Set<Integer> referenced = new HashSet<>();
  for (Cursor<String, String> c = meta.cursor("root."); c.hasNext();) {
    String key = c.next();
    if (!key.startsWith("root.")) {
      break;
    }
    long pos = DataUtils.parseHexLong(c.getValue());
    if (pos == 0) {
      continue;
    }
    int mapId = DataUtils.parseHexInt(key.substring("root.".length()));
    collectReferencedChunks(referenced, mapId, pos, 0);
  }
  long pos = lastChunk.metaRootPos;
  collectReferencedChunks(referenced, 0, pos, 0);
  readCount = fileStore.readCount.get() - readCount;
  return referenced;
}
origin: com.eventsourcing/h2

Cursor<Object, Object> cursor = map.cursor(null);
Page lastPage = null;
while (cursor.hasNext()) {
  cursor.next();
  Page p = cursor.getPage();
  if (p == lastPage) {
    continue;
origin: com.h2database/h2-mvstore

/**
 * Skip over that many entries. This method is relatively fast (for this map
 * implementation) even if many entries need to be skipped.
 *
 * @param n the number of entries to skip
 */
public void skip(long n) {
  if (!hasNext()) {
    return;
  }
  if (n < 10) {
    while (n-- > 0) {
      fetchNext();
    }
    return;
  }
  long index = map.getKeyIndex(current);
  K k = map.getKey(index + n);
  pos = null;
  min(root, k);
  fetchNext();
}
origin: com.h2database/h2

while (cursor.hasNext()) {
  K key = cursor.next();
origin: com.eventsourcing/h2

@Override
public K next() {
  hasNext();
  K c = current;
  last = current;
  lastValue = currentValue;
  lastPage = pos == null ? null : pos.page;
  fetchNext();
  return c;
}
origin: com.h2database/h2-mvstore

@Override
public boolean hasNext() {
  if (!initialized) {
    min(root, from);
    initialized = true;
    fetchNext();
  }
  return current != null;
}
origin: com.h2database/h2

/**
 * Get a cursor to iterate over a number of keys and values.
 *
 * @param from the first key to return
 * @return the cursor
 */
public Cursor<K, V> cursor(K from) {
  return new Cursor<>(this, root, from);
}
org.h2.mvstoreCursor

Javadoc

A cursor to iterate over elements in ascending order.

Most used methods

  • getValue
    Get the last read value if there was one.
  • hasNext
  • next
  • <init>
  • fetchNext
    Fetch the next entry if there is one.
  • getPage
  • min
    Fetch the next entry that is equal or larger than the given key, starting from the given page. This

Popular in Java

  • Making http post requests using okhttp
  • setContentView (Activity)
  • getApplicationContext (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Collectors (java.util.stream)
  • Reference (javax.naming)
  • JTable (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now