예제 #1
0
        /// <summary>
        /// UC-4 Create Insert method
        /// </summary>
        /// <param name="myNode"></param>
        /// <param name="newNode"></param>
        public void Insert(MyNode myNode, MyNode newNode)
        {
            MyNode tempNode = myNode.getNext();

            myNode.setNext(newNode);
            newNode.setNext(tempNode);
        }
예제 #2
0
        /// <summary>
        /// UC-9 Delete New Inserted Element
        /// </summary>
        /// <param name="deleteNode"></param>
        public void Delete(MyNode deleteNode)
        {
            MyNode tempNode1 = head;

            while (tempNode1.getNext() != deleteNode)
            {
                tempNode1 = tempNode1.getNext();
            }
            MyNode tempNode2 = tempNode1;

            tempNode1 = tempNode1.getNext();
            tempNode1 = tempNode1.getNext();
            tempNode2.setNext(tempNode1);
        }
예제 #3
0
 /// <summary>
 /// UC-3 Create Append Method
 /// </summary>
 /// <param name="newNode"></param>
 public void Append(MyNode newNode)
 {
     if (this.head == null)
     {
         this.head = newNode;
     }
     if (this.tail == null)
     {
         this.tail = newNode;
     }
     else
     {
         MyNode tempNode = this.tail;
         this.tail = newNode;
         tempNode.setNext(newNode);
     }
 }