1 package org.opentrafficsim.road.network.lane;
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.gtu.RelativePosition;
10 import org.opentrafficsim.road.gtu.lane.LaneBasedGTU;
11
12
13
14
15
16
17
18
19
20
21
22
23
24 public class SinkSensor extends AbstractSensor
25 {
26
27 private static final long serialVersionUID = 20150130L;
28
29
30
31
32
33
34 public SinkSensor(final Lane lane, final Length.Rel position, final OTSDEVSSimulatorInterface simulator)
35 {
36 super(lane, position, RelativePosition.FRONT, "SINK@" + lane.toString(), simulator);
37 try
38 {
39 new SinkAnimation(this, simulator);
40 }
41 catch (RemoteException | NamingException exception)
42 {
43 exception.printStackTrace();
44 }
45 }
46
47
48 @Override
49 public void trigger(final LaneBasedGTU gtu)
50 {
51 gtu.destroy();
52 }
53
54
55 @Override
56 public String toString()
57 {
58 return "SinkSensor [Lane=" + this.getLane() + "]";
59 }
60 }