Package weka.core

# Class Queue

java.lang.Object
weka.core.Queue

All Implemented Interfaces:
  `Serializable`, `RevisionHandler`

public class Queue extends Object implements Serializable, RevisionHandler
Class representing a FIFO queue.

Version:
  $Revision: 8034 $
Author:
  Len Trigg (trigg@cs.waikato.ac.nz)
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Queue()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `empty()`
  Checks if queue is empty.
  `String`
  `getRevision()`
  Returns the revision string.
  `static void`
  `main(String[] argv)`
  Main method for testing this class.
  `Object`
  `peek()`
  Gets object from the front of the queue.
  `Object`
  `pop()`
  Pops an object from the front of the queue.
  `Object`
  `push(Object item)`
  Appends an object to the back of the queue.
  `final void`
  `removeAllElements()`
  Removes all objects from the queue m_Tail.m_Next.
  `int`
  `size()`
  Gets queue's size.
  `String`
  `toString()`
  Produces textual description of queue.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Queue

    public Queue()

- ## Method Details

  - ### removeAllElements

    public final void removeAllElements()
    Removes all objects from the queue m_Tail.m_Next.

  - ### push

    public Object push(Object item)
    Appends an object to the back of the queue.
    Parameters:
      `item` - the object to be appended
    Returns:
      the object appended

  - ### pop

    public Object pop() throws RuntimeException
    Pops an object from the front of the queue.
    Returns:
      the object at the front of the queue
    Throws:
      `RuntimeException` - if the queue is empty

  - ### peek

    public Object peek() throws RuntimeException
    Gets object from the front of the queue.
    Returns:
      the object at the front of the queue
    Throws:
      `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 String toString()
    Produces textual description of queue.
    Overrides:
      `toString` in class `Object`
    Returns:
      textual description of queue

  - ### getRevision

    public String getRevision()
    Returns the revision string.
    Specified by:
      `getRevision` in interface `RevisionHandler`
    Returns:
      the revision

  - ### main

    public static void main(String[] argv)
    Main method for testing this class.
    Parameters:
      `argv` - a set of strings that are pushed on a test queue