dataStructures
Class LinkedQueue
java.lang.Object
|
+--dataStructures.LinkedQueue
- public class LinkedQueue
- extends java.lang.Object
- implements Queue
Field Summary |
protected dataStructures.ChainNode |
front
|
protected dataStructures.ChainNode |
rear
|
Method Summary |
java.lang.Object |
getFrontElement()
|
java.lang.Object |
getRearElement()
|
boolean |
isEmpty()
|
static void |
main(java.lang.String[] args)
test program |
void |
put(java.lang.Object theElement)
insert theElement at the rear of the queue |
java.lang.Object |
remove()
remove an element from the front of the queue |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
front
protected dataStructures.ChainNode front
rear
protected dataStructures.ChainNode rear
LinkedQueue
public LinkedQueue(int initialCapacity)
- create an empty queue
LinkedQueue
public LinkedQueue()
isEmpty
public boolean isEmpty()
- Specified by:
- isEmpty in interface Queue
- Returns:
- true iff queue is empty
getFrontElement
public java.lang.Object getFrontElement()
- Specified by:
- getFrontElement in interface Queue
- Returns:
- the element at the front of the queue
getRearElement
public java.lang.Object getRearElement()
- Specified by:
- getRearElement in interface Queue
- Returns:
- the element at the rear of the queue
put
public void put(java.lang.Object theElement)
- insert theElement at the rear of the queue
- Specified by:
- put in interface Queue
remove
public java.lang.Object remove()
- remove an element from the front of the queue
- Specified by:
- remove in interface Queue
- Returns:
- removed element
main
public static void main(java.lang.String[] args)
- test program