|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nih.nlm.mms.ConceptQueue
public class ConceptQueue
First In First Out queue for Concept objects. A producer
adds concepts until the queue is full and then blocks. A consumer
reads concepts out (notifying the producer when room is available
for adding more) and blocks when there are no more concepts to read.
The producer wakes up the consumer when there is more data to read.
| Constructor Summary | |
|---|---|
ConceptQueue(int size)
Instantiates a ConceptQueue with the specified size. |
|
| Method Summary | |
|---|---|
Concept |
get()
Removes a Concept from the queue, blocks if the queue is empty afterwards. |
boolean |
isEmpty()
Indicates whether or not the queue is empty. |
boolean |
isFull()
Indicates whether or not the queue is full. |
boolean |
isProducerFinished()
Indicates whether or not the producer is finished adding Concepts. |
static void |
main(String[] s)
Self-qa test. |
void |
put(Concept concept)
Adds a concept to the queue, blocks if the queue is full afterwards. |
void |
setProducerFinished()
Sets the flag to true indicating that the producer is finished
adding Concepts. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConceptQueue(int size)
ConceptQueue with the specified size.
size - the size of the queue| Method Detail |
|---|
public boolean isProducerFinished()
Concepts.
true if so, false otherwisepublic void setProducerFinished()
true indicating that the producer is finished
adding Concepts.
public boolean isFull()
true if full, false otherwisepublic boolean isEmpty()
true if empty, false otherwisepublic void put(Concept concept)
concept - the Concept to addpublic Concept get()
Concept from the queue, blocks if the queue is empty afterwards.
Wakes up a sleeping producer if the queue is at less than 50% full.
Conceptpublic static void main(String[] s)
s - command line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||