home *** CD-ROM | disk | FTP | other *** search
- package netscape.applet;
-
- import sun.awt.ObjectPeer;
-
- public class EventQueue {
- AppletEvent appletEventList = new AppletEvent(-1);
- int eventsCount = 0;
- static final int MAX_EVENTS_NUMBER = 400;
-
- public synchronized void sendEvent(int var1) {
- AppletEvent var2 = new AppletEvent(var1);
- this.appletEventList.appendElement(var2);
- this.notifyAll();
- }
-
- public synchronized void sendGUIEvent(GUIEvent var1) {
- if (this.eventsCount <= 400) {
- this.appletEventList.appendElement(var1);
- ++this.eventsCount;
- this.notifyAll();
- }
-
- }
-
- public synchronized AppletEvent getNextEvent() {
- Object var1 = null;
-
- try {
- while(this.appletEventList.isEmptyList()) {
- this.wait();
- }
-
- AppletEvent var4 = (AppletEvent)this.appletEventList.next;
- ((DoubleLinkedList)var4).remove();
- --this.eventsCount;
- return var4;
- } catch (Exception var3) {
- System.out.println("Exception occurred: " + ((Throwable)var3).toString());
- System.out.println("Returning null event");
- return (AppletEvent)var1;
- }
- }
-
- public synchronized int getQueueSize() {
- return this.eventsCount;
- }
-
- public synchronized void setQueueSize(int var1) {
- this.eventsCount = var1;
- }
-
- public synchronized void removeEventsForObject(ObjectPeer var1) {
- if (!this.appletEventList.isEmptyList()) {
- for(AppletEvent var3 = (AppletEvent)this.appletEventList.next; var3 != this.appletEventList && var3.eventId == 20; var3 = (AppletEvent)var3.next) {
- GUIEvent var2 = (GUIEvent)var3;
- if (var2.isEventForObject(var1)) {
- ((DoubleLinkedList)var2).remove();
- --this.eventsCount;
- }
- }
- }
-
- }
-
- public synchronized void colasceEvent(GUIEvent var1) {
- if (!this.appletEventList.isEmptyList()) {
- for(AppletEvent var3 = (AppletEvent)this.appletEventList.next; var3 != this.appletEventList && var3.eventId == 20; var3 = (AppletEvent)var3.next) {
- GUIEvent var2 = (GUIEvent)var3;
- if (var1.isEqual(var2)) {
- var1.combineEvent(var2);
- ((DoubleLinkedList)var2).remove();
- --this.eventsCount;
- return;
- }
- }
- }
-
- }
- }
-