[.home.]
[.hacks.]
[.java.]

Class Fifo

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

public class Fifo
extends java.util.Vector

(#)Fifo.java

Version:
3.2 19-Mar-2004

Implements a fifo (first in - first out queue) with an option to limit the number of entries, If the fifo already contains maxentries, the oldest entry will be discarded on addition of any new entry. If unique is specified to be true entries already contained will not be added to this fifo.
Author:
Holger Pfaff
See Also:
Serialized Form

Field Summary
protected  int maxentries
          Maximal number of entries. 0 for unlimited
protected  boolean unique
          Force entries to be unique ?
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Fifo()
          Constructs an unlimited Fifo with duplicate entries allowed.
Fifo(boolean unique)
          Constructs an unlimited Fifo with duplicate entries allowed or not allowed depending on unique.
Fifo(int maxentries)
          Constructs a Fifo limited to maxentries.
Fifo(int maxentries, boolean unique)
          Constructs a Fifo.
 
Method Summary
 void in(java.lang.Object obj)
          add an object to this fifo
 java.lang.Object out()
          remove an object from this fifo
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, 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

maxentries

protected int maxentries
Maximal number of entries. 0 for unlimited


unique

protected boolean unique
Force entries to be unique ?

Constructor Detail

Fifo

public Fifo()
Constructs an unlimited Fifo with duplicate entries allowed.


Fifo

public Fifo(int maxentries)
Constructs a Fifo limited to maxentries. Duplicate entries allowed.

Parameters:
maxentries - maximal number if entries.

Fifo

public Fifo(boolean unique)
Constructs an unlimited Fifo with duplicate entries allowed or not allowed depending on unique.

Parameters:
unique - force unique entries ?

Fifo

public Fifo(int maxentries,
            boolean unique)
Constructs a Fifo.

Parameters:
maxentries - maximal number if entries.
unique - force unique entries ?
Method Detail

in

public void in(java.lang.Object obj)
add an object to this fifo

Parameters:
obj - object to add.

out

public java.lang.Object out()
remove an object from this fifo


[.home.]
[.hacks.]
[.java.]