|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.LinkedList | +--com.mhhe.clrs2e.SentinelDLL
A circular, doubly linked list with a sentinel from pages 206-207 of Introduction to Algorithms, Second edition.
Nested Class Summary | |
class |
SentinelDLL.SentinelDLLIterator
Inner class for an iterator. |
Nested classes inherited from class com.mhhe.clrs2e.LinkedList |
LinkedList.Node |
Field Summary | |
protected LinkedList.Node |
nil
The sentinel. |
Constructor Summary | |
SentinelDLL()
Makes an empty list, consisting of only the sentinel. |
Method Summary | |
void |
concatenate(com.mhhe.clrs2e.LinkedList l)
Concatenates another linked list onto the end of this list, destroying the other linked list. |
void |
delete(java.lang.Object handle)
Removes an element. |
java.lang.Object |
insert(java.lang.Object o)
Inserts an element at the head of the list. |
java.lang.Object |
insertAfter(java.lang.Object o,
java.lang.Object after)
Inserts an element after a given element. |
java.lang.Object |
insertAtTail(java.lang.Object o)
Inserts an element at the tail of the list. |
boolean |
isEmpty()
Returns true if this list is empty,
false otherwise. |
java.util.Iterator |
iterator()
Creates and returns an Iterator object for this
list. |
Methods inherited from class com.mhhe.clrs2e.LinkedList |
dereference, toArray, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected final LinkedList.Node nil
Constructor Detail |
public SentinelDLL()
Method Detail |
public java.lang.Object insert(java.lang.Object o)
insert
in class LinkedList
o
- The element to be inserted.
public java.lang.Object insertAfter(java.lang.Object o, java.lang.Object after)
insertAfter
in class LinkedList
o
- The element to be inserted.after
- The element after which the new element is to be
inserted. If null
, the new element is inserted at
the head of the list.
public java.lang.Object insertAtTail(java.lang.Object o)
o
- The element to be inserted.
public void delete(java.lang.Object handle)
delete
in class LinkedList
handle
- Handle to the element to remove.
DeleteSentinelException
- if handle
references the sentinel nil
.public boolean isEmpty()
true
if this list is empty,
false
otherwise.
isEmpty
in class LinkedList
public java.util.Iterator iterator()
Iterator
object for this
list.
iterator
in class LinkedList
public void concatenate(com.mhhe.clrs2e.LinkedList l)
LinkedList
concatenate
in class LinkedList
l
- The linked list to be concatenated onto the end of
this list.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |