Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PObject * PAbstractSortedList::GetAt ( PINDEX  index ) const [virtual]

Get the object at the specified ordinal position. If the index was greater than the size of the collection then NULL is returned.

Returns:
pointer to object at the specified index.

Implements PCollection.

Definition at line 987 of file collect.cxx.

References PContainer::GetSize().

{
  if (index >= GetSize())
    return NULL;

  if (index != info->lastIndex) {
    if (index == info->lastIndex-1) {
      info->lastIndex--;
      info->lastElement = info->Predecessor(info->lastElement);
    }
    else if (index == info->lastIndex+1 && info->lastElement != NULL) {
      info->lastIndex++;
      info->lastElement = info->Successor(info->lastElement);
    }
    else {
      info->lastIndex = index;
      info->lastElement = info->OrderSelect(info->root, index+1);
    }
  }

  return PAssertNULL(info->lastElement)->data;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index