tapeutils
Interface BitProcessor

All Known Implementing Classes:
SimpleBitProcessor

public interface BitProcessor

This interface provices processing operations for identified bits.

Author:
hldswrth

Method Summary
 void addBit(int bitStart, int bitEnd, int bitValue)
          Add the bit to the current byte.
 int getBitEndIndex(int number)
          Get the index of the end of the given bit number.
 void getBitNumber(int index, int[] pos)
          Get the bit number at the given position in the sample.
 int getBitStartIndex(int number)
          Get the index of the start of the given bit number.
 int getBitValue(int index)
          Get the bit value at the given position in the sample.
 int getFirstBitStartIndex()
          Get the index of the start of the first bit found in the sample.
 int getLastBitEndIndex()
          Get the index of the end of the last bit extracted from the sample.
 int getLastBitValue()
          Get the value of the last bit extracted.
 int getNumberOfBits()
          Get the number of bits processed.
 void initialize()
          Initialize this object ready for processing a sample.
 int undoLastBit()
          Undo the last bit that was processed.
 

Method Detail

initialize

public void initialize()
Initialize this object ready for processing a sample.


addBit

public void addBit(int bitStart,
                   int bitEnd,
                   int bitValue)
Add the bit to the current byte.

Parameters:
bitStart - The start of the bit.
bitEnd - The end of the bit.
bitValue - The bit value.

undoLastBit

public int undoLastBit()
Undo the last bit that was processed.

Returns:
The index of the end of the bit before last.

getBitValue

public int getBitValue(int index)
Get the bit value at the given position in the sample.

Parameters:
index - The index.
Returns:
The bit value, as 0 or 1, or -1 for no value.

getBitNumber

public void getBitNumber(int index,
                         int[] pos)
Get the bit number at the given position in the sample.

Parameters:
index - The index.
pos - An array which will contain the bit number and offset from the start of the bit.

getBitStartIndex

public int getBitStartIndex(int number)
Get the index of the start of the given bit number.

Parameters:
number - The bit number.
Returns:
The index.

getBitEndIndex

public int getBitEndIndex(int number)
Get the index of the end of the given bit number.

Parameters:
number - The bit number.
Returns:
The index.

getLastBitValue

public int getLastBitValue()
Get the value of the last bit extracted.

Returns:
The last bit value.

getFirstBitStartIndex

public int getFirstBitStartIndex()
Get the index of the start of the first bit found in the sample.

Returns:
The index of the start of the first bit.

getLastBitEndIndex

public int getLastBitEndIndex()
Get the index of the end of the last bit extracted from the sample.

Returns:
The index of the end of the last bit.

getNumberOfBits

public int getNumberOfBits()
Get the number of bits processed.

Returns:
The number of bits.