|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LoopADT<E>
A Loop ADT is a circular sequence of items. A Loop has a current item and the ability to move forward or backwards. A Loop can be modified by removing the current item or by adding an item before the current item.
Method Summary | |
---|---|
void |
add(E item)
Adds the given item immediately before the current item. |
E |
getCurrent()
Returns the current item. |
boolean |
isEmpty()
Determines if this Loop is empty, i.e., contains no items. |
java.util.Iterator<E> |
iterator()
Returns an iterator for this Loop. |
void |
next()
Advances current forward one item resulting in the item that is immediately after the current item becoming the current item. |
void |
previous()
Moves current backwards one item resulting in the item that is immediately before the current item becoming the current item. |
E |
removeCurrent()
Removes and returns the current item. |
int |
size()
Returns the number of items in this Loop. |
Method Detail |
---|
void add(E item)
item
- the item to addE getCurrent() throws EmptyLoopException
EmptyLoopException
- if the Loop is emptyE removeCurrent() throws EmptyLoopException
EmptyLoopException
- if the Loop is emptyvoid next()
void previous()
boolean isEmpty()
int size()
java.util.Iterator<E> iterator()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |