Class Wall


public class Wall extends ColoredPoint
The Wall class extends the ColoredPoint class and adds a WallState attribute to represent the state of a wall (such as whether it's passable, blocked, or any other custom state). This class is particularly useful for representing walls in a maze or grid-based environment, where each wall can have a position, color, and state.

The state of the wall is represented by the WallState enum, which provides different states that can be associated with a wall (e.g., passable, blocked, etc.).

This class is most commonly used to represent a maze cell's wall in a maze generation or maze-solving algorithm.

  • Constructor Details

    • Wall

      public Wall(double x, double y, @NotNull @NotNull WallState state)
      Constructs a new Wall with the specified x and y coordinates, and a given WallState to represent the wall's current state. The color of the wall is determined by the WallState.
      Parameters:
      x - the x coordinate of the wall
      y - the y coordinate of the wall
      state - the WallState representing the state of the wall
    • Wall

      public Wall(@NotNull @NotNull Point point, @NotNull @NotNull WallState state)
      Constructs a new Wall by copying the coordinates of an existing Point and setting the WallState to the specified state. The color of the wall is determined by the state.
      Parameters:
      point - the Point to copy coordinates from
      state - the WallState representing the state of the wall
  • Method Details

    • getState

      public WallState getState()
      Returns the WallState of this wall.
      Returns:
      the WallState representing the current state of the wall