aima.util
Class AbstractQueue

java.lang.Object
  extended by 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
           
 
Constructor Summary
AbstractQueue()
           
 
Method Summary
 void add(java.util.List items)
           
 void add(java.lang.Object anItem)
           
 void addToBack(java.util.List list)
           
 void addToBack(java.lang.Object n)
           
 void addToFront(java.util.List list)
           
 void addToFront(java.lang.Object n)
           
 java.util.List asList()
           
 java.lang.Object get()
           
 java.lang.Object getFirst()
           
 java.lang.Object getLast()
           
 boolean isEmpty()
           
 java.lang.Object remove()
           
 java.lang.Object removeFirst()
           
 java.lang.Object removeLast()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

linkedList

protected java.util.LinkedList<java.lang.Object> linkedList
Constructor Detail

AbstractQueue

public AbstractQueue()
Method Detail

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