org.openjena.atlas.data
Class DistinctDataNet<E>

java.lang.Object
  extended by org.openjena.atlas.data.AbstractDataBag<E>
      extended by org.openjena.atlas.data.SortedDataBag<E>
          extended by org.openjena.atlas.data.DistinctDataBag<E>
              extended by org.openjena.atlas.data.DistinctDataNet<E>
All Implemented Interfaces:
Iterable<E>, DataBag<E>, Closeable, Sink<E>

public class DistinctDataNet<E>
extends DistinctDataBag<E>

This class is like DistinctDataBag except that you are informed if the item you just added was known to be distinct. This will normally only work until the first spill. After that, the system may not be able to tell for sure, and will thus return false. When you are finished adding items, you may call netIterator() to get any distinct items that are in the spill files but were not indicated as distinct previously. This is useful for a distinct operator that streams results until it exceeds the spill threshold.


Constructor Summary
DistinctDataNet(ThresholdPolicy<E> policy, SerializationFactory<E> serializerFactory, Comparator<E> comparator)
           
 
Method Summary
 boolean netAdd(E item)
           
 Iterator<E> netIterator()
          Returns an iterator to all additional items that are distinct but were not reported to be so at the time netAdd(Object) was invoked.
 
Methods inherited from class org.openjena.atlas.data.DistinctDataBag
isDistinct, isSorted, iterator
 
Methods inherited from class org.openjena.atlas.data.SortedDataBag
add, close, flush
 
Methods inherited from class org.openjena.atlas.data.AbstractDataBag
addAll, addAll, isEmpty, send, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistinctDataNet

public DistinctDataNet(ThresholdPolicy<E> policy,
                       SerializationFactory<E> serializerFactory,
                       Comparator<E> comparator)
Method Detail

netAdd

public boolean netAdd(E item)
Returns:
true if the item added is known to be distinct.

netIterator

public Iterator<E> netIterator()
Returns an iterator to all additional items that are distinct but were not reported to be so at the time netAdd(Object) was invoked.

If you do not exhaust the iterator, you should call Iter.close(Iterator) to be sure any open file handles are closed.



Licenced under the Apache License, Version 2.0