Class OffsetBitVector
- All Implemented Interfaces:
Serializable, Cloneable
- See Also:
-
Field Summary
Fields inherited from class BitVectorBase
bits, BITS_PER_UNIT, DEBUG, LOG_BITS_PER_UNIT, LOW_MASK, MASKModifier and TypeFieldDescriptionprotected int[]protected static final intprotected static final booleanprotected static final intprotected static final intprotected static final int -
Constructor Summary
ConstructorsConstructorDescriptionOffsetBitVector(int offset, int nbits) Creates an empty string with the specified size.Creates a copy of a Bit String -
Method Summary
Modifier and TypeMethodDescriptionvoidand(OffsetBitVector set) Logically ANDs this bit set with the specified set of bits.static OffsetBitVectorand(OffsetBitVector b1, OffsetBitVector b2) Return a new bit string as the AND of two others.voidandNot(OffsetBitVector set) static OffsetBitVectorandNot(OffsetBitVector b1, OffsetBitVector b2) Return a new bit string as the AND of two others.voidclear(int bit) Clears a bit.voidcopyBits(OffsetBitVector set) Copies the values of the bits in the specified set into this set.booleanCompares this object against the specified object.booleanget(int bit) Gets a bit.intbooleanCheck if the intersection of the two sets is emptybooleanisSubset(OffsetBitVector other) intlength()Calculates and returns the set's size in bits.intmax()intnextSetBit(int start) voidnot()Logically NOT this bit stringstatic OffsetBitVectorReturn the NOT of a bit stringvoidor(OffsetBitVector set) Logically ORs this bit set with the specified set of bits.static OffsetBitVectoror(OffsetBitVector b1, OffsetBitVector b2) Return a new FixedSizeBitVector as the OR of two othersbooleansameBits(OffsetBitVector set) Compares this object against the specified object.voidset(int bit) Sets a bit.voidsetAll()Sets all bits.toString()voidxor(OffsetBitVector set) Logically XORs this bit set with the specified set of bits.Methods inherited from class BitVectorBase
clearAll, clone, contains, copyBits, hashCode, isZero, populationCount, subscriptModifier and TypeMethodDescriptionfinal voidclearAll()Clears all bits.clone()booleancontains(int i) voidcopyBits(BitVectorBase set) Copies the values of the bits in the specified set into this set.inthashCode()booleanisZero()final intHow many bits are set?static intsubscript(int bitIndex) Convert bitIndex to a subscript into the bits[] array.
-
Constructor Details
-
OffsetBitVector
public OffsetBitVector() -
OffsetBitVector
public OffsetBitVector(int offset, int nbits) Creates an empty string with the specified size.- Parameters:
nbits- the size of the string
-
OffsetBitVector
Creates a copy of a Bit String- Parameters:
s- the string to copy- Throws:
IllegalArgumentException- if s is null
-
-
Method Details
-
toString
- Overrides:
toStringin classBitVectorBase<OffsetBitVector>
-
getOffset
public int getOffset() -
set
public void set(int bit) Sets a bit.- Specified by:
setin classBitVectorBase<OffsetBitVector>- Parameters:
bit- the bit to be set
-
clear
public void clear(int bit) Clears a bit.- Specified by:
clearin classBitVectorBase<OffsetBitVector>- Parameters:
bit- the bit to be cleared
-
get
public boolean get(int bit) Gets a bit.- Specified by:
getin classBitVectorBase<OffsetBitVector>- Parameters:
bit- the bit to be gotten
-
nextSetBit
public int nextSetBit(int start) - Overrides:
nextSetBitin classBitVectorBase<OffsetBitVector>- Returns:
- min j >= start s.t get(j)
-
not
public void not()Logically NOT this bit string -
max
public int max()- Overrides:
maxin classBitVectorBase<OffsetBitVector>
-
length
public int length()Calculates and returns the set's size in bits. The maximum element in the set is the size - 1st element.- Specified by:
lengthin classBitVectorBase<OffsetBitVector>
-
setAll
public void setAll()Sets all bits. -
equals
-
intersectionEmpty
Check if the intersection of the two sets is empty- Specified by:
intersectionEmptyin classBitVectorBase<OffsetBitVector>- Parameters:
set- the set to check intersection with- Throws:
IllegalArgumentException- if set == null
-
sameBits
Compares this object against the specified object.- Specified by:
sameBitsin classBitVectorBase<OffsetBitVector>- Parameters:
set- the object to compare with- Returns:
- true if the objects are the same; false otherwise.
- Throws:
IllegalArgumentException- if set == null
-
isSubset
- Specified by:
isSubsetin classBitVectorBase<OffsetBitVector>- Throws:
IllegalArgumentException
-
copyBits
Copies the values of the bits in the specified set into this set.- Parameters:
set- the bit set to copy the bits from- Throws:
IllegalArgumentException- if set is null
-
and
Logically ANDs this bit set with the specified set of bits.- Specified by:
andin classBitVectorBase<OffsetBitVector>- Parameters:
set- the bit set to be ANDed with- Throws:
IllegalArgumentException- if set == null
-
or
Logically ORs this bit set with the specified set of bits.- Specified by:
orin classBitVectorBase<OffsetBitVector>- Parameters:
set- the bit set to be ORed with- Throws:
IllegalArgumentException- if set == null
-
xor
Logically XORs this bit set with the specified set of bits.- Specified by:
xorin classBitVectorBase<OffsetBitVector>- Parameters:
set- the bit set to be XORed with- Throws:
IllegalArgumentException- if set == null
-
andNot
- Specified by:
andNotin classBitVectorBase<OffsetBitVector>- Throws:
IllegalArgumentException
-
not
Return the NOT of a bit string -
and
public static OffsetBitVector and(OffsetBitVector b1, OffsetBitVector b2) throws IllegalArgumentException Return a new bit string as the AND of two others.- Throws:
IllegalArgumentException- if b2 == null
-
or
public static OffsetBitVector or(OffsetBitVector b1, OffsetBitVector b2) throws IllegalArgumentException Return a new FixedSizeBitVector as the OR of two others- Throws:
IllegalArgumentException- if b2 == null
-
andNot
Return a new bit string as the AND of two others.
-