Example #1
0
        public void InsertAfter(T theElement)
        {
            CNode <T> newNode = new CNode <T>(theElement);

            newNode.Link = current.Link;
            current.Link = newNode;
        }
Example #2
0
        public void ShowList()
        {
            CNode <T> current = header.Link;

            while (!(current == null))
            {
                Console.WriteLine(current.Element);

                current = current.Link;
            }
        }
Example #3
0
        public void InsertBefore(T theElement)
        {
            CNode <T> newNode = new CNode <T>(theElement);

            if (previous.Link == null)
            {
                throw new InsertBeforeHeaderException("Can't insert here.");
            }
            else
            {
                newNode.Link  = previous.Link;
                previous.Link = newNode;
                current       = newNode;
            }
        }
Example #4
0
 public void Reset()
 {
     current  = theList.GetFirst();
     previous = null;
 }
Example #5
0
 public void NextLink()
 {
     previous = current;
     current  = current.Link;
 }
Example #6
0
 public ListIter(CLinkedList <T> list)
 {
     theList  = list;
     current  = theList.GetFirst();
     previous = null;
 }
Example #7
0
 public CLinkedList()
 {
     header = new CNode <T>(default(T));
 }
Example #8
0
 public CNode(T theElement)
 {
     Element = theElement;
     Link    = null;
 }
Example #9
0
 public CNode()
 {
     Element = default(T);
     Link    = null;
 }