aima.util
Class AbstractQueue
java.lang.Object
aima.util.AbstractQueue
- All Implemented Interfaces:
- Queue
- Direct Known Subclasses:
- FIFOQueue, LIFOQueue
public class AbstractQueue
- extends java.lang.Object
- implements Queue
Artificial Intelligence A Modern Approach (2nd Edition): page 71.
The operations on a queue are as follows: MAKE-QUEUE(element,...) creates a
queue with the given element(s). EMPTY?(queue) returns true only if there are
no more elements in the queue. FIRST(queue) returns the first element of the
queue. REMOVE-FIRST(queue) returns FIRST(queue) and removes it from the
queue. INSERT(element, queue) inserts an element into the queue and returns
the resulting queue. (We will see that different types of queues insert
elements in different orders.) INSERT-ALL(elements, queue) inserts a set of
elements into the queue and returns the resulting queue.
Field Summary |
protected java.util.LinkedList<java.lang.Object> |
linkedList
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
linkedList
protected java.util.LinkedList<java.lang.Object> linkedList
AbstractQueue
public AbstractQueue()
addToFront
public void addToFront(java.lang.Object n)
addToBack
public void addToBack(java.lang.Object n)
addToFront
public void addToFront(java.util.List list)
addToBack
public void addToBack(java.util.List list)
removeFirst
public java.lang.Object removeFirst()
removeLast
public java.lang.Object removeLast()
getFirst
public java.lang.Object getFirst()
getLast
public java.lang.Object getLast()
isEmpty
public boolean isEmpty()
size
public int size()
asList
public java.util.List asList()
add
public void add(java.lang.Object anItem)
- Specified by:
add
in interface Queue
add
public void add(java.util.List items)
- Specified by:
add
in interface Queue
remove
public java.lang.Object remove()
- Specified by:
remove
in interface Queue
get
public java.lang.Object get()
- Specified by:
get
in interface Queue