FreeWRL/FreeX3D
3.0.0
Main Page
Related Pages
Data Structures
Files
File List
EAIAsyncQueue.java
1
// copyright (c) 1997,1998 stephen f. white
2
// Modified for EAI FreeWRL code. John Stewart CRC Canada 1999
3
//
4
// This program is free software; you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation; either version 2, or (at your option)
7
// any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program; see the file COPYING. If not, write to
16
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17
18
package
vrml.external.FreeWRLEAI;
19
20
public
class
EAIAsyncQueue
{
21
private
EAIAsyncMessage
head;
22
private
EAIAsyncMessage
tail;
23
24
public
EAIAsyncQueue
() {
25
head = tail = null;
26
}
27
28
public
synchronized
void
enqueue(
EAIAsyncMessage
msg) {
29
msg.next = head;
30
msg.prev = null;
31
if
(head == null) {
32
tail = msg;
33
}
else
{
34
head.prev = msg;
35
}
36
head = msg;
37
}
38
39
public
synchronized
EAIAsyncMessage
dequeue() {
40
if
(tail == null)
return
null;
41
EAIAsyncMessage
msg = tail;
42
tail = tail.prev;
43
if
(tail == null) {
44
head = null;
45
}
else
{
46
tail.next = null;
47
}
48
msg.prev = msg.next = null;
49
return
msg;
50
}
51
52
public
boolean
isEmpty() {
53
return
head == null;
54
}
55
}
vrml.external.FreeWRLEAI.EAIAsyncMessage
Definition:
EAIAsyncMessage.java:20
vrml.external.FreeWRLEAI.EAIAsyncQueue
Definition:
EAIAsyncQueue.java:20
src
java
vrml
external
FreeWRLEAI
EAIAsyncQueue.java
Generated on Thu Dec 14 2017 12:14:40 for FreeWRL/FreeX3D by
1.8.6