Copyright © 1998 T. H. Merrett
Class bitSeq
public class bitSeq
{
// Constructors
public bitSeq(byte seq); §bitSeq
public bitSeq(int seq); §bitSeq
public bitSeq(long seq); §bitSeq
public bitSeq(String seq); §bitSeq
// Methods
public void assign(byte seq); §assign
public void assign(int seq); §assign
public void assign(long seq); §assign
public void assign(String seq); §assign
public int getCurrent(); §getCurrent
public bit nextBit(); §nextBit
public String toString(); §toString
public boolean wasLastBit(); §wasLastBit
}
This class represents sequences of bits, and does conversions and comparisons. Provided as is for CS420.
bitSeq
public bitSeq(byte seq);
- Parameters:
seq
-
the byte representation of up to 8 bits, to be converted to a bit sequence
bitSeq
public bitSeq(int seq);
- Parameters:
seq
-
the int representation of up to 32 bits, to be converted to a bit sequence
bitSeq
public bitSeq(long seq);
- Parameters:
seq
-
the long representation of up to 128 bits, to be converted to a bit sequence
bitSeq
public bitSeq(String seq);
- Parameters:
seq
-
the String representation of bits, to be converted to a bit sequence
assign
public void assign(byte seq)
- Parameters:
seq
-
the byte representation of up to 8 bits, to be assigned to the bit sequence
assign
public void assign(int seq)
- Parameters:
seq
-
the int representation of up to 32 bits, to be assigned to the bit sequence
assign
public void assign(long seq)
- Parameters:
seq
-
the long representation of up to 128 bits, to be assigned to the bit sequence
assign
public void assign(String seq)
- Parameters:
seq
-
the string representation of bits, to be assigned to the bit sequence
getCurrent
public int getCurrent()
- Returns:
- The integer position of the current bit in the sequence (0..).
nextBit
public bit nextBit()
- Returns:
- The bit at the current position in the sequence, and advances the postion.
toString
public String toString()
- Returns:
- The string representation of the sequence.
wasLastBit
public boolean wasLastBit()
- Returns:
- True if the pointer to the current bit is past the end of the sequence.
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