Copyright © 1998 T. H. Merrett

Class bit

public  class  bit

{
        // Constructors
    public bit(int inbit); §bit
        // Methods
    public int bit2int(); §bit2int
    public bitPair bit2trieNode(); §bit2trieNode
    public boolean matches(int inbit); §matches
    public boolean matches(bit inbit); §matches
    public byte toByte(); §toByte
}
This class represents bits, and does conversions and comparisons. Provided as is for CS420.


Constructors

bit

public bit(int inbit);
Parameters:
inbit - the integer to be converted to a bit

Methods

bit2int

public int bit2int()
Returns:
The integer representing the bit: 0 or 1.

bit2trieNode

public bitPair bit2trieNode()
Returns:
The bit pair that represents the bit in a trie node: 0 -> 10, 1 -> 01.

matches

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

matches

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

toByte

public byte toByte()
Returns:
The byte representing the bit: 0 or 1.

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