fr.inria.opengve.tools.dataStructures
Class Fifo<E>

java.lang.Object
  extended by fr.inria.opengve.tools.dataStructures.Fifo<E>
Type Parameters:
E - The type of element in the FIFO.
All Implemented Interfaces:
Accumulator<E>

public class Fifo<E>
extends java.lang.Object
implements Accumulator<E>

This class implement the concept of FIFO. Add ________ Get --->|4|3|2|1|---->

Author:
fabrice.peix@sophia.inria.fr

Constructor Summary
Fifo()
          Default constructor.
 
Method Summary
 void clear()
          Removes all the element of this FIFO.
 E get()
          Return the first element of this FIFO and remove it.
 boolean isEmpty()
          Tell if the FIFO is empty.
 E look()
          Return the first element of this FIFO.
 void put(E o)
          Add an element to this FIFO.
 int size()
          Give the size of this FIFO.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fifo

public Fifo()
Default constructor.

Method Detail

get

public E get()
Return the first element of this FIFO and remove it.

Specified by:
get in interface Accumulator<E>
Returns:
The element at the right of the FIFO.
Throws:
java.util.NoSuchElementException - If this FIFO is empty.

look

public E look()
Return the first element of this FIFO.

Specified by:
look in interface Accumulator<E>
Returns:
The element at the right of the FIFO.
Throws:
java.util.NoSuchElementException - If this FIFO is empty.

put

public void put(E o)
Add an element to this FIFO.

Specified by:
put in interface Accumulator<E>
Parameters:
o - The object to add to this FIFO.

isEmpty

public boolean isEmpty()
Tell if the FIFO is empty.

Specified by:
isEmpty in interface Accumulator<E>
Returns:
true if the FIFO is empty and false otherwise.

size

public int size()
Give the size of this FIFO.

Specified by:
size in interface Accumulator<E>
Returns:
The number of element in this FIFO.

clear

public void clear()
Removes all the element of this FIFO.

Specified by:
clear in interface Accumulator<E>


Copyright © 2009 INRIA (Projet Mascotte). All Rights Reserved.