Class WrappedBloomFilter<T extends WrappedBloomFilter<T,W>,W extends BloomFilter<W>>  
- Type Parameters:
- T- The WrappedBloomFilter type.
- W- The wrapped BloomFilter type.
- All Implemented Interfaces:
- BitMapExtractor,- BloomFilter<T>,- IndexExtractor
- Since:
- 4.5.0-M1
- 
Field SummaryFields inherited from interface org.apache.commons.collections4.bloomfilter.BloomFilterSPARSE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionlong[]Return a copy of the BitMapExtractor data as a bit map array.int[]Return a copy of the IndexExtractor data as an int array.intGets the cardinality (number of enabled bits) of this Bloom filter.intGets the characteristics of the filter.voidclear()Clears the filter to by resetting it to its initial, unpopulated state.booleancontains(BitMapExtractor bitMapExtractor) Returnstrueif this filter contains the bits specified in the bit maps produced by the bitMapExtractor.booleancontains(BloomFilter<?> other) Returnstrueif this filter contains the specified filter.booleanReturnstrueif this filter contains the bits specified in the hasher.booleancontains(IndexExtractor indexExtractor) Returnstrueif this filter contains the indices specified IndexExtractor.intestimateIntersection(BloomFilter<?> other) Estimates the number of items in the intersection of this Bloom filter with the other bloom filter.intEstimates the number of items in the Bloom filter.intestimateUnion(BloomFilter<?> other) Estimates the number of items in the union of this Bloom filter with the other bloom filter.getShape()Gets the shape that was used when the filter was built.protected WGets the wrapped BloomFilter.booleanisFull()Determines if the bloom filter is "full".booleanmerge(BitMapExtractor bitMapExtractor) Merges the specified hasher into this Bloom filter.booleanmerge(BloomFilter<?> other) Merges the specified Bloom filter into this Bloom filter.booleanMerges the specified hasher into this Bloom filter.booleanmerge(IndexExtractor indexExtractor) Merges the specified IndexExtractor into this Bloom filter.booleanprocessBitMapPairs(BitMapExtractor other, LongBiPredicate func) Applies thefuncto each bit map pair in order.booleanprocessBitMaps(LongPredicate predicate) Each bit map is passed to the predicate in order.booleanprocessIndices(IntPredicate predicate) Each index is passed to the predicate.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.collections4.bloomfilter.BloomFiltercopy, isEmpty, uniqueIndices
- 
Constructor Details- 
WrappedBloomFilterWraps a Bloom filter. The wrapped filter is maintained as a reference not a copy. Changes in one will be reflected in the other.- Parameters:
- wrapped- The Bloom filter.
 
 
- 
- 
Method Details- 
asBitMapArrayDescription copied from interface:BitMapExtractorReturn a copy of the BitMapExtractor data as a bit map array.The default implementation of this method is slow. It is recommended that implementing classes reimplement this method. - Specified by:
- asBitMapArrayin interface- BitMapExtractor
- Returns:
- An array of bit map data.
 
- 
asIndexArrayDescription copied from interface:IndexExtractorReturn a copy of the IndexExtractor data as an int array.Indices ordering and uniqueness is not guaranteed. The default implementation of this method creates an array and populates it. Implementations that have access to an index array should consider returning a copy of that array if possible. - Specified by:
- asIndexArrayin interface- IndexExtractor
- Returns:
- An int array of the data.
 
- 
cardinalityDescription copied from interface:BloomFilterGets the cardinality (number of enabled bits) of this Bloom filter.This is also known as the Hamming value or Hamming number. - Specified by:
- cardinalityin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Returns:
- the cardinality of this filter
 
- 
characteristicsDescription copied from interface:BloomFilterGets the characteristics of the filter.Characteristics are defined as bits within the characteristics integer. - Specified by:
- characteristicsin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Returns:
- the characteristics for this bloom filter.
 
- 
clearDescription copied from interface:BloomFilterClears the filter to by resetting it to its initial, unpopulated state.- Specified by:
- clearin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
 
- 
containsDescription copied from interface:BloomFilterReturnstrueif this filter contains the bits specified in the bit maps produced by the bitMapExtractor.- Specified by:
- containsin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- bitMapExtractor- the- BitMapExtractorto provide the bit maps.
- Returns:
- trueif this filter is enabled for all bits specified by the bit maps
 
- 
containsDescription copied from interface:BloomFilterReturnstrueif this filter contains the specified filter.Specifically this returns trueif this filter is enabled for all bits that are enabled in theotherfilter. Using the bit representations this is effectively(this AND other) == other.- Specified by:
- containsin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- other- the other Bloom filter
- Returns:
- true if all enabled bits in the other filter are enabled in this filter.
 
- 
containsDescription copied from interface:BloomFilterReturnstrueif this filter contains the bits specified in the hasher.Specifically this returns trueif this filter is enabled for all bit indexes identified by thehasher. Using the bit map representations this is effectively(this AND hasher) == hasher.- Specified by:
- containsin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- hasher- the hasher to provide the indexes
- Returns:
- true if this filter is enabled for all bits specified by the hasher
 
- 
containsDescription copied from interface:BloomFilterReturnstrueif this filter contains the indices specified IndexExtractor.Specifically this returns trueif this filter is enabled for all bit indexes identified by theIndexExtractor.- Specified by:
- containsin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- indexExtractor- the IndexExtractor to provide the indexes
- Returns:
- trueif this filter is enabled for all bits specified by the IndexExtractor
 
- 
estimateIntersectionDescription copied from interface:BloomFilterEstimates the number of items in the intersection of this Bloom filter with the other bloom filter.This method produces estimate is roughly equivalent to the number of unique Hashers that have been merged into both of the filters by rounding the value from the calculation described in the Shapeclass Javadoc.estimateIntersectionshould only be called with Bloom filters of the same Shape. If called on Bloom filters of differing shape this method is not symmetric. Ifotherhas more bits anIllegalArgumentExceptionmay be thrown.- Specified by:
- estimateIntersectionin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- other- The other Bloom filter
- Returns:
- an estimate of the number of items in the intersection. If the calculated estimate is larger than Integer.MAX_VALUE then MAX_VALUE is returned.
- See Also:
 
- 
estimateNDescription copied from interface:BloomFilterEstimates the number of items in the Bloom filter.By default this is the rounding of the Shape.estimateN(cardinality)calculation for the shape and cardinality of this filter.This produces an estimate roughly equivalent to the number of Hashers that have been merged into the filter by rounding the value from the calculation described in the Shapeclass Javadoc.Note: - if cardinality == numberOfBits, then result is Integer.MAX_VALUE.
- if cardinality > numberOfBits, then an IllegalArgumentException is thrown.
 - Specified by:
- estimateNin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Returns:
- an estimate of the number of items in the bloom filter. Will return Integer.MAX_VALUE if the estimate is larger than Integer.MAX_VALUE.
- See Also:
 
- 
estimateUnionDescription copied from interface:BloomFilterEstimates the number of items in the union of this Bloom filter with the other bloom filter.This produces an estimate roughly equivalent to the number of unique Hashers that have been merged into either of the filters by rounding the value from the calculation described in the Shapeclass Javadoc.estimateUnionshould only be called with Bloom filters of the same Shape. If called on Bloom filters of differing shape this method is not symmetric. Ifotherhas more bits anIllegalArgumentExceptionmay be thrown.- Specified by:
- estimateUnionin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- other- The other Bloom filter
- Returns:
- an estimate of the number of items in the union. Will return Integer.MAX_VALUE if the estimate is larger than Integer.MAX_VALUE.
- See Also:
 
- 
getShapeDescription copied from interface:BloomFilterGets the shape that was used when the filter was built.- Specified by:
- getShapein interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Returns:
- The shape the filter was built with.
 
- 
getWrapped
- 
isFullDescription copied from interface:BloomFilterDetermines if the bloom filter is "full".Full is defined as having no unset bits. - Specified by:
- isFullin interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Returns:
- trueif the filter is full,- falseotherwise.
 
- 
mergeDescription copied from interface:BloomFilterMerges the specified hasher into this Bloom filter. Specifically all bit indexes that are identified by thebitMapExtractorwill be enabled in this filter.Note: This method should return trueeven if no additional bit indexes were enabled. Afalseresult indicates that this filter may or may not contain all the indexes enabled in thebitMapExtractor. This state may occur in complex Bloom filter implementations like counting Bloom filters.- Specified by:
- mergein interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- bitMapExtractor- The BitMapExtractor to merge.
- Returns:
- true if the merge was successful
 
- 
mergeDescription copied from interface:BloomFilterMerges the specified Bloom filter into this Bloom filter.Specifically all bit indexes that are identified by the otherwill be enabled in this filter.Note: This method should return trueeven if no additional bit indexes were enabled. Afalseresult indicates that this filter may or may not contain theotherBloom filter. This state may occur in complex Bloom filter implementations like counting Bloom filters.- Specified by:
- mergein interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- other- The bloom filter to merge into this one.
- Returns:
- true if the merge was successful
 
- 
mergeDescription copied from interface:BloomFilterMerges the specified hasher into this Bloom filter. Specifically all bit indexes that are identified by thehasherwill be enabled in this filter.Note: This method should return trueeven if no additional bit indexes were enabled. Afalseresult indicates that this filter may or may not contain thehashervalues. This state may occur in complex Bloom filter implementations like counting Bloom filters.- Specified by:
- mergein interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- hasher- The hasher to merge.
- Returns:
- true if the merge was successful
 
- 
mergeDescription copied from interface:BloomFilterMerges the specified IndexExtractor into this Bloom filter. Specifically all bit indexes that are identified by theindexExtractorwill be enabled in this filter.Note: This method should return trueeven if no additional bit indexes were enabled. Afalseresult indicates that this filter may or may not contain all the indexes of theindexExtractor. This state may occur in complex Bloom filter implementations like counting Bloom filters.- Specified by:
- mergein interface- BloomFilter<T extends WrappedBloomFilter<T,- W>> 
- Parameters:
- indexExtractor- The IndexExtractor to merge.
- Returns:
- true if the merge was successful
 
- 
processBitMapPairsDescription copied from interface:BitMapExtractorApplies thefuncto each bit map pair in order. Will apply all of the bit maps from the other BitMapExtractor to this extractor. If this extractor does not have as many bit maps it will provide 0 (zero) for all excess calls to the LongBiPredicate.The default implementation of this method uses asBitMapArray(). It is recommended that implementations of BitMapExtractor that have local arrays reimplement this method.- Specified by:
- processBitMapPairsin interface- BitMapExtractor
- Parameters:
- other- The other BitMapExtractor that provides the y values in the (x,y) pair.
- func- The function to apply.
- Returns:
- A LongPredicate that tests this BitMapExtractor's bitmap values in order.
 
- 
processBitMapsDescription copied from interface:BitMapExtractorEach bit map is passed to the predicate in order. The predicate is applied to each bit map value, if the predicate returnsfalsethe execution is stopped,falseis returned, and no further bit maps are processed.If the extractor is empty this method will return true. Any exceptions thrown by the action are relayed to the caller. - Specified by:
- processBitMapsin interface- BitMapExtractor
- Parameters:
- predicate- the function to execute
- Returns:
- trueif all bit maps returned- true,- falseotherwise.
 
- 
processIndicesDescription copied from interface:IndexExtractorEach index is passed to the predicate. The predicate is applied to each index value, if the predicate returnsfalsethe execution is stopped,falseis returned, and no further indices are processed.Any exceptions thrown by the action are relayed to the caller. Indices ordering and uniqueness is not guaranteed. - Specified by:
- processIndicesin interface- IndexExtractor
- Parameters:
- predicate- the action to be performed for each non-zero bit index.
- Returns:
- trueif all indexes return true from consumer,- falseotherwise.
 
 
-