1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ////////////////////////////////////////////////
17 // Huffman classes for set:TPC //
18 ////////////////////////////////////////////////
19 //This file contains two classes and it implements
20 //the Huffman algorithm for creating tables
21 //used in the compression phase.
22 //The class AliTPCHNode represents a node of the Huffman tree, while
23 //the class AliTPCHTable represents a compression table
25 #include "AliTPCHNode.h"
29 AliTPCHNode::AliTPCHNode(){
35 //////////////////////////////////////////////////////////////////////////////
37 AliTPCHNode::AliTPCHNode(Int_t sym, Double_t freq){
38 //Standard constructor
45 //////////////////////////////////////////////////////////////////////////////
47 AliTPCHNode::AliTPCHNode(const AliTPCHNode &source)
50 if(&source == this) return;
51 this->fSymbol = source.fSymbol;
52 this->fFrequency = source.fFrequency;
53 this->fLeft = source.fLeft;
54 this->fRight = source.fRight;
58 //////////////////////////////////////////////////////////////////////////////
60 AliTPCHNode& AliTPCHNode::operator=(const AliTPCHNode &source){
62 if(&source == this) return *this;
63 this->fSymbol = source.fSymbol;
64 this->fFrequency = source.fFrequency;
65 this->fLeft = source.fLeft;
66 this->fRight = source.fRight;
70 //////////////////////////////////////////////////////////////////////////////
72 Int_t AliTPCHNode::Compare(const TObject *obj)const{
73 //Function called by Sort method of TObjArray
74 AliTPCHNode *node=(AliTPCHNode *)obj;
75 Double_t f=fFrequency;
76 Double_t fo=node->fFrequency;
78 else if (f>fo) return -1;
82 //////////////////////////////////////////////////////////////////////////////