aim4.im.v2i

## Class V2IManager

- java.lang.Object
- - aim4.im.IntersectionManager
  - - aim4.im.v2i.V2IManager

- All Implemented Interfaces:
    V2IManagerCallback

      public class V2IManager
      extends IntersectionManager
      implements V2IManagerCallback

  An intersection manager that takes requests from vehicles and coordinates their traversals of the intersection to ensure that there are no collisions. The V2IManager makes its decisions using an intersection control `Policy`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `MAXIMUM_FUTURE_RESERVATION_TIME` The maximum amount of time, in seconds, in the future, for which the policy will accept reservation requests.

    - ### Fields inherited from class aim4.im.IntersectionManager

      `currentTime, id`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `V2IManager(Intersection intersection, TrackModel trackModel, double currentTime, ReservationGridManager.Config config, Registry<IntersectionManager> registry)` Construct a new V2IManager given the structure of Lanes in the intersection.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `act(double timeStep)` Give the V2IManager a chance to respond to messages from vehicles, change policies, and so forth.
    `void` | `clearInbox()` Clear out the inbox.
    `void` | `clearOutbox()` Clear out the outbox.
    `AdmissionControlZone` | `getACZ(int laneId)` Get the Admission Control Zone of a given lane.
    `AczManager` | `getAczManager(int laneId)` Get the manager of an ACZ
    `int` | `getBitsReceived()` Get the number of bits this IntersectionManager has received.
    `int` | `getBitsTransmitted()` Get the number of bits this IntersectionManager has transmitted.
    `List<? extends Shape>` | `getDebugShapes()` Get any shapes to display for debugging purposes.
    `Policy` | `getPolicy()` Get the policy.
    `ReservationGrid` | `getReservationGrid()` Get the reservation grid.
    `ReservationGridManager` | `getReservationGridManager()` Get the manager of the reservation grid
    `double` | `getTransmissionPower()` Get the IntersectionManager's transmission power.
    `Iterator<V2IMessage>` | `inboxIterator()` Get an iterator for the messages waiting to be read.
    `Iterator<I2VMessage>` | `outboxIterator()` Get an iterator for the messages waiting to be delivered from this IntersectionManager.
    `void` | `printData(String outFileName)` Print the collected data to a file.
    `void` | `receive(V2IMessage msg)` Adds a message to the incoming queue of messages delivered to this IntersectionManager.
    `void` | `sendI2VMessage(I2VMessage msg)` Adds a message to the outgoing queue of messages to be delivered to a Vehicle.
    `void` | `setPolicy(Policy policy)` set the policy.

    - ### Methods inherited from class aim4.im.IntersectionManager

      `checkCurrentTime, contains, getCurrentTime, getId, getIntersection, getSortedDepartureLanes, getTrackModel, intersects, manages, manages, traversalDistance, traversalDistance, traversalDistance`

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

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

    - ### Methods inherited from interface aim4.im.v2i.V2IManagerCallback

      `getCurrentTime, getId, getIntersection, getTrackModel`

- - ### Field Detail

    - #### MAXIMUM_FUTURE_RESERVATION_TIME

          public static final double MAXIMUM_FUTURE_RESERVATION_TIME

      The maximum amount of time, in seconds, in the future, for which the policy will accept reservation requests. 10.0 seconds.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### V2IManager

          public V2IManager(Intersection intersection,
                    TrackModel trackModel,
                    double currentTime,
                    ReservationGridManager.Config config,
                    Registry<IntersectionManager> registry)

      Construct a new V2IManager given the structure of Lanes in the intersection.
      Parameters:
        `intersection` - an intersection
        `trackModel` - a path model of the intersection
        `currentTime` - the current time
        `registry` - an intersection manager registry

  - ### Method Detail

    - #### getPolicy

          public Policy getPolicy()

      Get the policy.

    - #### setPolicy

          public void setPolicy(Policy policy)

      set the policy.
      Parameters:
        `policy` - the policy

    - #### act

          public void act(double timeStep)

      Give the V2IManager a chance to respond to messages from vehicles, change policies, and so forth.
      Overrides:
        `act` in class `IntersectionManager`
      Parameters:
        `timeStep` - the size of the time step to simulate, in seconds

    - #### getTransmissionPower

          public double getTransmissionPower()

      Get the IntersectionManager's transmission power.
      Returns:
        the IntersectionManager's transmission power, in meters

    - #### inboxIterator

          public Iterator<V2IMessage> inboxIterator()

      Get an iterator for the messages waiting to be read.
      Returns:
        an iterator for the messages waiting to be read.

    - #### clearInbox

          public void clearInbox()

      Clear out the inbox.

    - #### outboxIterator

          public Iterator<I2VMessage> outboxIterator()

      Get an iterator for the messages waiting to be delivered from this IntersectionManager.
      Returns:
        an iterator for the messages waiting to be delivered from this IntersectionManager

    - #### clearOutbox

          public void clearOutbox()

      Clear out the outbox.

    - #### receive

          public void receive(V2IMessage msg)

      Adds a message to the incoming queue of messages delivered to this IntersectionManager.
      Parameters:
        `msg` - the message to be received

    - #### getBitsReceived

          public int getBitsReceived()

      Get the number of bits this IntersectionManager has received.
      Returns:
        the number of bits this IntersectionManager has received

    - #### getBitsTransmitted

          public int getBitsTransmitted()

      Get the number of bits this IntersectionManager has transmitted.
      Returns:
        the number of bits this IntersectionManager has transmitted

    - #### getReservationGrid

          public ReservationGrid getReservationGrid()

      Get the reservation grid.
      Specified by:
        `getReservationGrid` in interface `V2IManagerCallback`
      Returns:
        the reservation grid

    - #### getReservationGridManager

          public ReservationGridManager getReservationGridManager()

      Get the manager of the reservation grid
      Specified by:
        `getReservationGridManager` in interface `V2IManagerCallback`
      Returns:
        the manager of the reservation grid

    - #### getACZ

          public AdmissionControlZone getACZ(int laneId)

      Get the Admission Control Zone of a given lane.
      Specified by:
        `getACZ` in interface `V2IManagerCallback`
      Parameters:
        `laneId` - the id of the lane
      Returns:
        the admission control zone of the lane.

    - #### getAczManager

          public AczManager getAczManager(int laneId)

      Get the manager of an ACZ
      Specified by:
        `getAczManager` in interface `V2IManagerCallback`

    - #### sendI2VMessage

          public void sendI2VMessage(I2VMessage msg)

      Adds a message to the outgoing queue of messages to be delivered to a Vehicle.
      Specified by:
        `sendI2VMessage` in interface `V2IManagerCallback`
      Parameters:
        `msg` - the message to send to a Vehicle

    - #### printData

          public void printData(String outFileName)

      Print the collected data to a file.
      Overrides:
        `printData` in class `IntersectionManager`
      Parameters:
        `outFileName` - the name of the file to which the data are outputted.

    - #### getDebugShapes

          public List<? extends Shape> getDebugShapes()

      Get any shapes to display for debugging purposes.
      Overrides:
        `getDebugShapes` in class `IntersectionManager`
      Returns:
        any shapes to display for debugging purposes

Copyright © 2013. All rights reserved.