Package org.apache.jena.atlas.data
Class DistinctDataNet<E>
- java.lang.Object
-
- org.apache.jena.atlas.data.AbstractDataBag<E>
-
- org.apache.jena.atlas.data.SortedDataBag<E>
-
- org.apache.jena.atlas.data.DistinctDataBag<E>
-
- org.apache.jena.atlas.data.DistinctDataNet<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>
,DataBag<E>
,org.apache.jena.atlas.lib.Closeable
,org.apache.jena.atlas.lib.Sink<E>
public class DistinctDataNet<E> extends DistinctDataBag<E>
This class is likeDistinctDataBag
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 callnetIterator()
to get any distinct items that are in the spill files but were not indicated as distinct previously.
-
-
Constructor Summary
Constructors Constructor Description DistinctDataNet(ThresholdPolicy<E> policy, SerializationFactory<E> serializerFactory, java.util.Comparator<E> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
netAdd(E item)
java.util.Iterator<E>
netIterator()
Returns an iterator to all additional items that are distinct but were not reported to be so at the timenetAdd(Object)
was invoked.-
Methods inherited from class org.apache.jena.atlas.data.DistinctDataBag
isDistinct, isSorted, iterator
-
Methods inherited from class org.apache.jena.atlas.data.SortedDataBag
add, cancel, close, flush, isCancelled, isClosed
-
Methods inherited from class org.apache.jena.atlas.data.AbstractDataBag
isEmpty, send, size
-
-
-
-
Constructor Detail
-
DistinctDataNet
public DistinctDataNet(ThresholdPolicy<E> policy, SerializationFactory<E> serializerFactory, java.util.Comparator<E> comparator)
-
-
Method Detail
-
netAdd
public boolean netAdd(E item)
- Returns:
- true if the item added is known to be distinct.
-
netIterator
public java.util.Iterator<E> netIterator()
Returns an iterator to all additional items that are distinct but were not reported to be so at the timenetAdd(Object)
was invoked. If you do not exhaust the iterator, you should callIter.close(Iterator)
to be sure any open file handles are closed.
-
-