|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A positional list may be specified as an ordered pair this = (R, L), where L and R are n-tuples, L = () or (l0, l1, ..., l#(L)-1 and R = () or (r0, r1, ..., r#(R)-1 L is the sublist to the left of the current position and R is the sublist to the right of the current positon
| Method Summary | |
boolean |
atFront()
Reports whether or not current viewing position is at front of list |
boolean |
atRear()
Reports whether or not current viewing position is at rear of list |
PositionalList |
factory()
Returns an empty PositionalList implementation of the type used in the method's application. |
void |
insert(java.lang.Object obj)
Inserts obj at the current position in the list. |
boolean |
isEmpty()
Reports whether or not the list is empty (i.e., contains no items). |
void |
next()
Moves current viewing position one object towards the rear, if possible. |
void |
previous()
Moves current viewing position one place towards the front, if possible. |
java.lang.Object |
remove()
Removes the current item from the list |
void |
replace(java.lang.Object obj)
Replaces item at current position in the list with obj. |
void |
toFront()
Moves current viewing position to front of list Pre: none Post: L'==(), R'==(L, R) |
void |
toRear()
Moves current viewing position to rear of list Pre: none Post: L'==(L, R), R'==() |
java.lang.String |
toString()
Return a string representation of a positonal list. |
java.lang.Object |
view()
Returns a reference to the current item in list. |
| Method Detail |
public java.lang.Object view()
Object, a reference to current item in list
Pre: !atRear(), equivalently R!=()
Post: this' = this
Returns: r0public void replace(java.lang.Object obj)
obj - The object replacing the current object in the list.public void insert(java.lang.Object obj)
obj at the current position in the list.
Pre: none
Post: R' = (obj, R)
obj - New item inserted at the current position.public java.lang.Object remove()
Object, the item that was removed
Pre: !atRear(), equivalently R!=()
Post: R = (r0, R')
Returns: r0public boolean isEmpty()
boolean true iff the list is empty.
Pre: none
Post: P'==P
Returns: L==() && R==()public boolean atFront()
boolean true iff current position is front
Pre: none
Post: P'==P
Returns: L==()public boolean atRear()
boolean true iff current position is rear
Pre: none
Post: P'==P
Returns: R==()public void toFront()
public void toRear()
public void previous()
public void next()
public java.lang.String toString()
public PositionalList factory()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||