#include "TTableIter.h"
#include "TTableSorter.h"
ClassImp(TTableIter)
TTableIter::TTableIter(const TTableSorter *table, Float_t &keyvalue)
: fTableSorter(table), fIndx(0), fFirstIndx(0)
{
CountKey(keyvalue);
}
TTableIter::TTableIter(const TTableSorter *table, Long_t &keyvalue)
: fTableSorter(table), fIndx(0), fFirstIndx(0)
{
CountKey(keyvalue);
}
TTableIter::TTableIter(const TTableSorter *table, Int_t &keyvalue)
: fTableSorter(table), fIndx(0), fFirstIndx(0)
{
CountKey(keyvalue);
}
TTableIter::TTableIter(const TTableSorter *table, Short_t &keyvalue)
: fTableSorter(table), fIndx(0), fFirstIndx(0)
{
CountKey(keyvalue);
}
TTableIter::TTableIter(const TTableSorter *table, Double_t &keyvalue)
: fTableSorter(table), fIndx(0), fFirstIndx(0)
{
CountKey(keyvalue);
}
Int_t TTableIter::CountKey(Float_t &keyvalue)
{
fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
return GetNRows();
}
Int_t TTableIter::CountKey(Long_t &keyvalue)
{
fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
return GetNRows();
}
Int_t TTableIter::CountKey(Int_t &keyvalue)
{
fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
return GetNRows();
}
Int_t TTableIter::CountKey(Short_t &keyvalue)
{
fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
return GetNRows();
}
Int_t TTableIter::CountKey(Double_t &keyvalue)
{
fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
return GetNRows();
}
Int_t TTableIter::Next()
{
Int_t rowIndx = -1;
if (fIndx < fTotalKeys) {
rowIndx = fTableSorter->GetIndex(UInt_t(fFirstIndx+fIndx));
fIndx++;
}
return rowIndx;
}
Int_t TTableIter::Next(Int_t idx)
{
Int_t rowIndx = -1;
if (idx < fTotalKeys)
rowIndx = fTableSorter->GetIndex(UInt_t(fFirstIndx+idx));
return rowIndx;
}
Int_t TTableIter::Reset(Int_t indx)
{
Int_t oldIdx = fIndx;
fIndx = TMath::Min(indx,fTotalKeys);
return oldIdx;
}