home *** CD-ROM | disk | FTP | other *** search
- package netscape.applet;
-
- class EventQueue {
- static final int MAX_EVENTS_NUMBER = 400;
- NEvent eventList = new AppletEvent(-1);
- int eventsCount = 0;
-
- public EventQueue() {
- }
-
- public void destroy() {
- this.eventList = null;
- }
-
- public synchronized void sendEvent(NEvent var1) {
- this.eventList.appendElement(var1);
- this.notifyAll();
- }
-
- public synchronized void sendGUIEvent(NEvent var1) {
- if (this.eventsCount <= 400) {
- this.eventList.appendElement(var1);
- ++this.eventsCount;
- this.notifyAll();
- }
-
- }
-
- public synchronized NEvent getNextEvent() {
- Object var1 = null;
-
- while(this.eventList.isEmptyList()) {
- try {
- this.wait();
- } catch (InterruptedException var2) {
- return (NEvent)var1;
- }
- }
-
- NEvent var3 = (NEvent)this.eventList.next;
- ((DoubleLinkedList)var3).remove();
- --this.eventsCount;
- return var3;
- }
-
- public synchronized int getQueueSize() {
- return this.eventsCount;
- }
-
- public synchronized void removeEvents(Object var1) {
- if (!this.eventList.isEmptyList()) {
- for(NEvent var2 = (NEvent)this.eventList.next; var2 != this.eventList; var2 = (NEvent)var2.next) {
- if (var1 == var2.getTarget()) {
- ((DoubleLinkedList)var2).remove();
- --this.eventsCount;
- }
- }
- }
-
- }
-
- public synchronized void coalesceEvent(NEvent var1) {
- if (!this.eventList.isEmptyList()) {
- for(NEvent var2 = (NEvent)this.eventList.next; var2 != this.eventList; var2 = (NEvent)var2.next) {
- if (var1.coalesce(var2)) {
- ((DoubleLinkedList)var2).remove();
- --this.eventsCount;
- return;
- }
- }
- }
-
- }
- }
-