All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gerken.vehicles.Location

java.lang.Object
   |
   +----gerken.vehicles.Location

public class Location
extends Object

A Location represents a position of a SimulationParticipant using two double values (x and y). A Location is able to

This software is provided on an as-is basis and is copyright Chris Gerken. The only rights granted to you are to enjoy and learn from this software.


Constructor Index

 o Location(double, double)

Return a Location object representing coordinates (x,y).

Method Index

 o addPolar(double, double)

Compute and return a Location that results from moving away from the receiver for a distance of length at an angle of angle

 o distanceFrom(Location)

Calculate and return the distance from this location to Location l

 o getVectorLength()

Return the distance from the receiver to the origin.

 o getX()

Return the X value as an double

 o getY()

Return the Y value as an double

 o intX()

Return the X value as an integer

 o intY()

Return the Y value as an integer

 o toString()

Return a text representation of the receiver.

Constructors

 o Location
 public Location(double x,
                 double y)

Return a Location object representing coordinates (x,y).

Parameters:
x - double
y - double

Methods

 o addPolar
 public void addPolar(double angle,
                      double length)

Compute and return a Location that results from moving away from the receiver for a distance of length at an angle of angle

Parameters:
angle - double
length - double
 o distanceFrom
 public double distanceFrom(Location l)

Calculate and return the distance from this location to Location l

Parameters:
l - gerken.vehicles.VehicleLocation
Returns:
double
 o getVectorLength
 public double getVectorLength()

Return the distance from the receiver to the origin.

Returns:
double
 o getX
 public double getX()

Return the X value as an double

Returns:
double
 o getY
 public double getY()

Return the Y value as an double

Returns:
double
 o intX
 public int intX()

Return the X value as an integer

Returns:
int
 o intY
 public int intY()

Return the Y value as an integer

Returns:
int
 o toString
 public String toString()

Return a text representation of the receiver.

Returns:
java.lang.String
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index