# huyle0112/lthdt.20241-12 architecture

> Architecture diagram of the GitHub repository huyle0112/lthdt.20241-12, 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/huyle0112/lthdt.20241-12
- Repository: https://github.com/huyle0112/lthdt.20241-12

## Overview

##### Main Project Components
- App Entry Point: The App.java file in the "application" package serves as the application’s entry point.
- Controllers: The “controller” package includes the MainMenuController and SimulationController, which handle user interactions and program flow. Their roles – such as opening views, handling events, and communicating with model classes – should be clearly depicted.
- Models: The “model” package holds the Process class, the abstract Scheduler class, and concrete implementations (FCFS, SJF, RoundRobin) that encapsulate the scheduling algorithms. These components perform the primary data processing and scheduling simulation.
- Views: Although there is no explicit "view" package, the FXML files stored under "src/main/resources" (MainMenuView.fxml and SimulationView.fxml) form the user interfaces.
- External Elements: Configuration via Maven (pom.xml, mvnw, etc.) and supplementary design and demo artifacts (under design and demo directories) can be referenced to illustrate build, design, and demonstration processes.

##### Interactions and Relationships
- Model Layer Interaction: The Scheduler (abstract) and its subclass implementations (FCFS, SJF, RoundRobin) process scheduling logic. Their output is formatted (for example, as data required to generate a Gantt chart) and then passed back via Controllers to update the view.
- MVC Pattern: Clearly display the separation of concerns between the user interface (View), user request processing (Controller), and the processing logic (Model).

##### Important Architectural Patterns and Design Principles
- MVC Pattern: Emphasize that the project adheres to the Model–View–Controller pattern by separating data, user interfaces, and control flow.
- Object-Oriented Design: Note that the design uses inheritance (with Scheduler as an abstract class for FCFS, SJF, and RoundRobin) and encapsulation to improve code modularity.
- Modularity and Extensibility: By separating algorithm implementations into distinct classes in the Model package, the design supports easy swapping or addition of new scheduling algorithms.

- Begin at the highest level by showing the overall system architecture (entry point, UI, controller, model).
- Drill down into each layer with as much detail as possible, such as listing key classes and their interactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Layer
    subgraph "Application Layer"
        A["App.java (Entry Point)"]:::app
    end

    %% Controller Layer
    subgraph "Controller Layer"
        MC["MainMenuController"]:::controller
        SC["SimulationController"]:::controller
    end

    %% Model Layer
    subgraph "Model Layer"
        PM["Process Model"]:::model
        SCH["Scheduler (Abstract)"]:::model
        FCFS["FCFS Scheduler"]:::model
        SJF["SJF Scheduler"]:::model
        RR["RoundRobin Scheduler"]:::model
    end

    %% View Layer
    subgraph "View Layer"
        MV["Main Menu (FXML)"]:::view
        SV["Simulation View (FXML)"]:::view
    end

    %% External Elements
    subgraph "External Elements"
        Maven["Maven Configuration"]:::external
        DesignDemo["Design & Demo Artifacts"]:::external
    end

    %% Connections: Application Flow
    A -->|"routes-to"| MC
    MC -->|"loads"| MV
    MC -->|"triggers"| SC
    SC -->|"updates"| SV

    %% Connections: Controllers to Models
    SC -->|"executes"| SCH
    SCH -->|"uses"| PM
    SCH -->|"implemented_by"| FCFS
    SCH -->|"implemented_by"| SJF
    SCH -->|"implemented_by"| RR

    %% External dependencies
    Maven -->|"builds"| A
    DesignDemo -->|"informs"| A

    %% Styling Classes
    classDef app fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef controller fill:#cce5ff,stroke:#007bff,stroke-width:2px;
    classDef model fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef view fill:#fff3cd,stroke:#ffeeba,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#dc3545,stroke-width:2px;

    %% Click Events
    click A "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/java/com/example/cpuscheduler/application/App.java"
    click MC "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/java/com/example/cpuscheduler/controller/MainMenuController.java"
    click SC "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/java/com/example/cpuscheduler/controller/SimulationController.java"
    click PM "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/java/com/example/cpuscheduler/model/Process.java"
    click SCH "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/java/com/example/cpuscheduler/model/Scheduler.java"
    click FCFS "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/java/com/example/cpuscheduler/model/FCFS.java"
    click SJF "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/java/com/example/cpuscheduler/model/SJF.java"
    click RR "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/java/com/example/cpuscheduler/model/RoundRobin.java"
    click MV "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/resources/com/example/cpuscheduler/MainMenuView.fxml"
    click SV "https://github.com/huyle0112/lthdt.20241-12/blob/main/src/main/resources/com/example/cpuscheduler/SimulationView.fxml"
    click Maven "https://github.com/huyle0112/lthdt.20241-12/blob/main/pom.xml"
    click DesignDemo "https://github.com/huyle0112/lthdt.20241-12/tree/main/design"
```
