Commit a7fa2380 authored by Kevin Coulomb's avatar Kevin Coulomb

Correction de fautes dans le manuel technique

parent 4b021d87
......@@ -107,7 +107,7 @@ public :
*
*/
bool has_children(){
return ((_left_child == NULL)&&(_right_child==NULL));
return !((_left_child == NULL)&&(_right_child==NULL));
}
......
/*
J'ai besoin d'ajouter a la structure node :
1 intervalle pour dire la taille de l'intervalle ou je suis
1 tableau de 4 intervalles donnant les intervalles a conflit
Un tableau de 2 entiers donnant si les fils sont pas encore parcours ( 0 ), affichable ( 1 ), non affichable ( 2 ), ...
Peut etre un booleen donnant le fait que l'on soit affiche ou pas
*/
/*
*
*\file tree/Node.hpp
......
......@@ -84,7 +84,7 @@ private :
*
*/
bool is_occuped(){
return _status == OCCUPED;
return (_status == OCCUPED);
}
/*
......@@ -94,7 +94,7 @@ private :
*
*/
bool is_free(){
return _status == FREE;
return (_status == FREE);
}
/*
......@@ -104,7 +104,7 @@ private :
*
*/
bool is_locked(){
return _status == LOCKED;
return (_status == LOCKED);
}
/*
......@@ -114,7 +114,7 @@ private :
*
*/
void set_busy(){
_status = OCCUPED;
this->_status = OCCUPED;
}
/*
......@@ -124,7 +124,7 @@ private :
*
*/
void set_free(){
_status = FREE;
this->_status = FREE;
}
/*
......@@ -134,7 +134,7 @@ private :
*
*/
void set_locked(){
_status = LOCKED;
this->_status = LOCKED;
}
/*
......@@ -154,7 +154,7 @@ private :
*
*/
void set_node(Node<E> * node){
this->_tree->set_current_node(node);
(this->_tree)->set_current_node(node);
}
/*
......@@ -189,7 +189,7 @@ private :
*
*
*/
TableNode *_temporary;// = new TableNode[size];
TableNode *_temporary;
/*
*
......@@ -214,12 +214,12 @@ private :
_temporary = new TableNode[_size];
}
TreeBuilder(std::list<E>* l, BinaryTree<E> * t){
_size = 1;
_list = l;
_tree = t;
_beginning = 0;
_temporary = new TableNode[_size];
TreeBuilder(std::list<E>* list, BinaryTree<E> * tree){
this->_size = 1;
this->_list = list;
this->_tree = tree;
this->_beginning = 0;
this->_temporary = new TableNode[_size];
}
/*
......@@ -240,7 +240,7 @@ private :
*
*/
void inc_beginning(){
this->_beginning ++;
(this->_beginning) ++;
}
/*
......@@ -290,6 +290,7 @@ private :
*\brief Clear the memory linked to the binary tree
*
*/
///////////////////////////////ATTENTION A FAIRE LE CLEAR DANS LE BINARY_TREE
void clear_tree(){
BinaryTree<E> * copy = _tree->getRoot();
copy->clear_tree();
......@@ -332,20 +333,18 @@ private :
*
*/
void build_tree(){
BinaryTree <E> * tmp;
int pos = 0;
int cpt;
int cptlimit=0;
// std::list<int>::iterator iter;
// std::list<E>::const_iterator iter;
BinaryTree <E> * father;
BinaryTree <E> * leftChild;
BinaryTree <E> * rightChild;
BinaryTree <E> * left_child;
BinaryTree <E> * right_child;
E item;
// If the list is not empty
if(!_list->empty()){
int size_list = _size;
this->_beginning = 0;
......@@ -358,45 +357,46 @@ private :
this->_temporary = new TableNode[n];
item = _list->front();
// iter = _list.begin();
// While the whole tree has not been built
while (!_list->empty()){
// create a node with the current element of the list
create_binary_tree(item,tmp);
// delete _list->front();
// Getting the first position free where we can insert the node in the table
pos = get_first_freebox();
// Set the node in the table
set_node(tmp->get_current(),pos);
// To look if there is links that can already be put
// To look if there are links that can already be put
tmp = _temporary[pos].get_tree();
// If it is a leaf
if(pos == _beginning){
tmp->set_children(NULL,NULL);
}
else{
// Previous node = left child
leftChild = _temporary[pos-1].get_tree();
else{ // Previous node = left child
left_child = _temporary[pos-1].get_tree();
leftChild->set_father(tmp);
tmp->set_left_child(leftChild);
left_child->set_father(tmp);
tmp->set_left_child(left_child);
// Removing the previous nodes in the table
// Removing all the previous nodes in the table
for(cpt=_beginning;cpt<pos;cpt++){
_temporary[cpt].set_free();
_temporary[cpt].set_node(NULL);
}
}//end else
// If there is its father (--> i am its right child)
if(_temporary[pos+1].is_occuped()){
rightChild = tmp;
right_child = tmp;
tmp = _temporary[pos+1].get_tree();
rightChild->set_father(tmp);
tmp->set_right_child(rightChild);
right_child->set_father(tmp);
tmp->set_right_child(right_child);
}
if ( cptlimit == limit ){
......@@ -404,10 +404,10 @@ private :
}
cptlimit ++;
// ATTENTION VOIR SI ON DETRUIT LE NOEUD DE LA LISTE ICI
_list->pop_front();
item = _list->front();
// this->_list = this->_list->get_next();
tmp = NULL;
}//endwhile
......@@ -420,14 +420,12 @@ private :
if(pos == _beginning){
tmp->set_children(NULL,NULL);
}
else{
// Previous node = left child
leftChild = _temporary[pos-1].get_tree();
else{ // Previous node = left child
left_child = _temporary[pos-1].get_tree();
left_child->set_father(tmp);
tmp->set_left_child(left_child);
leftChild->set_father(tmp);
tmp->set_left_child(leftChild);
// Removing the previous nodes in the table
// Removing all the previous nodes in the table
for(cpt=_beginning;cpt<pos;cpt++){
_temporary[cpt].set_free();
_temporary[cpt].set_node(NULL);
......@@ -435,18 +433,18 @@ private :
}//end else
if(_temporary[pos+1].is_occuped()){
rightChild = tmp;
right_child = tmp;
tmp = _temporary[pos+1].get_tree();
rightChild->set_father(tmp);
tmp->set_right_child(rightChild);
right_child->set_father(tmp);
tmp->set_right_child(right_child);
}
this->_tree = tmp;
}
else{
this->_beginning = -1;
this->_beginning = 0;
this->_tree = new BinaryTree<E>();
}
}
......@@ -492,7 +490,7 @@ private :
/*
*
*\fn get_power(int size)
*\brief Calculate and return the number j to have 2^j<size<2^(j+1)
*\brief Calculate and return the number j+1 to have 2^j<size<2^(j+1)
*
*/
int get_power(int size){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment