|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectlinkedLists.DList
public class DList
Doubly liked list with nodes of type DNode storing strings
Constructor Summary | |
---|---|
DList()
Constructor that creates an empty list |
Method Summary | |
---|---|
void |
addAfter(DNode v,
DNode z)
Inserts the given node z after the given node v. |
void |
addBefore(DNode v,
DNode z)
Inserts the given node z before the given node v. |
void |
addFirst(DNode v)
Inserts the given node at the head of the list |
void |
addLast(DNode v)
Inserts the given node at the tail of the list |
DNode |
getFirst()
Returns the first node of the list |
DNode |
getLast()
Returns the last node of the list |
DNode |
getNext(DNode v)
Returns the node after the given node v. |
DNode |
getPrev(DNode v)
Returns the node before the given node v. |
boolean |
hasNext(DNode v)
Returns whether a given node has a next node |
boolean |
hasPrev(DNode v)
Returns whether a given node has a previous node |
boolean |
isEmpty()
Returns whether the list is empty |
void |
remove(DNode v)
Removes the given node v from the list. |
int |
size()
Returns the number of elements in the list |
static void |
sort(DList L)
Insertion-sort for a doubly linked list of class DList |
java.lang.String |
toString()
Returns a string representation of the list |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DList()
Method Detail |
---|
public int size()
public boolean isEmpty()
public DNode getFirst() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public DNode getLast() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public DNode getPrev(DNode v) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public DNode getNext(DNode v) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void addBefore(DNode v, DNode z) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void addAfter(DNode v, DNode z)
public void addFirst(DNode v)
public void addLast(DNode v)
public void remove(DNode v)
public boolean hasPrev(DNode v)
public boolean hasNext(DNode v)
public java.lang.String toString()
toString
in class java.lang.Object
public static void sort(DList L)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |