# elieahd/randomizer architecture

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

- Interactive diagram: https://gitdiagram.com/elieahd/randomizer
- Repository: https://github.com/elieahd/randomizer

## Overview

##### Main Components & Layers
- Library API: This is the public interface that client code will use. It is represented by the core randomizer methods (for instance, a simple “random(…)" API).
- Core Factory & Utilities: Include components like RandomizerFactory, RandomizerParameter, and RandomizerUtils. The factory likely orchestrates creation and registration/override of the different randomizer implementations.
- Randomizer Implementations:
- Field Randomizers: This branch includes subpackages for different kinds of fields. There are separate areas for “fields/dates” (with classes such as DateRandomizer, LocalDateRandomizer, etc.), “fields/numbers” (including IntegerRandomizer, DoubleRandomizer, etc.), and “fields/types” (like BooleanRandomizer, CharacterRandomizer, etc.).
- Collection Randomizers: Separate implementations for arrays, lists, sets, maps, and streams are present under the “randomizers/collections” package, each responsible for building a random collection.
- Inventories: The “inventories” package (for example, FieldRandomizerInventory) could be visualized as a registry or lookup component that tracks available randomizer implementations.
- Testing Suite: Although not part of the runtime system, include a “Tests” component to emphasize the importance of unit tests in verifying interactions and correctness.
- CI/CD & Build System Components (Optional): You may add a note on the side representing Maven (pom.xml), GitHub workflows, and sonar-project.properties. These items ensure code quality, automated testing, and deployment, and though not part of the runtime flow, they are essential for understanding the development lifecycle.

##### Relationships & Interactions
- A client calls the public API (possibly a static “random(…)" method) which delegates to the RandomizerFactory.
- The Factory centrally manages which specific randomizer implementation to use based on the type (and may check or use the inventory for available implementations).
- Once a specific randomizer is chosen, it utilizes utility methods from RandomizerUtils (if any) to perform randomization.
- For collections, the factory would delegate to collection-specific classes (ArrayRandomizer, ListRandomizer, etc.) which then internally might call upon the field randomizers when creating elements.
- Test components to show that each of these layers is validated by dedicated test classes in the “src/test” packages.

##### Architectural Patterns & Principles
- The Factory Pattern is employed, as seen in RandomizerFactory, which abstracts the creation of various randomizer implementations.
- There is a clear separation of concerns by dividing randomization logic into field-specific and collection-specific packages.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    Client["Client Code"]:::external
    API["Randomizer API"]:::core
    Factory["Randomizer Factory"]:::core
    Parameter["Randomizer Parameter"]:::core
    Utils["Randomizer Utilities"]:::core
    Inventories["Inventories"]:::impl

    subgraph "Field Randomizers"
        Dates["Dates"]:::impl
        Numbers["Numbers"]:::impl
        Types["Types"]:::impl
    end

    Collections["Collection Randomizers"]:::impl
    Tests["Testing Suite"]:::test

    subgraph "Build & CI/CD Tools"
        Maven["Maven Build"]:::ci
        Workflows["CI/CD Workflows"]:::ci
        Quality["Code Quality"]:::ci
    end

    %% Relationships
    Client -->|"calls"| API
    API -->|"delegates"| Factory
    Factory -->|"uses"| Parameter
    Factory -->|"utilizes"| Utils
    Factory -->|"checks"| Inventories
    Factory -->|"creates"| Dates
    Factory -->|"creates"| Numbers
    Factory -->|"creates"| Types
    Factory -->|"delegates"| Collections
    Collections -->|"calls"| Dates

    Tests -->|"tests"| API
    Tests -->|"tests"| Factory
    Tests -->|"tests"| Utils

    Maven -.->|"builds"| Factory
    Workflows -.->|"CI"| Factory
    Quality -.->|"checks"| Factory

    %% Click Events
    click API "https://github.com/elieahd/randomizer/blob/main/src/main/java/com/devt/randomizer/randomizers/Randomizer.java"
    click Factory "https://github.com/elieahd/randomizer/blob/main/src/main/java/com/devt/randomizer/RandomizerFactory.java"
    click Parameter "https://github.com/elieahd/randomizer/blob/main/src/main/java/com/devt/randomizer/RandomizerParameter.java"
    click Utils "https://github.com/elieahd/randomizer/blob/main/src/main/java/com/devt/randomizer/RandomizerUtils.java"
    click Dates "https://github.com/elieahd/randomizer/tree/main/src/main/java/com/devt/randomizer/randomizers/fields/dates"
    click Numbers "https://github.com/elieahd/randomizer/tree/main/src/main/java/com/devt/randomizer/randomizers/fields/numbers"
    click Types "https://github.com/elieahd/randomizer/tree/main/src/main/java/com/devt/randomizer/randomizers/fields/types"
    click Collections "https://github.com/elieahd/randomizer/tree/main/src/main/java/com/devt/randomizer/randomizers/collections"
    click Inventories "https://github.com/elieahd/randomizer/blob/main/src/main/java/com/devt/randomizer/inventories/FieldRandomizerInventory.java"
    click Tests "https://github.com/elieahd/randomizer/tree/main/src/test/java/com/devt/randomizer"
    click Maven "https://github.com/elieahd/randomizer/blob/main/pom.xml"
    click Workflows "https://github.com/elieahd/randomizer/tree/main/.github/workflows"
    click Quality "https://github.com/elieahd/randomizer/blob/main/sonar-project.properties"

    %% Styles
    classDef external fill:#f4cccc,stroke:#333,stroke-width:2px;
    classDef core fill:#c9daf8,stroke:#333,stroke-width:2px;
    classDef impl fill:#d9ead3,stroke:#333,stroke-width:2px;
    classDef test fill:#fff2cc,stroke:#333,stroke-width:2px;
    classDef ci fill:#ead1dc,stroke:#333,stroke-width:2px;
```
