robocode
Class Event

java.lang.Object
  extended by robocode.Event
All Implemented Interfaces:
java.lang.Comparable<Event>
Direct Known Subclasses:
BulletHitBulletEvent, BulletHitEvent, BulletMissedEvent, CustomEvent, DeathEvent, HitByBulletEvent, HitRobotEvent, HitWallEvent, MessageEvent, RobotDeathEvent, ScannedRobotEvent, SkippedTurnEvent, WinEvent

public class Event
extends java.lang.Object
implements java.lang.Comparable<Event>

The superclass of all Robocode events.

Author:
Mathew A. Nelson (original), Flemming N. Larsen (contributor)

Constructor Summary
Event()
          Called by the game to create a new Event.
 
Method Summary
 int compareTo(Event event)
          Compares this event with another event, but only based on the priority and time of the two events.
 int getPriority()
          Returns the priority of this event.
 long getTime()
          Returns the time this event occurred.
 void setPriority(int newPriority)
          Called by the game to set the priority of an event to the priority your robot specified for this type of event (or the default priority).
 void setTime(long newTime)
          Called by the game to set the time this event occurred.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Event

public Event()
Called by the game to create a new Event.

Method Detail

compareTo

public int compareTo(Event event)
Compares this event with another event, but only based on the priority and time of the two events.

This call is called by the game in order to sort events based on the priority and time.

Specified by:
compareTo in interface java.lang.Comparable<Event>
Parameters:
event - the event to compare to this event
Returns:
a negative integer, zero, or a positive integer as this event has a lower priority, same priority, or greater priority than the specified event

getPriority

public int getPriority()
Returns the priority of this event. An event priority is a value from 0 - 99. The higher value, the higher priority. The default priority is 80.

Returns:
the priority of this event

getTime

public long getTime()
Returns the time this event occurred.

Returns:
the time this event occurred

setPriority

public void setPriority(int newPriority)
Called by the game to set the priority of an event to the priority your robot specified for this type of event (or the default priority).

An event priority is a value from 0 - 99. The higher value, the higher priority. The default priority is 80.

Parameters:
newPriority - the new priority of this event
See Also:
AdvancedRobot.setEventPriority(java.lang.String, int)

setTime

public void setTime(long newTime)
Called by the game to set the time this event occurred.

Parameters:
newTime - the time this event occured