aim4.util

## Class TiledArea

- java.lang.Object
- - aim4.util.TiledArea

-     public class TiledArea
      extends Object

  A tiled area - a subdivision of an area into a grid of small rectangles.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TiledArea.Tile` A tile.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TiledArea(Area area, double length)` Create a tiled area
    `TiledArea(Area area, double xLength, double yLength)` Create a tiled area

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `areTilesSquare()` Whether or not the tile are squares.
    `List<TiledArea.Tile>` | `findOccupiedTiles(Shape shape)` Get the list of tiles that are occupied by the given Shape.
    `Area` | `getArea()` Get the area controlled by this tiled area
    `int` | `getNumberOfTiles()` Get the total number of tiles
    `TiledArea.Tile` | `getTile(int x, int y)` Get the tile at the (x,y) location in the grid
    `TiledArea.Tile` | `getTileById(int id)` Get a tile according to its id.
    `double` | `getXLength()` Get the length of a tile in the x-direction
    `int` | `getXNum()` Get the number of tiles in the x-direction
    `double` | `getYLength()` Get the length of a tile in the y-direction
    `int` | `getYNum()` Get the number of tiles in the y-direction

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

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

- - ### Constructor Detail

    - #### TiledArea

          public TiledArea(Area area,
                   double length)

      Create a tiled area
      Parameters:
        `area` - the area
        `length` - the length of a tile in both directions

    - #### TiledArea

          public TiledArea(Area area,
                   double xLength,
                   double yLength)

      Create a tiled area
      Parameters:
        `area` - the area
        `xLength` - the length of a tile in the x-direction
        `yLength` - the length of a tile in the y-direction

  - ### Method Detail

    - #### getArea

          public Area getArea()

      Get the area controlled by this tiled area
      Returns:
        the area controlled by this tiled area

    - #### getXNum

          public int getXNum()

      Get the number of tiles in the x-direction
      Returns:
        the number of tiles in the x-direction

    - #### getYNum

          public int getYNum()

      Get the number of tiles in the y-direction
      Returns:
        the number of tiles in the y-direction

    - #### getXLength

          public double getXLength()

      Get the length of a tile in the x-direction
      Returns:
        the length of a tile in the x-direction

    - #### getYLength

          public double getYLength()

      Get the length of a tile in the y-direction
      Returns:
        the length of a tile in the y-direction

    - #### getTile

          public TiledArea.Tile getTile(int x,
                               int y)

      Get the tile at the (x,y) location in the grid
      Parameters:
        `x` - the x-coordinate of the tile
        `y` - the y-coordinate of the tile
      Returns:
        the tile; return null if the tile does not exist

    - #### getNumberOfTiles

          public int getNumberOfTiles()

      Get the total number of tiles
      Returns:
        the total number of tiles

    - #### areTilesSquare

          public boolean areTilesSquare()

      Whether or not the tile are squares.
      Returns:
        whether or not the tile are squares

    - #### getTileById

          public TiledArea.Tile getTileById(int id)

      Get a tile according to its id.
      Parameters:
        `id` - the id of the tile
      Returns:
        the tile

    - #### findOccupiedTiles

          public List<TiledArea.Tile> findOccupiedTiles(Shape shape)

      Get the list of tiles that are occupied by the given Shape.
      Parameters:
        `shape` - the Shape for which to find occupied tiles
      Returns:
        the List of tiles that are occupied by the given Shape

Copyright © 2013. All rights reserved.