Copyright © 1998 T. H. Merrett

Class bitPairSeq

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.


Constructors

bitPairSeq

public bitPairSeq(int len);
Parameters:
len - the length of the bit pair sequence to be created

bitPairSeq

public bitPairSeq(byte[] B);
Parameters:
B - the byte array from which the bit pair sequence will be created

Methods

appendBP

public void appendBP(bitPair bp)
Parameters:
bp - the bit pair to be appended to the sequence. (The current position is advanced.)

changeBP

public void changeBP(bitPair bp)
Parameters:
bp - the bit pair to replace the current pair in the sequence. (The current position is advanced.)

insertBP

public void insertBP(bitPair bp)
Parameters:
bp - the bit pair to be inserted after the current pair in the sequence. (The current position is advanced.)

isAt

public boolean isAt(int pos)
Parameters:
pos - the position to be tested for currency in the sequence. (?==pos + 1)
Returns:
True if Pos==pos + 1.

isBefore

public boolean isBefore(int pos)
Parameters:
pos - the position to be tested for currency in the sequence. (?<=pos)
Returns:
True if Pos<=pos.

nextBP

public bitPair nextBP()
Returns:
The current bit pair in the sequence, advancing the currency pointer.

wasLastBP

public boolean wasLastBP()
Returns:
True if the pointer to the current bit pair is past the end of the sequence.

zeroBPS

public void zeroBPS(int len)
Sets 4*len bit pairs of the sequence to zero.
Parameters:
len - the number of bytes to be zeroed.

1 Java cs420 Document (HTML written by T. H. Merrett on September 14, 1998)
Please send any comments or corrections to tim@cs.mcgill.ca