INRIA & FluxMedia

fr.fluxmedia.transmorpher.Utils
Class Fifo

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--fr.fluxmedia.transmorpher.Utils.Fifo
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class Fifo
extends java.util.Vector

See Also:
Serialized Form

Field Summary
private  int first
          The first position at which there is unpoped value
private  int last
          The last position at which there is no value
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData, serialVersionUID
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Fifo()
          Creates an empty Fifo
 
Method Summary
 void clear()
          Empties the Fifo
 boolean isEmpty()
          Test if the Fifo is empty
 java.lang.Object peek()
          Returns the first element of the Fifo (which is left unchanged)
 java.lang.Object pop()
          Returns the first element of the Fifo which is withdrawn
 void push(java.lang.Object item)
          Pushes an item onto the top of the Fifo
 void removeAllElements()
          Empties the Fifo
 int search(java.lang.Object item)
          Returns the 1-based position where the object item is in the Fifo.
 int size()
          Returns the number of elements in the Fifo
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, ensureCapacityHelper, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

first

private int first
The first position at which there is unpoped value

last

private int last
The last position at which there is no value
Constructor Detail

Fifo

public Fifo()
Creates an empty Fifo
Method Detail

push

public void push(java.lang.Object item)
Pushes an item onto the top of the Fifo
Parameters:
item - the item to be pushed on the Fifo
Returns:
the item argument
See Also:
Vector.addElement(Object)

pop

public java.lang.Object pop()
                     throws java.util.EmptyStackException
Returns the first element of the Fifo which is withdrawn
Returns:
the first element on top of the Fifo
Throws:
java.util.EmptyStackException -  

peek

public java.lang.Object peek()
                      throws java.util.EmptyStackException
Returns the first element of the Fifo (which is left unchanged)
Returns:
the first element on top of the Fifo
Throws:
java.util.EmptyStackException -  

isEmpty

public boolean isEmpty()
Test if the Fifo is empty
Overrides:
isEmpty in class java.util.Vector
Returns:
true if and only if the Fifo contains no item; false otherwise

size

public int size()
Returns the number of elements in the Fifo
Overrides:
size in class java.util.Vector
Returns:
the number of elements in the Fifo

clear

public void clear()
Empties the Fifo
Overrides:
clear in class java.util.Vector

removeAllElements

public void removeAllElements()
Empties the Fifo
Overrides:
removeAllElements in class java.util.Vector

search

public int search(java.lang.Object item)
Returns the 1-based position where the object item is in the Fifo. If the object item accours at an element of the Fifo, this method returns the distance from the bottom of the Fifo of the occurence nearest to the bottom. The bottom item is considered at distance 1. The equals method is used to compare item to the items in this Fifo.
Parameters:
item - the item to be found
Returns:
the 1-based position for the begining of the Fifo where the object is located; the return value -1 indicates that the object is not in the Fifo.
See Also:
Vector.addElement(Object)

INRIA & FluxMedia

..no bottom yet...