Exemplo n.º 1
0
 /** Returns a list containing all events currently in the robot's queue. */
 public List<Event> getAllEvents() {
   List<Event> events = new ArrayList<Event>();
   synchronized (eventQueue) {
     for (Event e : eventQueue) {
       events.add(e);
     }
   }
   return events;
 }
Exemplo n.º 2
0
 /** Returns a list containing all StatusEvents currently in the robot's queue. */
 public List<StatusEvent> getStatusEvents() {
   List<StatusEvent> events = new ArrayList<StatusEvent>();
   synchronized (eventQueue) {
     for (Event e : eventQueue) {
       if (e instanceof StatusEvent) {
         events.add((StatusEvent) e);
       }
     }
   }
   return events;
 }
Exemplo n.º 3
0
 /** Returns a list containing all MessageEvents currently in the robot's queue. */
 public List<MessageEvent> getMessageEvents() {
   List<MessageEvent> events = new ArrayList<MessageEvent>();
   synchronized (eventQueue) {
     for (Event e : eventQueue) {
       if (e instanceof MessageEvent) {
         events.add((MessageEvent) e);
       }
     }
   }
   return events;
 }
Exemplo n.º 4
0
 /** Returns a list containing all RobotDeathEvents currently in the robot's queue. */
 public List<RobotDeathEvent> getRobotDeathEvents() {
   List<RobotDeathEvent> events = new ArrayList<RobotDeathEvent>();
   synchronized (eventQueue) {
     for (Event e : eventQueue) {
       if (e instanceof RobotDeathEvent) {
         events.add((RobotDeathEvent) e);
       }
     }
   }
   return events;
 }
Exemplo n.º 5
0
 /** Returns a list containing all HitWallEvents currently in the robot's queue. */
 public List<HitWallEvent> getHitWallEvents() {
   List<HitWallEvent> events = new ArrayList<HitWallEvent>();
   synchronized (eventQueue) {
     for (Event e : eventQueue) {
       if (e instanceof HitWallEvent) {
         events.add((HitWallEvent) e);
       }
     }
   }
   return events;
 }
Exemplo n.º 6
0
 /** Returns a list containing all BulletMissedEvents currently in the robot's queue. */
 public List<BulletMissedEvent> getBulletMissedEvents() {
   List<BulletMissedEvent> events = new ArrayList<BulletMissedEvent>();
   synchronized (eventQueue) {
     for (Event e : eventQueue) {
       if (e instanceof BulletMissedEvent) {
         events.add((BulletMissedEvent) e);
       }
     }
   }
   return events;
 }
Exemplo n.º 7
0
 /** Resets this event manager by removing all events from the event queue. */
 public synchronized void reset() {
   currentTopEventPriority = Integer.MIN_VALUE;
   clearAllEvents(true);
   customEvents.clear();
 }
Exemplo n.º 8
0
 /** Removes all custom events from the event queue. */
 public void resetCustomEvents() {
   customEvents.clear();
 }
Exemplo n.º 9
0
 /**
  * Removes the custom event with the specified condition from the event queue.
  *
  * @param condition is the condition of the custom event to remove.
  */
 public void removeCustomEvent(Condition condition) {
   customEvents.remove(condition);
 }
Exemplo n.º 10
0
 /**
  * Adds an custom event to the event queue based on a condition.
  *
  * @param condition is the condition that must be met in order to trigger the custom event.
  */
 public void addCustomEvent(Condition condition) {
   customEvents.add(condition);
 }