------------------------------------------------------------------------------
| 252 | |
| 253 | //------------------------------------------------------------------------------ |
| 254 | vtkObject* vtkCollection::GetItemAsObject(int i) VTK_FUTURE_CONST |
| 255 | { |
| 256 | vtkCollectionElement* elem = this->Top; |
| 257 | |
| 258 | if (i < 0) |
| 259 | { |
| 260 | return nullptr; |
| 261 | } |
| 262 | |
| 263 | if (i == this->NumberOfItems - 1) |
| 264 | { |
| 265 | // optimize for the special case where we're looking for the last elem |
| 266 | elem = this->Bottom; |
| 267 | } |
| 268 | else |
| 269 | { |
| 270 | while (elem != nullptr && i > 0) |
| 271 | { |
| 272 | elem = elem->Next; |
| 273 | i--; |
| 274 | } |
| 275 | } |
| 276 | if (elem != nullptr) |
| 277 | { |
| 278 | return elem->Item; |
| 279 | } |
| 280 | else |
| 281 | { |
| 282 | return nullptr; |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | //------------------------------------------------------------------------------ |
| 287 | void vtkCollection::ReplaceItem(int i, vtkObject* a) |
no outgoing calls