# seyl3/rechor architecture

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

- Interactive diagram: https://gitdiagram.com/seyl3/rechor
- Repository: https://github.com/seyl3/rechor

## Overview

##### Main Components
- User Interface Layer: Although the project isn’t web-based, it does include a user-friendly interface (possibly a GUI or command-line input) where the user enters departure, destination, and time preferences.
- Application Controller/Coordinator: A central component that takes user input and orchestrates interactions between the various modules.
- Journey Planning Module: This includes packages such as journey (e.g., Journey, JourneyExtractor, JourneyIcalConverter, Profile, ParetoFront) that implement the search algorithms, process criteria, and generate journey proposals.
- Timetable Data Module: Your core data is represented by packages and classes inside timetable and timetable/mapped (e.g., Connections, Trips, Stations, Routes, Transfers, etc.). This module encapsulates reading and processing the pre-downloaded Swiss timetable data.
- Data Representation/Processing Components: Classes like PackedRange, Bits32_24_8, and Preconditions are used for internal data management, validations, and efficient storage.
- External Calendar Integration: The IcalBuilder and JourneyIcalConverter indicate that the system supports outputting journey details in a standardized calendar format (.ical), which can be considered as another module.

##### Relationships and Data Flow
- How the UI layer collects user inputs and forwards this information to the Application Controller.
- That once a journey is determined, the result is passed into the ICal conversion module to generate a downloadable calendar entry.

##### Architectural Patterns and Design Principles
- Object-Oriented Modularity: Emphasize how code is grouped by functionality (separate packages for journey planning, timetable processing, and utility functions).
- Data Abstraction and Encapsulation: Identify that the timetable module abstracts raw data into higher-level objects (e.g., Stations, Connections, Transfers) for consumption by the planning algorithms.
- Separation of Concerns: Clearly split the UI/input handling, data processing, algorithm execution, and output generation.
- Efficiency via Mapped Structures: Note the existence of “mapped” packages that indicate optimized or buffered loading of large datasets, ensuring efficient resource usage.

##### Technologies, Frameworks, and Tools
- Java (minimum JRE 8) forms the basis.
- Use of JUnit (as evidenced by the junit-platform-console jar) for testing.

##### Additional Detail Level
- Submodules within the Journey Planning component showing how various classes (JourneyExtractor, ParetoFront, etc.) might interact.
- In the Timetable Data module, illustrate the flow from raw binary files (connections.bin, trips.bin, etc.) through processing classes to the mapped data representations.
- Interaction and data flow between lower-level utility classes (e.g., Preconditions) and higher-level operations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    UI["UI/Input Module"]:::interface

    %% Application Controller/Coordinator
    AC["Application Controller/Coordinator"]:::controller

    %% Journey Planning Module
    subgraph "Journey Planning Module"
        JP["Journey Planning Engine"]:::planning
        JE["Journey.java"]:::planning
        JEX["JourneyExtractor.java"]:::planning
        JIC["JourneyIcalConverter.java"]:::planning
        PC["PackedCriteria.java"]:::planning
        PF["ParetoFront.java"]:::planning
        P["Profile.java"]:::planning
        ST["Stop.java"]:::planning
        VH["Vehicle.java"]:::planning
    end

    %% Timetable Data Module
    subgraph "Timetable Data Module"
        TD["Timetable Data Loader"]:::data
        MTD["Mapped Timetable Data Loader"]:::data
        CN["Connections.java"]:::data
        TR["Trips.java"]:::data
        TS["Stations.java"]:::data
        RT["Routes.java"]:::data
        TF["TimeTable.java"]:::data
        TRF["Transfers.java"]:::data
    end

    %% Data Representation/Processing Components
    subgraph "Data Processing Components"
        B1["Bits32_24_8.java"]:::processing
        PR["PackedRange.java"]:::processing
        PCV["Preconditions.java"]:::processing
    end

    %% External Calendar Integration
    subgraph "External Calendar Integration"
        IC["ICalBuilder.java"]:::calendar
    end

    %% Testing/Validation Components
    TEST["Test Suite"]:::testing

    %% Data Flow
    UI -->|"inputs"| AC
    AC -->|"coordinates"| JP
    AC -->|"loadsData"| TD
    JP -->|"fetchesData"| TD
    TD -->|"optimizesData"| MTD
    JP -->|"generatesCalendar"| IC
    JP -->|"uses"| PCV
    JP -->|"uses"| B1
    JP -->|"uses"| PR
    AC -->|"triggersTests"| TEST

    %% Click Events
    click AC "https://github.com/seyl3/rechor/tree/master/src/ch/epfl/rechor"
    click JE "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/journey/Journey.java"
    click JEX "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/journey/JourneyExtractor.java"
    click JIC "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/journey/JourneyIcalConverter.java"
    click PC "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/journey/PackedCriteria.java"
    click PF "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/journey/ParetoFront.java"
    click P "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/journey/Profile.java"
    click ST "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/journey/Stop.java"
    click VH "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/journey/Vehicle.java"
    click TD "https://github.com/seyl3/rechor/tree/master/src/ch/epfl/rechor/timetable"
    click MTD "https://github.com/seyl3/rechor/tree/master/src/ch/epfl/rechor/timetable/mapped"
    click B1 "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/Bits32_24_8.java"
    click PR "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/PackedRange.java"
    click PCV "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/Preconditions.java"
    click IC "https://github.com/seyl3/rechor/blob/master/src/ch/epfl/rechor/IcalBuilder.java"
    click TEST "https://github.com/seyl3/rechor/tree/master/test/ch/epfl/rechor"

    %% Styles
    classDef interface fill:#f9dcdc,stroke:#e74c3c,stroke-width:2px;
    classDef controller fill:#dfeaf5,stroke:#3498db,stroke-width:2px;
    classDef planning fill:#fcf3cf,stroke:#f1c40f,stroke-width:2px;
    classDef data fill:#d4efdf,stroke:#27ae60,stroke-width:2px;
    classDef processing fill:#ede7f6,stroke:#8e44ad,stroke-width:2px;
    classDef calendar fill:#fce4ec,stroke:#e91e63,stroke-width:2px;
    classDef testing fill:#f0f3f4,stroke:#95a5a6,stroke-width:2px;
```
