vanetsim.map
Class TrafficLight

java.lang.Object
  extended by vanetsim.map.TrafficLight

public class TrafficLight
extends java.lang.Object

This class represents a traffic light at a junction.


Constructor Summary
TrafficLight(double redPhaseLength, double yellowPhaseLength, double greenPhaseLength, Junction junction)
          Constructor.
TrafficLight(Junction junction)
          Constructor.
 
Method Summary
 void calculateTrafficLightPosition(Street tmpStreet)
          Calculates Traffic light position for drawing
 void changePhases(int timePerStep)
          This function should change the states of the traffic lights if necessary.
 double getGreenPhaseLength()
          Gets the length of the green phase.
 double getRedPhaseLength()
          Gets the length of the red phase.
 int getState()
           
 Street[] getStreets_()
           
 double getYellowPhaseLength()
          Gets the length of the yellow phase.
 void setGreenPhaseLength(double greenPhaseLength)
          Sets the length for the green Phase.
 void setRedPhaseLength(double redPhaseLength)
          Sets the length of the red phase.
 void setState(int state)
           
 void setStreets_(Street[] streets_)
           
 void setYellowPhaseLength(double yellowPhaseLength)
          Sets the length of the yellow phase.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrafficLight

public TrafficLight(Junction junction)
Constructor.


TrafficLight

public TrafficLight(double redPhaseLength,
                    double yellowPhaseLength,
                    double greenPhaseLength,
                    Junction junction)
Constructor.

Method Detail

changePhases

public void changePhases(int timePerStep)
This function should change the states of the traffic lights if necessary. Should be called after the first greenphase


calculateTrafficLightPosition

public void calculateTrafficLightPosition(Street tmpStreet)
Calculates Traffic light position for drawing


getGreenPhaseLength

public double getGreenPhaseLength()
Gets the length of the green phase.

Returns:
the length of the green phase

setGreenPhaseLength

public void setGreenPhaseLength(double greenPhaseLength)
Sets the length for the green Phase.

Parameters:
greenPhaseLength - the length for the green phase

setYellowPhaseLength

public void setYellowPhaseLength(double yellowPhaseLength)
Sets the length of the yellow phase.

Parameters:
yellowPhaseLength - the length of the yellow phase

getYellowPhaseLength

public double getYellowPhaseLength()
Gets the length of the yellow phase.

Returns:
the length of the yellow phase

setRedPhaseLength

public void setRedPhaseLength(double redPhaseLength)
Sets the length of the red phase.

Parameters:
redPhaseLength - the length of the red phase

getRedPhaseLength

public double getRedPhaseLength()
Gets the length of the red phase.

Returns:
the length of the red phase

setState

public void setState(int state)
Parameters:
state - the state to set

getState

public int getState()
Returns:
the state

getStreets_

public Street[] getStreets_()
Returns:
the streets_

setStreets_

public void setStreets_(Street[] streets_)
Parameters:
streets_ - the streets_ to set