@Override public Cursor findFirstOrLast(Session session, boolean first) { TransactionMap<Value, Value> map = getMap(session); ValueLong v = (ValueLong) (first ? map.firstKey() : map.lastKey()); if (v == null) { return new MVStoreCursor(session, Collections.<Entry<Value, Value>> emptyList().iterator()); } Value value = map.get(v); Entry<Value, Value> e = new DataUtils.MapEntry<Value, Value>(v, value); List<Entry<Value, Value>> list = Collections.singletonList(e); MVStoreCursor c = new MVStoreCursor(session, list.iterator()); c.next(); return c; }
@Override public Cursor findFirstOrLast(Session session, boolean first) { TransactionMap<Value, Value> map = getMap(session); ValueLong v = (ValueLong) (first ? map.firstKey() : map.lastKey()); if (v == null) { return new MVStoreCursor(session, Collections .<Entry<Value, Value>> emptyList().iterator(), null); } Value value = map.get(v); Entry<Value, Value> e = new DataUtils.MapEntry<Value, Value>(v, value); @SuppressWarnings("unchecked") List<Entry<Value, Value>> list = Arrays.asList(e); MVStoreCursor c = new MVStoreCursor(session, list.iterator(), v); c.next(); return c; }
@Override public Cursor findFirstOrLast(Session session, boolean first) { TransactionMap<Value, Value> map = getMap(session); ValueLong v = (ValueLong) (first ? map.firstKey() : map.lastKey()); if (v == null) { return new MVStoreCursor(session, Collections .<Entry<Value, Value>> emptyList().iterator(), null); } Value value = map.get(v); Entry<Value, Value> e = new DataUtils.MapEntry<Value, Value>(v, value); @SuppressWarnings("unchecked") List<Entry<Value, Value>> list = Arrays.asList(e); MVStoreCursor c = new MVStoreCursor(session, list.iterator(), v); c.next(); return c; }
@Override public Cursor find(Session session, SearchRow first, SearchRow last) { ValueLong min, max; if (first == null) { min = MIN; } else if (mainIndexColumn < 0) { min = ValueLong.get(first.getKey()); } else { ValueLong v = (ValueLong) first.getValue(mainIndexColumn); if (v == null) { min = ValueLong.get(first.getKey()); } else { min = v; } } if (last == null) { max = MAX; } else if (mainIndexColumn < 0) { max = ValueLong.get(last.getKey()); } else { ValueLong v = (ValueLong) last.getValue(mainIndexColumn); if (v == null) { max = ValueLong.get(last.getKey()); } else { max = v; } } TransactionMap<Value, Value> map = getMap(session); return new MVStoreCursor(session, map.entryIterator(min), max); }
@Override public Cursor find(Session session, SearchRow first, SearchRow last) { ValueLong min, max; if (first == null) { min = MIN; } else if (mainIndexColumn < 0) { min = ValueLong.get(first.getKey()); } else { ValueLong v = (ValueLong) first.getValue(mainIndexColumn); if (v == null) { min = ValueLong.get(first.getKey()); } else { min = v; } } if (last == null) { max = MAX; } else if (mainIndexColumn < 0) { max = ValueLong.get(last.getKey()); } else { ValueLong v = (ValueLong) last.getValue(mainIndexColumn); if (v == null) { max = ValueLong.get(last.getKey()); } else { max = v; } } TransactionMap<Value, Value> map = getMap(session); return new MVStoreCursor(session, map.entryIterator(min), max); }
/** * Search for a specific row or a set of rows. * * @param session the session * @param first the key of the first row * @param last the key of the last row * @return the cursor */ Cursor find(Session session, ValueLong first, ValueLong last) { TransactionMap<Value, Value> map = getMap(session); return new MVStoreCursor(session, map.entryIterator(first), last); }
/** * Search for a specific row or a set of rows. * * @param session the session * @param first the key of the first row * @param last the key of the last row * @return the cursor */ Cursor find(Session session, ValueLong first, ValueLong last) { TransactionMap<Value, Value> map = getMap(session); return new MVStoreCursor(session, map.entryIterator(first), last); }
@Override public Cursor find(Session session, SearchRow first, SearchRow last) { ValueLong min, max; if (first == null) { min = ValueLong.MIN; } else if (mainIndexColumn < 0) { min = ValueLong.get(first.getKey()); } else { ValueLong v = (ValueLong) first.getValue(mainIndexColumn); if (v == null) { min = ValueLong.get(first.getKey()); } else { min = v; } } if (last == null) { max = ValueLong.MAX; } else if (mainIndexColumn < 0) { max = ValueLong.get(last.getKey()); } else { ValueLong v = (ValueLong) last.getValue(mainIndexColumn); if (v == null) { max = ValueLong.get(last.getKey()); } else { max = v; } } TransactionMap<Value, Value> map = getMap(session); return new MVStoreCursor(session, map.entryIterator(min, max)); }
/** * Search for a specific row or a set of rows. * * @param session the session * @param first the key of the first row * @param last the key of the last row * @return the cursor */ Cursor find(Session session, ValueLong first, ValueLong last) { TransactionMap<Value, Value> map = getMap(session); return new MVStoreCursor(session, map.entryIterator(first, last)); }