Java Reference
In-Depth Information
14.3.3
The outline implementation
The project taxi-company-outline contains an outline implementation of the classes, respon-
sibilities, and collaborations that we have described as part of the design process. You are
encouraged to browse through the source code and associate the concrete classes with the cor-
responding descriptions of Section 14.2.3. Code 14.1 shows an outline of the Vehicle class from
the project.
Code 14.1
An outline of the
Vehicle class
/**
* Capture outline details of a vehicle.
*
* @author David J. Barnes and Michael Kölling
* @version 2011.07.31
*/
public abstract class Vehicle
{
private TaxiCompany company;
// Where the vehicle is.
private Location location;
// Where the vehicle is headed.
private Location targetLocation;
/**
* Constructor of class Vehicle
* @param company The taxi company. Must not be null.
* @param location The vehicle's starting point. Must not
* be null.
* @throws NullPointerException If company or location is
* null.
*/
public Vehicle(TaxiCompany company, Location location)
{
if (company == null ){
throw new NullPointerException( "company" );
}
if (location == null ){
throw new NullPointerException( "location" );
}
this .company = company;
this .location = location;
targetLocation = null ;
}
 
Search WWH ::




Custom Search