com.deltax.util
Class FIFOQueue

java.lang.Object
  extended bycom.deltax.util.FIFOQueue

public class FIFOQueue
extends java.lang.Object

A simple FIFO queue.

Version:
1.2
Author:
Cris Sadun

Constructor Summary
FIFOQueue()
          Create an empty queue
 
Method Summary
 void clear()
          Clear the queue
 java.lang.Object get()
          Return the queue head
 boolean getBoolean()
          Return the queue head, as a boolean
 byte getByte()
          Return the queue head, as a byte
 char getChar()
          Return the queue head, as a char
 double getDouble()
          Return the queue head, as a double
 float getFloat()
          Return the queue head, as a float
 int getInteger()
          Return the queue head, as a int
 long getLong()
          Return the queue head, as a long
 java.lang.String getString()
          Return the queue head, as a String
 boolean isEmpty()
          Return true if the queue is empty.
 java.lang.Object peek()
           
 java.lang.Object peek(int i)
           
 void put(boolean x)
          Insert a boolean in the queue
 void put(byte x)
          Insert a byte in the queue
 void put(char x)
          Insert a char in the queue
 void put(double x)
          Insert a double in the queue
 void put(float x)
          Insert a float in the queue
 void put(int x)
          Insert an integer in the queue
 void put(long x)
          Insert a long in the queue
 void put(java.lang.Object obj)
          Insert an Object in the queue
 int size()
          Return the size of the queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIFOQueue

public FIFOQueue()
Create an empty queue

Method Detail

clear

public void clear()
Clear the queue


get

public java.lang.Object get()
                     throws QueueEmptyException
Return the queue head

Returns:
the queue head
Throws:
QueueEmptyException - if the queue is empty

peek

public java.lang.Object peek(int i)

peek

public java.lang.Object peek()

getByte

public byte getByte()
             throws QueueEmptyException
Return the queue head, as a byte

Returns:
the queue head
Throws:
QueueEmptyException - if the queue is empty
java.lang.ClassCastException - if the queue head is not a Byte object

getChar

public char getChar()
             throws QueueEmptyException
Return the queue head, as a char

Returns:
the queue head
Throws:
QueueEmptyException - if the queue is empty
java.lang.ClassCastException - if the queue head is not a Character object

getDouble

public double getDouble()
                 throws QueueEmptyException
Return the queue head, as a double

Returns:
the queue head
Throws:
QueueEmptyException - if the queue is empty
java.lang.ClassCastException - if the queue head is not a Double object

getFloat

public float getFloat()
               throws QueueEmptyException
Return the queue head, as a float

Returns:
the queue head
Throws:
QueueEmptyException - if the queue is empty
java.lang.ClassCastException - if the queue head is not a Float object

getInteger

public int getInteger()
               throws QueueEmptyException
Return the queue head, as a int

Returns:
the queue head
Throws:
QueueEmptyException - if the queue is empty
java.lang.ClassCastException - if the queue head is not an Integer object

getLong

public long getLong()
             throws QueueEmptyException
Return the queue head, as a long

Returns:
the queue head
Throws:
QueueEmptyException - if the queue is empty
java.lang.ClassCastException - if the queue head is not a Long object

getString

public java.lang.String getString()
                           throws QueueEmptyException
Return the queue head, as a String

Returns:
the queue head
Throws:
QueueEmptyException - if the queue is empty
java.lang.ClassCastException - if the queue head is not a String object

getBoolean

public boolean getBoolean()
                   throws QueueEmptyException
Return the queue head, as a boolean

Returns:
the queue head
Throws:
QueueEmptyException - if the queue is empty
java.lang.ClassCastException - if the queue head is not a Boolean object

isEmpty

public boolean isEmpty()
Return true if the queue is empty.

Returns:
true if the queue is empty

size

public int size()
Return the size of the queue


put

public void put(byte x)
Insert a byte in the queue

Parameters:
x - the element to be inserted

put

public void put(char x)
Insert a char in the queue

Parameters:
x - the element to be inserted

put

public void put(double x)
Insert a double in the queue

Parameters:
x - the element to be inserted

put

public void put(float x)
Insert a float in the queue

Parameters:
x - the element to be inserted

put

public void put(int x)
Insert an integer in the queue

Parameters:
x - the element to be inserted

put

public void put(long x)
Insert a long in the queue

Parameters:
x - the element to be inserted

put

public void put(boolean x)
Insert a boolean in the queue

Parameters:
x - the element to be inserted

put

public void put(java.lang.Object obj)
Insert an Object in the queue

Parameters:
obj - the object to be inserted