diff options
author | endolf <[email protected]> | 2011-02-05 17:38:53 +0000 |
---|---|---|
committer | endolf <[email protected]> | 2011-02-05 17:38:53 +0000 |
commit | 1d05f15cc4b2625e5aa1a8f8b5b9e23cc652f363 (patch) | |
tree | 39f5e4b8099eb05da14cc835fdae88ad93349411 | |
parent | e2cb1eb72be85953453ed496a1bd37c41e262265 (diff) |
Updated javadoc
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@237 e343933a-64c8-49c5-92b1-88f2ce3e89e8
-rw-r--r-- | coreAPI/src/java/net/java/games/input/EventQueue.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/coreAPI/src/java/net/java/games/input/EventQueue.java b/coreAPI/src/java/net/java/games/input/EventQueue.java index 960ed40..a025d9c 100644 --- a/coreAPI/src/java/net/java/games/input/EventQueue.java +++ b/coreAPI/src/java/net/java/games/input/EventQueue.java @@ -38,31 +38,53 @@ *****************************************************************************/ package net.java.games.input; +/** + * A FIFO queue for input events. + */ public final class EventQueue { private final Event[] queue; private int head; private int tail; + /** + * This is an internal method and should not be called by applications using the API + */ public EventQueue(int size) { queue = new Event[size + 1]; for (int i = 0; i < queue.length; i++) queue[i] = new Event(); } + /** + * This is an internal method and should not be called by applications using the API + */ final synchronized void add(Event event) { queue[tail].set(event); tail = increase(tail); } + /** + * Check if the queue is full + * @return true if the queue is full + */ final synchronized boolean isFull() { return increase(tail) == head; } + /** + * This is an internal method and should not be called by applications using the API + */ private final int increase(int x) { return (x + 1)%queue.length; } + /** + * Populates the provided event with the details of the event on the head of the queue. + * + * @param event The event to populate + * @return false if there were no events left on the queue, otherwise true. + */ public final synchronized boolean getNextEvent(Event event) { if (head == tail) return false; |