aim4.driver.coordinator

## Class V2ICoordinator

- java.lang.Object
- - aim4.driver.coordinator.V2ICoordinator

- All Implemented Interfaces:
    Coordinator

      public class V2ICoordinator
      extends Object
      implements Coordinator

  An agent that autonomously controls the coordination of a `AutoVehicleDriverView` with other Vehicles and with `IntersectionManager`s. This agent is capable of both V2V and V2I coordination, and uses the current readings of the vehicle and state in the CoordinatingDriverAgent, along with an optimism/pessimism heuristic to make reservations. It also alters the state of the CoordinatingDriverAgent of which it is a part to reflect the current reservation status.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `V2ICoordinator.ReservationParameter` Postprocessing the reservation parameters
    `static class` | `V2ICoordinator.State` Potential states that a CoordinatingDriverAgent can be in.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `V2ICoordinator(AutoVehicleDriverView vehicle, AutoDriver driver, BasicMap basicMap)` Create an AutonomousCoordinator to coordinate a Vehicle.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `act()` Receive, process, and send messages between Vehicles and IntersectionManagers, and maintain the reservation status in the Vehicle.
    `boolean` | `getIsDebugging()` Whether the coordinator is in a debug mode
    `V2ICoordinator.ReservationParameter` | `getReservationParameter()` Get the confirm message for this driver agent's reservation
    `V2ICoordinator.State` | `getState()` Get the current state of the CoordinatingDriverAgent.
    `boolean` | `isAwaitingResponse()` Whether or not the DriverAgent is waiting for a response from the Intersection Manager.
    `boolean` | `isTerminated()` Whether of not the coordinator has finished its job.
    `double` | `timeToReservation()` Calculate the amount of time, in seconds, until the reservation's arrival time.

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

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

- - ### Constructor Detail

    - #### V2ICoordinator

          public V2ICoordinator(AutoVehicleDriverView vehicle,
                        AutoDriver driver,
                        BasicMap basicMap)

      Create an AutonomousCoordinator to coordinate a Vehicle.
      Parameters:
        `vehicle` - the Vehicle to coordinate
        `driver` - the driver
        `basicMap` - the map

  - ### Method Detail

    - #### act

          public void act()

      Receive, process, and send messages between Vehicles and IntersectionManagers, and maintain the reservation status in the Vehicle.
      Specified by:
        `act` in interface `Coordinator`

    - #### getState

          public V2ICoordinator.State getState()

      Get the current state of the CoordinatingDriverAgent.
      Returns:
        the current state of the driver agent

    - #### isTerminated

          public boolean isTerminated()

      Whether of not the coordinator has finished its job.
      Specified by:
        `isTerminated` in interface `Coordinator`

    - #### isAwaitingResponse

          public boolean isAwaitingResponse()

      Whether or not the DriverAgent is waiting for a response from the Intersection Manager.
      Returns:
        whether or not this DriverAgent is waiting for a response from the Intersection Manager.

    - #### getReservationParameter

          public V2ICoordinator.ReservationParameter getReservationParameter()

      Get the confirm message for this driver agent's reservation
      Returns:
        the confirm message; null if there is no confirm message

    - #### timeToReservation

          public double timeToReservation()

      Calculate the amount of time, in seconds, until the reservation's arrival time.
      Returns:
        the amount of time, in seconds, until the reserved arrival time; -1.0 if there is no reservation

    - #### getIsDebugging

          public boolean getIsDebugging()

      Whether the coordinator is in a debug mode
      Returns:
        Whether the coordinator is in a debug mode

Copyright © 2013. All rights reserved.