|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.Queue
Class representing a FIFO queue.
Nested Class Summary | |
protected class |
Queue.QueueNode
Represents one node in the queue. |
Field Summary | |
protected Queue.QueueNode |
m_Head
Store a reference to the head of the queue |
protected int |
m_Size
Store the current number of elements in the queue |
protected Queue.QueueNode |
m_Tail
Store a reference to the tail of the queue |
Constructor Summary | |
Queue()
|
Method Summary | |
boolean |
empty()
Checks if queue is empty. |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
java.lang.Object |
peek()
Gets object from the front of the queue. |
java.lang.Object |
pop()
Pops an object from the front of the queue. |
java.lang.Object |
push(java.lang.Object item)
Appends an object to the back of the queue. |
void |
removeAllElements()
Removes all objects from the queue. |
int |
size()
Gets queue's size. |
java.lang.String |
toString()
Produces textual description of queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Queue.QueueNode m_Head
protected Queue.QueueNode m_Tail
protected int m_Size
Constructor Detail |
public Queue()
Method Detail |
public final void removeAllElements()
public java.lang.Object push(java.lang.Object item)
item
- the object to be appended
public java.lang.Object pop()
java.lang.RuntimeException
- if the queue is emptypublic java.lang.Object peek()
java.lang.RuntimeException
- if the queue is emptypublic boolean empty()
public int size()
public java.lang.String toString()
public static void main(java.lang.String[] argv)
argv
- a set of strings that are pushed on a test queue
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |