|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gshute.ioutil.CircularList
A CircularList is a list with its far end linked to its near end. Data items can be added or retrieved from either end. Data items can be removed from the front. The first data item can be rotated to the far end. One CircularList can be appended to another CircularList. A CircularList can be used to implement various data structures.
Inner Class Summary | |
class |
CircularList.Node
A Node is a building block for circular linked lists. |
Field Summary | |
protected CircularList.Node |
tail
tail is a reference to the last Node in this CircularList. |
Constructor Summary | |
CircularList()
CircularList() returns an empty CircularList. |
|
CircularList(java.lang.Object dat)
CircularList(dat) returns a CircularList with a single data item dat. |
Method Summary | |
void |
addFirst(java.lang.Object dat)
cl.addFirst(dat) adds dat as the first data item in cl. |
void |
addLast(java.lang.Object dat)
cl.addLast(dat) adds dat as the last data item in cl. |
void |
append(CircularList cl1)
cl.append(cl1) appends cl1 onto the end of cl and makes cl1 empty. |
java.lang.Object |
getFirst()
cl.getFirst() returns the first data item in cl. |
java.lang.Object |
getLast()
cl.getLast() returns the last data item in cl. |
boolean |
isEmpty()
cl.isEmpty() returns true if cl is empty. |
void |
removeFirst()
cl.removeFirst() removes the first data item from cl. |
void |
rotate()
cl.rotate() rotates the first data item in cl to the end of cl. |
java.lang.String |
toString()
cl.toString() returns a string describing the data in cl. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected CircularList.Node tail
Constructor Detail |
public CircularList()
public CircularList(java.lang.Object dat)
Method Detail |
public boolean isEmpty()
public java.lang.Object getFirst()
Preconditions:
cl.isEmpty() is false.
public java.lang.Object getLast()
Preconditions:
cl.isEmpty() is false.
public void addFirst(java.lang.Object dat)
public void addLast(java.lang.Object dat)
public void removeFirst()
Preconditions:
cl.isEmpty() is false.
public void rotate()
public void append(CircularList cl1)
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |