Esempio n. 1
0
        public void removeItem(uint index)
        {
            Current = getItem(index);

            //only execute it if the item is actuall valid;
            if (Current != null)
            {
                //If the item is at the end of the list
                if (Current.getNextNode() == null)
                {
                    //set the previous node as tail.
                    Tail = Current.getPreviousNode();
                    Tail.setNewNextNode(null);
                }
                else
                {
                    //Set the next nodes previous pointer to the previous item.
                    Current.getNextNode().setNewPreviousNode(Current.getPreviousNode());
                }

                //If the item is at the start of the list
                if (Current.getPreviousNode() == null)
                {
                    Head = Current.getNextNode();
                    Head.setNewPreviousNode(null);
                }
                else
                {
                    //Set the previous items pointer to the next item.
                    Current.getPreviousNode().setNewNextNode(Current.getNextNode());
                }
            }
        }