160 for (Int_t irow=1; irow<=maxrow; irow++)
162 for (Int_t icol=1; icol<=maxcol; icol++)
221 for (Int_t irow=0; irow<
fRows->GetSize(); irow++)
223 TObjArray* mrow=(TObjArray*)
fRows->At(irow);
228 mrow->SetOwner(kTRUE);
232 mrow->SetOwner(kFALSE);
273 cout <<
" *NcObjMatrix::SetSwapMode* Matrix not empty ==> No action." << endl;
303 cout <<
" *NcObjMatrix::AddObject* Invalid argument(s) (row,col) : ("
304 << row <<
"," << col <<
")" << endl;
318 fRows=
new TObjArray(rowx);
323 if (rowx >
fRows->GetSize())
fRows->Expand(rowx);
326 TObjArray* mrow=(TObjArray*)
fRows->At(rowx-1);
330 TObjArray* columns=
new TObjArray(colx);
331 if (
fOwn) columns->SetOwner();
332 fRows->AddAt(columns,rowx-1);
337 if (colx > mrow->GetSize()) mrow->Expand(colx);
340 TObject* old=(TObject*)mrow->At(colx-1);
345 if (
fOwn)
delete old;
348 mrow->AddAt(obj,colx-1);
367 if (!
fRows || row<1 || col<1)
return;
376 if (rowx <= fRows->GetSize()) mrow=(TObjArray*)
fRows->At(rowx-1);
380 if (colx <= mrow->GetSize()) obj=(TObject*)mrow->At(colx-1);
387 if (
fOwn)
delete obj;
460 if (row && !col) nrefs=
GetIndices(obj,row,cols);
461 if (!row && col) nrefs=
GetIndices(obj,rows,col);
465 for (Int_t i=0; i<nrefs; i++)
468 if (!irow) irow=rows.At(i);
470 if (!icol) icol=cols.At(i);
488 if (!
fRows || row<1 || col<1)
return obj;
497 if (rowx <= fRows->GetSize()) mrow=(TObjArray*)
fRows->At(rowx-1);
499 if (!mrow)
return obj;
501 if (colx <= mrow->GetSize()) obj=(TObject*)mrow->At(colx-1);
524 if (j>0 && j<=nobj) obj=(TObject*)
fObjects->At(j-1);
593 if (!obj)
return nobjs;
596 for (Int_t i=1; i<=nobjs; i++)
599 if (objx==obj) nrefs++;
639 if (!nrefs)
return 0;
643 for (Int_t i=0; i<
fRows->GetSize(); i++)
645 TObjArray* columns=(TObjArray*)
fRows->At(i);
646 if (!columns)
continue;
648 for (Int_t j=0; j<columns->GetSize(); j++)
650 TObject* objx=(TObject*)columns->At(j);
651 if (objx && (objx==obj || !obj))
657 rows.AddAt(irow,jref);
658 cols.AddAt(icol,jref);
662 if (jref==nrefs)
break;
665 if (jref==nrefs)
break;
710 if (!nrefs)
return 0;
722 for (Int_t idx=0; idx<n; idx++)
726 for (Int_t k=0; k<jref; k++)
728 if (icol==cols.At(k)) found=1;
732 cols.AddAt(icol,jref);
743 for (Int_t i=0; i<
fRows->GetSize(); i++)
745 TObjArray* columns=(TObjArray*)
fRows->At(i);
746 if (!columns)
continue;
748 for (Int_t j=0; j<columns->GetSize(); j++)
750 TObject* objx=(TObject*)columns->At(j);
751 if (objx && (objx==obj || !obj))
759 cols.AddAt(icol,jref);
764 if (jref==nrefs)
break;
767 if (jref==nrefs)
break;
815 if (!nrefs)
return 0;
827 for (Int_t idx=0; idx<n; idx++)
831 for (Int_t k=0; k<jref; k++)
833 if (irow==rows.At(k)) found=1;
837 rows.AddAt(irow,jref);
848 for (Int_t i=0; i<
fRows->GetSize(); i++)
850 TObjArray* columns=(TObjArray*)
fRows->At(i);
851 if (!columns)
continue;
853 for (Int_t j=0; j<columns->GetSize(); j++)
855 TObject* objx=(TObject*)columns->At(j);
856 if (objx && (objx==obj || !obj))
864 rows.AddAt(irow,jref);
869 if (jref==nrefs)
break;
872 if (jref==nrefs)
break;
894 if (strlen(name)) m->SetName(name);
Handling of a matrix structure of objects.
Int_t GetNrefs(TObject *obj) const
virtual TObject * GetObject(Int_t row, Int_t col) const
virtual void EnterObject(Int_t row, Int_t col, TObject *obj)
virtual TObject * Clone(const char *name="") const
virtual Int_t GetMaxColumn() const
void RemoveObject(Int_t row, Int_t col)
virtual void SetOwner(Int_t own=1)
Int_t GetIndices(TObject *obj, TArrayI &rows, TArrayI &cols) const
virtual Int_t GetSwapMode() const
virtual Int_t GetOwner() const
virtual TObjArray * GetObjects()
void RemoveObjects(TObject *obj, Int_t row=0, Int_t col=0)
virtual Int_t GetMaxRow() const
virtual void SetSwapMode(Int_t swap=1)
virtual Int_t GetNobjects() const