streamit.misc
Class WrappableGrowableQueue_char
java.lang.Object
streamit.misc.WrappableGrowableQueue_char
- All Implemented Interfaces:
- WrappableGrowableQueue
public class WrappableGrowableQueue_char
- extends Object
- implements WrappableGrowableQueue
This implements a queue that uses a circular buffer which grows
whenever the head reaches the tail.
Note: This comment will appear in any WrappableGrowableQueue_*.java files,
however the subsequent comments will only appear in this file. It should
be understood that all of these classes are essentially the same thing and
changes to one should be made to all of them.
Note that the addition of generics in Java 1.5 won't help the situation because
generics don't handle basic data types like int, double, float, etc, and we're
using those precisely to avoid their Object counterparts.
Method Summary |
char |
dequeue()
|
char |
elem(int index)
|
void |
enqueue(char i)
|
void |
setBufferSize(int size)
Changes the size of the buffer used to hold the queue. |
int |
size()
Returns the number of elements currently stored in the queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WrappableGrowableQueue_char
public WrappableGrowableQueue_char()
enqueue
public void enqueue(char i)
dequeue
public char dequeue()
elem
public char elem(int index)
size
public int size()
- Description copied from interface:
WrappableGrowableQueue
- Returns the number of elements currently stored in the queue.
- Specified by:
size
in interface WrappableGrowableQueue
- Returns:
- The number of elements in the queue.
setBufferSize
public void setBufferSize(int size)
- Description copied from interface:
WrappableGrowableQueue
- Changes the size of the buffer used to hold the queue. This is the only function
which somewhat exposes the internal workings of the object, and it is there as a
performance measure so that objects which know they need a queue of a certain size
can grow it to that size beforehand.
- Specified by:
setBufferSize
in interface WrappableGrowableQueue
- Parameters:
size
- The number of elements the buffer should be able to hold.