public class bitPairSeq { // Constructors public bitPairSeq(int len); §bitPairSeq public bitPairSeq(byte[] B); §bitPairSeq // Methods public void appendBP(bitPair bp); §appendBP public void changeBP(bitPair bp); §changeBP public void insertBP(bitPair bp); §insertBP public boolean isAt(int pos); §isAt public boolean isBefore(int pos); §isBefore public bitPair nextBP(); §nextBP public boolean wasLastBP(); §wasLastBP public void zeroBPS(int len); §zeroBPS }This class represents sequences of bit pairs, and does conversions and comparisons. Provided as is for CS420.
bitPairSeq
public bitPairSeq(int len);
len
-
the length of the bit pair sequence to be created
public bitPairSeq(byte[] B);
B
-
the byte array from which the bit pair sequence will be created
public void appendBP(bitPair bp)
bp
-
the bit pair to be appended to the sequence. (The current position is advanced.)
public void changeBP(bitPair bp)
bp
-
the bit pair to replace the current pair in the sequence. (The current position is advanced.)
public void insertBP(bitPair bp)
bp
-
the bit pair to be inserted after the current pair in the sequence. (The current position is advanced.)
public boolean isAt(int pos)
pos
-
the position to be tested for currency in the sequence. (?==pos + 1
)
Pos==pos + 1
.
public boolean isBefore(int pos)
pos
-
the position to be tested for currency in the sequence. (?<=pos
)
Pos<=pos
.
public bitPair nextBP()
public boolean wasLastBP()
public void zeroBPS(int len)
4*len
bit pairs of the sequence to zero.
len
-
the number of bytes to be zeroed.