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