View Javadoc

1   /*
2    * @(#)VehicleControl.java Jul 4, 2004
3    * 
4    * Copyright (c) 2003, 2004 Delft University of Technology Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  
11  package nl.tudelft.simulation.traffic.vehicle;
12  
13  import java.rmi.RemoteException;
14  import nl.tudelft.simulation.dsol.simulators.DEVDESSSimulatorInterface;
15  import nl.tudelft.simulation.event.EventInterface;
16  import nl.tudelft.simulation.event.EventProducer;
17  import nl.tudelft.simulation.traffic.track.TrackInterface;
18  
19  /***
20   * <br>
21   * (c) copyright 2003-2004 <a href="http://www.simulation.tudelft.nl">Delft
22   * University of Technology </a>, the Netherlands. <br>
23   * See for project information <a href="http://www.simulation.tudelft.nl">
24   * www.simulation.tudelft.nl </a> <br>
25   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
26   * License (GPL) </a>, no warranty <br>
27   * 
28   * @version Jul 4, 2004 <br>
29   * @author <a
30   * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
31   * Verbraeck </a>
32   */
33  public class VehicleControl extends EventProducer
34          implements
35              VehicleControlInterface
36  {
37      /*** the physical vehicle */
38      private VehiclePhysicalInterface vehiclePhysical;
39  
40      /*** the line id */
41      private String line;
42  
43      /***
44       * @param line
45       *  
46       */
47      public VehicleControl(final String line)
48      {
49          this.line = line;
50      }
51  
52      /***
53       * @param track
54       * @param progression
55       * @param maxSpeedStart
56       * @param simulator
57       * @param vehicleType
58       * @param line
59       * @throws Exception
60       */
61      public VehicleControl(final TrackInterface track, final double progression,
62              final double maxSpeedStart,
63              final DEVDESSSimulatorInterface simulator,
64              final VehicleType vehicleType, final String line) throws Exception
65      {
66          this.line = line;
67          this.vehiclePhysical = new VehiclePhysical(vehicleType, this, track,
68                  progression, maxSpeedStart, simulator);
69      }
70  
71      /***
72       * @see nl.tudelft.simulation.traffic.vehicle.VehicleControlInterface#startDriving()
73       */
74      public void startDriving()
75      {
76          this.vehiclePhysical.startDriving();
77      }
78  
79      /***
80       * @see nl.tudelft.simulation.traffic.vehicle.VehicleControlInterface#getVehiclePhysical()
81       */
82      public VehiclePhysicalInterface getVehiclePhysical()
83      {
84          return this.vehiclePhysical;
85      }
86  
87      /***
88       * @see nl.tudelft.simulation.traffic.vehicle.VehicleControlInterface#setVehiclePhysical(nl.tudelft.simulation.traffic.vehicle.VehiclePhysicalInterface)
89       */
90      public synchronized void setVehiclePhysical(
91              VehiclePhysicalInterface vehiclePhysical) throws Exception
92      {
93          this.vehiclePhysical = vehiclePhysical;
94      }
95  
96      /***
97       * @return Returns the line.
98       */
99      public String getLine()
100     {
101         return this.line;
102     }
103 
104     /***
105      * @see nl.tudelft.simulation.traffic.vehicle.VehicleControlInterface#removeVehicle()
106      */
107     public void removeVehicle() throws RemoteException
108     {
109         //
110     }
111 
112     /***
113      * @see nl.tudelft.simulation.event.EventListenerInterface#notify(nl.tudelft.simulation.event.EventInterface)
114      */
115     public void notify(EventInterface event) throws RemoteException
116     {
117         //
118     }
119 }