/** * Converts an Iteration to a string by concatenating all of the string representations of objects in the * Iteration, divided by a separator. * * @param iter * An Iteration over arbitrary objects that are expected to implement {@link Object#toString()}. * @param separator * The separator to insert between the object strings. * @param sb * A StringBuilder to append the Iteration string to. */ public static <X extends Exception> void toString(Iteration<?, X> iter, String separator, StringBuilder sb) throws X { while (iter.hasNext()) { sb.append(iter.next()); if (iter.hasNext()) { sb.append(separator); } } } }
public void remove() throws RepositoryException { wrappedIter.remove(); }
public boolean hasNext() throws RepositoryException { return wrappedIter.hasNext(); }
@Override public T next() throws RepositoryException { return wrappedIter.next(); }
@Override public boolean hasNext() { return iteration.hasNext(); }
@Override public T next() { return iteration.next(); } };
/** * Converts an Iteration to a string by concatenating all of the string representations of objects in the * Iteration, divided by a separator. * * @param iter * An Iteration over arbitrary objects that are expected to implement {@link Object#toString()}. * @param separator * The separator to insert between the object strings. * @param sb * A StringBuilder to append the Iteration string to. */ public static <X extends Exception> void toString(Iteration<?, X> iter, String separator, StringBuilder sb) throws X { while (iter.hasNext()) { sb.append(iter.next()); if (iter.hasNext()) { sb.append(separator); } } } }
@Override public boolean hasNext() throws RepositoryException { return wrappedIter.hasNext(); }
public T next() throws RepositoryException { return wrappedIter.next(); }
@Override public void remove() throws RepositoryException { wrappedIter.remove(); }
/** * Converts an Iteration to a string by concatenating all of the string representations of objects in the * Iteration, divided by a separator. * * @param iter * An Iteration over arbitrary objects that are expected to implement {@link Object#toString()}. * @param separator * The separator to insert between the object strings. * @param sb * A StringBuilder to append the Iteration string to. */ public static <X extends Exception> void toString(Iteration<?, X> iter, String separator, StringBuilder sb) throws X { while (iter.hasNext()) { sb.append(iter.next()); if (iter.hasNext()) { sb.append(separator); } } } }
@Override public boolean hasNext() { boolean hasMore = iteration.hasNext(); if (!hasMore) { Iterators.closeSilently(this); } return hasMore; }
@Override public E next() { return iteration.next(); }
@Override public void remove() { iteration.remove(); }
/** * Adds all elements from the supplied Iteration to the specified collection. If the supplied Iteration is * an instance of {@link CloseableIteration} it is automatically closed after consumption. * * @param iter * An Iteration containing elements to add to the container. If the Iteration is an instance of * {@link CloseableIteration} it is automatically closed after consumption. * @param collection * The collection to add the elements to. * @return The <tt>collection</tt> object that was supplied to this method. */ public static <E, X extends Exception, C extends Collection<E>> C addAll(Iteration<? extends E, X> iter, C collection) throws X { try { while (iter.hasNext()) { collection.add(iter.next()); } } finally { closeCloseable(iter); } return collection; }
@Override public boolean hasNext() { boolean hasMore = iteration.hasNext(); if (!hasMore) { Iterators.closeSilently(this); } return hasMore; }
@Override public E next() { return iteration.next(); }
@Override public void remove() { iteration.remove(); }
/** * @param arg2 * the iteration with elements to add to the includeSet * @param includeSet * the set that should have all unique elements of arg2 * @param used * the collection size counter of all collections used in answering a query * @param maxSize * the point at which we throw a new query exception * @return the includeSet * @throws QueryEvaluationException * trigerred when maxSize is smaller than the used value */ public static Set<BindingSet> addAll( Iteration<? extends BindingSet, ? extends QueryEvaluationException> arg2, Set<BindingSet> includeSet, AtomicLong used, long maxSize) throws QueryEvaluationException { while (arg2.hasNext()) { if (includeSet.add(arg2.next()) && used.incrementAndGet() > maxSize) throw new QueryEvaluationException("Size limited reached inside intersect operator"); } return includeSet; }
@Override public boolean hasNext() { boolean hasMore = iteration.hasNext(); if (!hasMore) { Iterators.closeSilently(this); } return hasMore; }