Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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();
 }
Beispiel #8
0
 /** Removes all custom events from the event queue. */
 public void resetCustomEvents() {
   customEvents.clear();
 }
Beispiel #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);
 }
Beispiel #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);
 }