robocode
Class ScannedShipEvent

java.lang.Object
  extended by robocode.Event
      extended by robocode.ScannedShipEvent
All Implemented Interfaces:
Serializable, Comparable<Event>

public class ScannedShipEvent
extends Event

Extension on ScannedRobotEvent

Since:
1.8.3.0 Alpha 1
Version:
0.1
Author:
Thales B.V. / Jiri Waning / Thomas Hakkers
See Also:
Serialized Form

Field Summary
protected  double distance
           
protected  double energy
           
protected  double heading
           
protected  String name
           
protected  double velocity
           
 
Constructor Summary
ScannedShipEvent(String name, double energy, double bearingFront, double bearingBack, double bearingRadar, double distance, double heading, double velocity)
          Called by the game to create a new ScannedShipEvent.
 
Method Summary
 int compareTo(Event event)
          Compares this event to another event regarding precedence.
 double getBearingBack()
          Returns the bearing to the robot you scanned, measured from the back weapon; relative to your robot's back weapon zero (absolute south!)
 double getBearingBackRadians()
          Returns the bearing to the robot you scanned, measured from the back weapon; relative to your robot's back weapon zero (absolute south!)
 double getBearingDegrees()
           
 double getBearingFront()
          Returns the bearing to the ship you scanned, measured from the front weapon; relative to your ship's front weapon zero (absolute north!)
 double getBearingFrontRadians()
          Returns the bearing to the robot you scanned, measured from the front weapon; relative to your robot's front weapon zero (absolute north!)
 double getBearingRadians()
           
 double getDistance()
          Returns the distance to the other ship's origin.
 double getEnergy()
          Returns the energy of the ship.
 double getHeading()
          Returns the heading of the ship, in degrees. (0 <= getHeading() < 360)
 double getHeadingRadians()
          Returns the heading of the ship, in radians. (0 <= getHeading() < TWO_PI)
 String getName()
          Returns the name of the ship.
 double getVelocity()
          Returns the velocity of the ship.
 
Methods inherited from class robocode.Event
getPriority, getTime, setPriority, setTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final String name

energy

protected final double energy

heading

protected final double heading

distance

protected final double distance

velocity

protected final double velocity
Constructor Detail

ScannedShipEvent

public ScannedShipEvent(String name,
                        double energy,
                        double bearingFront,
                        double bearingBack,
                        double bearingRadar,
                        double distance,
                        double heading,
                        double velocity)
Called by the game to create a new ScannedShipEvent.

Parameters:
name - The name of the scanned ship.
energy - The energy of the scanned ship.
bearingFront - The bearing of the scanned ship, in radians, for the weapon on the front end.
bearingBack - The bearing of the scanned ship, in radians, for the weapon on the back end.
bearingRadar - The bearing of the scanned ship, in radians, for the radar.
distance - The distance from your ship to the scanned ship.
heading - The heading of the scanned ship.
velocity - The velocity of the scanned ship.
Method Detail

getBearingFront

public double getBearingFront()
Returns the bearing to the ship you scanned, measured from the front weapon; relative to your ship's front weapon zero (absolute north!), in degrees (-180 <= getBearing() < 180)

Returns:
The bearing to the ship you scanned, in degrees, measured from the front weapon.

getBearingFrontRadians

public double getBearingFrontRadians()
Returns the bearing to the robot you scanned, measured from the front weapon; relative to your robot's front weapon zero (absolute north!), in radians (-PI <= getBearing() < PI)

Returns:
The bearing to the robot you scanned, in radians, measured from the front weapon.

getBearingBack

public double getBearingBack()
Returns the bearing to the robot you scanned, measured from the back weapon; relative to your robot's back weapon zero (absolute south!), in degrees (-180 <= getBearing() < 180)

Returns:
The bearing to the robot you scanned, in degrees, measured from the back weapon.

getBearingBackRadians

public double getBearingBackRadians()
Returns the bearing to the robot you scanned, measured from the back weapon; relative to your robot's back weapon zero (absolute south!), in radians (-PI <= getBearing() < PI)

Returns:
The bearing to the robot you scanned, in radians, measured from the back weapon.

getDistance

public double getDistance()
Returns the distance to the other ship's origin. (Your center to his center.)

Returns:
The distance to the other ship's origin.

getEnergy

public double getEnergy()
Returns the energy of the ship.

Returns:
The energy of the ship.

getHeading

public double getHeading()
Returns the heading of the ship, in degrees. (0 <= getHeading() < 360)

Returns:
The heading of the ship, in degrees.

getHeadingRadians

public double getHeadingRadians()
Returns the heading of the ship, in radians. (0 <= getHeading() < TWO_PI)

Returns:
The heading of the ship, in radians.

getBearingRadians

public double getBearingRadians()

getBearingDegrees

public double getBearingDegrees()

getName

public String getName()
Returns the name of the ship.

Returns:
The name of the ship.

getVelocity

public double getVelocity()
Returns the velocity of the ship.

Returns:
The velocity of the ship.

compareTo

public final 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<Event>
Overrides:
compareTo in class Event
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.


Copyright © 2015 Robocode. All Rights Reserved.