Class Arbre

java.lang.Object
  extended by Arbre

public class Arbre
extends java.lang.Object


Constructor Summary
Arbre()
          This constructor is used to create the dictionnary initially.
Arbre(int i)
          This constructor is used when adding a new element to the dictionary.
 
Method Summary
 void ecrireEntier(int n)
          This method writes to the standard output the binary representation of an integer where the least significant bit is written first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Arbre

public Arbre()
This constructor is used to create the dictionnary initially. It consists in a tree with a root with 256 descendants. "taille" is the size of the dictionary, it is equal to 256 after invoking the constructor and "logtaille" is equal to 8 at the end of the call of this constructor.


Arbre

public Arbre(int i)
This constructor is used when adding a new element to the dictionary. The size of the dictionary, i.e. "taille" is increased by 1 and the number of bits needed to represent the largest index of an element in the dictionary is increased if needed.

Parameters:
i - the index of the word which is added to the dictionary.
Method Detail

ecrireEntier

public void ecrireEntier(int n)
This method writes to the standard output the binary representation of an integer where the least significant bit is written first. The length of the representaton is not specified in the method: it is the attribute "logtaille" which specifies the length of the binary representation which is used. For instance when writing "7" to the standard output when the attribute "logtaille" is equal to 4, the sequence 1,1,1,0 is written to the output (a zero is added at the end so that the length of the representation is 4).

Parameters:
n - the integer whose binary representation is written to the standard output.