# 66-m/sorting-visualizer architecture

> Architecture diagram of the GitHub repository 66-m/sorting-visualizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/66-m/sorting-visualizer
- Repository: https://github.com/66-m/sorting-visualizer

## Overview

- MainController → ArrayController (Array state management)
- ArrayController → SortingAlgorithm (Array manipulation)
- SortingAlgorithm → Visualization (Display updates)
- SortingAlgorithm → Sound (Audio feedback)

- Settings → MainController (Configuration)

##### Key Architectural Elements

- UI Layer (Settings.form)
- Control Layer (Controllers)
- Business Logic Layer (Sorting Algorithms)
- Presentation Layer (Visualizations)
- Audio Layer (Sound)

##### Technical Details

- Java/JDK dependency
- Processing4 core library integration
- MIDI system requirements
- Maven build system

##### Interaction Flows

Sequence of operations:
1. User input → Settings
2. Settings → MainController
3. MainController → ArrayController
4. ArrayController → SortingAlgorithm
5. SortingAlgorithm → Visualization/Sound

- Control logic (io.github.compilerstuck.Control)
- Sorting implementations (io.github.compilerstuck.SortingAlgorithms)
- Visualization components (io.github.compilerstuck.Visual)
- Sound system (io.github.compilerstuck.Sound)

Use a hierarchical layout to show the inheritance relationships within each component group, particularly for the sorting algorithms and visualizations which have multiple implementations.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef control fill:#a8d1f0,stroke:#333
    classDef sorting fill:#90EE90,stroke:#333
    classDef visual fill:#DDA0DD,stroke:#333
    classDef sound fill:#FFA07A,stroke:#333
    classDef interface fill:#f9f9f9,stroke:#333,stroke-dasharray: 5 5

    %% Legend
    subgraph Legend
        L1[Control Components]:::control
        L2[Sorting Components]:::sorting
        L3[Visual Components]:::visual
        L4[Sound Components]:::sound
        L5[Interface]:::interface
    end

    %% Control Layer
    subgraph Control
        MC[MainController]:::control
        AC[ArrayController]:::control
        SET[Settings]:::control
        ST[ShuffleType]:::control
    end

    %% Sorting Layer
    subgraph SortingAlgorithms
        SA[SortingAlgorithm]:::interface
        SORTS[22 Algorithm Implementations]:::sorting
    end

    %% Visualization Layer
    subgraph Visual
        VIS[Visualization]:::interface
        subgraph 2D
            BARS[Bars]:::visual
            SCATTER[ScatterPlot]:::visual
        end
        subgraph 3D
            SPHERE[Sphere]:::visual
            CUBE[Cube]:::visual
        end
        GRAD[Gradient Package]:::visual
    end

    %% Sound Layer
    subgraph Sound
        SND[Sound]:::interface
        MIDI[MidiSys]:::sound
        MINIM[MinimSound]:::sound
    end

    %% Relationships
    MC --> AC
    AC --> SA
    SA --> SORTS
    SA --> VIS
    SA --> SND
    SET --> MC
    VIS --> GRAD
    SND --> MIDI
    SND --> MINIM
    VIS --> |2D| BARS
    VIS --> |2D| SCATTER
    VIS --> |3D| SPHERE
    VIS --> |3D| CUBE

    %% Click Events
    click MC "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Control/MainController.java"
    click AC "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Control/ArrayController.java"
    click SET "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Control/Settings.java"
    click ST "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Control/ShuffleType.java"
    click SA "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/SortingAlgorithms/SortingAlgorithm.java"
    click SORTS "https://github.com/66-m/sorting-visualizer/tree/main/src/main/java/io/github/compilerstuck/SortingAlgorithms/"
    click VIS "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Visual/Visualization.java"
    click BARS "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Visual/Bars.java"
    click SCATTER "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Visual/ScatterPlot.java"
    click SPHERE "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Visual/Sphere.java"
    click CUBE "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Visual/Cube.java"
    click GRAD "https://github.com/66-m/sorting-visualizer/tree/main/src/main/java/io/github/compilerstuck/Visual/Gradient/"
    click SND "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Sound/Sound.java"
    click MIDI "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Sound/MidiSys.java"
    click MINIM "https://github.com/66-m/sorting-visualizer/blob/main/src/main/java/io/github/compilerstuck/Sound/MinimSound.java"
```
