summaryrefslogtreecommitdiff
path: root/lib/HTree.cc
diff options
context:
space:
mode:
authorPixel <>2001-03-03 22:53:41 +0000
committerPixel <>2001-03-03 22:53:41 +0000
commitdc2ce18ea8e1686e61dce2b924e3607df69a2dcf (patch)
treef035493abaca3227da9bbae2b628afbeb990759c /lib/HTree.cc
parent833d20a69fe17ab846c153e35230c66a41d8fca9 (diff)
Plein de changements
Diffstat (limited to 'lib/HTree.cc')
-rw-r--r--lib/HTree.cc64
1 files changed, 36 insertions, 28 deletions
diff --git a/lib/HTree.cc b/lib/HTree.cc
index c651f48..b8731e4 100644
--- a/lib/HTree.cc
+++ b/lib/HTree.cc
@@ -3,38 +3,46 @@
#include "config.h"
#include "HTree.h"
-HTree::HTree(int n_freq, char * n_objet) {
- freq = n_freq;
- objet = n_objet;
- left = right = NULL;
+HTree::HTree(int n_freq, char *n_objet)
+{
+ freq = n_freq;
+ objet = n_objet;
+ left = right = NULL;
}
-HTree::HTree(HTree * n_left, HTree * n_right) {
- left = n_left;
- right = n_right;
- freq = n_left->freq + n_right->freq;
- objet = NULL;
+HTree::HTree(HTree * n_left, HTree * n_right)
+{
+ left = n_left;
+ right = n_right;
+ freq = n_left->freq + n_right->freq;
+ objet = NULL;
}
-HTree::~HTree() {
- if (left) delete left;
- if (right) delete right;
+HTree::~HTree()
+{
+ if (left)
+ delete left;
+
+ if (right)
+ delete right;
}
-ostream & HTree::Trace(ostream & os, int d) {
- static char cmpr[MAX_HDEPTH + 1];
- if (objet) {
- cmpr[d] = '\0';
- os << objet << " = " << cmpr << endl;
- } else {
- if (left) {
- cmpr[d] = '0';
- left->Trace(os, d + 1);
- }
- if (right) {
- cmpr[d] = '1';
- right->Trace(os, d + 1);
- }
- }
- return os;
+ostream & HTree::Trace(ostream & os, int d)
+{
+ static char cmpr[MAX_HDEPTH + 1];
+
+ if (objet) {
+ cmpr[d] = '\0';
+ os << objet << " = " << cmpr << endl;
+ } else {
+ if (left) {
+ cmpr[d] = '0';
+ left->Trace(os, d + 1);
+ }
+ if (right) {
+ cmpr[d] = '1';
+ right->Trace(os, d + 1);
+ }
+ }
+ return os;
}