hockey.api
Class Position

java.lang.Object
  |
  +--hockey.api.Position
All Implemented Interfaces:
IObject

public class Position
extends java.lang.Object
implements IObject

An IObject implementation that represents a position on the ice. It may also have heading and speed.

See Also:
IObject

Constructor Summary
Position(int x, int y)
          Creates a new Position from a given position, with zero heading and speed.
Position(int x, int y, int heading, int speed)
          Creates a new Position from a given position, heading and speed.
Position(IObject o)
          Creates a new Position from a given IObject's current position, heading and speed.
 
Method Summary
 int getHeading()
          Returns the absolute heading in degrees.
 int getSpeed()
          Returns the speed in cm/s.
 int getX()
          Returns the x-coordinate in cm.
 int getY()
          Returns the y-coordinate in cm.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Position

public Position(IObject o)
Creates a new Position from a given IObject's current position, heading and speed.

Parameters:
o - the IObject that the position, heading and speed is copied from.

Position

public Position(int x,
                int y)
Creates a new Position from a given position, with zero heading and speed.

Parameters:
x - the x-coordinate of the position, in cm.
y - the y-coordinate of the position, in cm.

Position

public Position(int x,
                int y,
                int heading,
                int speed)
Creates a new Position from a given position, heading and speed.

Parameters:
x - the x-coordinate of the position, in cm.
y - the y-coordinate of the position, in cm.
heading - the Position's heading, in degrees.
speed - the Position's speed, in cm/s.
Method Detail

getX

public int getX()
Description copied from interface: IObject
Returns the x-coordinate in cm.

Specified by:
getX in interface IObject
Returns:
the x-coordinate, in cm.

getY

public int getY()
Description copied from interface: IObject
Returns the y-coordinate in cm.

Specified by:
getY in interface IObject
Returns:
the y-coordinate, in cm.

getHeading

public int getHeading()
Description copied from interface: IObject
Returns the absolute heading in degrees.

Specified by:
getHeading in interface IObject
Returns:
the absolute heading, in degrees.

getSpeed

public int getSpeed()
Description copied from interface: IObject
Returns the speed in cm/s.

Specified by:
getSpeed in interface IObject
Returns:
the speed, in cm/s.