Class Queue
- java.lang.Object
-
- org.processmining.plugins.workshop.Yaguang.WekaDiscriminationTree.Queue
-
- All Implemented Interfaces:
java.io.Serializable
public class Queue extends java.lang.Object implements java.io.SerializableClass representing a FIFO queue.- Version:
- $Revision: 1.7 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classQueue.QueueNodeRepresents one node in the queue.
-
Field Summary
Fields Modifier and Type Field Description protected Queue.QueueNodem_HeadStore a reference to the head of the queueprotected intm_SizeStore the c m_Tail.m_Nexturrent number of elements in the queueprotected Queue.QueueNodem_TailStore a reference to the tail of the queue
-
Constructor Summary
Constructors Constructor Description Queue()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanempty()Checks if queue is empty.static voidmain(java.lang.String[] argv)Main method for testing this class.java.lang.Objectpeek()Gets object from the front of the queue.java.lang.Objectpop()Pops an object from the front of the queue.java.lang.Objectpush(java.lang.Object item)Appends an object to the back of the queue.voidremoveAllElements()Removes all objects from the queue m_Tail.m_Next.intsize()Gets queue's size.java.lang.StringtoString()Produces textual description of queue.
-
-
-
Field Detail
-
m_Head
protected Queue.QueueNode m_Head
Store a reference to the head of the queue
-
m_Tail
protected Queue.QueueNode m_Tail
Store a reference to the tail of the queue
-
m_Size
protected int m_Size
Store the c m_Tail.m_Nexturrent number of elements in the queue
-
-
Method Detail
-
removeAllElements
public final void removeAllElements()
Removes all objects from the queue m_Tail.m_Next.
-
push
public java.lang.Object push(java.lang.Object item)
Appends an object to the back of the queue.- Parameters:
item- the object to be appended- Returns:
- the object appended
-
pop
public java.lang.Object pop() throws java.lang.RuntimeExceptionPops an object from the front of the queue.- Returns:
- the object at the front of the queue
- Throws:
java.lang.RuntimeException- if the queue is empty
-
peek
public java.lang.Object peek() throws java.lang.RuntimeExceptionGets object from the front of the queue.- Returns:
- the object at the front of the queue
- Throws:
java.lang.RuntimeException- if the queue is empty
-
empty
public boolean empty()
Checks if queue is empty.- Returns:
- true if queue is empty
-
size
public int size()
Gets queue's size.- Returns:
- size of queue
-
toString
public java.lang.String toString()
Produces textual description of queue.- Overrides:
toStringin classjava.lang.Object- Returns:
- textual description of queue
-
main
public static void main(java.lang.String[] argv)
Main method for testing this class.- Parameters:
argv- a set of strings that are pushed on a test queue
-
-