|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--hw6.Vehicle | +--hw6.LocatedVehicle | +--hw6.TransitBus
This class implements a TransitBus, which is a LocatedVehicle with an integer route number.
Field Summary |
Fields inherited from class hw6.Vehicle |
vin |
Constructor Summary | |
TransitBus(int vin,
double lat,
double lon,
int r)
Create a new TransitBus object with the given vehicle id number, located at the given location, with the given route number. |
Method Summary | |
java.lang.Object |
clone()
Create a copy of this TransitBus object. |
int |
getRoute()
Get the route number for this TransitBus. |
void |
setRoute(int r)
Set the route number for this TransitBus. |
java.lang.String |
toString()
Provide a String representation of this TransitBus. |
Methods inherited from class hw6.LocatedVehicle |
distanceTo, getLocation, setLocation, setLocation |
Methods inherited from class hw6.Vehicle |
compareTo, equals, getVIN, hashCode, main |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TransitBus(int vin, double lat, double lon, int r)
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.r
- the route number for this bus.Method Detail |
public int getRoute()
public void setRoute(int r)
r
- the new route numberpublic java.lang.String toString()
toString
in class LocatedVehicle
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class LocatedVehicle
java.lang.CloneNotSupportedException
- but this should never happen
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |