# coologtvil/plagdetect architecture

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

- Interactive diagram: https://gitdiagram.com/coologtvil/plagdetect
- Repository: https://github.com/coologtvil/plagdetect

## Overview

##### Project Type and Purpose
- This project is a Java application that focuses on plagiarism detection.
- It uses JavaFX for the UI, and its structure suggests an MVC pattern, where the “plagdetect” namespace separates concerns into:
- Model (data entities like FileModel and User)
- View (UI – implemented in UI.java)
- Controller (business logic, e.g., FileController and PlagiarismDetection)
- The README instructs on building and running with Gradle, which signals it’s built on a Gradle-managed build process.

##### Main Components & How to Represent Them
- Entry Point: Represent the App.java class which initializes the application.
- Controllers:
- FileController.java – likely handling file-related operations.
- PlagiarismDetection.java – responsible for the core plagiarism detection logic.
- Models:
- FileModel.java, User.java – representing the core data entities.
- Views:
- UI.java – built using JavaFX which interacts with the user.
- Resources:
- config.properties – holds configuration details (e.g., passwords, database or environment settings).
- db.sql – likely used for setting up the initial database schema/data.
- Build/Deployment:
- Gradle build files (build.gradle, settings.gradle, and gradle wrapper files) – emphasize that this project uses Gradle for building and dependency management.

##### Relationships and Interactions
- The App.java (entry point) initializes the JavaFX UI and subsequently links the UI (View) with the Controller.
- The Controller classes (FileController, PlagiarismDetection) handle business logic and control the data flow between the View and the Model.
- Model classes (FileModel, User) represent the underlying data and are used by controllers for operations such as file handling or user management.
- The configuration files (config.properties) and database script (db.sql) should be depicted as external resources that the application depends on.
- Data flow from the UI (view) to the controllers.
- Business logic processing by controllers and interaction with models.
- Dependency on configuration and database resources.

##### Architectural Patterns & Technologies
- MVC Pattern: Clearly show how the Model, View, and Controller layers interact.
- JavaFX: Emphasize in the View layer that JavaFX is used for the user interface.
- Gradle Build System: Detail how the Gradle build process fits into the project lifecycle (build and runtime).
- External Resource Integration: Show where configuration and database initialization come into play.
- Optional: If any additional architectural patterns (like dependency injection or layered separation) are observed, you may add them for clarity.

##### Specific Elements
- The initialization flow from App.java to UI.
- Communication paths from UI to Controller.
- Interactions between Controller and Model, as well as any integration with external resources.
- Blue for the view layer (UI/JavaFX)
- Green for controllers
- Orange for models

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Gradle Build Process
    Gradle["Gradle Build Process"]:::build

    %% Entry Point
    Entry["Entry Point (App.java)"]

    %% MVC Architecture
    subgraph "MVC Architecture"
        subgraph "View Layer"
            UI["UI (JavaFX)"]:::view
        end
        subgraph "Controller Layer"
            FC["Controller (FileController)"]:::controller
            PD["Controller (PlagiarismDetection)"]:::controller
        end
        subgraph "Model Layer"
            FM(("Model (FileModel)")):::model
            U(("Model (User)")):::model
        end
    end

    %% External Resources
    subgraph "External Resources"
        Config["Config (config.properties)"]:::resource
        Database["Database (db.sql)"]:::resource
    end

    %% Legend (Annotation)
    Legend["Legend: Blue = View, Green = Controller, Orange = Model, Gray = External Resource, Pink = Gradle Build"]

    %% Connections
    Gradle -->|"builds"| Entry
    Entry -->|"initializes"| UI
    UI -->|"triggers"| FC
    UI -->|"initiates"| PD
    FC -->|"handles"| FM
    PD -->|"accesses"| FM
    PD -->|"manages"| U
    Entry -->|"loads"| Config
    Entry -->|"loads"| Database

    %% Click Events
    click Entry "https://github.com/coologtvil/plagdetect/blob/main/app/src/main/java/plagdetect/App.java"
    click FC "https://github.com/coologtvil/plagdetect/blob/main/app/src/main/java/plagdetect/controller/FileController.java"
    click PD "https://github.com/coologtvil/plagdetect/blob/main/app/src/main/java/plagdetect/controller/PlagiarismDetection.java"
    click FM "https://github.com/coologtvil/plagdetect/blob/main/app/src/main/java/plagdetect/model/FileModel.java"
    click U "https://github.com/coologtvil/plagdetect/blob/main/app/src/main/java/plagdetect/model/User.java"
    click UI "https://github.com/coologtvil/plagdetect/blob/main/app/src/main/java/plagdetect/view/UI.java"
    click Config "https://github.com/coologtvil/plagdetect/blob/main/app/src/main/resources/config.properties"
    click Database "https://github.com/coologtvil/plagdetect/blob/main/app/src/main/resources/db.sql"
    click Gradle "https://github.com/coologtvil/plagdetect/blob/main/app/build.gradle"

    %% Styles
    classDef view fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef controller fill:#A9DFBF,stroke:#1E8449,stroke-width:2px;
    classDef model fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef resource fill:#D5DBDB,stroke:#808B96,stroke-width:2px;
    classDef build fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
```
