View Javadoc
1   package org.opentrafficsim.core.network.lane;
2   
3   import java.io.Serializable;
4   import java.rmi.RemoteException;
5   
6   import org.opentrafficsim.core.gtu.RelativePosition;
7   import org.opentrafficsim.core.gtu.lane.LaneBasedGTU;
8   import org.opentrafficsim.core.unit.LengthUnit;
9   import org.opentrafficsim.core.value.vdouble.scalar.DoubleScalar;
10  
11  /**
12   * <p>
13   * Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
15   * <p>
16   * @version Dec 31, 2014 <br>
17   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
18   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
19   */
20  public interface Sensor extends Serializable, Comparable<Sensor>
21  {
22      /** @return The lane for which this is a sensor. */
23      Lane getLane();
24  
25      /** @return the position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane. */
26      DoubleScalar.Abs<LengthUnit> getLongitudinalPosition();
27  
28      /** @return the position as a double in SI units for quick sorting and sensor triggering. */
29      double getLongitudinalPositionSI();
30  
31      /** @return the relative position type of the vehicle (e.g., FRONT, BACK) that triggers the sensor. */
32      RelativePosition.TYPE getPositionType();
33  
34      /**
35       * Trigger an action on the GTU. Normally this is the GTU that triggered the sensor. The typical call therefore is
36       * <code>sensor.trigger(this);</code>.
37       * @param gtu the GTU for which to carry out the trigger action.
38       * @throws RemoteException on communications failure
39       */
40      void trigger(LaneBasedGTU<?> gtu) throws RemoteException;
41  }