1 package org.opentrafficsim.road.network.lane.object.trafficlight;
2
3 import org.djunits.value.vdouble.scalar.Length;
4 import org.djutils.exceptions.Throw;
5 import org.opentrafficsim.core.dsol.OTSSimulatorInterface;
6 import org.opentrafficsim.core.network.NetworkException;
7 import org.opentrafficsim.road.network.lane.CrossSectionElement;
8 import org.opentrafficsim.road.network.lane.Lane;
9
10
11
12
13
14
15
16
17
18
19
20
21 public class SimpleTrafficLight extends AbstractTrafficLight
22 {
23
24 private static final long serialVersionUID = 201601001L;
25
26
27
28
29
30
31
32
33 public SimpleTrafficLight(final String id, final Lane lane, final Length longitudinalPosition,
34 final OTSSimulatorInterface simulator) throws NetworkException
35 {
36 super(id, lane, longitudinalPosition, simulator);
37 }
38
39
40 @Override
41 @SuppressWarnings("checkstyle:designforextension")
42 public String toString()
43 {
44 return "SimpleTrafficLight [trafficLightColor=" + getTrafficLightColor() + "]";
45 }
46
47
48 @Override
49 @SuppressWarnings("checkstyle:designforextension")
50 public SimpleTrafficLight clone(final CrossSectionElement newCSE, final OTSSimulatorInterface newSimulator)
51 throws NetworkException
52 {
53 Throw.when(!(newCSE instanceof Lane), NetworkException.class, "traffic lights can only be cloned for Lanes");
54 Throw.when(!(newSimulator instanceof OTSSimulatorInterface), NetworkException.class,
55 "simulator should be a DEVSSimulator");
56 return new SimpleTrafficLight(getId(), (Lane) newCSE, getLongitudinalPosition(),
57 (OTSSimulatorInterface) newSimulator);
58 }
59
60 }