Class IntegerBitSet
java.lang.Object
adaa.analytics.rules.logic.representation.IntegerBitSet
- All Implemented Interfaces:
Serializable
,Iterable<Integer>
,Collection<Integer>
,Set<Integer>
Upper-bounded set of integers represented internally as a bit vector.
NOTE: While class implements Serializable interface, serialization/deserialization methods do nothing!
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIntegerBitSet
(int maxElement) Allocates words array for storing bits.IntegerBitSet
(int maxElement, boolean fill) Allocates words array for storing bits. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds new integer to the set (sets an appropriate bit).boolean
addAll
(Collection<? extends Integer> arg0) Adds all elements from a collection of integers to the set (sets appropriate bits).int
Calculates size of the interesection between this set and another one.int
calculateIntersectionSize
(IntegerBitSet other1, IntegerBitSet other2) Calculates size of the interesection between this set and two other ones.void
clear()
Clears the set (resets all the bits).clone()
Clones the set.boolean
Checks if the set contains a given integer.boolean
containsAll
(Collection<?> arg0) Check if the set contains all integers from a given collection.boolean
filteredCompare
(IntegerBitSet arg0, IntegerBitSet arg1) Compares two other integer sets using this set as a mask.int
GetsmaxElement
.long[]
boolean
isEmpty()
Checks if set is empty.iterator()
Gets a set iterator.void
negate()
Generates complement of the set (negates all bits).void
negate
(IntegerBitSet output) Generates complement of the set (negates all bits).boolean
Removes an integer from the set (resets an appropriate bit).boolean
removeAll
(Collection<?> arg0) Removes all elements from a collection of integers to the set (resets appropriate bits).boolean
retainAll
(Collection<?> arg0) Retain from the set all of its elements that are contained in the specified collection.void
setAll()
Adds all elements up tomaxElement
(sets all bits).void
setAll
(Collection<? extends Integer> arg0) Clears set and adds all elements from another collections.int
size()
Calculates set size.Object[]
toArray()
To be implemented.<T> T[]
toArray
(T[] arg0) To be implemented.toString()
Generates a text representation of the set.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
Field Details
-
OFFSET_MASK
public static final int OFFSET_MASK- See Also:
-
ID_SHIFT
public static final int ID_SHIFT- See Also:
-
-
Constructor Details
-
IntegerBitSet
public IntegerBitSet(int maxElement) Allocates words array for storing bits.- Parameters:
maxElement
- Max element that can be stored in the set.
-
IntegerBitSet
public IntegerBitSet(int maxElement, boolean fill) Allocates words array for storing bits.- Parameters:
maxElement
- Max element that can be stored in the set.
-
-
Method Details
-
getMaxElement
public int getMaxElement()GetsmaxElement
. -
getRawTable
public long[] getRawTable() -
add
Adds new integer to the set (sets an appropriate bit). -
addAll
Adds all elements from a collection of integers to the set (sets appropriate bits). If given collection is another bit set, an optimized path is executed (logical operations on bit vectors). -
clear
public void clear()Clears the set (resets all the bits). -
setAll
public void setAll()Adds all elements up tomaxElement
(sets all bits). -
setAll
Clears set and adds all elements from another collections. -
negate
public void negate()Generates complement of the set (negates all bits). -
negate
Generates complement of the set (negates all bits). -
contains
Checks if the set contains a given integer. -
containsAll
Check if the set contains all integers from a given collection. If given collection is another bit set, an optimized path is executed (logical operations on bit vectors).- Specified by:
containsAll
in interfaceCollection<Integer>
- Specified by:
containsAll
in interfaceSet<Integer>
- Parameters:
arg0
- Collection of integers to be checked.- Returns:
- Test result.
-
isEmpty
public boolean isEmpty()Checks if set is empty. -
iterator
Gets a set iterator. -
remove
Removes an integer from the set (resets an appropriate bit). -
removeAll
Removes all elements from a collection of integers to the set (resets appropriate bits). If given collection is another bit set, an optimized path is executed (logical operations on bit vectors). -
retainAll
Retain from the set all of its elements that are contained in the specified collection. If given collection is another bit set, an optimized path is executed (logical operations on bit vectors). -
size
public int size()Calculates set size. -
toString
Generates a text representation of the set. -
calculateIntersectionSize
Calculates size of the interesection between this set and another one.- Parameters:
other
- Other set.- Returns:
- Intersection size.
-
calculateIntersectionSize
Calculates size of the interesection between this set and two other ones.- Parameters:
other1
- First other set.other2
- Second other set.- Returns:
- Intersection size.
-
toArray
To be implemented. -
toArray
public <T> T[] toArray(T[] arg0) To be implemented. -
clone
Clones the set. -
filteredCompare
Compares two other integer sets using this set as a mask.- Parameters:
arg0
- First set.arg1
- Second set.- Returns:
- Value indicating if given two sets are equal after masking.
-