nl.tudelft.simulation.traffic.controlpoint.blocks
Class BlockTrafficLight

java.lang.Object
  extended bynl.tudelft.simulation.event.EventProducer
      extended bynl.tudelft.simulation.traffic.controlpoint.real.AbstractVisibleControlPoint
          extended bynl.tudelft.simulation.traffic.controlpoint.blocks.BlockTrafficLight
All Implemented Interfaces:
Changeable, ControlPointInterface, nl.tudelft.simulation.event.EventProducerInterface, nl.tudelft.simulation.dsol.animation.LocatableInterface, java.io.Serializable, StopSignInterface, VisibleControlPointInterface

public class BlockTrafficLight
extends AbstractVisibleControlPoint
implements nl.tudelft.simulation.dsol.animation.LocatableInterface, StopSignInterface


(c) copyright 2003-2004 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: General Public License (GPL) , no warranty

Version:
May 31, 2004
Author:
Alexander Verbraeck
See Also:
Serialized Form

Field Summary
static int SENSOR_GREEN
          GREEN sensor
static int SENSOR_RED
          RED sensor
static int SENSOR_YELLOW
          YELLOW sensor
static java.lang.String[] sensorNames
          sensor names
static java.lang.String STATE_BLACK
          BLACK state
static java.lang.String STATE_GREEN
          GREEN state
static java.lang.String STATE_RED
          RED state
static java.lang.String STATE_YELLOW
          YELLOW state
 
Fields inherited from class nl.tudelft.simulation.traffic.controlpoint.real.AbstractVisibleControlPoint
progression, track
 
Fields inherited from class nl.tudelft.simulation.event.EventProducer
listeners
 
Fields inherited from interface nl.tudelft.simulation.traffic.controlpoint.real.StopSignInterface
CONTINUE, STOP
 
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
 
Fields inherited from interface nl.tudelft.simulation.traffic.controlpoint.ControlPointInterface
BACK, FRONT
 
Fields inherited from interface nl.tudelft.simulation.traffic.controlpoint.real.Changeable
CHANGE_STATUS_EVENT
 
Constructor Summary
BlockTrafficLight(java.lang.String name, TrackInterface track, double progression, double visibleDistance, double distanceRed, double distanceYellow, double distanceGreen, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface simulator, double dx, double dy)
           
 
Method Summary
 javax.media.j3d.Bounds getBounds()
           
 java.lang.String getCurrentState()
           
 nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
           
 java.lang.String getStatus()
           
 void pass(VehiclePhysicalInterface vehicle)
          This method handles actions of the controlPoint when the controlPoint is passed by a vehicle.
 java.lang.String toString()
           
 void triggerSensor(int sensor, VehiclePhysicalInterface vehicle)
          The stateful handling of a sensor trigger.
 
Methods inherited from class nl.tudelft.simulation.traffic.controlpoint.real.AbstractVisibleControlPoint
getProgression, getTrack, getVisibleDistance
 
Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getEventTypes, removeAllListeners, removeAllListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface nl.tudelft.simulation.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypes, removeListener
 
Methods inherited from interface nl.tudelft.simulation.traffic.controlpoint.real.VisibleControlPointInterface
getVisibleDistance
 
Methods inherited from interface nl.tudelft.simulation.traffic.controlpoint.ControlPointInterface
getProgression, getTrack
 

Field Detail

STATE_GREEN

public static final java.lang.String STATE_GREEN
GREEN state

See Also:
Constant Field Values

STATE_YELLOW

public static final java.lang.String STATE_YELLOW
YELLOW state

See Also:
Constant Field Values

STATE_RED

public static final java.lang.String STATE_RED
RED state

See Also:
Constant Field Values

STATE_BLACK

public static final java.lang.String STATE_BLACK
BLACK state

See Also:
Constant Field Values

SENSOR_GREEN

public static final int SENSOR_GREEN
GREEN sensor

See Also:
Constant Field Values

SENSOR_YELLOW

public static final int SENSOR_YELLOW
YELLOW sensor

See Also:
Constant Field Values

SENSOR_RED

public static final int SENSOR_RED
RED sensor

See Also:
Constant Field Values

sensorNames

public static final java.lang.String[] sensorNames
sensor names

Constructor Detail

BlockTrafficLight

public BlockTrafficLight(java.lang.String name,
                         TrackInterface track,
                         double progression,
                         double visibleDistance,
                         double distanceRed,
                         double distanceYellow,
                         double distanceGreen,
                         nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface simulator,
                         double dx,
                         double dy)
Parameters:
name -
track -
progression -
visibleDistance -
distanceRed -
distanceYellow -
distanceGreen -
simulator -
dx -
dy -
Method Detail

triggerSensor

public void triggerSensor(int sensor,
                          VehiclePhysicalInterface vehicle)
The stateful handling of a sensor trigger. Works as follows:

 
  
   
    
     
            -------------------------------
            | OLD___ | SENSOR___ | NEW___ |
            | STATE_ | R | Y | G | STATE_ |
            -------------------------------
            | BLACK_ | X | X | X | BLACK_ | (error)
            -------------------------------
            | RED___ | X | . | . | BLACK_ | (error)
            | RED___ | . | X | . | YELLOW |
            | RED___ | . | . | X | RED___ |
            -------------------------------
            | YELLOW | X | . | . | RED___ |
            | YELLOW | . | X | . | BLACK_ | (error)
            | YELLOW | . | . | X | GREEN_ |
            -------------------------------
            | GREEN_ | X | . | . | RED___ |
            | GREEN_ | . | X | . | BLACK_ | (error)
            | GREEN_ | . | . | X | BLACK_ | (error)
            -------------------------------
           
      
     
    
   
  
 

Parameters:
sensor -
vehicle -

pass

public void pass(VehiclePhysicalInterface vehicle)
Description copied from interface: ControlPointInterface
This method handles actions of the controlPoint when the controlPoint is passed by a vehicle.

Specified by:
pass in interface ControlPointInterface
Parameters:
vehicle - that triggers the controlPoint
See Also:
ControlPointInterface.pass(nl.tudelft.simulation.traffic.vehicle.VehiclePhysicalInterface)

getLocation

public nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
                                                            throws java.rmi.RemoteException
Specified by:
getLocation in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
Overrides:
getLocation in class AbstractVisibleControlPoint
Throws:
java.rmi.RemoteException
See Also:
LocatableInterface.getLocation()

getBounds

public javax.media.j3d.Bounds getBounds()
                                 throws java.rmi.RemoteException
Specified by:
getBounds in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
Overrides:
getBounds in class AbstractVisibleControlPoint
Throws:
java.rmi.RemoteException
See Also:
LocatableInterface.getBounds()

getCurrentState

public java.lang.String getCurrentState()
Returns:
Returns the currentState.

getStatus

public java.lang.String getStatus()
Specified by:
getStatus in interface Changeable
Returns:
status
See Also:
Changeable.getStatus()

toString

public java.lang.String toString()
See Also:
Object.toString()


Copyright © 2003-2004 Delft University of Technology, the Netherlands. All Rights Reserved.