Ejemplo n.º 1
0
 public DoubleLinkedList()
 {
     head = new LinkedHead(this);
     tail = new LinkedTail(this);
     currentItteration = tail;
     this.listSize     = 0;
 }
Ejemplo n.º 2
0
        public void getRemove()
        {
            LinkedNodeElement currentNode = this.currentItteration;

            this.currentItteration = this.currentItteration.getNextNode();

            currentNode.removeSelf();
        }
Ejemplo n.º 3
0
        public T get()
        {
            LinkedNodeElement currentNode = this.currentItteration;

            this.currentItteration = this.currentItteration.getNextNode();

            return(currentNode.getElement());
        }
Ejemplo n.º 4
0
            public LinkedNodeElement addElement(T element, DoubleLinkedList <T> list)
            {
                LinkedNodeElement newNode = new LinkedNodeElement(element, list);

                newNode.setNextNode(this.nextNode);     // Head     Add --> Tail^      order of these is important

                newNode.setPreviousNode(this);          // Head <-- Add     Tail

                this.nextNode.setPreviousNode(newNode); // Head     Add <-- Tail^

                this.nextNode = newNode;                // Head --> Add     Tail**   change this.nextNode from tail to add LAST

                return(newNode);
            }
Ejemplo n.º 5
0
        public ListNodeTicket <T> add(T element)
        {
            try
            {
                LinkedNodeElement newElement = this.head.addElement(element, this);
                currentItteration = newElement;
                listSize++;
                return(new ListNodeTicket <T>(newElement));
            }

            catch (InvalidCastException e)
            {
                //System.err.println("Attempted to add entity without Composite DoubleLinkedList.");
                return(null);
            }
        }
Ejemplo n.º 6
0
 public void setNextNode(LinkedNodeElement nextNode)
 {
     this.nextNode = nextNode;
 }