00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "TTableIter.h"
00019 #include "TTableSorter.h"
00020
00021 ClassImp(TTableIter)
00022
00023
00024 TTableIter::TTableIter(const TTableSorter *table, Float_t &keyvalue)
00025 : fTableSorter(table), fIndx(0), fFirstIndx(0)
00026 {
00027
00028 CountKey(keyvalue);
00029 }
00030
00031
00032 TTableIter::TTableIter(const TTableSorter *table, Long_t &keyvalue)
00033 : fTableSorter(table), fIndx(0), fFirstIndx(0)
00034 {
00035
00036 CountKey(keyvalue);
00037 }
00038
00039
00040 TTableIter::TTableIter(const TTableSorter *table, Int_t &keyvalue)
00041 : fTableSorter(table), fIndx(0), fFirstIndx(0)
00042 {
00043
00044 CountKey(keyvalue);
00045 }
00046
00047
00048 TTableIter::TTableIter(const TTableSorter *table, Short_t &keyvalue)
00049 : fTableSorter(table), fIndx(0), fFirstIndx(0)
00050 {
00051
00052 CountKey(keyvalue);
00053 }
00054
00055
00056 TTableIter::TTableIter(const TTableSorter *table, Double_t &keyvalue)
00057 : fTableSorter(table), fIndx(0), fFirstIndx(0)
00058 {
00059
00060 CountKey(keyvalue);
00061 }
00062
00063
00064 Int_t TTableIter::CountKey(Float_t &keyvalue)
00065 {
00066
00067 fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00068 return GetNRows();
00069 }
00070
00071 Int_t TTableIter::CountKey(Long_t &keyvalue)
00072 {
00073
00074 fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00075 return GetNRows();
00076 }
00077
00078
00079 Int_t TTableIter::CountKey(Int_t &keyvalue)
00080 {
00081
00082 fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00083 return GetNRows();
00084 }
00085
00086
00087 Int_t TTableIter::CountKey(Short_t &keyvalue)
00088 {
00089
00090 fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00091 return GetNRows();
00092 }
00093
00094
00095 Int_t TTableIter::CountKey(Double_t &keyvalue)
00096 {
00097
00098 fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00099 return GetNRows();
00100 }
00101
00102
00103 Int_t TTableIter::Next()
00104 {
00105
00106 Int_t rowIndx = -1;
00107 if (fIndx < fTotalKeys) {
00108 rowIndx = fTableSorter->GetIndex(UInt_t(fFirstIndx+fIndx));
00109 fIndx++;
00110 }
00111 return rowIndx;
00112 }
00113
00114
00115 Int_t TTableIter::Next(Int_t idx)
00116 {
00117
00118 Int_t rowIndx = -1;
00119 if (idx < fTotalKeys)
00120 rowIndx = fTableSorter->GetIndex(UInt_t(fFirstIndx+idx));
00121 return rowIndx;
00122 }
00123
00124
00125 Int_t TTableIter::Reset(Int_t indx)
00126 {
00127
00128 Int_t oldIdx = fIndx;
00129 fIndx = TMath::Min(indx,fTotalKeys);
00130 return oldIdx;
00131 }