aim4.im.v2i.reservation

## Class ReservationGrid

- java.lang.Object
- - aim4.im.v2i.reservation.ReservationArray
  - - aim4.im.v2i.reservation.ReservationGrid

-     public class ReservationGrid
      extends ReservationArray

  The reservation grid.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `ReservationGrid.TimeTile` The time tile.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReservationGrid(int xNum, int yNum, double gridTimeStep)` Create a reservation grid.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `calcDiscreteTime(double time)` Get the discrete time of a given time.
    `double` | `calcRemainingTime(double time)` Get the remaining time in the grid time step of the given time
    `int` | `calcTileId(int x, int y)` Get the ID of the time tile at a given coordinate.
    `double` | `calcTime(int discreteTime)` Get the time of a given discrete time.
    `int` | `calcX(int tid)` The x coordinate of the time tile.
    `int` | `calcY(int tid)` The y coordinate of the time tile.
    `void` | `cleanUp(double currentTime)` Clean up the reservation grid.
    `double` | `getGridTimeStep()` Get the time step.
    `double` | `getLastReservedTime()` Get the last time at which any time-tile has been reserved.
    `List<Integer>` | `getReservedTilesAtTime(double time)` Get the set of all reserved tiles at a given discrete time.
    `Set<Integer>` | `getVinOfReservedTilesAtTime(double time)` Get the VINs of all reserved tiles at a given discrete time.
    `int` | `getxNum()` Get the number of time tiles in the x direction.
    `int` | `getXnum()` Get the number of time tiles in the x direction.
    `int` | `getyNum()` Get the number of time tiles in the y direction.
    `int` | `getYnum()` Get the number of time tiles in the y direction.

    - ### Methods inherited from class aim4.im.v2i.reservation.ReservationArray

      `cancel, cleanUp, getLastReservedDiscreteTime, getLastReservedDiscreteTime, getNumberOfTiles, getReservationId, getReservedTilesAtTime, getVinOfReservedTilesAtTime, hasReservation, isReserved, reserve`

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

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

- - ### Constructor Detail

    - #### ReservationGrid

          public ReservationGrid(int xNum,
                         int yNum,
                         double gridTimeStep)

      Create a reservation grid.
      Parameters:
        `xNum` - the number of time tiles in the x direction
        `yNum` - the number of time tiles in the y direction
        `gridTimeStep` - the time step.

  - ### Method Detail

    - #### cleanUp

          public void cleanUp(double currentTime)

      Clean up the reservation grid.
      Parameters:
        `currentTime` - the current time

    - #### getXnum

          public int getXnum()

      Get the number of time tiles in the x direction.
      Returns:
        the number of time tiles in the x direction

    - #### getYnum

          public int getYnum()

      Get the number of time tiles in the y direction.
      Returns:
        the number of time tiles in the y direction

    - #### calcX

          public int calcX(int tid)

      The x coordinate of the time tile.
      Parameters:
        `tid` - the ID of the time tile
      Returns:
        the x coordinate of the time tile.

    - #### calcY

          public int calcY(int tid)

      The y coordinate of the time tile.
      Parameters:
        `tid` - the ID of the time tile
      Returns:
        the y coordinate of the time tile.

    - #### calcTileId

          public int calcTileId(int x,
                       int y)

      Get the ID of the time tile at a given coordinate.
      Parameters:
        `x` - the x-coordinate
        `y` - the y-coordinate
      Returns:
        the ID of the time tile at a given coordinate

    - #### getxNum

          public int getxNum()

      Get the number of time tiles in the x direction.
      Returns:
        the number of time tiles in the x direction.

    - #### getyNum

          public int getyNum()

      Get the number of time tiles in the y direction.
      Returns:
        the number of time tiles in the y direction.

    - #### getGridTimeStep

          public double getGridTimeStep()

      Get the time step.
      Returns:
        the time step

    - #### calcDiscreteTime

          public int calcDiscreteTime(double time)

      Get the discrete time of a given time. If the given time is not exactly equal to the discrete time, the largest discrete time that is smaller or equal to the given time will be returned.
      Parameters:
        `time` - the time
      Returns:
        the discrete time

    - #### calcRemainingTime

          public double calcRemainingTime(double time)

      Get the remaining time in the grid time step of the given time
      Parameters:
        `time` - the time
      Returns:
        the remaining time in the grid time step

    - #### calcTime

          public double calcTime(int discreteTime)

      Get the time of a given discrete time.
      Parameters:
        `discreteTime` - the time
      Returns:
        the time

    - #### getLastReservedTime

          public double getLastReservedTime()

      Get the last time at which any time-tile has been reserved.
      Returns:
        the last time at which any time-tile has been reserved; -1 if there is currently no reservation.

    - #### getReservedTilesAtTime

          public List<Integer> getReservedTilesAtTime(double time)

      Get the set of all reserved tiles at a given discrete time.
      Parameters:
        `time` - the time
      Returns:
        the list of tile IDs that are reserved at the given discrete time.

    - #### getVinOfReservedTilesAtTime

          public Set<Integer> getVinOfReservedTilesAtTime(double time)

      Get the VINs of all reserved tiles at a given discrete time.
      Parameters:
        `time` - the time
      Returns:
        a set of reservation IDs.

Copyright © 2013. All rights reserved.