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.


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(_FILE_AND_LINE_);  // 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(_FILE_AND_LINE_);
 B.Clear(_FILE_AND_LINE_);

 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 Wed Feb 1 13:33:46 2012 for RakNet by  doxygen 1.5.7.1