Java Reference
In-Depth Information
Code 14.1
continued
An outline of the
Vehicle class
/**
* Notify the company of our arrival at a pickup
* location.
*/
public void notifyPickupArrival()
{
company.arrivedAtPickup( this );
}
/**
* Notify the company of our arrival at a
* passenger's destination.
*/
public void notifyPassengerArrival(Passenger passenger)
{
company.arrivedAtDestination( this , passenger);
}
/**
* Receive a pickup location.
* How this is handled depends on the type of vehicle.
* @param location The pickup location.
*/
public abstract void setPickupLocation(Location location);
/**
* Receive a passenger.
* How this is handled depends on the type of vehicle.
* @param passenger The passenger.
*/
public abstract void pickup(Passenger passenger);
/**
* Get the target location.
* @return Whether or not this vehicle is free.
*/
public abstract boolean isFree();
/**
* Offload any passengers whose destination is the
* current location.
*/
public abstract void offloadPassenger();
/**
* @return Where this vehicle is currently located.
*/
Search WWH ::




Custom Search