INRIA & FluxMedia

fr.fluxmedia.transmorpher.utils
Class Fifo

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector
              extended by fr.fluxmedia.transmorpher.utils.Fifo
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

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
 
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, 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, 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
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

Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.List
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

Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.List
Overrides:
size in class java.util.Vector
Returns:
the number of elements in the Fifo

clear

public void clear()
Empties the Fifo

Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.List
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...