# shadielfares/assignment1-2aa4 architecture

> Architecture diagram of the GitHub repository shadielfares/assignment1-2aa4, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shadielfares/assignment1-2aa4
- Repository: https://github.com/shadielfares/assignment1-2aa4

## Overview

##### Main Components
- Command-Line Interface (CLI) & Input Handling:
- Entry point as the Main class (located in src/main/java/…/mazerunner/Main.java). This component manages command line arguments such as the maze file (-i MAZE_FILE), the path sequence (-p PATH_SEQUENCE), and the optional method flag (-method {tremaux, righthand}).
- Maze Input and File Processing:
- FileController (src/main/java/…/mazerunner/FileController.java) which is responsible for reading the maze file from disk.
- MazeReader (src/main/java/…/mazerunner/MazeReader.java) which processes the file content and translates it into an internal representation.
- Maze Representation:
- MazeArray (src/main/java/…/mazerunner/MazeArray.java). This component stores the maze’s structure (walls and passages) read from the file.
- Path Computation Logic:
- Direction (src/main/java/…/mazerunner/Direction.java): likely manages the orientation.
- PathTraversal and its interface iPathTraversal (src/main/java/…/mazerunner/PathTraversal.java and src/main/java/…/mazerunner/iPathTraversal.java): these modules carry out the actual traversal logic through the maze.
- PathSequence (src/main/java/…/mazerunner/PathSequence.java): possibly deals with generating a canonical sequence
- PathChecker (src/main/java/…/mazerunner/PathChecker.java): which validates if a provided (or computed) path is correct.
- Output:
- The computed or verified path is printed on the console (standard output). Although not a separate module, it is a key result in the workflow.

##### Relationships and Data Flow
- The FileController sends the raw file content to MazeReader, which converts it into a MazeArray (internal representation of the maze).
- The MazeRunner (or the main logic in Main) then invokes the PathTraversal (or the designated method: right-hand default or Tremaux if flagged) and uses Direction and PathSequence to compute the path.
- Optionally, if a path is provided via the -p argument, the Main class uses PathChecker to validate the provided sequence against the maze from MazeArray.
- Finally, the result (computed path or verification result such as “correct path”/”incorrect path”) is pushed to the console.

##### Architectural and Design Patterns
- Separation of Concerns: Notice how file I/O, maze parsing, path computation, and output verification are handled in distinct modules.
- Interface-based Design: The use of an interface (iPathTraversal) for the traversal logic allows different algorithm implementations (e.g., Tremaux vs. right-hand rule).

##### Including Technologies & Frameworks
- Maven: Note the presence of a pom.xml; this indicates dependency management and build orchestration.
- Java Standard Library: Emphasize the use of standard Java constructs (no external UI frameworks, as this is console-based) and maybe logging with log4j2 (src/main/resources/log4j2.xml).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    subgraph "Input Layer"
        Main["Main (CLI)"]:::input
        FileController["FileController"]:::input
        MazeReader["MazeReader"]:::input
    end

    %% Business Logic Layer
    subgraph "Business Logic"
        MazeArray["MazeArray"]:::business
        Direction["Direction"]:::business
        PathTraversal["PathTraversal"]:::business
        iPathTraversal["iPathTraversal (Interface)"]:::business
        PathSequence["PathSequence"]:::business
        PathChecker["PathChecker"]:::business
    end

    %% Output Layer
    subgraph "Output"
        Console["Console Output"]:::output
    end

    %% Data Flow Connections
    Main -->|"processInput"| FileController
    FileController -->|"readFile"| MazeReader
    MazeReader -->|"parseMaze"| MazeArray
    
    %% Main orchestrates path computation or validation
    Main -->|"computePath"| PathTraversal
    Main -->|"validatePath"| PathChecker

    %% Maze data usage in subsequent computations
    MazeArray -->|"forComputation"| PathTraversal
    MazeArray -->|"forValidation"| PathChecker

    %% Path traversal details
    PathTraversal -->|"useDirection"| Direction
    PathTraversal -->|"generateSequence"| PathSequence
    %% Output computed path
    PathTraversal -->|"displayPath"| Console

    %% Path verification output
    PathChecker -->|"displayVerification"| Console

    %% Click Events
    click Main "https://github.com/shadielfares/assignment1-2aa4/blob/main/src/main/java/ca/mcmaster/se2aa4/mazerunner/Main.java"
    click FileController "https://github.com/shadielfares/assignment1-2aa4/blob/main/src/main/java/ca/mcmaster/se2aa4/mazerunner/FileController.java"
    click MazeReader "https://github.com/shadielfares/assignment1-2aa4/blob/main/src/main/java/ca/mcmaster/se2aa4/mazerunner/MazeReader.java"
    click MazeArray "https://github.com/shadielfares/assignment1-2aa4/blob/main/src/main/java/ca/mcmaster/se2aa4/mazerunner/MazeArray.java"
    click Direction "https://github.com/shadielfares/assignment1-2aa4/blob/main/src/main/java/ca/mcmaster/se2aa4/mazerunner/Direction.java"
    click PathTraversal "https://github.com/shadielfares/assignment1-2aa4/blob/main/src/main/java/ca/mcmaster/se2aa4/mazerunner/PathTraversal.java"
    click iPathTraversal "https://github.com/shadielfares/assignment1-2aa4/blob/main/src/main/java/ca/mcmaster/se2aa4/mazerunner/iPathTraversal.java"
    click PathSequence "https://github.com/shadielfares/assignment1-2aa4/blob/main/src/main/java/ca/mcmaster/se2aa4/mazerunner/PathSequence.java"
    click PathChecker "https://github.com/shadielfares/assignment1-2aa4/blob/main/src/main/java/ca/mcmaster/se2aa4/mazerunner/PathChecker.java"

    %% Styles
    classDef input fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef business fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef output fill:#FFA500,stroke:#000,stroke-width:2px;
```
