|
Java Eyes Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cs101.util.semaphore.IntBuffer
Implements a producer/consumer synchronized buffer.
Interface is IntBuffer.putButton( int ), IntBuffer.getButton(). This class
does guarantee that no value written to it will be overwritten before it
has been read and also guarantees that once a value has been read it will
not be re-read on subsequent attempts.
This class only behaves well when a single thread is reading the buffer and a single thread is writing to the buffer, or the order in which events are processed is unimportant. This class doesn't guarantee that competing threads will get to write in a sensible order, and does not guarantee that competing threads will get to read from the buffer in a sensible order
BS
Constructor Summary | |
IntBuffer()
|
Method Summary | |
int |
getButton()
An alternate (caluculator oriented) name for getInt() . |
int |
getInt()
(Safely) Consumes the int held in the IntBuffer. |
void |
putButton(int newButton)
An alternate (calculator oriented) name for putInt(int) . |
void |
putInt(int newButton)
(Safely) Puts an int into the IntBuffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public IntBuffer()
Method Detail |
public void putButton(int newButton)
putInt(int)
.
newButton
- the button to be inserted.getButton()
,
BS
public int getButton()
getInt()
.
putButton(int)
,
BS
public void putInt(int newButton)
newButton
- the value to be inserted.getButton()
,
BS
public int getInt()
putButton(int)
,
BS
|
Java Eyes Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |