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 TypeMethodDescriptionbooleanAdds new integer to the set (sets an appropriate bit).booleanaddAll(Collection<? extends Integer> arg0) Adds all elements from a collection of integers to the set (sets appropriate bits).intCalculates size of the interesection between this set and another one.intcalculateIntersectionSize(IntegerBitSet other1, IntegerBitSet other2) Calculates size of the interesection between this set and two other ones.voidclear()Clears the set (resets all the bits).clone()Clones the set.booleanChecks if the set contains a given integer.booleancontainsAll(Collection<?> arg0) Check if the set contains all integers from a given collection.booleanfilteredCompare(IntegerBitSet arg0, IntegerBitSet arg1) Compares two other integer sets using this set as a mask.intGetsmaxElement.long[]booleanisEmpty()Checks if set is empty.iterator()Gets a set iterator.voidnegate()Generates complement of the set (negates all bits).voidnegate(IntegerBitSet output) Generates complement of the set (negates all bits).booleanRemoves an integer from the set (resets an appropriate bit).booleanremoveAll(Collection<?> arg0) Removes all elements from a collection of integers to the set (resets appropriate bits).booleanretainAll(Collection<?> arg0) Retain from the set all of its elements that are contained in the specified collection.voidsetAll()Adds all elements up tomaxElement(sets all bits).voidsetAll(Collection<? extends Integer> arg0) Clears set and adds all elements from another collections.intsize()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, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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:
containsAllin interfaceCollection<Integer>- Specified by:
containsAllin 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.
-