DataStructures::CircularLinkedList< CircularLinkedListType > Class Template Reference

(Circular) Linked List ADT (Doubly Linked Pointer to Node Style) - More...

#include <DS_LinkedList.h>

List of all members.

Public Member Functions

 CircularLinkedList (const CircularLinkedList &original_copy)
bool operator= (const CircularLinkedList &original_copy)
CircularLinkedListoperator++ ()
CircularLinkedListoperator++ (int)
CircularLinkedListoperator-- ()
CircularLinkedListoperator-- (int)
bool IsIn (const CircularLinkedListType &input)
bool Find (const CircularLinkedListType &input)
void Insert (const CircularLinkedListType &input)
CircularLinkedListType & Add (const CircularLinkedListType &input)
void Replace (const CircularLinkedListType &input)
void Del (void)
unsigned int Size (void)
CircularLinkedListType & Peek (void)
CircularLinkedListType Pop (void)
void Clear (void)
void Sort (void)
void Beginning (void)
void End (void)
void Concatenate (const CircularLinkedList &L)

Protected Member Functions

node * FindPointer (const CircularLinkedListType &input)

Protected Attributes

unsigned int list_size
node * root
node * position

Private Member Functions

CircularLinkedList Merge (CircularLinkedList L1, CircularLinkedList L2)
CircularLinkedList Mergesort (const CircularLinkedList &L)

Classes

struct  node


Detailed Description

template<class CircularLinkedListType>
class DataStructures::CircularLinkedList< CircularLinkedListType >

(Circular) Linked List ADT (Doubly Linked Pointer to Node Style) -

By Kevin Jenkins (http://www.rakkar.org) Initilize with the following command LinkedList<TYPE> OR CircularLinkedList<Type>

Has the following member functions

Note:
1. LinkedList and CircularLinkedList are exactly the same except LinkedList won't let you wrap around the root and lets you jump to two positions relative to the root/ 2. Postfix ++ and -- can be used but simply call the prefix versions.
EXAMPLE:
 LinkedList<int> A;  // Creates a Linked List of integers called A
 CircularLinkedList<int> B;  // Creates a Circular Linked List of 
          // integers called B

 A.Insert(20);  // Adds 20 to A.  A: 20 - current is 20
 A.Insert(5);  // Adds 5 to A.  A: 5 20 - current is 5
 A.Insert(1);  // Adds 1 to A.  A: 1 5 20 - current is 1

 A.IsIn1); // returns true
 A.IsIn200); // returns false
 A.Find(5);  // returns true and sets current to 5
 A.Peek();  // returns 5
 A.Find(1);  // returns true and sets current to 1

 (++A).Peek();  // Returns 5
 A.Peek(); // Returns 5

 A.Replace(10);  // Replaces 5 with 10.
 A.Peek();  // Returns 10

 A.Beginning();  // Current points to the beginning of the list at 1

 (++A).Peek();  // Returns 5
 A.Peek();  // Returns 10

 A.Del();  // Deletes 10.  Current points to the next element, which is 20
 A.Peek();  // Returns 20
 
 A.Beginning();  // Current points to the beginning of the list at 1

 (++A).Peek();  // Returns 5
 A.Peek();  // Returns 20

 A.Clear();  // Deletes all nodes in A

 A.Insert(5);  // A: 5 - current is 5
 A.Insert(6); // A: 6 5 - current is 6
 A.Insert(7); // A: 7 6 5 - current is 7

 A.Clear();
 B.Clear();

 B.Add(10);
 B.Add(20);
 B.Add(30);
 B.Add(5);
 B.Add(2);
 B.Add(25);
 // Sorts the numbers in the list and sets the current pointer to the 
 // first element
 B.sort();  

 // Postfix ++ just calls the prefix version and has no functional 
 // difference.
 B.Peek();  // Returns 2
 B++;
 B.Peek();  // Returns 5
 B++;
 B.Peek();  // Returns 10
 B++;
 B.Peek();  // Returns 20
 B++;
 B.Peek();  // Returns 25
 B++;
 B.Peek();  // Returns 30


The documentation for this class was generated from the following file:
Generated on Sat Oct 14 08:37:40 2006 for RakNet by  doxygen 1.4.6-NO