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
public static class BitKey.Small extends BitKey.AbstractBitKey
Implementation ofBitKeyfor bit counts less than 64.- See Also:
- Serialized Form
-
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BitKeyand(BitKey bitKey)Returns the boolean AND of this bitkey and the given bitkey.BitKeyandNot(BitKey bitKey)Returns aBitKeycontaining all of the bits in thisBitSetwhose corresponding bit is NOT set in the specifiedBitSet.intcardinality()Returns the number of bits set.voidclear()Sets all of the bits in this BitKey tofalse.voidclear(int pos)Sets the bit specified by the index tofalse.intcompareTo(BitKey bitKey)protected intcompareToBig(BitKey.Big that)BitKeycopy()Returns a copy of this BitKey.BitKeyemptyCopy()Returns an empty BitKey of the same type.booleanequals(Object o)booleanget(int pos)Returns the value of the bit with the specified index.inthashCode()booleanintersects(BitKey bitKey)Returns whether this BitKey has any bits in common with a given BitKey.booleanisEmpty()Returns true if thisBitKeycontains no bits that are set totrue.booleanisSuperSetOf(BitKey bitKey)Is every bit set in the parameterbitKeyalso set inthis.Iterator<Integer>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.intnextSetBit(int fromIndex)Returns the index of the first bit that is set totruethat occurs on or after the specified starting index.BitKeyor(BitKey bitKey)Or the parameterBitKeywiththis.BitKeyorNot(BitKey bitKey)XOr the parameterBitKeywiththis.voidset(int pos)Sets the bit at the specified index totrue.BitSettoBitSet()Returns aBitSetwith the same contents as this BitKey.StringtoString()-
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 Detail
-
set
public void set(int pos)
Description copied from interface:BitKeySets the bit at the specified index totrue.
-
get
public boolean get(int pos)
Description copied from interface:BitKeyReturns the value of the bit with the specified index. The value istrueif the bit with the indexbitIndexis currently set in thisBitKey; otherwise, the result isfalse.
-
clear
public void clear(int pos)
Description copied from interface:BitKeySets the bit specified by the index tofalse.
-
clear
public void clear()
Description copied from interface:BitKeySets all of the bits in this BitKey tofalse.
-
cardinality
public int cardinality()
Description copied from interface:BitKeyReturns the number of bits set.- Returns:
- Number of bits set
-
or
public BitKey or(BitKey bitKey)
Description copied from interface:BitKeyOr the parameterBitKeywiththis.- Parameters:
bitKey- Bit key
-
orNot
public BitKey orNot(BitKey bitKey)
Description copied from interface:BitKeyXOr the parameterBitKeywiththis.- Parameters:
bitKey- Bit key
-
and
public BitKey and(BitKey bitKey)
Description copied from interface:BitKeyReturns the boolean AND of this bitkey and the given bitkey.- Parameters:
bitKey- Bit key
-
andNot
public BitKey andNot(BitKey bitKey)
Description copied from interface:BitKeyReturns aBitKeycontaining all of the bits in thisBitSetwhose corresponding bit is NOT set in the specifiedBitSet.
-
isSuperSetOf
public boolean isSuperSetOf(BitKey bitKey)
Description copied from interface:BitKeyIs every bit set in the parameterbitKeyalso set inthis. If one switchesthiswith the parameterbitKeyone gets the equivalent of isSubSetOf.- Parameters:
bitKey- Bit key
-
intersects
public boolean intersects(BitKey bitKey)
Description copied from interface:BitKeyReturns whether this BitKey has any bits in common with a given BitKey.
-
toBitSet
public BitSet toBitSet()
Description copied from interface:BitKeyReturns aBitSetwith the same contents as this BitKey.
-
iterator
public Iterator<Integer> 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:BitKeyReturns the index of the first bit that is set totruethat occurs on or after the specified starting index. If no such bit exists then -1 is returned. To iterate over thetruebits 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
-
compareTo
public int compareTo(BitKey bitKey)
-
compareToBig
protected int compareToBig(BitKey.Big that)
-
copy
public BitKey copy()
Description copied from interface:BitKeyReturns a copy of this BitKey.- Returns:
- copy of BitKey
-
emptyCopy
public BitKey emptyCopy()
Description copied from interface:BitKeyReturns 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:BitKeyReturns true if thisBitKeycontains no bits that are set totrue.
-
-