From 1d05f15cc4b2625e5aa1a8f8b5b9e23cc652f363 Mon Sep 17 00:00:00 2001 From: endolf Date: Sat, 5 Feb 2011 17:38:53 +0000 Subject: Updated javadoc git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@237 e343933a-64c8-49c5-92b1-88f2ce3e89e8 --- .../src/java/net/java/games/input/EventQueue.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'coreAPI') 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; -- cgit v1.2.3