# 2aa4-w24/a2-rescue-mission-team-110 architecture

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

- Interactive diagram: https://gitdiagram.com/2aa4-w24/a2-rescue-mission-team-110
- Repository: https://github.com/2aa4-w24/a2-rescue-mission-team-110

## Overview

##### Project Type and Purpose
- This is a Java-based, Maven-built application acting as a “command center” for exploration in the Island game. Its purpose is to interface with the competition arena by processing map files (JSON) and outputting exploration results (JSON, SVG, and transcript logs). A notable detail is that the current strategy “stops exploring as soon as we start” by flying back immediately, so simplicity and safe fallback behavior are key design aspects.

##### Analysis of the File Structure
- Top-Level Files and Directories:
- Directories like “src/main/java” indicate that the project source is split into logical packages.
- The “maps” directory holds various JSON map files used as input for simulation.
- “outputs” is the destination for generated outputs such as the map image, POI locations, and transcript logs.
- Maven’s “pom.xml” suggests dependency management and standardized build processes.
- Package Structure:
- All Java code is housed under “ca.mcmaster.se2aa4.island.team110”, indicating team-specific implementations.
- The “Aerial” sub-package contains classes like DroneController, DroneHeading, DroneRadar, and DroneScanner—which imply the management of an “aerial” (drone) subsystem that handles scanning or surveying.
- The “Interfaces” package defines abstraction layers (e.g., Controller, JSONResponseParser, Phase, Radar, Scanner) that separate the contract from implementation details, promoting modularity.
- The “Phases” package breaks down various sequential phases (EmergencySite, FindGround, MoveToGround, ReturnHome, iFirstPass, iSecondPass) encapsulating the exploration logic.
- “Records” hold domain-specific data (Battery, Point) used by the functional modules.
- The “Runner” class serves as the entry point or executor that runs the command center when a specific map is passed as an argument.

a. Main Components to Include:
- Command Center (Explorer): Central hub coordinating exploration logic.
- Runner: The driver class that launches the application.
- Aerial Module: Represented by the DroneController and associated classes managing aerial functions (drone heading, radar, and scanner operations).
- Interfaces: Abstract definitions for controllers, phase handling, scanning, and JSON parsing. They indicate the plug-and-play nature of components.
- Phases: Different exploration states (EmergencySite, FindGround, etc.) representing various strategies or behavioral phases during gameplay.
- Data/Configuration Layers: Maps (input JSON), Outputs (results directory) and resource configuration (e.g., log4j2.xml, ruleset.xml).
- External Dependencies: Indicate Maven and potential external libraries/frameworks used (logging framework, JSON parsing libraries).

b. Relationships and Interactions:
- Runner initiates the process by loading a map file from the “maps” directory.
- The Explorer (command center) orchestrates the overall exploration strategy by interacting with the Aerial module and transitioning between the various Phases.
- The Aerial module, interfaced via defined “Interfaces” (e.g., Controller, Scanner, Radar), encapsulates the technical operations such as scanning and radar detection.
- Phases use methods defined in the interfaces to carry out their logic, triggering transitions from one phase to the other (for instance, transitioning from “FindGround” to “ReturnHome”).
- Output generation is done at the end of the exploration, producing files in the “outputs” directory.

c. Architectural Patterns/Design Principles:
- Modular design: Splitting out phases and aerial controls into distinct packages with interfaces.
- Use of Abstraction: Interfaces decouple the implementations from the usage, making it easier to extend or modify functionalities.
- Layered Architecture: Clearly separated modules for input (maps), processing (exploration phases and aerial control), and output (results files).
- Testability: The presence of a comprehensive “src/test” suite hints at unit testing for each significant component.

d. Relevant Technologies:
- Java (main programming language) and Maven (build and dependency management).
- Logging (via log4j2.xml).
- JSON parsing (implied by DefaultJSONResponseParser and JSONResponseParser interfaces).
- SVG generation for map visualization.

##### Specific Elements
- Clear labels for each component (e.g., “Runner: Application Launcher”, “Explorer: Command Center”).
- Annotations for external resources (e.g., “maps input”, “output files”) and configuration (e.g., “log4j2.xml for logging”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data & Configuration"
        MAPS["Maps: Input JSON Files"]:::config
        OUTPUTS["Outputs: Exploration Results"]:::config
        RESOURCES["Resources: Logging & Config"]:::config
    end

    EXT["External Dependencies: pom.xml"]:::external

    CORE_RUNNER["Runner: Application Launcher"]:::core
    CORE_EXPLORER["Explorer: Command Center"]:::core

    AERIAL["Aerial Module: Drone Operations"]:::module
    PHASES["Phases: Exploration Strategies"]:::module
    INTERFACES["Interfaces: Abstraction Layers"]:::interface
    RECORDS["Records: Domain-Specific Data"]:::data

    EXT --> CORE_RUNNER
    MAPS --> CORE_RUNNER
    CORE_RUNNER --> CORE_EXPLORER
    CORE_EXPLORER --> AERIAL
    CORE_EXPLORER --> PHASES
    CORE_EXPLORER --> OUTPUTS
    AERIAL --> INTERFACES
    PHASES --> INTERFACES
    RESOURCES --> CORE_EXPLORER
    CORE_EXPLORER --> RECORDS

    %% Click Events
    click CORE_RUNNER "https://github.com/2aa4-w24/a2-rescue-mission-team-110/blob/main/src/main/java/ca/mcmaster/se2aa4/island/team110/Runner.java"
    click CORE_EXPLORER "https://github.com/2aa4-w24/a2-rescue-mission-team-110/blob/main/src/main/java/ca/mcmaster/se2aa4/island/team110/Explorer.java"
    click AERIAL "https://github.com/2aa4-w24/a2-rescue-mission-team-110/tree/main/src/main/java/ca/mcmaster/se2aa4/island/team110/Aerial/"
    click INTERFACES "https://github.com/2aa4-w24/a2-rescue-mission-team-110/tree/main/src/main/java/ca/mcmaster/se2aa4/island/team110/Interfaces/"
    click PHASES "https://github.com/2aa4-w24/a2-rescue-mission-team-110/tree/main/src/main/java/ca/mcmaster/se2aa4/island/team110/Phases/"
    click RECORDS "https://github.com/2aa4-w24/a2-rescue-mission-team-110/tree/main/src/main/java/ca/mcmaster/se2aa4/island/team110/Records/"
    click RESOURCES "https://github.com/2aa4-w24/a2-rescue-mission-team-110/blob/main/src/main/resources/log4j2.xml"
    click RESOURCES "https://github.com/2aa4-w24/a2-rescue-mission-team-110/blob/main/src/main/resources/ruleset.xml"
    click EXT "https://github.com/2aa4-w24/a2-rescue-mission-team-110/blob/main/pom.xml"

    %% Styles
    classDef core fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef module fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef interface fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef config fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef data fill:#e2e3e5,stroke:#41464b,stroke-width:2px;
```
