Open
Graph Drawing
Framework

 v.2010.10
 

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

ogdf::ListPure< E > Class Template Reference

The parameterized class ListPure<E> represents doubly linked lists with content type E. More...

#include <ogdf/basic/List.h>

Inheritance diagram for ogdf::ListPure< E >:
ogdf::List< E >

List of all members.

Public Types

typedef E value_type
typedef ListElement< E > element_type
typedef ListConstIterator< E > const_iterator
typedef ListIterator< E > iterator

Public Member Functions

 ListPure ()
 Constructs an empty doubly linked list.
 ListPure (const ListPure< E > &L)
 Constructs a doubly linked list that is a copy of L.
 ~ListPure ()
bool empty () const
 Returns true iff the list is empty.
int size () const
 Returns the length of the list.
const ListConstIterator< E > begin () const
 Returns an iterator to the first element of the list.
ListIterator< E > begin ()
 Returns an iterator to the first element of the list.
ListConstIterator< E > end () const
 Returns an iterator to one-past-last element of the list.
ListIterator< E > end ()
 Returns an iterator to one-past-last element of the list.
const ListConstIterator< E > rbegin () const
 Returns an iterator to the last element of the list.
ListIterator< E > rbegin ()
 Returns an iterator to the last element of the list.
ListConstIterator< E > rend () const
 Returns an iterator to one-before-first element of the list.
ListIterator< E > rend ()
 Returns an iterator to one-before-first element of the list.
const E & front () const
 Returns a reference to the first element.
E & front ()
 Returns a reference to the first element.
const E & back () const
 Returns a reference to the last element.
E & back ()
 Returns a reference to the last element.
ListConstIterator< E > cyclicSucc (ListConstIterator< E > it) const
 Returns an iterator to the cyclic successor of it.
ListIterator< E > cyclicSucc (ListIterator< E > it)
 Returns an iterator to the cyclic successor of it.
ListConstIterator< E > cyclicPred (ListConstIterator< E > it) const
 Returns an iterator to the cyclic predecessor of it.
ListIterator< E > cyclicPred (ListIterator< E > it)
 Returns an iterator to the cyclic predecessor of it.
ListConstIterator< E > get (int pos) const
 Returns an iterator pointing to the element at position pos.
ListIterator< E > get (int pos)
 Returns an iterator pointing to the element at position pos.
int pos (ListConstIterator< E > it) const
 Returns the position (starting with 0) of it in the list.
ListPure< E > & operator= (const ListPure< E > &L)
 Assignment operator.
bool operator== (const ListPure< E > &L) const
 Equality operator.
bool operator!= (const ListPure< E > &L) const
 Inequality operator.
ListIterator< E > pushFront (const E &x)
 Adds element x at the begin of the list.
ListIterator< E > pushBack (const E &x)
 Adds element x at the end of the list.
ListIterator< E > insert (const E &x, ListIterator< E > it, Direction dir=after)
 Inserts element x before or after it.
ListIterator< E > insertBefore (const E &x, ListIterator< E > it)
 Inserts element x before it.
ListIterator< E > insertAfter (const E &x, ListIterator< E > it)
 Inserts element x after it.
void popFront ()
 Removes the first element from the list.
popFrontRet ()
 Removes the first element from the list and returns it.
void popBack ()
 Removes the last element from the list.
popBackRet ()
 Removes the last element from the list and returns it.
void del (ListIterator< E > it)
 Removes it from the list.
void exchange (ListIterator< E > it1, ListIterator< E > it2)
 Exchanges the positions of it1 and it2 in the list.
void moveToFront (ListIterator< E > it)
 Moves it to the begin of the list.
void moveToBack (ListIterator< E > it)
 Moves it to the end of the list.
void moveToSucc (ListIterator< E > it, ListIterator< E > itBefore)
 Moves it after itBefore.
void moveToPrec (ListIterator< E > it, ListIterator< E > itAfter)
 Moves it before itAfter.
void moveToFront (ListIterator< E > it, ListPure< E > &L2)
 Moves it to the begin of L2.
void moveToBack (ListIterator< E > it, ListPure< E > &L2)
 Moves it to the end of L2.
void moveToSucc (ListIterator< E > it, ListPure< E > &L2, ListIterator< E > itBefore)
 Moves it to list L2 and inserts it after itBefore.
void moveToPrec (ListIterator< E > it, ListPure< E > &L2, ListIterator< E > itAfter)
 Moves it to list L2 and inserts it before itAfter.
void conc (ListPure< E > &L2)
 Appends L2 to this list and makes L2 empty.
void concFront (ListPure< E > &L2)
 Prepends L2 to this list and makes L2 empty.
void exchange (ListPure< E > &L2)
 Exchanges too complete lists in O(1).
void split (ListIterator< E > it, ListPure< E > &L1, ListPure< E > &L2, Direction dir=before)
 Splits the list at element it into lists L1 and L2.
void splitAfter (ListIterator< E > it, ListPure< E > &L2)
 Splits the list after it.
void splitBefore (ListIterator< E > it, ListPure< E > &L2)
 Splits the list before it.
void reverse ()
 Reverses the order of the list elements.
void clear ()
 Removes all elements from the list.
void quicksort ()
 Sorts the list using Quicksort.
template<class COMPARER >
void quicksort (const COMPARER &comp)
 Sorts the list using Quicksort and comparer comp.
void bucketSort (int l, int h, BucketFunc< E > &f)
 Sorts the list using bucket sort.
void permute ()
 Randomly permutes the elements in the list.
int search (const E &e) const
 Scans the list for the specified element and returns its position in the list, or -1 if not found.
template<class COMPARER >
int search (const E &e, const COMPARER &comp) const
 Scans the list for the specified element (using the user-defined comparer) and returns its position in the list, or -1 if not found.
void * operator new (size_t nBytes)
void * operator new (size_t, void *p)
void operator delete (void *p, size_t nBytes)

Protected Member Functions

void copy (const ListPure< E > &L)
void permute (const int n)

Protected Attributes

ListElement< E > * m_head
 Pointer to first element.
ListElement< E > * m_tail
 Pointer to last element.

Detailed Description

template<class E>
class ogdf::ListPure< E >

The parameterized class ListPure<E> represents doubly linked lists with content type E.

Elements of the list are instances of type ListElement<E>. Use ListConstIterator<E> or ListIterator<E> in order to iterate over the list.

In contrast to List<E>, instances of ListPure<E> do not store the length of the list.

Definition at line 281 of file List.h.


Member Typedef Documentation


Constructor & Destructor Documentation

template<class E>
ogdf::ListPure< E >::ListPure (  )  [inline]

Constructs an empty doubly linked list.

Definition at line 289 of file List.h.

template<class E>
ogdf::ListPure< E >::ListPure ( const ListPure< E > &  L  )  [inline]

Constructs a doubly linked list that is a copy of L.

Definition at line 292 of file List.h.

template<class E>
ogdf::ListPure< E >::~ListPure (  )  [inline]

Definition at line 297 of file List.h.


Member Function Documentation

template<class E>
void ogdf::ListPure< E >::bucketSort ( int  l,
int  h,
BucketFunc< E > &  f 
)

Sorts the list using bucket sort.

Parameters:
l is the lowest bucket that will occur.
h is the highest bucket that will occur.
f returns the bucket for each element.
Precondition:
The bucket function f will only return bucket values between l and h for this list.

Reimplemented in ogdf::List< E >, ogdf::List< ClusterCrossing >, ogdf::List< NodeSplit >, ogdf::List< double >, ogdf::List< node >, ogdf::List< nodePair >, ogdf::List< ChangedCrossing >, ogdf::List< label >, ogdf::List< int >, ogdf::List< PQNode< edge, indInfo *, bool > * >, ogdf::List< OgmlTag * >, ogdf::List< OgmlAttribute * >, ogdf::List< ClusterElement * >, ogdf::List< EnergyFunction * >, ogdf::List< IPoint >, ogdf::List< cluster >, ogdf::List< PQNode< T, whaInfo *, Y > * >, ogdf::List< List< LabelInfo > >, ogdf::List< PosInfo >, ogdf::List< ABA_CONSTRAINT * >, ogdf::List< Crossing >, ogdf::List< LabelInfo >, ogdf::List< PQNode< T, X, Y > * >, ogdf::List< DPoint >, ogdf::List< SegmentInfo >, ogdf::List< OgmlAttributeValue * >, ogdf::List< List< node > >, ogdf::List< Adjacency >, ogdf::List< GenericPoint< coordType > >, ogdf::List< bool >, ogdf::List< ParticleInfo >, ogdf::List< PQNode< edge, X, bool > * >, ogdf::List< PosInfo * >, ogdf::List< face >, ogdf::List< List< adjEntry > >, ogdf::List< withKey >, ogdf::List< edge >, ogdf::List< PQNode< edge, whaInfo *, bool > * >, ogdf::List< EdgeLeg * >, ogdf::List< QuadTreeNodeNM * >, ogdf::List< Group >, and ogdf::List< adjEntry >.

Definition at line 1460 of file List.h.

template<class E>
void ogdf::ListPure< E >::conc ( ListPure< E > &  L2  )  [inline]

Appends L2 to this list and makes L2 empty.

Definition at line 837 of file List.h.

template<class E>
void ogdf::ListPure< E >::concFront ( ListPure< E > &  L2  )  [inline]

Prepends L2 to this list and makes L2 empty.

Definition at line 851 of file List.h.

template<class E>
void ogdf::ListPure< E >::copy ( const ListPure< E > &  L  )  [inline, protected]

Definition at line 1023 of file List.h.

template<class E>
void ogdf::ListPure< E >::exchange ( ListPure< E > &  L2  )  [inline]

Exchanges too complete lists in O(1).

The list's content is moved to L2 and vice versa.

Definition at line 868 of file List.h.

template<class E>
ListIterator<E> ogdf::ListPure< E >::insert ( const E &  x,
ListIterator< E >  it,
Direction  dir = after 
) [inline]

Inserts element x before or after it.

Parameters:
x is the element to be inserted.
it is a list iterator in this list.
dir determines if x is inserted before or after it. Possible values are ogdf::before and ogdf::after.
Precondition:
it points to an element in this list.

Reimplemented in ogdf::List< E >, ogdf::List< ClusterCrossing >, ogdf::List< NodeSplit >, ogdf::List< double >, ogdf::List< node >, ogdf::List< nodePair >, ogdf::List< ChangedCrossing >, ogdf::List< label >, ogdf::List< int >, ogdf::List< PQNode< edge, indInfo *, bool > * >, ogdf::List< OgmlTag * >, ogdf::List< OgmlAttribute * >, ogdf::List< ClusterElement * >, ogdf::List< EnergyFunction * >, ogdf::List< IPoint >, ogdf::List< cluster >, ogdf::List< PQNode< T, whaInfo *, Y > * >, ogdf::List< List< LabelInfo > >, ogdf::List< PosInfo >, ogdf::List< ABA_CONSTRAINT * >, ogdf::List< Crossing >, ogdf::List< LabelInfo >, ogdf::List< PQNode< T, X, Y > * >, ogdf::List< DPoint >, ogdf::List< SegmentInfo >, ogdf::List< OgmlAttributeValue * >, ogdf::List< List< node > >, ogdf::List< Adjacency >, ogdf::List< GenericPoint< coordType > >, ogdf::List< bool >, ogdf::List< ParticleInfo >, ogdf::List< PQNode< edge, X, bool > * >, ogdf::List< PosInfo * >, ogdf::List< face >, ogdf::List< List< adjEntry > >, ogdf::List< withKey >, ogdf::List< edge >, ogdf::List< PQNode< edge, whaInfo *, bool > * >, ogdf::List< EdgeLeg * >, ogdf::List< QuadTreeNodeNM * >, ogdf::List< Group >, and ogdf::List< adjEntry >.

Definition at line 523 of file List.h.

template<class E>
void ogdf::ListPure< E >::moveToBack ( ListIterator< E >  it,
ListPure< E > &  L2 
) [inline]

Moves it to the end of L2.

Precondition:
it points to an element in this list.

Definition at line 775 of file List.h.

template<class E>
void ogdf::ListPure< E >::moveToFront ( ListIterator< E >  it,
ListPure< E > &  L2 
) [inline]

Moves it to the begin of L2.

Precondition:
it points to an element in this list.

Definition at line 754 of file List.h.

template<class E>
void ogdf::ListPure< E >::moveToPrec ( ListIterator< E >  it,
ListPure< E > &  L2,
ListIterator< E >  itAfter 
) [inline]

Moves it to list L2 and inserts it before itAfter.

Precondition:
it points to an element in this list, and itAfter points to an element in L2.

Definition at line 819 of file List.h.

template<class E>
void ogdf::ListPure< E >::moveToSucc ( ListIterator< E >  it,
ListPure< E > &  L2,
ListIterator< E >  itBefore 
) [inline]

Moves it to list L2 and inserts it after itBefore.

Precondition:
it points to an element in this list, and itBefore points to an element in L2.

Definition at line 797 of file List.h.

template<class E>
bool ogdf::ListPure< E >::operator!= ( const ListPure< E > &  L  )  const [inline]

Inequality operator.

Definition at line 491 of file List.h.

template<class E>
ListPure<E>& ogdf::ListPure< E >::operator= ( const ListPure< E > &  L  )  [inline]

Assignment operator.

Definition at line 473 of file List.h.

template<class E>
bool ogdf::ListPure< E >::operator== ( const ListPure< E > &  L  )  const [inline]

Equality operator.

Definition at line 479 of file List.h.

template<class E >
void ogdf::ListPure< E >::permute ( const int  n  )  [protected]

Definition at line 1494 of file List.h.

template<class E>
template<class COMPARER >
int ogdf::ListPure< E >::search ( const E &  e,
const COMPARER &  comp 
) const [inline]
template<class E>
void ogdf::ListPure< E >::split ( ListIterator< E >  it,
ListPure< E > &  L1,
ListPure< E > &  L2,
Direction  dir = before 
) [inline]

Splits the list at element it into lists L1 and L2.

If it is not a null pointer and L = x1,...,x{k-1}, it,x_{k+1},xn, then L1 = x1,...,x{k-1} and L2 = it,x{k+1},...,xn if dir = before. If it is a null pointer, then L1 is made empty and L2 = L. Finally L is made empty if it is not identical to L1 or L2.

Precondition:
it points to an element in this list.

Definition at line 888 of file List.h.

template<class E>
void ogdf::ListPure< E >::splitAfter ( ListIterator< E >  it,
ListPure< E > &  L2 
) [inline]

Splits the list after it.

Definition at line 917 of file List.h.

template<class E>
void ogdf::ListPure< E >::splitBefore ( ListIterator< E >  it,
ListPure< E > &  L2 
) [inline]

Splits the list before it.

Definition at line 931 of file List.h.


Member Data Documentation

template<class E>
ListElement<E>* ogdf::ListPure< E >::m_head [protected]

Pointer to first element.

Definition at line 284 of file List.h.

template<class E>
ListElement<E>* ogdf::ListPure< E >::m_tail [protected]

Pointer to last element.

Definition at line 285 of file List.h.


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