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 CustomEvent

    java.lang.Object
      robocode.Event
          robocode.CustomEvent

All Implemented Interfaces:
  java.lang.Comparable<Event>

    public class CustomEvent

extends Event

This event is sent to `onCustomEvent` when a custom condition is met. Be sure to reset or remove the custom condition to avoid having it reoccuring repeatedly.

Author:
  Mathew A. Nelson (original)
See Also:
  `getCondition()`

Constructor Summary
`CustomEvent(Condition condition)` Called by the game to create a new CustomEvent when a condition is met.
`CustomEvent(Condition condition, int priority)` Called by the game to create a new CustomEvent when a condition is met.

Method Summary
`Condition` | `getCondition()` Returns the condition that fired, causing this event to be generated.

Methods inherited from class robocode.Event
`compareTo, getPriority, getTime, setPriority, setTime`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CustomEvent

    public CustomEvent(Condition condition)

  Called by the game to create a new CustomEvent when a condition is met.

  Parameters:
    `condition` - the condition that must be met

### CustomEvent

    public CustomEvent(Condition condition,
                       int priority)

  Called by the game to create a new CustomEvent when a condition is met. The event will have the given priority. An event priority is a value from 0 - 99. The higher value, the higher priority. The default priority is 80.

  This is equivalent to calling `Condition.setPriority(int)` on the Condition.

  Parameters:
    `condition` - the condition that must be met
    `priority` - the priority of the condition

Method Detail

### getCondition

    public Condition getCondition()

  Returns the condition that fired, causing this event to be generated. Use this to determine which condition fired, and to remove the custom event.

         public void onCustomEvent(CustomEvent event) {
             if (event.getCondition().getName().equals("mycondition")) {
                 removeCustomEvent(event.getCondition());
                 doSomethingElse();
             }
         }

  Returns:
    the condition that fired, causing this event to be generated

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