|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBoundedBuffer
public class BoundedBuffer
Bounded buffer.
Field Summary | |
---|---|
private java.lang.Object[] |
buffer
The buffer storage of objects. |
private Sema |
empty
A semaphore to indicate an empty buffer. |
private int |
front
The position of the first filled cell. |
private Sema |
full
A semaphore to indicate a full buffer. |
private java.lang.Object |
gt
|
private java.lang.Object |
pt
|
private int |
rear
The position of the first empty cell. |
private int |
size
The size of the buffer. |
Constructor Summary | |
---|---|
BoundedBuffer(int init)
Constructs a BoundedBuffer with a desired size. |
Method Summary | |
---|---|
boolean |
empty()
Tests if the BoundedBuffer is empty. |
java.lang.Object |
get()
Get an object from the BoundedBuffer. |
void |
put(java.lang.Object v)
Put an object to the BoundedBuffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.Object[] buffer
private int size
private int front
private int rear
private Sema empty
private Sema full
private java.lang.Object pt
private java.lang.Object gt
Constructor Detail |
---|
public BoundedBuffer(int init)
init
- the size of the buffer.Method Detail |
---|
public boolean empty()
public void put(java.lang.Object v)
v
- an object to be put to the buffer.public java.lang.Object get()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |