EDU.gatech.cc.is.util
Class CircularBufferEnumeration
java.lang.Object
|
+--EDU.gatech.cc.is.util.CircularBufferEnumeration
- public class CircularBufferEnumeration
- extends java.lang.Object
- implements java.util.Enumeration, java.lang.Cloneable, java.io.Serializable
Implements an enumeration of items in a circular buffer.
Copyright (c)2000 Tucker Balch
- See Also:
- Serialized Form
Field Summary |
protected int |
position
the last cell read. |
protected int |
total
total number of items ever read from the buffer by this enumeration. |
Method Summary |
boolean |
hasMoreElements()
Tests if this enumeration contains more elements. |
static void |
main(java.lang.String[] args)
Tests circular buffer enumeration. |
java.lang.Object |
nextElement()
Returns the next element of this enumeration. |
java.lang.Object |
waitMatchingElement(java.lang.Class c)
Returns the next element matching the requested class. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
position
protected int position
- the last cell read.
total
protected int total
- total number of items ever read from the buffer by this enumeration.
CircularBufferEnumeration
public CircularBufferEnumeration(CircularBuffer cb)
- create a CircularBufferEnumeration with a circular buffer.
- Parameters:
cb
- CircularBuffer, the buffer to enumerate.
hasMoreElements
public boolean hasMoreElements()
- Tests if this enumeration contains more elements.
- Specified by:
- hasMoreElements in interface java.util.Enumeration
- Returns:
- true if this enumeration contains more elements;
false otherwise.
nextElement
public java.lang.Object nextElement()
throws java.util.NoSuchElementException
- Returns the next element of this enumeration.
- Specified by:
- nextElement in interface java.util.Enumeration
- Returns:
- the next element of this enumeration.
- Throws:
- java.util.NoSuchElementException - if no more elements exist.
waitMatchingElement
public java.lang.Object waitMatchingElement(java.lang.Class c)
- Returns the next element matching the requested class.
Implicitly consumes other types of elements.
- Returns:
- the next element of this enumeration.
main
public static void main(java.lang.String[] args)
- Tests circular buffer enumeration.