/// <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); }
/// <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); }
/// <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); } }