Class to hold information about the processed elements of a file.
{
const ProcFileElements::ProcFileElement *e =
dynamic_cast<const ProcFileElements::ProcFileElement *>(o);
if (!e) return -1;
return 0;
}
else if (fFirst < e->
fFirst) {
return -1;
} else {
return 1;
}
}
Int_t ProcFileElements::ProcFileElement::Overlapping(ProcFileElement *e)
{
if (!e) return -1;
if (
fFirst == 0 && fLast == -1) {
return 1;
}
if (fLast >= 0) {
if (fLast < e->fFirst - 1) {
return -1;
} else {
if (fLast == e->fFirst - 1) {
return 0;
} else {
return 1;
}
}
} else {
return 1;
}
} else if (fFirst == e->fFirst) {
if (fFirst == fLast || e->fFirst == e->fLast) return 0;
return 1;
} else {
if (e->fLast >= 0) {
if (e->fLast < fFirst - 1) {
return -1;
} else {
if (e->fLast == fFirst - 1) {
return 0;
} else {
return 1;
}
}
} else {
return 1;
}
}
Warning(
"Overlapping",
"should never be here!");
return -1;
}
Int_t ProcFileElements::ProcFileElement::MergeElement(ProcFileElement *e)
{
if (Overlapping(e) < 0) return -1;
if (e->fFirst < fFirst) fFirst = e->fFirst;
if (fLast == -1 || e->fLast == -1) {
fLast = -1;
} else {
if (fLast < e->fLast) fLast = e->fLast;
}
return 0;
}
{
Printf(
"\tfirst: %lld\t last: %lld", fFirst, fLast);
}
{
if (!fElements) {
Error(
"Add",
"could not create internal list!");
return -1;
}
ProcFileElements::ProcFileElement *ne =
new ProcFileElements::ProcFileElement(fst, lst);
ProcFileElements::ProcFileElement *e = 0;
while ((e = (ProcFileElements::ProcFileElement *)nxe())) {
if (e->MergeElement(ne) == 0) break;
}
if (e) {
fElements->Remove(e);
fElements->Add(e);
} else {
fElements->Add(ne);
rc = 1;
}
ProcFileElements::ProcFileElement *ep = 0, *en = 0;
TObjLink *olp = fElements->FirstLink(), *oln = 0;
while (olp && (ep = (ProcFileElements::ProcFileElement *) olp->
GetObject())) {
while (oln) {
if ((en = (ProcFileElements::ProcFileElement *) oln->GetObject())) {
if (ep->MergeElement(en) == 0) {
fElements->Remove(en);
delete en;
}
}
}
}
if ((e = (ProcFileElements::ProcFileElement *) fElements->First())) fFirst = e->fFirst;
if ((e = (ProcFileElements::ProcFileElement *) fElements->Last())) fLast = e->fLast;
return rc;
}
{
Printf(
"--- ProcFileElements ----------------------------------------");
Printf(
" # proc elements: %d", fElements ? fElements->GetSize() : 0);
ProcFileElements::ProcFileElement *e = 0;
while ((e = (ProcFileElements::ProcFileElement *)nxe())) { e->Print(); }
Printf(
" Raw overall range: [%lld, %lld]", fFirst, fLast);
Printf(
"-------------------------------------------------------------");
}
{
if (!li) return -1;
ProcFileElements *pfe = 0;
while ((pfe = (ProcFileElements *) nxo())) {
if (strcmp(
GetName(), pfe->GetName()))
Warning(
"Merge",
"merging objects of different name! ('%s' != '%s')",
TIter nxe(pfe->GetListOfElements());
ProcFileElements::ProcFileElement *e = 0;
while ((e = (ProcFileElements::ProcFileElement *)nxe())) {
if (rc == 1) nadd++;
}
}
return nadd;
}