Copyright © 1998 T. H. Merrett

Class bitPair

public  class  bitPair

{
        // Constructors
    public bitPair(String pair); §bitPair
    public bitPair(int pair); §bitPair
    public bitPair(bit b1, bit b0); §bitPair
        // Methods
    public boolean matches(bitPair pair); §matches
    public boolean matches(String pair); §matches
    public boolean matches(int pair); §matches
    public boolean matches(bit b1, bit b0); §matches
    public boolean matches(bit B); §matches
    public byte toByte(); §toByte
}
This class represents bit pairs, and does conversions and comparisons. Provided as is for CS420.


Constructors

bitPair

public bitPair(String pair);
Parameters:
pair - the String to be converted to a bit pair

bitPair

public bitPair(int pair);
Parameters:
pair - the int to be converted to a bit pair

bitPair

public bitPair(bit b1, bit b0);
Parameters:
b1 - the more signifiacnt of two bits to be converted to a bit pair
Parameters:
b0 - the less signifiacnt of two bits to be converted to a bit pair

Methods

matches

public boolean matches(bitPair pair)
Parameters:
pair - the bit pair to be compared
Returns:
True if there is a match, else false.

matches

public boolean matches(String pair)
Parameters:
pair - the string to be compared with the bit pair
Returns:
True if there is a match, else false.

matches

public boolean matches(int pair)
Parameters:
pair - the int to be compared with the bit pair
Returns:
True if there is a match, else false.

matches

public boolean matches(bit b1, bit b0)
Parameters:
b1 - the more significant of two bits to be compared with the bit pair
b0 - the less significant of two bits to be compared with the bit pair
Returns:
True if there is a match, else false.

matches

public boolean matches(bit B)
Parameters:
B - the bit to be compared with the bit pair
Returns:
True if there is a match, else false. (Trie node comparison: 0 matches 10, 11; 1 matches 01, 11)

toByte

public byte toByte()
Returns:
The byte representing the bit pair: 00, 01, 10 or 11.

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