Package mondrian.rolap
Class BitKey.Small
java.lang.Object
mondrian.rolap.BitKey.AbstractBitKey
mondrian.rolap.BitKey.Small
- All Implemented Interfaces:
Serializable
,Comparable<BitKey>
,Iterable<Integer>
,BitKey
- Enclosing interface:
- BitKey
Implementation of
BitKey
for bit counts less than 64.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface mondrian.rolap.BitKey
BitKey.AbstractBitKey, BitKey.Big, BitKey.Factory, BitKey.Mid128, BitKey.Small
-
Field Summary
Fields inherited from class mondrian.rolap.BitKey.AbstractBitKey
ChunkBitCount, Mask, WORD_MASK
Fields inherited from interface mondrian.rolap.BitKey
bitPositionTable, EMPTY
-
Method Summary
Modifier and TypeMethodDescriptionReturns the boolean AND of this bitkey and the given bitkey.Returns aBitKey
containing all of the bits in thisBitSet
whose corresponding bit is NOT set in the specifiedBitSet
.int
Returns the number of bits set.void
clear()
Sets all of the bits in this BitKey tofalse
.void
clear
(int pos) Sets the bit specified by the index tofalse
.int
protected int
compareToBig
(BitKey.Big that) copy()
Returns a copy of this BitKey.Returns an empty BitKey of the same type.boolean
boolean
get
(int pos) Returns the value of the bit with the specified index.int
hashCode()
boolean
intersects
(BitKey bitKey) Returns whether this BitKey has any bits in common with a given BitKey.boolean
isEmpty()
Returns true if thisBitKey
contains no bits that are set totrue
.boolean
isSuperSetOf
(BitKey bitKey) Is every bit set in the parameterbitKey
also set inthis
.iterator()
To say that I am happy about this algorithm (or the variations of the algorithm used for the Mid128 and Big BitKey implementations) would be a stretch.int
nextSetBit
(int fromIndex) Returns the index of the first bit that is set totrue
that occurs on or after the specified starting index.Or the parameterBitKey
withthis
.XOr the parameterBitKey
withthis
.void
set
(int pos) Sets the bit at the specified index totrue
.toBitSet()
Returns aBitSet
with the same contents as this BitKey.toString()
Methods inherited from class mondrian.rolap.BitKey.AbstractBitKey
bit, bitCount, chunkCount, chunkPos, copyFromByte, copyFromLong, createException, set
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
set
public void set(int pos) Description copied from interface:BitKey
Sets the bit at the specified index totrue
. -
get
public boolean get(int pos) Description copied from interface:BitKey
Returns the value of the bit with the specified index. The value istrue
if the bit with the indexbitIndex
is currently set in thisBitKey
; otherwise, the result isfalse
. -
clear
public void clear(int pos) Description copied from interface:BitKey
Sets the bit specified by the index tofalse
. -
clear
public void clear()Description copied from interface:BitKey
Sets all of the bits in this BitKey tofalse
. -
cardinality
public int cardinality()Description copied from interface:BitKey
Returns the number of bits set.- Returns:
- Number of bits set
-
or
Description copied from interface:BitKey
Or the parameterBitKey
withthis
.- Parameters:
bitKey
- Bit key
-
orNot
Description copied from interface:BitKey
XOr the parameterBitKey
withthis
.- Parameters:
bitKey
- Bit key
-
and
Description copied from interface:BitKey
Returns the boolean AND of this bitkey and the given bitkey.- Parameters:
bitKey
- Bit key
-
andNot
Description copied from interface:BitKey
Returns aBitKey
containing all of the bits in thisBitSet
whose corresponding bit is NOT set in the specifiedBitSet
. -
isSuperSetOf
Description copied from interface:BitKey
Is every bit set in the parameterbitKey
also set inthis
. If one switchesthis
with the parameterbitKey
one gets the equivalent of isSubSetOf.- Parameters:
bitKey
- Bit key
-
intersects
Description copied from interface:BitKey
Returns whether this BitKey has any bits in common with a given BitKey. -
toBitSet
Description copied from interface:BitKey
Returns aBitSet
with the same contents as this BitKey. -
iterator
To say that I am happy about this algorithm (or the variations of the algorithm used for the Mid128 and Big BitKey implementations) would be a stretch. It works but there has to be a more elegant and faster one but this is the best I could come up with in a couple of hours. -
nextSetBit
public int nextSetBit(int fromIndex) Description copied from interface:BitKey
Returns the index of the first bit that is set totrue
that occurs on or after the specified starting index. If no such bit exists then -1 is returned. To iterate over thetrue
bits in aBitKey
, use the following loop:for (int i = bk.nextSetBit(0); i >= 0; i = bk.nextSetBit(i + 1)) { // operate on index i here }
- Parameters:
fromIndex
- the index to start checking from (inclusive)- Returns:
- the index of the next set bit
-
equals
-
hashCode
public int hashCode() -
compareTo
-
compareToBig
-
toString
-
copy
Description copied from interface:BitKey
Returns a copy of this BitKey.- Returns:
- copy of BitKey
-
emptyCopy
Description copied from interface:BitKey
Returns an empty BitKey of the same type. This is the same as callingBitKey.copy()
followed byBitKey.clear()
.- Returns:
- BitKey of same type
-
isEmpty
public boolean isEmpty()Description copied from interface:BitKey
Returns true if thisBitKey
contains no bits that are set totrue
.
-