|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.BitSet
bits.BitSequence
public class BitSequence
| Field Summary | |
|---|---|
private static long |
serialVersionUID
Default serialVersionUID |
private int |
size
|
| Constructor Summary | |
|---|---|
BitSequence()
Creates a new BitSequence without specifying the size. |
|
BitSequence(byte[] bytes)
Creates a new BitSequence from the specified array of bytes. |
|
BitSequence(int targetSize)
|
|
BitSequence(int targetSize,
int sequenceSize)
Creates a new BitSequence with an underlying representation of size targetSize and an initial BitSequence size of sequenceSize such that a subsequent append operation would occur at index sequenceSize. |
|
| Method Summary | |
|---|---|
void |
append(BitSequence bitSequence)
Appends all bits in bitSequence to the current bit sequence. |
void |
append(boolean bit)
Append, not aritmetic add. |
void |
append(byte newByte)
Add as in append, not aritmetic add. |
void |
append(byte[] bytes)
Add as in append, not aritmetic add. |
void |
append(byte[] bytes,
int start,
int count)
TODO: Unchecked...may throw an out of bounds exception |
void |
append(int x,
int n)
Appends the last n bits of the integer x to the current BitSequence in the order they appear in the integer x. |
int |
bitCount()
Returns the total number of bits in this sequence. |
int |
bitSetLength()
Returns the length of the underlying BitSet representation. |
int |
bitSetSize()
Returns the size of the underlying BitSet representation. |
static java.util.BitSet |
byteToBitSet(byte newByte)
|
BitSequence |
compress()
Produces a new BitSequence resulting from compressing the entire current BitSequence using a specific algorithm. |
BitSequence |
decompress()
Produces a new BitSequence resulting from de-compressing the entire current BitSequence using a specific algorithm. |
BitSequence |
get(int fromIndex,
int count)
Gets a subsequence of the current BitSequence of size count starting from fromIndex |
byte[] |
getBytes()
Get the entire BitSequence as a byte array. |
static BitSequence |
integerToBitSequence(int x,
int n)
Creates a new BitSequence consisting of the last n bits in the integer x. |
int |
length()
Returns the total number of bits in this sequence. |
void |
printAllBits()
Prints all bits in the sequence. |
void |
setSize(int newSize)
Sets the size of this BitSequence to the specified value. |
int |
size()
Returns the total number of bits in this sequence. |
java.lang.String |
toAsciiString()
Returns the entire current BitSequence as an ASCII string. |
| Methods inherited from class java.util.BitSet |
|---|
and, andNot, cardinality, clear, clear, clear, clone, equals, flip, flip, get, hashCode, intersects, isEmpty, nextClearBit, nextSetBit, or, set, set, set, set, toString, xor |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private int size
| Constructor Detail |
|---|
public BitSequence()
public BitSequence(int targetSize)
targetSize - The default size of the underlying BitSet. Note that
this does NOT set the size of the BitSequence itself, which
remains at zero.
public BitSequence(int targetSize,
int sequenceSize)
targetSize - sequenceSize - public BitSequence(byte[] bytes)
bytes - | Method Detail |
|---|
public void append(boolean bit)
bit - public void append(byte newByte)
newByte - public void append(byte[] bytes)
bytes -
public void append(byte[] bytes,
int start,
int count)
bytes - start - count - public void append(BitSequence bitSequence)
bitSequence -
public void append(int x,
int n)
x - n -
public BitSequence get(int fromIndex,
int count)
get in class java.util.BitSetfromIndex - index of the first bit in the subsequencecount - number of bits to return in the subsequence
public static java.util.BitSet byteToBitSet(byte newByte)
public BitSequence compress()
public BitSequence decompress()
public byte[] getBytes()
public void printAllBits()
public int bitCount()
size()
public int size()
bitSetSize()
Identical to bitCount()
size in class java.util.BitSetpublic int length()
size()
length in class java.util.BitSetpublic void setSize(int newSize)
public int bitSetSize()
public int bitSetLength()
public java.lang.String toAsciiString()
public static BitSequence integerToBitSequence(int x,
int n)
x - n -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||