View Javadoc
1   package org.opentrafficsim.road.network.lane.object.trafficlight;
2   
3   import java.rmi.RemoteException;
4   
5   import javax.naming.NamingException;
6   
7   import org.djunits.value.vdouble.scalar.Length;
8   import org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface;
9   import org.opentrafficsim.core.dsol.OTSSimulatorInterface;
10  import org.opentrafficsim.core.network.NetworkException;
11  import org.opentrafficsim.road.network.lane.CrossSectionElement;
12  import org.opentrafficsim.road.network.lane.Lane;
13  
14  /**
15   * Standard implementation of a traffic light.
16   * <p>
17   * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
18   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
19   * </p>
20   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
21   * initial version Nov 30, 2015 <br>
22   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
23   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
24   */
25  public class SimpleTrafficLight extends AbstractTrafficLight
26  {
27      /** */
28      private static final long serialVersionUID = 201601001L;
29  
30      /**
31       * @param id traffic light id
32       * @param lane lane where the traffic light is located
33       * @param longitudinalPosition position of the traffic light on the lane, in the design direction
34       * @param simulator the simulator for animation and timed events
35       * @throws NetworkException on failure to place the object
36       */
37      public SimpleTrafficLight(final String id, final Lane lane, final Length longitudinalPosition,
38              final OTSDEVSSimulatorInterface simulator) throws NetworkException
39      {
40          super(id, lane, longitudinalPosition, simulator);
41  
42          try
43          {
44              new TrafficLightAnimation(this, simulator);
45          }
46          catch (RemoteException | NamingException exception)
47          {
48              throw new NetworkException(exception);
49          }
50      }
51  
52      /** {@inheritDoc} */
53      @Override
54      @SuppressWarnings("checkstyle:designforextension")
55      public String toString()
56      {
57          return "SimpleTrafficLight [trafficLightColor=" + getTrafficLightColor() + "]";
58      }
59  
60      /** {@inheritDoc} */
61      @Override
62      @SuppressWarnings("checkstyle:designforextension")
63      public SimpleTrafficLight clone(final CrossSectionElement newCSE, final OTSSimulatorInterface newSimulator,
64              final boolean animation) throws NetworkException
65      {
66          // TODO
67          return null;
68      }
69  
70  }