|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.util.BitSet
de.upb.swtpra05.group03.shuttle.util.EfficientBitSet
This is a memory efficient variant of a BitSet. A BitSet is not
memory efficient for large bit indices. If one sets e.g. only 8-digit numbers a BitSet
would also allocate the indices from zero to these numbers. This is inefficient cause some
methods of the BitSet iterate trough the whole set which takes a lot of time.
This extension saves the smallest known index number and offers the lower bits only implicitly.
These are set to false. This is realized completely transparent, so that the EfficientBitSet
can be used in the same way. It is possible to set the lowest index in a new constructor
or via the method normalizeTo(int).
BitSet,
Serialized Form| Field Summary | |
private int |
smallestBitIndex
The smallest known index number. |
| Fields inherited from class java.util.BitSet |
|
| Constructor Summary | |
EfficientBitSet()
The intially smallest index number is Integer.MAX_VALUE. |
|
EfficientBitSet(int nbits)
The intially smallest index number is Integer.MAX_VALUE. |
|
EfficientBitSet(int nbits,
int smallestBitIndex)
The intially smallest index number is smallestBitIndex. |
|
| Method Summary | |
void |
and(java.util.BitSet set)
This method overrides BitSet.and(BitSet) so that a logical AND can
only be used with another EfficientBitSet |
void |
and(EfficientBitSet set)
Performs a logical AND of this target bit set with the argument bit set. |
void |
andNot(java.util.BitSet set)
This method overrides BitSet.andNot(BitSet) so that a logical ANDNOT
can only be used with another EfficientBitSet |
void |
andNot(EfficientBitSet set)
Clears all of the bits in this BitSet whose corresponding bit is set in
the specified BitSet. |
int |
cardinality()
|
void |
clear()
|
void |
clear(int bitIndex)
|
void |
clear(int fromIndex,
int toIndex)
|
java.lang.Object |
clone()
|
boolean |
equals(java.lang.Object obj)
|
int |
explicitSize()
The explicit size of this set is the number of bits of space in use. |
void |
flip(int bitIndex)
|
void |
flip(int fromIndex,
int toIndex)
|
boolean |
get(int bitIndex)
|
java.util.BitSet |
get(int fromIndex,
int toIndex)
|
int |
getSmallestBitIndex()
Gets the current smallest known index number |
int |
hashCode()
|
int |
implicitSize()
The implicit size ot this set is the number of bits of space in use plus the implicit number of bits which are smaller than the lowest known index. |
boolean |
intersects(java.util.BitSet set)
This method overrides BitSet.intersects(BitSet) so that an EfficientBitSet
can only be intersected with an EfficientBitSet. |
boolean |
intersects(EfficientBitSet set)
Returns true if the specified EfficientBitSet has any bits set to true
that are also set to true in this EfficientBitSet. |
boolean |
isEmpty()
|
int |
length()
|
int |
nextClearBit(int fromIndex)
|
int |
nextSetBit(int fromIndex)
|
void |
normalizeTo(int newSmallestBitIndex)
Normalizes this set to the newSmallestBitIndex number which is either smaller
or bigger than the current smallest known index. |
void |
or(java.util.BitSet set)
This method overrides BitSet.or(BitSet) so that a logical OR can
only be used with another EfficientBitSet |
void |
or(EfficientBitSet set)
Performs a logical OR of this bit set with the bit set argument. |
void |
set(int bitIndex)
|
void |
set(int bitIndex,
boolean value)
|
void |
set(int fromIndex,
int toIndex)
|
void |
set(int fromIndex,
int toIndex,
boolean value)
|
int |
size()
Deprecated. use EfficientBitSet.implicitSize() or EfficientBitSet.explicitSize()
instead. |
java.lang.String |
toString()
|
void |
xor(java.util.BitSet set)
This method overrides BitSet.xor(BitSet) so that a logical XOR can
only be used with another EfficientBitSet |
void |
xor(EfficientBitSet set)
Performs a logical XOR of this bit set with the bit set argument. |
| Methods inherited from class java.util.BitSet |
|
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
private int smallestBitIndex
| Constructor Detail |
public EfficientBitSet()
Integer.MAX_VALUE.
java.util.BitSet#EfficientBitSet()public EfficientBitSet(int nbits)
Integer.MAX_VALUE.
nbits - No description providedjava.util.BitSet#EfficientBitSet(int)
public EfficientBitSet(int nbits,
int smallestBitIndex)
smallestBitIndex.
smallestBitIndex - The intial value of the smallest index number.nbits - No description providedjava.util.BitSet#EfficientBitSet(int)| Method Detail |
public void flip(int bitIndex)
bitIndex - No description providedBitSet.flip(int)
public void flip(int fromIndex,
int toIndex)
fromIndex - No description providedtoIndex - No description providedBitSet.flip(int,int)public void set(int bitIndex)
bitIndex - No description providedBitSet.set(int)
public void set(int bitIndex,
boolean value)
bitIndex - No description providedvalue - No description providedBitSet.set(int, boolean)
public void set(int fromIndex,
int toIndex)
fromIndex - No description providedtoIndex - No description providedBitSet.set(int,int)
public void set(int fromIndex,
int toIndex,
boolean value)
fromIndex - No description providedtoIndex - No description providedvalue - No description providedBitSet.set(int,int,boolean)public void clear(int bitIndex)
bitIndex - No description providedBitSet.clear(int)
public void clear(int fromIndex,
int toIndex)
fromIndex - No description providedtoIndex - No description providedBitSet.clear(int,int)public void clear()
BitSet.clear()public boolean get(int bitIndex)
bitIndex - No description provided
BitSet.get(int)
public java.util.BitSet get(int fromIndex,
int toIndex)
fromIndex - No description providedtoIndex - No description provided
BitSet.get(int,int)public int nextSetBit(int fromIndex)
fromIndex - No description provided
BitSet.nextSetBit(int)public int nextClearBit(int fromIndex)
fromIndex - No description provided
BitSet.nextClearBit(int)public int length()
BitSet.length()public boolean isEmpty()
BitSet.isEmpty()public boolean intersects(java.util.BitSet set)
BitSet.intersects(BitSet) so that an EfficientBitSet
can only be intersected with an EfficientBitSet.
set - No description provided
BitSet.intersects(java.util.BitSet)public boolean intersects(EfficientBitSet set)
EfficientBitSet has any bits set to true
that are also set to true in this EfficientBitSet.
set - EfficientBitSet to intersect with
BitSet intersects the specified
EfficientBitSet.public int cardinality()
BitSet.cardinality()public void and(java.util.BitSet set)
BitSet.and(BitSet) so that a logical AND can
only be used with another EfficientBitSet
set - No description providedBitSet.and(java.util.BitSet)public void and(EfficientBitSet set)
true if and only
if it both initially had the value true and the corresponding bit in the
bit set argument also had the value true.
set - a bit set.public void or(java.util.BitSet set)
BitSet.or(BitSet) so that a logical OR can
only be used with another EfficientBitSet
set - No description providedBitSet.or(java.util.BitSet)public void or(EfficientBitSet set)
true if and only if it either
already had the value true or the corresponding bit in the bit set argument
has the value true.
set - a bit set.public void xor(java.util.BitSet set)
BitSet.xor(BitSet) so that a logical XOR can
only be used with another EfficientBitSet
set - No description providedBitSet.xor(java.util.BitSet)public void xor(EfficientBitSet set)
true if and only if one of
the following statements holds:
true, and the corresponding bit in
the argument has the value false.
false, and the corresponding bit
in the argument has the value true.
set - a bit set.public void andNot(java.util.BitSet set)
BitSet.andNot(BitSet) so that a logical ANDNOT
can only be used with another EfficientBitSet
set - No description providedBitSet.andNot(java.util.BitSet)public void andNot(EfficientBitSet set)
BitSet whose corresponding bit is set in
the specified BitSet.
set - the BitSet with which to mask this BitSet.public int hashCode()
BitSet.hashCode()public int size()
EfficientBitSet.implicitSize() or EfficientBitSet.explicitSize()
instead.
explicitSize() has the same result.
BitSet.size()public int implicitSize()
BitSet.size()public int explicitSize()
BitSet.size()public boolean equals(java.lang.Object obj)
obj - No description provided
BitSet.equals(java.lang.Object)public java.lang.Object clone()
BitSet.clone()public java.lang.String toString()
BitSet.toString()
public void normalizeTo(int newSmallestBitIndex)
throws java.lang.Exception
newSmallestBitIndex number which is either smaller
or bigger than the current smallest known index.
newSmallestBitIndex - the new smallest index number
java.lang.Exception - if the new smallest index number is bigger than the current
one and there are bits set to true below the new onepublic int getSmallestBitIndex()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||