FileDocCategorySizeDatePackage
Controller.javaAPI DocExample3609Mon Apr 06 18:10:20 BST 1998c07.controller

EventSet

public class EventSet extends Object

Fields Summary
private Event[]
events
private int
index
private int
next
Constructors Summary
Methods Summary
public voidadd(Event e)

      
    if(index >= events.length)
      return; // (In real life, throw exception)
    events[index++] = e;
  
public EventgetNext()

    boolean looped = false;
    int start = next;
    do {
      next = (next + 1) % events.length;
      // See if it has looped to the beginning:
      if(start == next) looped = true;
      // If it loops past start, the list 
      // is empty:
      if((next == (start + 1) % events.length)
         && looped)
        return null;
    } while(events[next] == null);
    return events[next];
  
public voidremoveCurrent()

    events[next] = null;