Class TransitBus
java.lang.Object
|
+--Vehicle
|
+--LocatedVehicle
|
+--TransitBus
- All Implemented Interfaces:
- java.lang.Comparable, Locatable
- public class TransitBus
- extends LocatedVehicle
This class implements a TransitBus, which is a LocatedVehicle with
an integer route number.
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 |
int |
getRoute()
Get the route number for this TransitBus. |
void |
setRoute(int r)
Set the route number for this TransitBus. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
TransitBus
public 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.
Use the super class constructor in order to do this, using the
constructor super(...).
- Parameters:
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.
getRoute
public int getRoute()
- Get the route number for this TransitBus.
- Returns:
- the route number
setRoute
public void setRoute(int r)
- Set the route number for this TransitBus.
- Parameters:
r
- the new route number