Class MazeModel

java.lang.Object
mazealgo.model.MazeModel

public class MazeModel extends Object
High-level model facade for the UI / ViewModel. Two operating modes:
  • In-process (no-arg constructor) — generates and solves directly with MyMazeGenerator / BestFirstSearch. Used by tests; also a convenient fallback if running the UI without MazeApp's embedded servers.
  • Remote (MazeModel(int, int) constructor) — talks to MyServer over localhost sockets. The JavaFX app embeds both servers on OS-assigned ports and injects them here, so every Generate / Solution Hint click goes through the Strategy + Decorator-compression + SHA-256 cache pipeline Phase 2 built.
  • Constructor Details

    • MazeModel

      public MazeModel()
      In-process mode: algorithms run on the calling thread, no sockets.
    • MazeModel

      public MazeModel(int generatePort, int solvePort)
      Remote mode: every generate(int, int) / solve(Maze) call opens a fresh localhost socket to the given ports.
  • Method Details

    • generate

      public Maze generate(int rows, int columns)
    • solve

      public Solution solve(Maze maze)
    • isRemote

      public boolean isRemote()