Class ConciseSet
- java.lang.Object
-
- org.apache.druid.extendedset.intset.AbstractIntSet
-
- org.apache.druid.extendedset.intset.ConciseSet
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IntSet>,IntSet
public class ConciseSet extends AbstractIntSet implements Serializable
This is CONCISE: COmpressed 'N' Composable Integer SEt. This class is an instance ofIntSetinternally represented by compressed bitmaps though a RLE (Run-Length Encoding) compression algorithm. See http://ricerca.mat.uniroma3.it/users/dipietro/publications/0020-0190.pdf for more details. Notice that the iterator byiterator()is fail-fast, similar to mostCollection-derived classes. If the set is structurally modified at any time after the iterator is created, the iterator will throw aConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future. The iterator throws aConcurrentModificationExceptionon a best-effort basis. Therefore, it would be wrong to write a program that depended on this exception for its correctness: the fail-fast behavior of iterators should be used only to detect bugs.- Version:
- $Id$
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.druid.extendedset.intset.IntSet
IntSet.IntIterator
-
-
Constructor Summary
Constructors Constructor Description ConciseSet()Creates an empty integer setConciseSet(boolean simulateWAH)Creates an empty integer setConciseSet(int[] words, boolean simulateWAH)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(int e)booleanaddAll(IntSet c)voidclear()ConciseSetclone()See theclone()ofObjectintcompareTo(IntSet o)booleancontains(int o)ConciseSetconvert(int... a)IntSet.IntIteratordescendingIterator()ConciseSetempty()booleanequals(Object obj)int[]getWords()inthashCode()ConciseSetintersection(IntSet other)booleanisEmpty()IntSet.IntIteratoriterator()booleanremove(int o)intsize()-
Methods inherited from class org.apache.druid.extendedset.intset.AbstractIntSet
toString
-
-
-
-
Constructor Detail
-
ConciseSet
public ConciseSet()
Creates an empty integer set
-
ConciseSet
public ConciseSet(boolean simulateWAH)
Creates an empty integer set- Parameters:
simulateWAH-trueif the class must simulate the behavior of WAH
-
ConciseSet
public ConciseSet(int[] words, boolean simulateWAH)
-
-
Method Detail
-
clone
public ConciseSet clone()
See theclone()ofObject- Specified by:
clonein interfaceIntSet- Specified by:
clonein classAbstractIntSet- Returns:
- cloned object
-
getWords
public int[] getWords()
-
intersection
public ConciseSet intersection(IntSet other)
-
iterator
public IntSet.IntIterator iterator()
- Specified by:
iteratorin interfaceIntSet- Specified by:
iteratorin classAbstractIntSet- Returns:
- a
IntSet.IntIteratorinstance to iterate over the set
-
descendingIterator
public IntSet.IntIterator descendingIterator()
- Specified by:
descendingIteratorin interfaceIntSet- Specified by:
descendingIteratorin classAbstractIntSet- Returns:
- a
IntSet.IntIteratorinstance to iterate over the set in descending order
-
clear
public void clear()
-
convert
public ConciseSet convert(int... a)
-
add
public boolean add(int e)
-
remove
public boolean remove(int o)
-
contains
public boolean contains(int o)
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceIntSet- Specified by:
isEmptyin classAbstractIntSet- Returns:
- true if this set contains no elements
-
addAll
public boolean addAll(IntSet c)
-
size
public int size()
- Specified by:
sizein interfaceIntSet- Specified by:
sizein classAbstractIntSet- Returns:
- the number of elements in this set (its cardinality)
-
empty
public ConciseSet empty()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractIntSet
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAbstractIntSet
-
compareTo
public int compareTo(IntSet o)
- Specified by:
compareToin interfaceComparable<IntSet>- Overrides:
compareToin classAbstractIntSet
-
-