Class WaitingActionList
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.AbstractSequentialList
|
+--java.util.LinkedList
|
+--WaitingActionList
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable
- public class WaitingActionList
- extends java.util.LinkedList
Linked list implementation of the List interface containing String actions and accompanying Object elements. Implements all
optional list operations, but only permits a String
with Object
insertion. In addition to implementing the List interface,
the WaitingActionList class extends the uniformly named methods within LinkedList to
get, remove and insert an element at the
beginning and end of the list. These operations allow this list to be
used as a stack, queue, or double-ended queue (deque).
The primary purpose of the class is for the development of nextAction,
which calls the waitingAction
method for the headelement
passed and the
next action and accompanying Object element.
- See Also:
- Serialized Form
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary |
WaitingActionList()
Constructs an empty list. |
WaitingActionList(java.util.Collection actions,
java.util.Collection elements)
Constructs a list containing the elements of the specified
collection, in the order they are returned by the collection's
iterator. |
Method Summary |
void |
add(int index,
java.lang.String action,
java.lang.Object element)
Inserts the specified String and Object at the specified position in this list. |
boolean |
add(java.lang.String action,
java.lang.Object element)
Appends the given String and Object at the end of this list. |
void |
addFirst(java.lang.String action,
java.lang.Object element)
Inserts the given String and Object at the beggining of this list. |
void |
addLast(java.lang.String action,
java.lang.Object element)
Appends the given String and Object at the end of this list. |
java.lang.String |
getFirstAction()
Gets the given String of the action at the beggining of this list. |
void |
nextAction(TreeHead headTree)
Calls the next action of the ObjectHead headelement, using the waitingAction command. |
Methods inherited from class java.util.LinkedList |
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, remove, remove, removeFirst, removeLast, set, size, toArray, toArray |
Methods inherited from class java.util.AbstractSequentialList |
iterator |
Methods inherited from class java.util.AbstractList |
equals, hashCode, listIterator, removeRange, subList |
Methods inherited from class java.util.AbstractCollection |
containsAll, isEmpty, removeAll, retainAll, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList |
WaitingActionList
public WaitingActionList()
- Constructs an empty list.
WaitingActionList
public WaitingActionList(java.util.Collection actions,
java.util.Collection elements)
- Constructs a list containing the elements of the specified
collection, in the order they are returned by the collection's
iterator.
- Parameters:
actions
- the collection whose string actions are to be placed into this list as the String Actions.elements
- the collection whose elements are to be places into the list as the Object elements.
add
public boolean add(java.lang.String action,
java.lang.Object element)
- Appends the given
String
and Object
at the end of this list.
- Parameters:
action
- the String
representing an action, to be inserted at the beginning of this list.element
- the Object
to be inserted in reference to the action.- Returns:
- true (as per the general contract of
Collection.add).
add
public void add(int index,
java.lang.String action,
java.lang.Object element)
throws java.lang.IndexOutOfBoundsException
- Inserts the specified
String
and Object
at the specified position in this list.
Shifts the String
and Object
currently at that position (if any) and any
subsequent elements to the right (adds one to their indices).
- Parameters:
index
- the integer index representing the location to add the action and element.action
- the String
representing an action, to be inserted at the beginning of this list.element
- the Object
to be inserted in reference to the action.- Throws:
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index > size()).
addFirst
public void addFirst(java.lang.String action,
java.lang.Object element)
- Inserts the given
String
and Object
at the beggining of this list.
- Parameters:
action
- the String
representing an action, to be inserted at the beginning of this list.element
- the Object
to be inserted in reference to the action.
addLast
public void addLast(java.lang.String action,
java.lang.Object element)
- Appends the given
String
and Object
at the end of this list.
- Parameters:
action
- the String
representing an action, to be inserted at the end of this list.element
- the Object
to be inserted in reference to the action.
getFirstAction
public java.lang.String getFirstAction()
- Gets the given
String
of the action at the beggining of this list.
- Returns:
- action the
String
representing the first action.
nextAction
public void nextAction(TreeHead headTree)
- Calls the next action of the
ObjectHead
headelement, using the waitingAction command.
The call to waitingAction
always passes the element, even if the element is unnecssary to
that operations.
- Parameters:
headTree
- the TreeHead
element of the Tree
to which the action occurs.