|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
An interface for a simple list ADT. Note that this ADT does not specify how the list is ordered. No method is required for finding an element on the list. This is simply a "barebones" list ADT which can be used to introduce the concepts of lists and ADTs.
| Method Summary | |
void |
advance()
Advances the current position in the list by one element. |
void |
append(java.lang.Object element)
Appends a new element to the end of the list. |
void |
clear()
Empties all elements from the list. |
java.lang.Object |
getCurrent()
Retrieves the Object at the current position in the
list. |
void |
insert(java.lang.Object element)
Inserts a new element in front of the current position. |
boolean |
isEmpty()
Determines whether or not the list is empty. |
boolean |
isInList()
Determines whether or not the current position actually refers to a valid position in the list. |
int |
length()
Determines and returns the number of elements in the list. |
void |
print()
Prints the elements in the list to standard output. |
java.lang.Object |
remove()
Removes the element at the current position in the list. |
void |
setCurrent(java.lang.Object element)
Replaces the element at the current position in the list with the specified parameter. |
void |
setFirst()
Sets the current position in the list to point to the first element. |
| Method Detail |
public void clear()
public void insert(java.lang.Object element)
element - Object to insert in from of current position.public void append(java.lang.Object element)
element - Object to be appended to the end of the list.
public java.lang.Object remove()
throws BoundaryViolationException
Object that was removed from the current
position.
public java.lang.Object getCurrent()
throws BoundaryViolationException
Object at the current position in the
list.Object at the current position in the list.
public void setCurrent(java.lang.Object element)
throws BoundaryViolationException
element - Object to copy to the current position.public void setFirst()
public void advance()
throws BoundaryViolationException
public int length()
public boolean isEmpty()
true is the list contains at least one element,
false otherwise.public boolean isInList()
true if the
current position is the first position, the last position, or any position
in between, false otherwise.public void print()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||