public class TrafficLightSensor extends EventProducer implements EventListenerInterface, NonDirectionalOccupancySensor, EventProducerInterface, Locatable, Sensor
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
listeners
NON_DIRECTIONAL_OCCUPANCY_SENSOR_TRIGGER_ENTRY_EVENT, NON_DIRECTIONAL_OCCUPANCY_SENSOR_TRIGGER_EXIT_EVENT
FIRST_POSITION, LAST_POSITION
Constructor and Description |
---|
TrafficLightSensor(String id,
Lane laneA,
Length positionA,
Lane laneB,
Length positionB,
List<Lane> intermediateLanes,
RelativePosition.TYPE entryPosition,
RelativePosition.TYPE exitPosition,
DEVSSimulatorInterface.TimeDoubleUnit simulator,
Compatible compatible)
Construct a new traffic light sensor.
TODO Possibly provide the GTUTypes that trigger the sensor as an argument for the constructor |
Modifier and Type | Method and Description |
---|---|
protected void |
addGTU(LaneBasedGTU gtu)
Add a GTU to the set.
|
javax.media.j3d.Bounds |
getBounds() |
String |
getId() |
Length |
getLanePositionA()
Return the A position of this NonDirectionalOccupancySensor.
|
Length |
getLanePositionB()
Return the B position of this NonDirectionalOccupancySensor.
|
DirectedPoint |
getLocation() |
boolean |
getOccupancy()
Return the state of this traffic light sensor.
|
OTSLine3D |
getPath()
Return the path of this traffic light sensor.
|
RelativePosition.TYPE |
getPositionTypeEntry() |
RelativePosition.TYPE |
getPositionTypeExit() |
DEVSSimulatorInterface.TimeDoubleUnit |
getSimulator() |
void |
notify(EventInterface event) |
protected void |
removeGTU(LaneBasedGTU gtu)
Remove a GTU from the set.
|
void |
signalDetection(FlankSensor sensor,
LaneBasedGTU gtu)
One of our flank sensors has triggered.
|
String |
toString() |
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, addListener, addListener, addListener, removeListener
public TrafficLightSensor(String id, Lane laneA, Length positionA, Lane laneB, Length positionB, List<Lane> intermediateLanes, RelativePosition.TYPE entryPosition, RelativePosition.TYPE exitPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator, Compatible compatible) throws NetworkException
id
- String; id of this sensorlaneA
- Lane; the lane of the A detection point of this traffic light sensorpositionA
- Length; the position of the A detection point of this traffic light sensorlaneB
- Lane; the lane of the B detection point of this traffic light sensorpositionB
- Length; the position of the B detection point of this traffic light sensorintermediateLanes
- List<Lane>; list of intermediate lanesentryPosition
- TYPE; the position on the GTUs that trigger the entry eventsexitPosition
- TYPE; the position on the GTUs that trigger the exit eventssimulator
- DEVSSimulatorInterface.TimeDoubleUnit; the simulatorcompatible
- Compatible; object that checks that the detector detects a GTU.NetworkException
- when the network is inconsistent.protected final void addGTU(LaneBasedGTU gtu)
gtu
- LaneBasedGTU; the GTU that must be addedprotected final void removeGTU(LaneBasedGTU gtu)
gtu
- LaneBasedGTU; the GTU that must be removedpublic final void notify(EventInterface event) throws RemoteException
notify
in interface EventListenerInterface
RemoteException
public final RelativePosition.TYPE getPositionTypeEntry()
getPositionTypeEntry
in interface NonDirectionalOccupancySensor
public final RelativePosition.TYPE getPositionTypeExit()
getPositionTypeExit
in interface NonDirectionalOccupancySensor
public final Length getLanePositionA()
getLanePositionA
in interface NonDirectionalOccupancySensor
public final Length getLanePositionB()
getLanePositionB
in interface NonDirectionalOccupancySensor
public final void signalDetection(FlankSensor sensor, LaneBasedGTU gtu)
sensor
- FlankSensor; the sensor that was triggeredgtu
- LaneBasedGTU; the gtu that triggered the flank sensorpublic final String getId()
getId
in interface Identifiable
getId
in interface NonDirectionalOccupancySensor
public final DEVSSimulatorInterface.TimeDoubleUnit getSimulator()
getSimulator
in interface NonDirectionalOccupancySensor
public final DirectedPoint getLocation() throws RemoteException
getLocation
in interface Locatable
RemoteException
public final javax.media.j3d.Bounds getBounds() throws RemoteException
getBounds
in interface Locatable
RemoteException
public final OTSLine3D getPath()
public final boolean getOccupancy()
Copyright © 2014–2019 Delft University of Technology. All rights reserved.