# majiro-dev/avaj-launcher architecture

> Architecture diagram of the GitHub repository majiro-dev/avaj-launcher, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/majiro-dev/avaj-launcher
- Repository: https://github.com/majiro-dev/avaj-launcher

## Overview

##### Project Identification
- Project Type: A Java-based aircraft simulation program.
- Purpose: To simulate the behavior of various aircraft (balloon, jet, and helicopter) under dynamic weather conditions using object-oriented design and design patterns.

##### Main Components
a. Input/Output:
- Input: Scenario files (located in the "scenarios" directory) which define simulation parameters.
- Output: Simulation logs written to "simulation.txt" (generated by the application).

b. Core Simulation Engine (Launcher):
- The Launcher class (in sources/Launcher.java) acts as the entry point that initializes the simulation.

c. Aircraft and Weather Elements:
- Aircraft Entities: Represented by classes like Aircraft, Baloon, Helicopter, and JetPlane. All implement the Flyable interface.
- Weather Tower: Managed through WeatherTower (in sources/WeatherTower.java) that interacts with aircraft; the WeatherTower uses the Observer pattern to notify aircraft of weather changes.
- Tower: This might serve as a base or manager for controlling aircraft notifications.
- Weather Provider: A singleton pattern component (in sources/WeatherProvider.java) that gives the current weather conditions.

d. Factory and Design Patterns:
- AircraftFactory (in sources/AircraftFactory.java): Implements the Factory pattern for creating various types of aircraft.
- The Observer pattern is used between the WeatherTower and each aircraft implementing Flyable.
- The Singleton pattern is applied in the WeatherProvider and possibly in the factory to ensure central control.

e. Supporting Data Structures:
- Coordinates (in sources/Coordinates.java): Likely used to store and manage positions for aircraft.

##### Relationships and Flow
- The created aircraft (Baloon, Helicopter, JetPlane) register themselves with the WeatherTower (via the Observer pattern).
- WeatherTower, which relies on a WeatherProvider (Singleton), periodically updates the weather.
- The simulation results are logged, showing interactions and status updates in an output file.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Input/Output Layer
    subgraph "Input/Output"
        A["Scenario Files"]:::input
        B["Simulation Log"]:::output
    end

    %% Core Simulation Control
    subgraph "Simulation Control"
        C["Launcher"]:::engine
    end

    %% Aircraft Creation Layer
    subgraph "Aircraft Creation"
        D["AircraftFactory (Factory Pattern)"]:::factory
        E["Aircraft (Base Class)"]:::aircraft
        F["Flyable (Interface)"]:::interface
        G["Baloon"]:::aircraft
        H["Helicopter"]:::aircraft
        I["JetPlane"]:::aircraft
    end

    %% Weather Management Layer
    subgraph "Weather Management"
        J["WeatherTower"]:::weather
        K["WeatherProvider (Singleton)"]:::singleton
        L["Tower"]:::weatherbase
    end

    %% Data Structures
    subgraph "Data Structures"
        M["Coordinates"]:::data
    end

    %% Connections
    A -->|"reads"| C
    C -->|"initializes"| D
    D -->|"creates"| G
    D -->|"creates"| H
    D -->|"creates"| I
    G -->|"inherits"| E
    H -->|"inherits"| E
    I -->|"inherits"| E
    G -->|"implements"| F
    H -->|"implements"| F
    I -->|"implements"| F
    E -->|"has"| M
    G -->|"registers"| J
    H -->|"registers"| J
    I -->|"registers"| J
    J -->|"gets"| K
    K -->|"updates"| J
    J -->|"logs"| B
    J -->|"extends"| L

    %% Click Events
    click A "https://github.com/majiro-dev/avaj-launcher/tree/main/scenarios/"
    click C "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/Launcher.java"
    click D "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/AircraftFactory.java"
    click E "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/Aircraft.java"
    click F "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/Flyable.java"
    click G "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/Baloon.java"
    click H "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/Helicopter.java"
    click I "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/JetPlane.java"
    click J "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/WeatherTower.java"
    click K "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/WeatherProvider.java"
    click L "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/Tower.java"
    click M "https://github.com/majiro-dev/avaj-launcher/blob/main/sources/Coordinates.java"

    %% Styles
    classDef input fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef output fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef engine fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef factory fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef aircraft fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef interface fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef weather fill:#87CEEB,stroke:#000,stroke-width:2px;
    classDef singleton fill:#FF69B4,stroke:#000,stroke-width:2px;
    classDef weatherbase fill:#98FB98,stroke:#000,stroke-width:2px;
    classDef data fill:#F0E68C,stroke:#000,stroke-width:2px;
```
