Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## robocode
Class Event

    java.lang.Object
      robocode.Event

All Implemented Interfaces:
  Serializable, Comparable

Direct Known Subclasses:
  BattleEndedEvent, BulletHitBulletEvent, BulletHitEvent, BulletMissedEvent, CustomEvent, DeathEvent, HitByBulletEvent, HitRobotEvent, HitWallEvent, KeyEvent, MessageEvent, MouseEvent, PaintEvent, RobotDeathEvent, ScannedRobotEvent, SkippedTurnEvent, StatusEvent, WinEvent

    public abstract class Event

extends Object
implements Comparable, Serializable

The superclass of all Robocode events.

Author:
  Mathew A. Nelson (original), Flemming N. Larsen (contributor)
See Also:
  Serialized Form

Constructor Summary
`Event()` Called by the game to create a new Event.

Method Summary
`int` | `compareTo(Event event)` Compares this event to another event regarding precedence.
`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)` Could be caled by robot to assign the time to events which are not managed by game.

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 to another event regarding precedence. The event precedence is first and foremost determined by the event time, secondly the event priority, and lastly specific event information.

  This method will first compare the time of each event. If the event time is the same for both events, then this method compared the priority of each event. If the event priorities are equals, then this method will compare the two event based on specific event information.

  This method is called by the game in order to sort the event queue of a robot to make sure the events are listed in chronological order.

  Specified by:
    `compareTo` in interface `Comparable`
  Parameters:
    `event` - the event to compare to this event.
  Returns:
    a negative value if this event has higher precedence, i.e. must be listed before the specified event. A positive value if this event has a lower precedence, i.e. must be listed after the specified event. 0 means that the precedence of the two events are equal.

### 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 final long getTime()

  Returns the time this event occurred.

  Returns:
    the time this event occurred.

### setPriority

    public final 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. Could be called by robot on events which are not managed by game. If the event is added into EventQueue, the time will be overridden.

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

### setTime

    public void setTime(long newTime)

  Could be caled by robot to assign the time to events which are not managed by game. If the event is added into EventQueue, the time could be overriden

  Parameters:
    `newTime` - the time this event occurred

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 Robocode. All Rights Reserved.