Package mondrian.rolap
Class BitKey.AbstractBitKey
- java.lang.Object
-
- mondrian.rolap.BitKey.AbstractBitKey
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<BitKey>
,java.lang.Iterable<java.lang.Integer>
,BitKey
- Direct Known Subclasses:
BitKey.Big
,BitKey.Mid128
,BitKey.Small
- Enclosing interface:
- BitKey
public abstract static class BitKey.AbstractBitKey extends java.lang.Object implements BitKey
Abstract implementation ofBitKey
.- 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 Modifier and Type Field Description protected static int
ChunkBitCount
protected static int
Mask
protected static long
WORD_MASK
-
Fields inherited from interface mondrian.rolap.BitKey
bitPositionTable, EMPTY
-
-
Constructor Summary
Constructors Constructor Description AbstractBitKey()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static long
bit(int pos)
Creates a chunk containing a single bit.protected static int
bitCount(long i)
Returns the number of one-bits in the two's complement binary representation of the specified long value.protected static int
chunkCount(int size)
Returns the number of chunks required for a given number of bits.protected static int
chunkPos(int size)
Returns which chunk a given bit falls into.(package private) static int
compareUnsigned(long i1, long i2)
Performs unsigned comparison on twolong
values.(package private) static int
compareUnsignedArrays(long[] a1, long[] a2)
Compares a pair oflong
arrays, using unsigned comparison semantics and padding to the left with 0s.protected static void
copyFromByte(java.util.BitSet bitSet, int pos, byte x)
Copies a byte into a bit set at a particular position.protected static void
copyFromLong(java.util.BitSet bitSet, int pos, long x)
Copies along
value (interpreted as 64 bits) into a bit set.protected java.lang.IllegalArgumentException
createException(BitKey bitKey)
void
set(int pos, boolean value)
Sets the bit at the specified index to the specified value.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface mondrian.rolap.BitKey
and, andNot, cardinality, clear, clear, copy, emptyCopy, get, intersects, isEmpty, isSuperSetOf, iterator, nextSetBit, or, orNot, set, toBitSet
-
-
-
-
Field Detail
-
ChunkBitCount
protected static final int ChunkBitCount
- See Also:
- Constant Field Values
-
Mask
protected static final int Mask
- See Also:
- Constant Field Values
-
WORD_MASK
protected static final long WORD_MASK
- See Also:
- Constant Field Values
-
-
Method Detail
-
bit
protected static long bit(int pos)
Creates a chunk containing a single bit.
-
chunkPos
protected static int chunkPos(int size)
Returns which chunk a given bit falls into. Bits 0 to 63 fall in chunk 0, bits 64 to 127 fall into chunk 1.
-
chunkCount
protected static int chunkCount(int size)
Returns the number of chunks required for a given number of bits.0 bits requires 0 chunks; 1 - 64 bits requires 1 chunk; etc.
-
bitCount
protected static int bitCount(long i)
Returns the number of one-bits in the two's complement binary representation of the specified long value. This function is sometimes referred to as the population count.(Copied from
Long.bitCount(long)
, which was introduced in JDK 1.5, but we need the functionality in JDK 1.4.)- Returns:
- the number of one-bits in the two's complement binary representation of the specified long value.
- Since:
- 1.5
-
set
public final void set(int pos, boolean value)
Description copied from interface:BitKey
Sets the bit at the specified index to the specified value.
-
copyFromByte
protected static void copyFromByte(java.util.BitSet bitSet, int pos, byte x)
Copies a byte into a bit set at a particular position.- Parameters:
bitSet
- Bit setpos
- Positionx
- Byte
-
copyFromLong
protected static void copyFromLong(java.util.BitSet bitSet, int pos, long x)
Copies along
value (interpreted as 64 bits) into a bit set.- Parameters:
bitSet
- Bit setpos
- Positionx
- Byte
-
createException
protected java.lang.IllegalArgumentException createException(BitKey bitKey)
-
compareUnsignedArrays
static int compareUnsignedArrays(long[] a1, long[] a2)
Compares a pair oflong
arrays, using unsigned comparison semantics and padding to the left with 0s.Values are treated as unsigned for the purposes of comparison.
If the arrays have different lengths, the shorter is padded with 0s.
- Parameters:
a1
- First arraya2
- Second array- Returns:
- -1 if a1 compares less to a2, 0 if a1 is equal to a2, 1 if a1 is greater than a2
-
compareUnsigned
static int compareUnsigned(long i1, long i2)
Performs unsigned comparison on twolong
values.- Parameters:
i1
- First valuei2
- Second value- Returns:
- -1 if i1 is less than i2, 1 if i1 is greater than i2, 0 if i1 equals i2
-
-