aim4.config

## Class TrafficSignalPhase

- java.lang.Object
- - aim4.config.TrafficSignalPhase

-     public class TrafficSignalPhase
      extends Object

  The traffic signal phases.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TrafficSignalPhase(GridMap map, List<String> strs)` Construct a traffic signal phases.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ApproxNPhasesTrafficSignalRequestHandler.CyclicSignalController` | `calcCyclicSignalController(Road road)` Generate a signal controller for a road.
    `List<Road>` | `getActiveRoads(int phaseId)` Get the list of the names of the roads that are active in the phase.
    `double` | `getGreenDurations(int phaseId)` Get the duration of the green signals.
    `int` | `getPhaseNum()` Get the number of phases.
    `double` | `getRedDurations(int phaseId)` Get the duration of the red signals.
    `double` | `getYellowDurations(int phaseId)` Get the duration of the yellow signals.
    `static TrafficSignalPhase` | `makeFromFile(GridMap map, String csvFileName)` Create a new traffic signal phase object from file
    `String` | `toString()` Get a string description of the signal phases.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TrafficSignalPhase

          public TrafficSignalPhase(GridMap map,
                            List<String> strs)

      Construct a traffic signal phases.
      Parameters:
        `map` - the map of the simulation
        `strs` - the description of the direction based on the name of the roads.

  - ### Method Detail

    - #### makeFromFile

          public static TrafficSignalPhase makeFromFile(GridMap map,
                                        String csvFileName)

      Create a new traffic signal phase object from file
      Parameters:
        `map` - the map
        `csvFileName` - the file name of the CSV file
      Returns:
        the traffic signal phase object

    - #### getPhaseNum

          public int getPhaseNum()

      Get the number of phases.
      Returns:
        the number of phases.

    - #### getActiveRoads

          public List<Road> getActiveRoads(int phaseId)

      Get the list of the names of the roads that are active in the phase.
      Parameters:
        `phaseId` - the phase ID
      Returns:
        the list of active roads

    - #### getGreenDurations

          public double getGreenDurations(int phaseId)

      Get the duration of the green signals.
      Parameters:
        `phaseId` - the phase ID
      Returns:
        the green duration

    - #### getYellowDurations

          public double getYellowDurations(int phaseId)

      Get the duration of the yellow signals.
      Parameters:
        `phaseId` - the phase ID
      Returns:
        the yellow duration

    - #### getRedDurations

          public double getRedDurations(int phaseId)

      Get the duration of the red signals.
      Parameters:
        `phaseId` - the phase ID
      Returns:
        the red duration

    - #### calcCyclicSignalController

          public ApproxNPhasesTrafficSignalRequestHandler.CyclicSignalController calcCyclicSignalController(Road road)

      Generate a signal controller for a road.
      Parameters:
        `road` - the road
      Returns:
        a signal controller for the road

    - #### toString

          public String toString()

      Get a string description of the signal phases.
      Overrides:
        `toString` in class `Object`
      Returns:
        the string description of the signal phases

Copyright © 2013. All rights reserved.