coins.alias.util
クラス BitVector

java.lang.Object
  |
  +--coins.alias.util.BitVector
直系の既知のサブクラス:
TagVector, TagVector2

public class BitVector
extends java.lang.Object

BitVector class: Unlike java.util.BitSet class, this class offers methods for non-destructive bit operations, where the result of the operation will be stored in the last argument of such methods.


フィールドの概要
protected  int fBitLength
          Length of this BitVector.
protected  int fLongWordLength
          Length of the long array that internally holds data.
protected static int fShiftMax
          Maximum possible shift of bits within a long word, or 63.
protected  long[] fVectorWord
          Array of longs that internally holds data.
 
コンストラクタの概要
BitVector(int pBitLength)
          Creates an instance of BitVector with the specified length.
 
メソッドの概要
 BitVectorIterator bitVectorIterator()
          Returns the BitVectorIterator that is backed by this BitVector.
 boolean equals(java.lang.Object pObject)
          The equality for two BitVector objects is specified by vectorEqual().
 int getBit(int pInx)
          Returns bit state at the specified position.
 int getBitLength()
          Returns the length of this BitVector.
 long[] getVectorWord()
          Returns the long array that internally holds data for this BitVector.
 int getWordLength()
          Returns the length of the long array that internally holds data for this BitVector.
 boolean isSet(int pInx)
          Queries if the specified bit is set.
 boolean isZero()
          Queries if all the bits of this BitVector's is unset.
 void resetBit(int pInx)
          Resets bit at the specified position.
 void setBit(int pInx)
          Sets bit at the specified position.
 java.lang.String toString()
          Returns a String representation of this BitVector.
 java.lang.String toStringDescriptive()
          Returns a String representation of this BitVector, which is at least as descriptive as the one returned by toString().
 BitVector vectorAnd(BitVector pOperand2, BitVector pResult)
          Performs the bitwise AND operation between this BitVector and the argument pOperand2, and stores the result into pResult.
 BitVector vectorCopy(BitVector pResult)
          Copies the contents of this BitVector into the specified argument.
 boolean vectorEqual(BitVector pOperand2)
          Compares this BitVector with the specified argument for equality.
 BitVector vectorNot(BitVector pResult)
          Performs the bitwise NOT operation on this BitVector and store the result into the specified argument.
 BitVector vectorOr(BitVector pOperand2, BitVector pResult)
          Performs the bitwise OR operation between this BitVector and the argument pOperand2, and stores the result into pResult.
 BitVector vectorReset()
          Resets all the bits of this BitVector.
 BitVector vectorSub(BitVector pOperand2, BitVector pResult)
          Performs the bitwise subtraction operation between this BitVector and the argument pOperand2, and stores the result into pResult.
 BitVector vectorXor(BitVector pOperand2, BitVector pResult)
          Performs the bitwise exclusive OR (XOR) operation between this BitVector and the argument pOperand2, and stores the result into pResult.
 
クラス java.lang.Object から継承したメソッド
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

fVectorWord

protected final long[] fVectorWord
Array of longs that internally holds data.


fLongWordLength

protected final int fLongWordLength
Length of the long array that internally holds data.


fBitLength

protected final int fBitLength
Length of this BitVector.


fShiftMax

protected static final int fShiftMax
Maximum possible shift of bits within a long word, or 63.

関連項目:
定数フィールド値
コンストラクタの詳細

BitVector

public BitVector(int pBitLength)
Creates an instance of BitVector with the specified length.

パラメータ:
pBitLength - the length of the BitVector
メソッドの詳細

setBit

public void setBit(int pInx)
Sets bit at the specified position.

パラメータ:
pInx - the index (position) of the bit to be set.

resetBit

public void resetBit(int pInx)
Resets bit at the specified position.

パラメータ:
pInx - the index (position) of the bit to be reset.

getBit

public int getBit(int pInx)
Returns bit state at the specified position.

パラメータ:
pInx - the index (position) of the bit to get.
戻り値:
1 if the specified bit is set, 0 otherwise.

isSet

public boolean isSet(int pInx)
Queries if the specified bit is set.

パラメータ:
pInx - the index (position) of the bit to query.
戻り値:
true if the specified bit is set.

isZero

public boolean isZero()
Queries if all the bits of this BitVector's is unset.

戻り値:
true if all the bits are unset.

getBitLength

public int getBitLength()
Returns the length of this BitVector.

戻り値:
the length of this BitVector.

getVectorWord

public long[] getVectorWord()
Returns the long array that internally holds data for this BitVector.

戻り値:
the long array that internally holds data.

getWordLength

public int getWordLength()
Returns the length of the long array that internally holds data for this BitVector.

戻り値:
the length of the long array that internally holds data.

bitVectorIterator

public BitVectorIterator bitVectorIterator()
Returns the BitVectorIterator that is backed by this BitVector.

戻り値:
the BitVectorIterator that is backed by this BitVector.

vectorNot

public BitVector vectorNot(BitVector pResult)
Performs the bitwise NOT operation on this BitVector and store the result into the specified argument. The argument must have the same length as this BitVector.

パラメータ:
pResult - the BitVector where the result of the NOT operation is stored.
戻り値:
pResult, the result of the NOT operation.

vectorAnd

public BitVector vectorAnd(BitVector pOperand2,
                           BitVector pResult)
Performs the bitwise AND operation between this BitVector and the argument pOperand2, and stores the result into pResult. Both pOperand2 and pResult must have the same length as this BitVector.

パラメータ:
pOperand2 - the BitVector with which this BitVector is ANDed.
pResult - the BitVector where the result of the AND operation is stored.
戻り値:
pResult, the result of the AND operation.

vectorOr

public BitVector vectorOr(BitVector pOperand2,
                          BitVector pResult)
Performs the bitwise OR operation between this BitVector and the argument pOperand2, and stores the result into pResult. Both pOperand2 and pResult must have the same length as this BitVector.

パラメータ:
pOperand2 - the BitVector with which this BitVector is ORed.
pResult - the BitVector where the result of the OR operation is stored.
戻り値:
pResult, the result of the OR operation.

vectorXor

public BitVector vectorXor(BitVector pOperand2,
                           BitVector pResult)
Performs the bitwise exclusive OR (XOR) operation between this BitVector and the argument pOperand2, and stores the result into pResult. Both pOperand2 and pResult must have the same length as this BitVector.

パラメータ:
pOperand2 - the BitVector with which this BitVector is XORed.
pResult - the BitVector where the result of the XOR operation is stored.
戻り値:
pResult, the result of the XOR operation.

vectorSub

public BitVector vectorSub(BitVector pOperand2,
                           BitVector pResult)
Performs the bitwise subtraction operation between this BitVector and the argument pOperand2, and stores the result into pResult. Both pOperand2 and pResult must have the same length as this BitVector.

パラメータ:
pOperand2 - the BitVector by which amount this BitVector is reduced (the second operand of the bitwise subtraction operation).
pResult - the BitVector where the result of the subtraction operation is stored.
戻り値:
pResult, the result of the subtraction operation.

vectorCopy

public BitVector vectorCopy(BitVector pResult)
Copies the contents of this BitVector into the specified argument. The argument must have the same length as this BitVector.

パラメータ:
pResult - the destination of the copy operation.
戻り値:
pResult, the result of the copy operation.

vectorEqual

public boolean vectorEqual(BitVector pOperand2)
Compares this BitVector with the specified argument for equality. Two BitVectors are equal when they have the same contents (bit sequences). The argument must have the same length as this BitVector.

パラメータ:
pOperand2 - the BitVector to be compared with this BitVector.
戻り値:
true if all the bits of this BitVector and those of the argument are equal.

equals

public boolean equals(java.lang.Object pObject)
The equality for two BitVector objects is specified by vectorEqual(). This method returns true if and only if the specified argument pObject is an instance of BitVector, its length is equal to the length of this BitVector, and vectorEqual((BitVector)pObject) returns true.

オーバーライド:
クラス java.lang.Object 内の equals
パラメータ:
pObject - the object to be compared with this BitVector.
戻り値:
true if the specified argument pObject is a BitVector having the same length as this one and vectorEqual((BitVector)pObject) returns true.
関連項目:
vectorEqual(coins.alias.util.BitVector)

vectorReset

public BitVector vectorReset()
Resets all the bits of this BitVector.

戻り値:
this BitVector with all the bits reset.

toString

public java.lang.String toString()
Returns a String representation of this BitVector. The resultant String contains the bit positions of the set bits separated by spaces.

オーバーライド:
クラス java.lang.Object 内の toString
戻り値:
the String representation of this BitVector.

toStringDescriptive

public java.lang.String toStringDescriptive()
Returns a String representation of this BitVector, which is at least as descriptive as the one returned by toString(). It should usually contain the String representation of the objects that are associated with the set bits. This method returns the same String as toString() for this class.

戻り値:
the String representation of this BitVector that is possibly more detailed than that returned by toString.