|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Vehicle | +--LocatedVehicle
This class implements the ability to give a Vehicle a Location.
Constructor Summary | |
LocatedVehicle(int vin,
double lat,
double lon)
Create a new LocatedVehicle object with the given vehicle id number and located at the given location. |
Method Summary | |
double |
distanceTo(Locatable other)
Calculate the distance to another Locatable object |
Location |
getLocation()
Return a reference to a copy of the Location object describing our current position. |
void |
setLocation(double lat,
double lon)
Set the values of our current Location by copying them from the arguments provided. |
void |
setLocation(Location loc)
Set the values of our current Location by copying them from the given Location object. |
Methods inherited from class Vehicle |
compareTo, equals, getVIN, hashCode, main, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LocatedVehicle(int vin, double lat, double lon)
vin
- the vehicle id numberlat
- the latitude where this Vehicle is located. Must
satisfy the constraints defined by the Location class.lon
- the longitude where this Vehicle is located. Must
satisfy the constraints defined by the Location class.Method Detail |
public Location getLocation()
getLocation
in interface Locatable
public void setLocation(Location loc)
setLocation
in interface Locatable
loc
- the Location to copy frompublic void setLocation(double lat, double lon)
setLocation
in interface Locatable
lat
- the new latitude valuelon
- the new longitude valuepublic double distanceTo(Locatable other)
distanceTo
in interface Locatable
other
- the other Location
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |