aim4.im

## Class IntersectionManager

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

- Direct Known Subclasses:
    DummyManager, V2IManager

      public class IntersectionManager
      extends Object

  An agent to manage an intersection. This is an abstract class that sets up the properties of the intersection when it is created.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected double` | `currentTime` the current time of the intersection manager
    `protected int` | `id` The ID number of this intersection manager.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IntersectionManager(Intersection intersection, TrackModel trackModel, double currentTime, Registry<IntersectionManager> imRegistry)` Create an intersection manager.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `act(double timeStep)` Take any actions for a certain period of time.
    `void` | `checkCurrentTime(double currentTime)` Check whether this intersection manager's time is current.
    `boolean` | `contains(VehicleSimView vehicle)` Determine whether the given Vehicle is currently entirely contained within the Area governed by this IntersectionManager.
    `double` | `getCurrentTime()` Get the current time.
    `List<? extends Shape>` | `getDebugShapes()` Get any shapes to display for debugging purposes.
    `int` | `getId()` Get the unique ID number of this IntersectionManager.
    `Intersection` | `getIntersection()` Get the intersection managed by this intersection manager.
    `List<Lane>` | `getSortedDepartureLanes(Lane arrivalLane, Road departure)` Given an arrival Lane and a departure Road, get an ordered List of Lanes that represents the Lanes from highest to lowest priority based on distance from the arrival Lane.
    `TrackModel` | `getTrackModel()` Get the track model.
    `boolean` | `intersects(Rectangle2D rectangle)` Determine whether the given Rectangle intersects the Area governed by this IntersectionManager.
    `boolean` | `manages(Lane l)` Whether or not this IntersectionManager manages the given Lane.
    `boolean` | `manages(Road r)` Whether or not this IntersectionManager manages the given Road.
    `void` | `printData(String outFileName)` Print the collected data to a file
    `double` | `traversalDistance(int arrivalID, int departureID)` Get the distance from the entry of the Lane with the first given ID, to the departure of the Lane with the other given ID, if traveling along segments through their point of intersection.
    `double` | `traversalDistance(Lane arrival, Lane departure)` Get the distance from the entry of the given Lane, to the departure of the other given Lane, if traveling along segments through their point of intersection.
    `double` | `traversalDistance(Road arrival, Road departure)` Get the distance from the entry of the given Road, to the departure of the other given Road.

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

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

- - ### Field Detail

    - #### id

          protected int id

      The ID number of this intersection manager.

    - #### currentTime

          protected double currentTime

      the current time of the intersection manager

  - ### Constructor Detail

    - #### IntersectionManager

          public IntersectionManager(Intersection intersection,
                             TrackModel trackModel,
                             double currentTime,
                             Registry<IntersectionManager> imRegistry)

      Create an intersection manager.
      Parameters:
        `intersection` - an intersection
        `trackModel` - a path model of the intersection
        `currentTime` - the current time
        `imRegistry` - an intersection manager registry

  - ### Method Detail

    - #### act

          public void act(double timeStep)

      Take any actions for a certain period of time.
      Parameters:
        `timeStep` - the size of the time step to simulate, in seconds

    - #### getId

          public int getId()

      Get the unique ID number of this IntersectionManager.
      Returns:
        the ID number of this IntersectionManager

    - #### getCurrentTime

          public double getCurrentTime()

      Get the current time.
      Returns:
        the current time.

    - #### getIntersection

          public Intersection getIntersection()

      Get the intersection managed by this intersection manager.
      Returns:
        the intersection managed by this intersection manager

    - #### getTrackModel

          public TrackModel getTrackModel()

      Get the track model.
      Returns:
        the track model

    - #### manages

          public boolean manages(Road r)

      Whether or not this IntersectionManager manages the given Road.
      Parameters:
        `r` - the Road
      Returns:
        whether this IntersectionManager manages the given Road

    - #### manages

          public boolean manages(Lane l)

      Whether or not this IntersectionManager manages the given Lane.
      Parameters:
        `l` - the Lane
      Returns:
        whether this IntersectionManager manages the given Lane

    - #### contains

          public boolean contains(VehicleSimView vehicle)

      Determine whether the given Vehicle is currently entirely contained within the Area governed by this IntersectionManager.
      Parameters:
        `vehicle` - the Vehicle
      Returns:
        whether the Vehicle is currently entirely contained within the Area governed by this IntersectionManager

    - #### intersects

          public boolean intersects(Rectangle2D rectangle)

      Determine whether the given Rectangle intersects the Area governed by this IntersectionManager.
      Parameters:
        `rectangle` - the Rectangle
      Returns:
        whether the Rectangle intersects the Area governed by this IntersectionManager

    - #### getSortedDepartureLanes

          public List<Lane> getSortedDepartureLanes(Lane arrivalLane,
                                           Road departure)

      Given an arrival Lane and a departure Road, get an ordered List of Lanes that represents the Lanes from highest to lowest priority based on distance from the arrival Lane.
      Parameters:
        `arrivalLane` - the Lane in which the vehicle is arriving
        `departure` - the Road by which the vehicle is departing
      Returns:
        the ordered List of Lanes, by priority, into which the vehicle should try to turn

    - #### traversalDistance

          public double traversalDistance(Road arrival,
                                 Road departure)

      Get the distance from the entry of the given Road, to the departure of the other given Road.
      Parameters:
        `arrival` - the arrival Road
        `departure` - the departure Road
      Returns:
        the distance from the entry of the arrival Road to the exit of the departure Road

    - #### traversalDistance

          public double traversalDistance(Lane arrival,
                                 Lane departure)

      Get the distance from the entry of the given Lane, to the departure of the other given Lane, if traveling along segments through their point of intersection.
      Parameters:
        `arrival` - the arrival Lane
        `departure` - the departure Lane
      Returns:
        the distance from the entry of the arrival Lane to the exit of the departure Lane through their intersection

    - #### traversalDistance

          public double traversalDistance(int arrivalID,
                                 int departureID)

      Get the distance from the entry of the Lane with the first given ID, to the departure of the Lane with the other given ID, if traveling along segments through their point of intersection.
      Parameters:
        `arrivalID` - the ID number of the arrival Lane
        `departureID` - the ID number of the departure Lane
      Returns:
        the distance from the entry of the arrival Lane to the exit of the departure Lane through their intersection

    - #### printData

          public void printData(String outFileName)

      Print the collected data to a file
      Parameters:
        `outFileName` - the name of the file to which the data are outputted.

    - #### checkCurrentTime

          public void checkCurrentTime(double currentTime)

      Check whether this intersection manager's time is current.
      Parameters:
        `currentTime` - the current time

    - #### getDebugShapes

          public List<? extends Shape> getDebugShapes()

      Get any shapes to display for debugging purposes.
      Returns:
        any shapes to display for debugging purposes

Copyright © 2013. All rights reserved.