aim4.map

## Class GridMap

- java.lang.Object
- - aim4.map.GridMap

- All Implemented Interfaces:
    BasicMap

      public class GridMap
      extends Object
      implements BasicMap

  The grid layout map.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GridMap(double initTime, int columns, int rows, double laneWidth, double speedLimit, int lanesPerRoad, double medianSize, double distanceBetween)` Create a grid map.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getColumns()` Get the number of columns in this grid layout.
    `List<DataCollectionLine>` | `getDataCollectionLines()` Get the list of data collection line.
    `List<Road>` | `getDestinationRoads()` Get the Roads that exit this Layout.
    `Rectangle2D` | `getDimensions()` Get the dimensions of this Layout, in Rectangle form.
    `List<Road>` | `getHorizontalRoads()` Get the set of horizontal roads.
    `List<SpawnPoint>` | `getHorizontalSpawnPoints()` Get the list of horizontal spawn points.
    `Registry<IntersectionManager>` | `getImRegistry()` Get the intersection manager registry.
    `List<IntersectionManager>` | `getIntersectionManagers()` Get the IntersectionManagers that are part of this Layout.
    `Registry<Lane>` | `getLaneRegistry()` Get the lane registry.
    `IntersectionManager` | `getManager(int column, int row)` Get the intersection manager of a particular intersection.
    `double` | `getMaximumSpeedLimit()` Get the maximum speed limit of any Road in the Layout.
    `Road` | `getRoad(int laneID)` Given a Lane ID number, get the Road of which that Lane is a part.
    `Road` | `getRoad(Lane lane)` Given a Lane, get the Road of which that Lane is a part.
    `List<Road>` | `getRoads()` Get the Roads that are part of this Layout.
    `List<Road>` | `getRoads(int column, int row)` Get the list of all roads that enter a particular intersection.
    `int` | `getRows()` Get the number of rows in this grid layout.
    `List<SpawnPoint>` | `getSpawnPoints()` Get the list of spawn points.
    `List<Road>` | `getVerticalRoads()` Get the set of vertical roads.
    `List<SpawnPoint>` | `getVerticalSpawnPoints()` Get the list of vertical spawn points.
    `void` | `printDataCollectionLinesData(String outFileName)` Print the data collected in data collection lines to the given file
    `void` | `removeAllManagers()` Remove managers in all intersections.
    `void` | `setManager(int column, int row, IntersectionManager im)` Set the intersection manager of a particular intersection.

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

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

- - ### Constructor Detail

    - #### GridMap

          public GridMap(double initTime,
                 int columns,
                 int rows,
                 double laneWidth,
                 double speedLimit,
                 int lanesPerRoad,
                 double medianSize,
                 double distanceBetween)

      Create a grid map.
      Parameters:
        `initTime` - the initial time
        `columns` - the number of columns
        `rows` - the number of rows
        `laneWidth` - the lane width
        `speedLimit` - the speed limit
        `lanesPerRoad` - the number of lanes per road
        `medianSize` - the width of the area between the roads in opposite direction
        `distanceBetween` - the distance between the adjacent intersections

  - ### Method Detail

    - #### getRoads

          public List<Road> getRoads()

      Get the Roads that are part of this Layout.
      Specified by:
        `getRoads` in interface `BasicMap`
      Returns:
        the Roads that are part of this Layout

    - #### getDestinationRoads

          public List<Road> getDestinationRoads()

      Get the Roads that exit this Layout.
      Specified by:
        `getDestinationRoads` in interface `BasicMap`
      Returns:
        the Roads exit this Layout

    - #### getDimensions

          public Rectangle2D getDimensions()

      Get the dimensions of this Layout, in Rectangle form.
      Specified by:
        `getDimensions` in interface `BasicMap`
      Returns:
        a Rectangle representing the dimensions of this Layout

    - #### getMaximumSpeedLimit

          public double getMaximumSpeedLimit()

      Get the maximum speed limit of any Road in the Layout.
      Specified by:
        `getMaximumSpeedLimit` in interface `BasicMap`
      Returns:
        the maximum speed, in meters per second, of any Lane in any Road in the Layout

    - #### getIntersectionManagers

          public List<IntersectionManager> getIntersectionManagers()

      Get the IntersectionManagers that are part of this Layout.
      Specified by:
        `getIntersectionManagers` in interface `BasicMap`
      Returns:
        the IntersectionManagers that are part of this Layout

    - #### getDataCollectionLines

          public List<DataCollectionLine> getDataCollectionLines()

      Get the list of data collection line.
      Specified by:
        `getDataCollectionLines` in interface `BasicMap`
      Returns:
        the data collection lines

    - #### getSpawnPoints

          public List<SpawnPoint> getSpawnPoints()

      Get the list of spawn points.
      Specified by:
        `getSpawnPoints` in interface `BasicMap`
      Returns:
        the lkist of spawn points

    - #### getHorizontalSpawnPoints

          public List<SpawnPoint> getHorizontalSpawnPoints()

      Get the list of horizontal spawn points.
      Returns:
        the list of horizontal spawn points

    - #### getVerticalSpawnPoints

          public List<SpawnPoint> getVerticalSpawnPoints()

      Get the list of vertical spawn points.
      Returns:
        the list of vertical spawn points

    - #### getRows

          public int getRows()

      Get the number of rows in this grid layout.
      Returns:
        the number of rows

    - #### getColumns

          public int getColumns()

      Get the number of columns in this grid layout.
      Returns:
        the number of columns

    - #### getRoads

          public List<Road> getRoads(int column,
                            int row)

      Get the list of all roads that enter a particular intersection.
      Parameters:
        `column` - the column of the intersection
        `row` - the row of the intersection
      Returns:
        the list of roads that enter the intersection at (column, row)

    - #### getHorizontalRoads

          public List<Road> getHorizontalRoads()

      Get the set of horizontal roads.
      Returns:
        the set of horizontal roads

    - #### getVerticalRoads

          public List<Road> getVerticalRoads()

      Get the set of vertical roads.
      Returns:
        the set of vertical roads

    - #### getImRegistry

          public Registry<IntersectionManager> getImRegistry()

      Get the intersection manager registry.
      Specified by:
        `getImRegistry` in interface `BasicMap`
      Returns:
        the intersection manager registry.

    - #### getLaneRegistry

          public Registry<Lane> getLaneRegistry()

      Get the lane registry.
      Specified by:
        `getLaneRegistry` in interface `BasicMap`
      Returns:
        the lane registry.

    - #### getRoad

          public Road getRoad(Lane lane)

      Given a Lane, get the Road of which that Lane is a part.
      Specified by:
        `getRoad` in interface `BasicMap`
      Parameters:
        `lane` - the Lane for which to get the enclosing Road
      Returns:
        the Road of which the given Lane is a part.

    - #### getRoad

          public Road getRoad(int laneID)

      Given a Lane ID number, get the Road of which that Lane is a part.
      Specified by:
        `getRoad` in interface `BasicMap`
      Parameters:
        `laneID` - the ID of the Lane for which to get the enclosing Road
      Returns:
        the Road of which the given Lane is a part.

    - #### getManager

          public IntersectionManager getManager(int column,
                                       int row)

      Get the intersection manager of a particular intersection.
      Parameters:
        `column` - the column of the intersection
        `row` - the row of the intersection

    - #### setManager

          public void setManager(int column,
                        int row,
                        IntersectionManager im)

      Set the intersection manager of a particular intersection.
      Specified by:
        `setManager` in interface `BasicMap`
      Parameters:
        `column` - the column of the intersection
        `row` - the row of the intersection
        `im` - the intersection manager

    - #### removeAllManagers

          public void removeAllManagers()

      Remove managers in all intersections.

    - #### printDataCollectionLinesData

          public void printDataCollectionLinesData(String outFileName)

      Print the data collected in data collection lines to the given file
      Specified by:
        `printDataCollectionLinesData` in interface `BasicMap`
      Parameters:
        `outFileName` - the name of the file to which the data are outputted.

Copyright © 2013. All rights reserved.