public void Delete(int index)
 {
     if (index >= this.count)
     {
         throw new Exception("Exception: there is no such element in linked list");
     }
     if (index == 0)
     {
         this.Deletion();
     }
     if (index == this.count - 1)
     {
         this.DeleteLast();
     }
     if (index != 0 && index != this.count - 1)
     {
         int pointer = 0;
         DoublyLinkedListNode temp = this.head;
         while (pointer != index)
         {
             temp = temp.getNext();
             pointer++;
         }
         temp.getPrev().setNext(temp.getNext());
         temp.getNext().setPrev(temp.getPrev());
         this.count--;
     }
 }
 public void InsertAfter(double value, int index)
 {
     if (index == 0)
     {
         this.Insertion(value);
     }
     if (index == this.count)
     {
         this.InsertLast(value);
     }
     if (index != 0 && index != this.count)
     {
         int pointer = 0;
         DoublyLinkedListNode temp    = this.head;
         DoublyLinkedListNode newNode = new DoublyLinkedListNode(value);
         while (pointer != index)
         {
             temp = temp.getNext();
             pointer++;
         }
         temp.getPrev().setNext(newNode);
         newNode.setPrev(temp.getPrev());
         temp.setPrev(newNode);
         newNode.setNext(temp);
         this.count++;
     }
 }
        public int Search(double value)
        {
            DoublyLinkedListNode temp = this.head;
            int pointer = 0;

            while (temp.getValue() != value)
            {
                temp = temp.getNext();
                pointer++;
            }
            return(pointer);
        }
        public void Insertion(double value)
        {
            DoublyLinkedListNode newNode = new DoublyLinkedListNode(value);

            if (this.head == null)
            {
                this.head = this.tail = newNode;
            }
            if (this.head != null)
            {
                newNode.setNext(this.head);
                this.head = newNode;
                newNode.getNext().setPrev(this.head);
            }
            this.count++;
        }
        public double Return(int index)
        {
            if (index >= this.count)
            {
                throw new Exception("Exception: there is no such element in linked list");
            }
            DoublyLinkedListNode temp = this.head;
            int pointer = 0;

            while (pointer != index)
            {
                temp = temp.getNext();
                pointer++;
            }
            return(temp.getValue());
        }