00001 #ifndef __CandidateHeapList__
00002 #define __CandidateHeapList__
00003 
00004 
00005 
00023 #include <stdio.h>
00024 #include "Psi2DValue.hpp"
00025 
00026 class CandidateHeapList
00027 {
00028 private:
00029 
00030 int                             nmax;                   
00031 int                             n;                              
00032 
00033 Psi2DValue**            heap;
00034 
00035 protected:
00036 
00037 void reorderUp(int key);                        
00038 void reorderDown(int key);                      
00039 
00040 void reorder(int akey)                          
00041                                 {
00042                                 reorderUp(akey);
00043                                 reorderDown(akey);
00044                                 }
00045 
00046 public:
00047 
00048 CandidateHeapList(int maxData);
00049 ~CandidateHeapList(){ delete[] heap; }  
00050         
00051 bool                    isEmpty(){ return n <= 0; }
00052 bool                    isFull(){ return n == nmax; }
00053 
00054 int                             numberOfData(){ return n; }
00055 
00056 Psi2DValue*             getTop(){ return heap[0]; }
00057 Psi2DValue*             get(int i){ return heap[i]; }
00058 
00059 void                    insertData(Psi2DValue* data);
00060 void                    removeFirstValue();
00061 void                    updateData(Psi2DValue* data);
00062 
00063 void                    output();
00064 };
00065 
00066 #endif