private Map.Entry<Object, OIdentifiable> nextTxEntry(int prefetchSize) { Map.Entry<Object, OIdentifiable> result = nextTxEntry; nextTxEntry = txBetweenIndexCursor.nextEntry(); return result; }
private Map.Entry<Object, OIdentifiable> nextTxEntry(int prefetchSize) { Map.Entry<Object, OIdentifiable> result = nextTxEntry; nextTxEntry = txBetweenIndexCursor.nextEntry(); return result; }
@Override public boolean hasNext() { if (noItems) return false; if (nextValue == null) { final Map.Entry<Object, OIdentifiable> entry = indexCursor.nextEntry(); if (entry == null) { noItems = true; return false; } nextValue = entry.getValue(); } return true; }
private List<OIdentifiable> cursorToList(OIndexCursor cursor) { final List<OIdentifiable> currentResult = new ArrayList<OIdentifiable>(); Map.Entry<Object, OIdentifiable> entry = cursor.nextEntry(); while (entry != null) { currentResult.add(entry.getValue()); entry = cursor.nextEntry(); } return currentResult; }
private Map.Entry<Object, OIdentifiable> nextBackedEntry(int prefetchSize) { Map.Entry<Object, OIdentifiable> result; result = calculateTxIndexEntry(nextBackedEntry.getKey(), nextBackedEntry.getValue(), indexChanges); nextBackedEntry = backedCursor.nextEntry(); return result; } }
private Map.Entry<Object, OIdentifiable> nextBackedEntry(int prefetchSize) { Map.Entry<Object, OIdentifiable> result; result = calculateTxIndexEntry(nextBackedEntry.getKey(), nextBackedEntry.getValue(), indexChanges); nextBackedEntry = backedCursor.nextEntry(); return result; } }
@Override public Map.Entry<Object, OIdentifiable> nextEntry() { Map.Entry<Object, OIdentifiable> entry = null; while (entry == null && cursor != null) { entry = cursor.nextEntry(); if (entry == null) { if (cursorIterator.hasNext()) { cursor = cursorIterator.next(); } else { cursor = null; } } } return entry; } }
private Map.Entry<Object, OIdentifiable> loadNextEntry(OCommandContext commandContext) { Map.Entry<Object, OIdentifiable> result = cursor.nextEntry(); while (true) { if (result == null) { return null; } if (ridCondition == null) { return result; } OResultInternal res = new OResultInternal(); res.setProperty("rid", result.getValue()); if (ridCondition.evaluate(res, commandContext)) { return result; } result = cursor.nextEntry(); } }
@Override @Guarded(by = STARTED) public <T> List<Entry<T, EntityId>> getNextPage(final OIndexCursor cursor, final int limit) { List<Entry<T, EntityId>> page = new ArrayList<>(limit); // For reasons unknown Orient needs the connection despite the code not using it try (ODatabaseDocumentTx db = databaseInstance.get().acquire()) { cursor.setPrefetchSize(limit); while (page.size() < limit) { Entry<Object, OIdentifiable> entry = cursor.nextEntry(); if (entry == null) { break; } @SuppressWarnings("unchecked") T key = (T) entry.getKey(); EntityId value = new AttachedEntityId(entityAdapter, entry.getValue().getIdentity()); page.add(new SimpleEntry<>(key, value)); } } return page; }
@Override public List<Object> edgeLookup(String edgeLabel, String indexPostfix, Object key) { OrientBaseGraph orientBaseGraph = unwrapCurrentGraph(); List<Object> ids = new ArrayList<>(); // Load the edge type in order to access the indices of the edge OrientEdgeType edgeType = orientBaseGraph.getEdgeType(edgeLabel); if (edgeType != null) { // Fetch the required index OIndex<?> index = edgeType.getClassIndex("e." + edgeLabel.toLowerCase() + "_" + indexPostfix); if (index != null) { // Iterate over the sb-tree index entries OIndexCursor cursor = index.iterateEntriesMajor(new OCompositeKey(key), true, false); while (cursor.hasNext()) { Entry<Object, OIdentifiable> entry = cursor.nextEntry(); if (entry != null) { OCompositeKey entryKey = (OCompositeKey) entry.getKey(); // The index returns all entries. We thus need to filter it manually if (entryKey.getKeys().get(1).equals(key)) { Object inId = entryKey.getKeys().get(0); // Only add the inbound vertex id to the list of ids ids.add(inId); } } else { break; } } } } return ids; }
/** * {@inheritDoc} */ @Override public Map.Entry<Object, OIdentifiable> nextEntry() { if (source.isRebuilding()) throwRebuildException(); final Map.Entry<Object, OIdentifiable> entry = delegate.nextEntry(); if (source.getRebuildVersion() != indexRebuildVersion) throwRebuildException(); return entry; }
private void fetchEntriesFromIndexCursor(final OIndexCursor cursor) { int needsToFetch; if (fetchLimit > 0) { needsToFetch = fetchLimit + skip; } else { needsToFetch = -1; } cursor.setPrefetchSize(needsToFetch); Entry<Object, OIdentifiable> entryRecord = cursor.nextEntry(); if (needsToFetch > 0) { needsToFetch--; } while (entryRecord != null) { final ODocument doc = new ODocument().setOrdered(true); doc.field("key", entryRecord.getKey()); doc.field("rid", entryRecord.getValue().getIdentity()); ORecordInternal.unsetDirty(doc); applyGroupBy(doc, context); if (!handleResult(doc, context)) { // LIMIT REACHED break; } if (needsToFetch > 0) { needsToFetch--; cursor.setPrefetchSize(needsToFetch); } entryRecord = cursor.nextEntry(); } }
Map.Entry<Object, OIdentifiable> entry; while ((entry = cursor.nextEntry()) != null) { OIdentifiable rec = entry.getValue(); rec = rec.getRecord();