aim4.im.v2i.RequestHandler

## Class Approx4PhasesTrafficSignalRequestHandler

- java.lang.Object
- - aim4.im.v2i.RequestHandler.Approx4PhasesTrafficSignalRequestHandler

- All Implemented Interfaces:
    RequestHandler, TrafficSignalRequestHandler

      public class Approx4PhasesTrafficSignalRequestHandler
      extends Object
      implements TrafficSignalRequestHandler

  The approximate 4-Phases traffic signal request handler.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Approx4PhasesTrafficSignalRequestHandler(double greenLightDuration, double yellowLightDuration)` Create the approximate 4-Phases traffic signal request handler.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `act(double timeStep)` Let the request handler to act for a given time period.
    `TrafficSignal` | `getSignal(int laneId)` Get the traffic signal of a lane.
    `StatCollector<?>` | `getStatCollector()` Get the statistic collector.
    `void` | `processRequestMsg(Request msg)` Process the request message.
    `void` | `setBasePolicyCallback(BasePolicyCallback basePolicy)` Set the base policy call-back.
    `void` | `setGreenLightDuration(double greenLightDuration)` Set the green signals duration.
    `void` | `setYellowLightDuration(double yellowLightDuration)` Set the yellow signals duration.

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

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

- - ### Constructor Detail

    - #### Approx4PhasesTrafficSignalRequestHandler

          public Approx4PhasesTrafficSignalRequestHandler(double greenLightDuration,
                                                  double yellowLightDuration)

      Create the approximate 4-Phases traffic signal request handler.
      Parameters:
        `greenLightDuration` - the duration of green signals
        `yellowLightDuration` - the duration of yellow signals

  - ### Method Detail

    - #### setGreenLightDuration

          public void setGreenLightDuration(double greenLightDuration)

      Set the green signals duration.
      Parameters:
        `greenLightDuration` - the green signal duration

    - #### setYellowLightDuration

          public void setYellowLightDuration(double yellowLightDuration)

      Set the yellow signals duration.
      Parameters:
        `yellowLightDuration` - the yellow signal duration

    - #### setBasePolicyCallback

          public void setBasePolicyCallback(BasePolicyCallback basePolicy)

      Set the base policy call-back.
      Specified by:
        `setBasePolicyCallback` in interface `RequestHandler`
      Parameters:
        `basePolicy` - the base policy's call-back

    - #### act

          public void act(double timeStep)

      Let the request handler to act for a given time period.
      Specified by:
        `act` in interface `RequestHandler`
      Parameters:
        `timeStep` - the time period

    - #### processRequestMsg

          public void processRequestMsg(Request msg)

      Process the request message.
      Specified by:
        `processRequestMsg` in interface `RequestHandler`
      Parameters:
        `msg` - the request message

    - #### getStatCollector

          public StatCollector<?> getStatCollector()

      Get the statistic collector.
      Specified by:
        `getStatCollector` in interface `RequestHandler`
      Returns:
        the statistic collector

    - #### getSignal

          public TrafficSignal getSignal(int laneId)

      Get the traffic signal of a lane.
      Specified by:
        `getSignal` in interface `TrafficSignalRequestHandler`
      Parameters:
        `laneId` - the land ID
      Returns:
        traffic signal

Copyright © 2013. All rights reserved.