coins.alias
Class TagVector

java.lang.Object
  extended bycoins.alias.util.BitVector
      extended bycoins.alias.TagVector

class TagVector
extends BitVector

BitVector where each bit represents a Tag. Tags that correspond to aggregate types correspond to several bits. The last bit is specially used for external addresses.


Field Summary
 
Fields inherited from class coins.alias.util.BitVector
fBitLength, fLongWordLength, fShiftMax, fVectorWord
 
Constructor Summary
(package private) TagVector(int pBitCount)
          Creates a new instance of TagVector with the specified bit length.
 
Method Summary
 void resetBit(int pIndex)
          Resets the bit at the specified position.
 void setBit(int pIndex)
          Sets the bit at the specified position.
(package private)  BriggsSet toBriggsSet()
          Returns the BriggsSet view of this BitVector.
(package private)  java.util.Set toSet(Tag[] pBitAssignedTags)
          Returns the Set view of this BitVector.
 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.
 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.
 
Methods inherited from class coins.alias.util.BitVector
bitVectorIterator, equals, getBit, getBitLength, getVectorWord, getWordLength, isSet, isZero, toString, toStringDescriptive, vectorEqual
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TagVector

TagVector(int pBitCount)
Creates a new instance of TagVector with the specified bit length.

Parameters:
pBitCount - the bit length of the TagVector.
Method Detail

setBit

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

Overrides:
setBit in class BitVector
Parameters:
pIndex - the bit position the bit at which is to be set.

resetBit

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

Overrides:
resetBit in class BitVector
Parameters:
pIndex - the bit position the bit at which is to be reset.

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.

Overrides:
vectorNot in class BitVector
Parameters:
pResult - the BitVector where the result of the NOT operation is stored.
Returns:
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.

Overrides:
vectorAnd in class BitVector
Parameters:
pOperand2 - the BitVector with which this BitVector is ANDed.
pResult - the BitVector where the result of the AND operation is stored.
Returns:
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.

Overrides:
vectorOr in class BitVector
Parameters:
pOperand2 - the BitVector with which this BitVector is ORed.
pResult - the BitVector where the result of the OR operation is stored.
Returns:
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.

Overrides:
vectorXor in class BitVector
Parameters:
pOperand2 - the BitVector with which this BitVector is XORed.
pResult - the BitVector where the result of the XOR operation is stored.
Returns:
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.

Overrides:
vectorSub in class BitVector
Parameters:
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.
Returns:
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.

Overrides:
vectorCopy in class BitVector
Parameters:
pResult - the destination of the copy operation.
Returns:
pResult, the result of the copy operation.

vectorReset

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

Overrides:
vectorReset in class BitVector
Returns:
this BitVector with all the bits reset.

toSet

java.util.Set toSet(Tag[] pBitAssignedTags)

Returns the Set view of this BitVector. BitVector does not perform well for scanning, so this method is for efficient scanning (while this set is not modified). Also, having the Set object with actual Tag objects inside may be sometimes easier to handle. Change to the set returned by this method will NOT be reflected in this bit vector and vice versa.

This method checks if this BitVector has been modified after the previous call to this method, and if not, returns the Set instance returned by the previous call. If this BitVector has been modified since the previous call, or there has never been such a call, then it returns a new copy of the Set synchronized with the current state of this BitVector. So if the Set instance returned by a previous call to this method has been modified while this BitVector itself has not been modified, this method will return the same Set instance returned by the previous call, which is not synchronized with the current state of this BitVector. In general, the Set instance returned by this method should not be modified.

Parameters:
pBitAssignedTags - the mapping from integer indexes to Tag objects, used to create the Set view of this TagVector.
Returns:
the Set view of this TagVector.

toBriggsSet

BriggsSet toBriggsSet()

Returns the BriggsSet view of this BitVector. BitVector does not perform well for scanning, so this method is for efficient scanning (while this set is not modified). Change to the set returned by this method will NOT be reflected in this bit vector and vice versa.

This method checks if this BitVector has been modified after the previous call to this method, and if not, returns the BriggsSet instance returned by the previous call. If this BitVector has been modified since the previous call, or there has never been such a call, then it returns a new copy of the BriggsSet synchronized with the current state of this BitVector. So if the BriggsSet instance returned by a previous call to this method has been modified while this BitVector itself has not been modified, this method will return the same BriggsSet instance returned by the previous call, which is not synchronized with the current state of this BitVector. In general, the BriggsSet instance returned by this method should not be modified.

Returns:
the BriggsSet view of this TagVector.