IList (interface)

Usage

Linkage:

-lopenxds_adt

To use the interface:

#include <openxds.adt/IList.h>

using namespace openxds::adt;

Method Summary

ReturnsMethod-nameParametersThrows
IPosition(E)* insertFirst E* element
IPosition(E)* insertLast E* element
IPosition(E)* insertBefore IPosition(E)& p E* element
IPosition(E)* insertAfter IPosition(E)& p E* element
E* replace IPosition(E)& p E* element
E* remove IPosition(E)* p
IPosition(E)* first NoSuchElementException*
IPosition(E)* last NoSuchElementException*
IPosition(E)* prev IPosition(E)& p NoSuchElementException*
IPosition(E)* previous IPosition(E)& p NoSuchElementException*
IPosition(E)* next IPosition(E)& p NoSuchElementException*
IIterator(E)* elements
IPIterator(E)*positions
bool isEmpty
long size

Methods


insertFirst

IPosition<E>* insertFirst( E* element );

Parameters

element, to be inserted into the list.

Returns

A new position that corresponds to the element's position in the list.


insertLast

IPosition<E>* insertLast( E* element );

Parameters

element, to be inserted into the list.

Returns

A new position that corresponds to the element's position in the list.


insertBefore

IPosition<E>* insertBefore( IPosition<E>& p, E* element );

Parameters

p, the position that the element is to be inserted before;

element, to be inserted into the list.

Returns

A new position that corresponds to the element's position in the list.


insertAfter

IPosition<E>* insertAfter( IPosition<E>& p, E* element );

Parameters

p, the position that the element is to be inserted after;

element, to be inserted into the list.

Returns

A new position that corresponds to the element's position in the list.


replace

E* replace( IPosition<E>& p, E* element );

Parameters

p, the position that the element is to be swapped into;

element, to be inserted into the list.

Returns

The previous element in that position.


remove

E* remove( IPosition<E>* p );

Parameters

p, the position that the element is to be removed from.

Returns

The element stored at the passed position.


first

IPosition<E>* first() throw (NoSuchElementException*);

Returns

The first position of the list.

Throws

NoSuchElementException, if the list is empty.


last

IPosition<E>* last() throw (NoSuchElementException*);

Returns

The last position of the list.

Throws

NoSuchElementException, if the list is empty.


previous (prev)

IPosition<E>* previous( IPosition<E>& p ) throw (NoSuchElementException*);

Parameters

p, a position in the list.

Returns

The position before p.

Throws

NoSuchElementException, if there is no position before p.


next

IPosition<E>* next( IPosition<E>& p ) throw (NoSuchElementException*);

Parameters

p, a position in the list.

Returns

The position after p.

Throws

NoSuchElementException, if there is no position after p.


elements

IIterator<E>* elements();

Returns

An element iterator that iterates over the list's elements.


positions

IPIterator<E>* positions();

Returns

A position iterator that iterates over the list's positions.

isEmpty

bool isEmpty();

Returns

TRUE, if the list is empty; otherwise FALSE.


size

long size();

Returns

The number of elements stored in the list.