| java.lang.Object org.apache.batik.util.DoublyLinkedList
DoublyLinkedList | public class DoublyLinkedList (Code) | | A simple Doubly Linked list class, designed to avoid
O(n) behaviour on insert and delete.
|
Inner Class :public static class Node | |
Method Summary | |
public void | add(int index, Node nde) | public void | add(Node nde) Adds nde to the head of the list.
In perl this is called an 'unpop'. | public synchronized void | empty() Removes all elements from the list. | public Node | getHead() | public synchronized int | getSize() Returns the number of elements currently in the list. | public Node | getTail() | public Node | pop() Removes 'head' from list and returns it. | public void | push(Node nde) | public void | remove(Node nde) Removes nde from the list it is part of (should be this
one, otherwise results are undefined). | public void | touch(Node nde) Moves nde to the head of the list (equivilent to
remove(nde); add(nde); but faster. | public void | unpop(Node nde) | public Node | unpush() Removes 'tail' from list and returns it. |
DoublyLinkedList | public DoublyLinkedList()(Code) | | |
add | public void add(int index, Node nde)(Code) | | |
add | public void add(Node nde)(Code) | | Adds nde to the head of the list.
In perl this is called an 'unpop'. nde should
not currently be part of any list.
Parameters: nde - the node to add to the list. |
empty | public synchronized void empty()(Code) | | Removes all elements from the list.
|
getHead | public Node getHead()(Code) | | Get the current head element
The current 'first' element in list. |
getSize | public synchronized int getSize()(Code) | | Returns the number of elements currently in the list.
|
getTail | public Node getTail()(Code) | | Get the current tail element
The current 'last' element in list. |
pop | public Node pop()(Code) | | Removes 'head' from list and returns it. Returns null if list is empty.
|
push | public void push(Node nde)(Code) | | Adds nde to tail of list
|
remove | public void remove(Node nde)(Code) | | Removes nde from the list it is part of (should be this
one, otherwise results are undefined). If nde is the
current head element, then the next element becomes head,
if there are no more elements the list becomes empty.
Parameters: nde - node to remove. |
touch | public void touch(Node nde)(Code) | | Moves nde to the head of the list (equivilent to
remove(nde); add(nde); but faster.
|
unpop | public void unpop(Node nde)(Code) | | Adds nde to head of list
|
unpush | public Node unpush()(Code) | | Removes 'tail' from list and returns it. Returns null if list is empty.
|
|
|