coins.flow
Class BitVectorImpl

java.lang.Object
  extended bycoins.flow.BitVectorImpl
All Implemented Interfaces:
BitVector, java.lang.Cloneable
Direct Known Subclasses:
BBlockVectorImpl, ExpVectorImpl, PointVectorImpl

public class BitVectorImpl
extends java.lang.Object
implements BitVector, java.lang.Cloneable

BitVectorImpl class


Field Summary
protected  int fBitLength
           
protected  int fLongWordLength
           
protected  int fShiftMax
           
protected  long[] fVectorWord
           
 
Constructor Summary
protected BitVectorImpl()
           
protected BitVectorImpl(int pLongWordCount)
           
 
Method Summary
 BitVectorIterator bitVectorIterator(SubpFlow pSubpFlow)
          Returns the BitVectorIterator object backed by this BitVector
 java.lang.Object clone()
           
 boolean equals(java.lang.Object pObj)
          Same as vectorEqual if the specified argument is an instance of BitVector, otherwise returns false.
 int getBit(int pInx)
          getBit Get pIndex-th bit of this bit vector.
 int getBitLength()
          Returns the length of this BitVector, not counting the 0-th bit, which is not used.
 long[] getVectorWord()
          Returns the array of long, which is where the actual data for this BitVector is stored.
 int getWordLength()
          Returns the # of long words this BitVector uses to store its data.
 int hashCode()
           
 boolean isSet(int pInx)
          Same as getBit(pInx) == 1.
 boolean isZero()
          Are all the bits zero?
 void resetBit(int pInx)
          resetBit Reset pIndex-th bit of this bit vector to 0.
 void setBit(int pInx)
          setBit Set pIndex-th bit of this bit vector to 1.
 java.lang.String toString()
          toString Get the sequence of indexes corresponding to the position having 1.
 java.lang.String toStringDescriptive()
          Returns a possibly more descriptive string representation than toString() of this BitVector.
 void vectorAnd(BitVector pOperand2, BitVector pResult)
          vectorAnd; Make a bit vector and set its value by executing bit-wise-and operation on this and pOperand2.
 void vectorCopy(BitVector pResult)
          vectorCopy; Make a bit vector and set its value same to that of pOperand.
 boolean vectorEqual(BitVector pOperand2)
          vectorEqual; See if this and pOperand2 have the same value or not.
 void vectorNot(BitVector pResult)
          vectorNot; Make a bit vector and set its value by executing bit-wise-not operation on pOperand.
 void vectorOr(BitVector pOperand2, BitVector pResult)
          vectorOr; Make a bit vector and set its value by executing bit-wise-or operation on this and pOperand2.
 void vectorReset()
          vectorReset; Reset all bits of this vector to 0.
 void vectorSub(BitVector pOperand2, BitVector pResult)
          vectorSub; Make a bit vector and set its value by executing bit-wise-sub operation on this and pOperand2.
 void vectorXor(BitVector pOperand2, BitVector pResult)
          vectorXor; Make a bit vector and set its value by executing bit-wise exclusive-or operation on this and pOperand2.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

fLongWordLength

protected int fLongWordLength

fBitLength

protected int fBitLength

fShiftMax

protected int fShiftMax

fVectorWord

protected long[] fVectorWord
Constructor Detail

BitVectorImpl

protected BitVectorImpl()

BitVectorImpl

protected BitVectorImpl(int pLongWordCount)
Method Detail

setBit

public void setBit(int pInx)
Description copied from interface: BitVector
setBit Set pIndex-th bit of this bit vector to 1.

Specified by:
setBit in interface BitVector
Returns:
this bit vector whose pIndex-th bit is reset to 1.

resetBit

public void resetBit(int pInx)
Description copied from interface: BitVector
resetBit Reset pIndex-th bit of this bit vector to 0.

Specified by:
resetBit in interface BitVector
Returns:
this bit vector whose pIndex-th bit is reset to 0.

getBit

public int getBit(int pInx)
Description copied from interface: BitVector
getBit Get pIndex-th bit of this bit vector.

Specified by:
getBit in interface BitVector
Returns:
pIndex-th bit of this bit vector.

isSet

public boolean isSet(int pInx)
Description copied from interface: BitVector
Same as getBit(pInx) == 1.

Specified by:
isSet in interface BitVector

isZero

public boolean isZero()
Description copied from interface: BitVector
Are all the bits zero?

Specified by:
isZero in interface BitVector

getBitLength

public int getBitLength()
Description copied from interface: BitVector
Returns the length of this BitVector, not counting the 0-th bit, which is not used.

Specified by:
getBitLength in interface BitVector

getWordLength

public int getWordLength()
Description copied from interface: BitVector
Returns the # of long words this BitVector uses to store its data.

Specified by:
getWordLength in interface BitVector

getVectorWord

public long[] getVectorWord()
Description copied from interface: BitVector
Returns the array of long, which is where the actual data for this BitVector is stored.

Specified by:
getVectorWord in interface BitVector

bitVectorIterator

public BitVectorIterator bitVectorIterator(SubpFlow pSubpFlow)
Description copied from interface: BitVector
Returns the BitVectorIterator object backed by this BitVector

Specified by:
bitVectorIterator in interface BitVector

vectorAnd

public void vectorAnd(BitVector pOperand2,
                      BitVector pResult)
Description copied from interface: BitVector
vectorAnd; Make a bit vector and set its value by executing bit-wise-and operation on this and pOperand2.

Specified by:
vectorAnd in interface BitVector
Returns:
the bit vector obtained by bit-wise-and operaion.

vectorOr

public void vectorOr(BitVector pOperand2,
                     BitVector pResult)
Description copied from interface: BitVector
vectorOr; Make a bit vector and set its value by executing bit-wise-or operation on this and pOperand2.

Specified by:
vectorOr in interface BitVector
Returns:
the bit vector obtained by bit-wise-or operaion.

vectorXor

public void vectorXor(BitVector pOperand2,
                      BitVector pResult)
Description copied from interface: BitVector
vectorXor; Make a bit vector and set its value by executing bit-wise exclusive-or operation on this and pOperand2.

Specified by:
vectorXor in interface BitVector
Returns:
the bit vector obtained by bit-wise exclusive-or operaion.

vectorNot

public void vectorNot(BitVector pResult)
Description copied from interface: BitVector
vectorNot; Make a bit vector and set its value by executing bit-wise-not operation on pOperand.

Specified by:
vectorNot in interface BitVector
Returns:
the bit vector obtained by bit-wise-not operaion.

vectorSub

public void vectorSub(BitVector pOperand2,
                      BitVector pResult)
Description copied from interface: BitVector
vectorSub; Make a bit vector and set its value by executing bit-wise-sub operation on this and pOperand2. (pOperand2 is subtracted from this.) //##62

Specified by:
vectorSub in interface BitVector

vectorCopy

public void vectorCopy(BitVector pResult)
Description copied from interface: BitVector
vectorCopy; Make a bit vector and set its value same to that of pOperand.

Specified by:
vectorCopy in interface BitVector
Returns:
a new bit vector having the same value as pOperand.

vectorEqual

public boolean vectorEqual(BitVector pOperand2)
Description copied from interface: BitVector
vectorEqual; See if this and pOperand2 have the same value or not.

Specified by:
vectorEqual in interface BitVector
Returns:
true if this and pOperand2 have the same value, false otherwise.

equals

public boolean equals(java.lang.Object pObj)
Description copied from interface: BitVector
Same as vectorEqual if the specified argument is an instance of BitVector, otherwise returns false.

Specified by:
equals in interface BitVector

hashCode

public int hashCode()

vectorReset

public void vectorReset()
Description copied from interface: BitVector
vectorReset; Reset all bits of this vector to 0.

Specified by:
vectorReset in interface BitVector
Returns:
this vector after resetting all of its bits to 0.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Description copied from interface: BitVector
toString Get the sequence of indexes corresponding to the position having 1.

Specified by:
toString in interface BitVector

toStringDescriptive

public java.lang.String toStringDescriptive()
Description copied from interface: BitVector
Returns a possibly more descriptive string representation than toString() of this BitVector.

Specified by:
toStringDescriptive in interface BitVector