Class LinkedList
java.lang.Object
|
+----LinkedList
- public class LinkedList
- extends Object
Doubly Linked List. Allows you to go forwards
and backwards.
- Version:
- Version 2
- Author:
- Millie Ives
-
LinkedList()
-
-
append(Object)
- Appends link object to the end of the link list.
-
atLastLink()
- Resets true if current pointer is pointing to the last link.
-
currentElement()
- Return the current linked list element.
-
getNextElement()
- Returns the next element in the list.
-
getPreviousElement()
- Returns the previous element in the linked list.
-
hasCurrElement()
-
-
hasMoreElements()
- Returns true iff the current pointer is not at the end of the list.
-
hasNextElement()
- Returns true iff current.next pointer is not null.
-
hasPreviousElement()
- Returns true iff current.previous pointer is not null.
-
insert(Object)
- Inserts object into the linked list after the current item.
-
remove()
- Removes current element from the linked list
Returns the removed object.
-
reset()
- Resets the linked list to the head (first element).
-
setToTail()
- Resets the linked list to the tail (last element).
LinkedList
public LinkedList()
reset
public void reset()
- Resets the linked list to the head (first element).
- Returns:
- None
hasMoreElements
public boolean hasMoreElements()
- Returns true iff the current pointer is not at the end of the list.
- Returns:
- boolean
hasNextElement
public boolean hasNextElement()
- Returns true iff current.next pointer is not null.
- Returns:
- boolean
hasPreviousElement
public boolean hasPreviousElement()
- Returns true iff current.previous pointer is not null.
- Returns:
- boolean
atLastLink
public boolean atLastLink()
- Resets true if current pointer is pointing to the last link.
Had to add this so the player wouldn't keep playing the
last packet.
- Returns:
- boolean
setToTail
public void setToTail()
- Resets the linked list to the tail (last element).
- Returns:
- None
getNextElement
public Object getNextElement()
- Returns the next element in the list.
- Returns:
- link Object
currentElement
public Object currentElement()
- Return the current linked list element.
- Returns:
- link Object
hasCurrElement
public boolean hasCurrElement()
getPreviousElement
public Object getPreviousElement()
- Returns the previous element in the linked list.
- Returns:
- link Object
insert
public void insert(Object n)
- Inserts object into the linked list after the current item.
- Parameters:
- link - Object
- Returns:
- None
append
public void append(Object n)
- Appends link object to the end of the link list.
- Parameters:
- link - Object
- Returns:
- None
remove
public Object remove()
- Removes current element from the linked list
Returns the removed object. Move the cursor to the
next element if not null or, to the element before it
if at the end of the list(after removal of the node).
- Returns:
- link Object
- Throws: NoSuch
- ElementException if already at the end of the list