public int size() { if (size > -1) return size; if (iterator instanceof OSizeable) return ((OSizeable) iterator).size(); return 0; }
@Override public int size() { if (edges == null) { return 0; } if (edges instanceof OSizeable) { return ((OSizeable) edges).size(); } if (edges instanceof Collection) { return ((Collection) edges).size(); } Iterator<OEdge> iterator = edges.iterator(); int count = 0; while (iterator.hasNext()) { count++; } return count; } }
private static void batchRemove(Collection<Object> coll, Iterator<?> it) { int approximateRemainingSize; if (it instanceof OSizeable) { approximateRemainingSize = ((OSizeable) it).size(); } else { approximateRemainingSize = -1; } while (it.hasNext()) { Set<?> batch = prepareBatch(it, approximateRemainingSize); coll.removeAll(batch); approximateRemainingSize -= batch.size(); } }
private static void batchRemove(Collection<Object> coll, Iterator<?> it) { int approximateRemainingSize; if (it instanceof OSizeable) { approximateRemainingSize = ((OSizeable) it).size(); } else { approximateRemainingSize = -1; } while (it.hasNext()) { Set<?> batch = prepareBatch(it, approximateRemainingSize); coll.removeAll(batch); approximateRemainingSize -= batch.size(); } }
/** * Returns the size of the multi-value object * * @param iObject * Multi-value object (array, collection or map) * @return the size of the multi value object */ public static int getSize(final Object iObject) { if (iObject == null) return 0; if (iObject instanceof OSizeable) return ((OSizeable) iObject).size(); if (!isMultiValue(iObject)) return 0; if (iObject instanceof Collection<?>) return ((Collection<Object>) iObject).size(); if (iObject instanceof Map<?, ?>) return ((Map<?, Object>) iObject).size(); if (iObject.getClass().isArray()) return Array.getLength(iObject); return 0; }
public static String getPrettyFieldMultiValue(final Iterator<?> iterator, final int maxMultiValueEntries) { final StringBuilder value = new StringBuilder("["); for (int i = 0; iterator.hasNext(); i++) { if (i >= maxMultiValueEntries) { if (iterator instanceof OSizeable) { value.append("(size="); value.append(((OSizeable) iterator).size()); value.append(")"); } else value.append("(more)"); break; } if (i > 0) value.append(','); value.append(getPrettyFieldValue(iterator.next(), maxMultiValueEntries)); } value.append("]"); return value.toString(); }
final List<Object> list = ioResult instanceof OSizeable ? new ArrayList<Object>(((OSizeable) ioResult).size()) : new ArrayList<Object>();
public int size() { // SUM ALL THE COLLECTION SIZES int size = 0; for (Object o : sources) { if (o != null) if (o instanceof Collection<?>) size += ((Collection<?>) o).size(); else if (o instanceof Map<?, ?>) size += ((Map<?, ?>) o).size(); else if (o instanceof OSizeable) size += ((OSizeable) o).size(); else if (o.getClass().isArray()) size += Array.getLength(o); else if (o instanceof Iterator<?> && o instanceof OResettable) { while (((Iterator<?>) o).hasNext()) { size++; ((Iterator<?>) o).next(); } ((OResettable) o).reset(); } else size++; } return size; }
final Set<Object> set = ioResult instanceof OSizeable ? new HashSet<Object>(((OSizeable) ioResult).size()) : new HashSet<Object>();
public int size() { // SUM ALL THE COLLECTION SIZES int size = 0; final int totSources = sources.size(); for (int i = 0; i < totSources; ++i) { final Object o = sources.get(i); if (o != null) if (o instanceof Collection<?>) size += ((Collection<?>) o).size(); else if (o instanceof Map<?, ?>) size += ((Map<?, ?>) o).size(); else if (o instanceof OSizeable) size += ((OSizeable) o).size(); else if (o.getClass().isArray()) size += Array.getLength(o); else if (o instanceof Iterator<?> && o instanceof OResettable) { while (((Iterator<?>) o).hasNext()) { size++; ((Iterator<?>) o).next(); } ((OResettable) o).reset(); } else size++; } return size; }
return ((OSizeable) iObject).size();
protected Object move(final ODatabase graph, final OIdentifiable iRecord, final String[] iLabels, Iterable<OIdentifiable> iPossibleResults) { if (iPossibleResults == null) { return v2v(graph, iRecord, ODirection.OUT, iLabels); } if (!iPossibleResults.iterator().hasNext()) { return Collections.emptyList(); } Object edges = v2e(graph, iRecord, ODirection.OUT, iLabels); if (edges instanceof OSizeable) { int size = ((OSizeable) edges).size(); if (size > supernodeThreshold) { Object result = fetchFromIndex(graph, iRecord, iPossibleResults, iLabels); if (result != null) { return result; } } } return v2v(graph, iRecord, ODirection.OUT, iLabels); }
protected Object move(final ODatabase graph, final OIdentifiable iRecord, final String[] iLabels, Iterable<OIdentifiable> iPossibleResults) { if (iPossibleResults == null) { return v2v(graph, iRecord, ODirection.IN, iLabels); } if (!iPossibleResults.iterator().hasNext()) { return Collections.emptyList(); } Object edges = v2e(graph, iRecord, ODirection.IN, iLabels); if (edges instanceof OSizeable) { int size = ((OSizeable) edges).size(); if (size > supernodeThreshold) { Object result = fetchFromIndex(graph, iRecord, iPossibleResults, iLabels); if (result != null) { return result; } } } return v2v(graph, iRecord, ODirection.IN, iLabels); }
protected Object move(final OrientBaseGraph graph, final OIdentifiable iRecord, final String[] iLabels, Iterable<OIdentifiable> iPossibleResults) { if (iPossibleResults == null) { return v2v(graph, iRecord, Direction.IN, iLabels); } if (!iPossibleResults.iterator().hasNext()) { return Collections.emptyList(); } Object edges = v2e(graph, iRecord, Direction.IN, iLabels); if (edges instanceof OSizeable) { int size = ((OSizeable) edges).size(); if (size > supernodeThreshold) { Object result = fetchFromIndex(graph, iRecord, iPossibleResults, iLabels); if (result != null) { return result; } } } return v2v(graph, iRecord, Direction.IN, iLabels); }
protected Object move(final OrientBaseGraph graph, final OIdentifiable iRecord, final String[] iLabels, Iterable<OIdentifiable> iPossibleResults) { if (iPossibleResults == null) { return v2v(graph, iRecord, Direction.OUT, iLabels); } if (!iPossibleResults.iterator().hasNext()) { return Collections.emptyList(); } Object edges = v2e(graph, iRecord, Direction.OUT, iLabels); if (edges instanceof OSizeable) { int size = ((OSizeable) edges).size(); if (size > supernodeThreshold) { Object result = fetchFromIndex(graph, iRecord, iPossibleResults, iLabels); if (result != null) { return result; } } } return v2v(graph, iRecord, Direction.OUT, iLabels); }
@Override public int size() { if (source.isRebuilding()) throwRebuildException(); final int size = ((OSizeable) delegate).size(); if (source.getRebuildVersion() != indexRebuildVersion) throwRebuildException(); return size; } }
return ((OSizeable) result).size();
long count = 0; if (cursor instanceof OSizeable) count = ((OSizeable) cursor).size(); else { while (cursor.hasNext()) {