container::SortedList Class Reference

Abstract base class for all sorted lists. More...

#include <sortedlist.h>

Inheritance diagram for container::SortedList:

Inheritance graph
[legend]
Collaboration diagram for container::SortedList:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~SortedList ()
bool insertSorted (Entity *entity)
 Insert an Entity into the List maintaining a sorted order.
virtual ostream & renderState (ostream &os) const
 Write the state of an Object for debugging and demonstration.
virtual const InfotypeInfo () const
 Return the instance of Object::Info that describes the class of this object.
virtual Objectclone (bool deepCopy=false) const =0
 A polymorphic copy constructor.

Static Public Attributes

static const Info *const TYPE_INFO = Object::typeInfoFactory("SortedList")

Protected Member Functions

 SortedList ()
 SortedList (const SortedList &orig)
virtual bool insertSorted_impl (Entity *entity)=0
 Called by a template method.

Private Member Functions

void setCount (int c)
 Hide from sub-classes.
void incCount ()
 Hide from sub-classes.
void decCount ()
 Hide from sub-classes.


Detailed Description

Abstract base class for all sorted lists.

Does not allow duplicate Entity objects.


Constructor & Destructor Documentation

container::SortedList::SortedList (  )  [protected]

00047 { }

container::SortedList::SortedList ( const SortedList orig  )  [protected]

00049 { }

container::SortedList::~SortedList (  )  [virtual]

00051 { }


Member Function Documentation

virtual Object* container::SortedList::clone ( bool  deepCopy = false  )  const [pure virtual]

A polymorphic copy constructor.

Implements container::List.

Implemented in container::SortedArrayList, and container::SortedLinkedList.

void container::SortedList::decCount (  )  [inline, private]

Hide from sub-classes.

Reimplemented from container::Container.

00119                           {
00120       Container::decCount();
00121    }

void container::SortedList::incCount (  )  [inline, private]

Hide from sub-classes.

Reimplemented from container::Container.

00112                           {
00113       Container::incCount();
00114    }

Here is the caller graph for this function:

bool container::SortedList::insertSorted ( Entity entity  ) 

Insert an Entity into the List maintaining a sorted order.

The position of entity will be determined by the Entity class' implementation of compareKeyTo(const Entity&). Duplicate keys will be rejected, i.e., if Entity::compareKeyTo(const Entity&) returns 0 for any item in the SortedList the insertion will not take place.

Returns:
true if the Entity was added; otherwise false
Precondition:
The List is sorted and does not contain duplicate entries
Postcondition:
The new Entity is in the list and count is incremented

The List is sorted and does not contain duplicate entries

The cursor remains unchanged, pointing to the same, pre-existing Entity or to the tail of the list

00055                                             {
00056    if (insertSorted_impl(entity)) {
00057       incCount();
00058       return true;
00059    }
00060 
00061    return false;
00062 }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool container::SortedList::insertSorted_impl ( Entity entity  )  [protected, pure virtual]

Called by a template method.

See also:
Details documented in SortedList::insertSorted

Implemented in container::SortedArrayList, and container::SortedLinkedList.

Here is the caller graph for this function:

ostream & container::SortedList::renderState ( ostream &  os  )  const [virtual]

Write the state of an Object for debugging and demonstration.

This method must not change the state of an Object; adding or removing debug statements should not change the behavior of a class. The implementation must be robust, e.g., NULL safe, etc. and work without an unrecoverable error for any state, excluding an Object's time of construction and destruction. It is not required for the implementation to be thread safe.

Precondition:
The Object has been fully constructed and is not in the process of destruction
Postcondition:
The state of the Object is unchanged

Reimplemented from container::List.

Reimplemented in container::SortedArrayList, and container::SortedLinkedList.

00066                                                    {
00067    return this->List::renderState(os);
00068 }

void container::SortedList::setCount ( int  c  )  [inline, private]

Hide from sub-classes.

Reimplemented from container::Container.

00105                                {
00106       Container::setCount(c);
00107    }

const Object::Info * container::SortedList::typeInfo (  )  const [virtual]

Return the instance of Object::Info that describes the class of this object.

Instantiation of Object::Info is controlled by the protected method Object::typeInfoFactory(const string&). Each sub-class of Object should create one and only one instance of Object::Info.

Reimplemented from container::List.

Reimplemented in container::SortedArrayList, and container::SortedLinkedList.

00070                                              {
00071    return TYPE_INFO;
00072 }


Member Data Documentation

const Object::Info *const container::SortedList::TYPE_INFO = Object::typeInfoFactory("SortedList") [static]

Reimplemented from container::List.

Reimplemented in container::SortedArrayList, and container::SortedLinkedList.


The documentation for this class was generated from the following files:

Generated on Tue Jun 16 23:13:00 2009 by  doxygen 1.5.9