MATSIM
TransitQVehicle.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * VehicleImpl.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2008 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 
21 package org.matsim.core.mobsim.qsim.pt;
22 
24 import org.matsim.vehicles.Vehicle;
26 
27 
28 public class TransitQVehicle extends QVehicleImpl implements TransitVehicle {
29 
31 
32  public TransitQVehicle(final Vehicle basicVehicle) {
33  super(basicVehicle);
34 
35  VehicleCapacity capacity = basicVehicle.getType().getCapacity();
36  if (capacity == null) {
37  throw new NullPointerException("No capacity set in vehicle type.");
38  }
39  // New default is that vehicle is created with capacity. Initial values are 1 seat for the driver and no standing room {@link org.matsim.vehicles.VehicleCapacity} (sep 19, KMT)
40  // PT does not count the driver, so only warn if there is indeed no real capacity (mar 21, mrieser)
41  if (capacity.getSeats() == 0 && capacity.getStandingRoom() == 0) {
42  throw new NullPointerException("No capacity set in vehicle type.");
43  }
44  }
45 
46  public void setStopHandler(TransitStopHandler stopHandler) {
47  this.stopHandler = stopHandler;
48  }
49 
50  @Override
52  return this.stopHandler;
53  }
54 
55 }
final VehicleCapacity getCapacity()
void setStopHandler(TransitStopHandler stopHandler)