View Javadoc

1   /*
2    * @(#)StationControlPoint.java May 31, 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.station;
12  
13  import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
14  import nl.tudelft.simulation.traffic.controlpoint.virtual.VirtualControlPoint;
15  import nl.tudelft.simulation.traffic.track.TrackInterface;
16  import nl.tudelft.simulation.traffic.vehicle.VehiclePhysicalInterface;
17  
18  /***
19   * This class implements red, yellow and green virtual control points for the
20   * BlockTrafficLights <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 May 31, 2004 <br>
29   * @author <a
30   * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
31   * Verbraeck </a>
32   */
33  public class StationControlPoint extends VirtualControlPoint
34  {
35      /*** object to call when sensor is triggered */
36      private StationHaltingTrafficLight callBack;
37  
38      /*** which sensor is this? */
39      private int sensor;
40  
41      /***
42       * @param track
43       * @param progression
44       * @param callBack
45       * @param sensor
46       * @param simulator
47       */
48      public StationControlPoint(final TrackInterface track,
49              final double progression,
50              final StationHaltingTrafficLight callBack, final int sensor,
51              final SimulatorInterface simulator)
52      {
53          super(track, progression, simulator);
54          this.callBack = callBack;
55          this.sensor = sensor;
56      }
57  
58      /***
59       * @see nl.tudelft.simulation.traffic.controlpoint.ControlPointInterface#pass(nl.tudelft.simulation.traffic.vehicle.VehiclePhysicalInterface)
60       */
61      public void pass(final VehiclePhysicalInterface vehicle)
62      {
63          this.callBack.triggerSensor(this.sensor, vehicle);
64      }
65  }