|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--BufferQueue
An object of class BufferQueue is a named queue of Buffers used by a BoundedBufferProcess. The name is established when the BufferQueue is constructed. It can be retrieved by calling toString(). When a BufferQueue is constructed, its capacity is established. It can be filled immediately afterward by calling fill(). If the BufferQueue is not full then a Buffer can be added by calling putBuffer(). Buffers can be retrieved by calling getBuffer(). This method does not return until there is an available Buffer in the BufferQueue.
Field Summary | |
protected Buffer[] |
buffers
buffers is the array of Buffers for this BufferQueue. |
protected int |
capacity
capacity is the maximum number of Buffers that this BufferQueue can hold. |
protected int |
count
count is the number of Buffers in this BufferQueue. |
protected java.lang.String |
name
name is the name for this BufferQueue. |
protected int |
nextGet
nextGet is the index where the next available Buffer can be found in this BufferQueue. |
Constructor Summary | |
BufferQueue(java.lang.String nm,
int n)
new BufferQueue(nm, n) returns a new BufferQueue with a capacity for n Buffer objects. |
Method Summary | |
void |
fill()
bq.fill() fills bq with Buffers whose names are the decimal representations of integers from 0 up to one less than the capacity of bq. |
Buffer |
getBuffer()
bq.getBuffer() returns the next available Buffer from bq. |
boolean |
isFull()
bq.isFull() returns true if there is no more room for Buffers in bq. |
void |
putBuffer(Buffer buff)
bq.putBuffer(buff) adds buff to bq. |
java.lang.String |
toString()
bq.toString() returns the name of bq. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Buffer[] buffers
protected int capacity
protected int count
protected int nextGet
protected java.lang.String name
Constructor Detail |
public BufferQueue(java.lang.String nm, int n)
Method Detail |
public void fill()
public boolean isFull()
public Buffer getBuffer()
public void putBuffer(Buffer buff)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |