Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.caff.maze
Interface Maze

All Known Implementing Classes:
  AbstractBasicMaze, CircularMaze, DiamondMaze, HexagonalMaze, OctogonalMaze, RectangularMaze, TriangularMaze

    public interface Maze

Basic interface of a Maze. A maze is defined by the following items:

- its cells: see `Maze.getCells()`
- its clear state (all cells are unconnected): see `Maze.reset()`
- how to draw itself: see `Maze.draw(MazePainter, MazePaintPropertiesProvider)`
- a start and an end cell: see `Maze.setWayStart(MazeCell)` and `Maze.setWayEnd(MazeCell)`
- a way to create a purely random maze (see `Maze.createMaze()`) or a special maze defined by a seed value (see `Maze.createMaze(long)`
- a preferred aspect ratio: see `Maze.getPreferredAspectRatio()`
- how to map a screen position to a cell: see `Maze.getCellAt(java.awt.geom.Point2D)`
- how to map an integer id to a cell: see `Maze.getCellByID(int)`
- how to store and load itself: see `Maze.storePersistentData(DataStorage)` and `Maze.loadPersistentData(DataStorage)`
- how to manage listeners which are interested to know when the creation of a maze has finished: `Maze.addMazeFinishedListener(MazeFinishedListener)` and `Maze.removeMazeFinishedListener(MazeFinishedListener)`

Method Summary
`void` | `addMazeFinishedListener(MazeFinishedListener listener)` Add a maze finished listener which is called when the maze (re)creation is finished.
`void` | `createMaze()` Create a purely random maze.
`void` | `createMaze(long seed)` Create a maze from a given seed.
`void` | `draw(MazePainter painter, MazePaintPropertiesProvider properties)` Draw this maze.
`MazeCell` | `getCellAt(java.awt.geom.Point2D position)` Get the cell at a given position.
`MazeCell` | `getCellByID(int id)` Get the cell with the given id.
`MazeCell[]` | `getCells()` Get all cells of this maze.
`java.awt.Insets` | `getInsets(MazePaintPropertiesProvider properties, float scaling)` Get the necessary insets depending on the paint properties.
`float` | `getPreferredAspectRatio()` Get the preferred aspect ratio of this maze.
`void` | `loadPersistentData(DataStorage systemAccess)` Load extra data defining the maze from the system access.
`void` | `removeMazeFinishedListener(MazeFinishedListener listener)` Remove a maze finished listener which was called when the maze (re)creation is finished.
`void` | `reset()` Reset all borders and ways.
`void` | `setWayEnd(MazeCell end)` Set the end cell of the way.
`void` | `setWayStart(MazeCell start)` Set the start cell of the way.
`void` | `storePersistentData(DataStorage systemAccess)` Store extra data defining the maze to the system access.

Method Detail

### getCells

    MazeCell[] getCells()

  Get all cells of this maze.

  Returns:
    maze cells

### reset

    void reset()

  Reset all borders and ways. After this all cells are unconnected.

### draw

    void draw(MazePainter painter,
              MazePaintPropertiesProvider properties)

  Draw this maze.

  Parameters:
    `painter` - painter to draw to
    `properties` - access to properties for drawing (colors etc)

### setWayStart

    void setWayStart(MazeCell start)

  Set the start cell of the way.

  Parameters:
    `start` - start cell

### setWayEnd

    void setWayEnd(MazeCell end)

  Set the end cell of the way.

  Parameters:
    `end` - end cell

### createMaze

    void createMaze()

  Create a purely random maze.

### createMaze

    void createMaze(long seed)

  Create a maze from a given seed.

  Parameters:
    `seed` - random seed

### getPreferredAspectRatio

    float getPreferredAspectRatio()

  Get the preferred aspect ratio of this maze.

  Returns:
    aspect ratio (width/height)

### getInsets

    java.awt.Insets getInsets(MazePaintPropertiesProvider properties,
                              float scaling)

  Get the necessary insets depending on the paint properties. Usually the insets are necessary to allow for the thick border line to be drawn completely.

  Parameters:
    `properties` - paint properties
    `scaling` - scaling used when painting
  Returns:
    insets

### getCellAt

    MazeCell getCellAt(java.awt.geom.Point2D position)

  Get the cell at a given position.

  Parameters:
    `position` - cell position
  Returns:
    cell at the given position or `null` if there is no cell at that position

### getCellByID

    MazeCell getCellByID(int id)

  Get the cell with the given id.

  Parameters:
    `id` - cell id
  Returns:
    the cell with the given id or `null` if there is no such cell
  See Also:
    `MazeCell.getID()`

### loadPersistentData

    void loadPersistentData(DataStorage systemAccess)

  Load extra data defining the maze from the system access.

  Parameters:
    `systemAccess` - system access

### storePersistentData

    void storePersistentData(DataStorage systemAccess)

  Store extra data defining the maze to the system access.

  Parameters:
    `systemAccess` - system access

### addMazeFinishedListener

    void addMazeFinishedListener(MazeFinishedListener listener)

  Add a maze finished listener which is called when the maze (re)creation is finished.

  Parameters:
    `listener` - listener to add

### removeMazeFinishedListener

    void removeMazeFinishedListener(MazeFinishedListener listener)

  Remove a maze finished listener which was called when the maze (re)creation is finished.

  Parameters:
    `listener` - listener to remove

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD