# talmizrahii/crochet-pattern-process architecture

> Architecture diagram of the GitHub repository talmizrahii/crochet-pattern-process, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/talmizrahii/crochet-pattern-process
- Repository: https://github.com/talmizrahii/crochet-pattern-process

## Overview

#### Purpose and Execution

This is a Java console application that estimates an amigurumi/crochet project’s preparation time, yarn needs, and price from a plaintext crochet pattern plus user-selected working parameters. The likely executable entry point is `src/RunProcess.java`; it coordinates interactive input and the end-to-end processing run. Sample inputs are under `patterns/pattern1.txt`, `patterns/pattern2.txt`, and `patterns/pattern3.txt`.

#### Input Acquisition and Session Control

`src/RunProcess.java` owns the application-level control flow: obtain the pattern file path, present/select project parameters (hook size, separate parts, work speed), invoke processing, and display calculated results. The system is local and file-based; there is no web runtime, database, or remote service dependency indicated.

Pattern text is loaded line-by-line by `src/ReadCrochetPattern/ReadLines.java`. A material boundary exists here: raw user-provided `.txt` content enters the application, with the README noting paths must not contain spaces.

#### Pattern Parsing

`src/ReadCrochetPattern/CrochetProcess.java` transforms the loaded crochet-pattern lines into a processable representation. It is the domain parsing stage between unstructured pattern text and estimation logic.

`src/SyntexRelated/Regexes.java` centralizes syntax recognition, likely defining the regular expressions used to identify crochet notation and counts. This isolates pattern-language assumptions from orchestration and calculation stages.

#### Parsed Pattern Model

`src/ProcessRelated/PatternInfo.java` is the core pattern-information carrier. It likely holds extracted counts and/or pattern attributes used by downstream estimators, providing a boundary between parsing and numeric business logic.

The expected flow is:
`ReadLines` → `CrochetProcess`/`Regexes` → `PatternInfo`.

#### Calculation Coordination

`src/ProcessRelated/Calculation.java` is the estimation coordinator. It consumes parsed pattern information plus runtime choices from the console session and produces the project-level results.

This layer should remain the primary boundary for combining independent estimates, rather than coupling readers/parsers directly to price, time, or yarn formulas.

#### Domain Estimators

Three specialized calculation components represent the application’s main output dimensions:

- `src/ProcessRelated/YarnProcess.java` estimates required material/yarn based on pattern data and hook/project inputs.
- `src/ProcessRelated/TimeProcess.java` estimates preparation/work time, incorporating the user’s approximate work speed.
- `src/ProcessRelated/PriceProcess.java` evaluates project cost/price, likely using yarn/material results and project parameters.

The intended dependency direction is parsed pattern facts into `Calculation`, then into these focused estimators, with their outputs aggregated for console display.

#### Runtime and External Boundaries

The material runtime is a standard Java command-line environment. Inputs are local text files and interactive terminal values; outputs are terminal-displayed estimates. The only external reference in the README is an informational Wikipedia link, not an application integration. No persistence, authentication, network APIs, or infrastructure services are present in the repository tree.

Main entry points: [`src/ProcessRelated/Calculation.java`](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/Calculation.java) (Calculation), [`src/ProcessRelated/YarnProcess.java`](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/YarnProcess.java) (YarnProcess), [`src/RunProcess.java`](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/RunProcess.java) (RunProcess), [`src/ReadCrochetPattern/ReadLines.java`](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ReadCrochetPattern/ReadLines.java) (ReadLines)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input"]
  node_terminal(("Console user<br/>runtime boundary"))
  node_patterns["Pattern text files<br/>plaintext input<br/>[pattern1.txt]"]
end

subgraph group_parsing["Pattern Parsing"]
  node_read_lines["ReadLines<br/>file reader<br/>[ReadLines.java]"]
  node_crochet_process["CrochetProcess<br/>pattern parser"]
  node_regexes["Regexes<br/>syntax rules<br/>[Regexes.java]"]
  node_pattern_info["PatternInfo<br/>parsed pattern model<br/>[PatternInfo.java]"]
end

subgraph group_estimation["Estimation"]
  node_calculation{{"Calculation<br/>estimation coordinator<br/>[Calculation.java]"}}
  node_yarn["YarnProcess<br/>yarn estimator<br/>[YarnProcess.java]"]
  node_time["TimeProcess<br/>time estimator<br/>[TimeProcess.java]"]
  node_price["PriceProcess<br/>price estimator<br/>[PriceProcess.java]"]
end

node_run{{"RunProcess<br/>application entry point<br/>[RunProcess.java]"}}
node_results["Displayed estimates<br/>console output"]

node_terminal -->|"parameters and file path"| node_run
node_patterns -->|"selected text"| node_read_lines
node_run -->|"loads pattern"| node_read_lines
node_read_lines -->|"pattern lines"| node_crochet_process
node_regexes -->|"recognition rules"| node_crochet_process
node_crochet_process -->|"extracted facts"| node_pattern_info
node_run -->|"session choices"| node_calculation
node_pattern_info -->|"parsed pattern"| node_calculation
node_calculation -->|"material estimate"| node_yarn
node_calculation -->|"time estimate"| node_time
node_calculation -->|"price estimate"| node_price
node_yarn -->|"yarn requirement"| node_price
node_yarn -->|"yarn need"| node_results
node_time -->|"work time"| node_results
node_price -->|"project price"| node_results
node_results -->|"display"| node_terminal

click node_patterns "https://github.com/talmizrahii/crochet-pattern-process/blob/main/patterns/pattern1.txt"
click node_run "https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/RunProcess.java"
click node_read_lines "https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ReadCrochetPattern/ReadLines.java"
click node_crochet_process "https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ReadCrochetPattern/CrochetProcess.java"
click node_regexes "https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/SyntexRelated/Regexes.java"
click node_pattern_info "https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/PatternInfo.java"
click node_calculation "https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/Calculation.java"
click node_yarn "https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/YarnProcess.java"
click node_time "https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/TimeProcess.java"
click node_price "https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/PriceProcess.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_terminal,node_patterns toneBlue
class node_read_lines,node_crochet_process,node_regexes,node_pattern_info toneAmber
class node_calculation,node_yarn,node_time,node_price toneMint
class node_run,node_results toneNeutral
```

## Components

### Input

- **Console user**: runtime boundary · Supplies project choices and receives estimates.
- [Pattern text files](https://github.com/talmizrahii/crochet-pattern-process/blob/main/patterns/pattern1.txt): plaintext input · Local crochet patterns selected by path. · `patterns/pattern1.txt`

### Pattern Parsing

- [ReadLines](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ReadCrochetPattern/ReadLines.java): file reader · Loads the selected pattern line by line. · `src/ReadCrochetPattern/ReadLines.java`
- [CrochetProcess](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ReadCrochetPattern/CrochetProcess.java): pattern parser · Converts pattern lines into processable facts. · `src/ReadCrochetPattern/CrochetProcess.java`
- [Regexes](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/SyntexRelated/Regexes.java): syntax rules · Centralizes crochet notation recognition. · `src/SyntexRelated/Regexes.java`
- [PatternInfo](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/PatternInfo.java): parsed pattern model · Carries extracted pattern attributes and counts. · `src/ProcessRelated/PatternInfo.java`

### Estimation

- [Calculation](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/Calculation.java): estimation coordinator · Combines parsed facts with session parameters. · `src/ProcessRelated/Calculation.java`
- [YarnProcess](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/YarnProcess.java): yarn estimator · Estimates required yarn. · `src/ProcessRelated/YarnProcess.java`
- [TimeProcess](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/TimeProcess.java): time estimator · Estimates work time from speed and pattern data. · `src/ProcessRelated/TimeProcess.java`
- [PriceProcess](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/ProcessRelated/PriceProcess.java): price estimator · Calculates project cost or price. · `src/ProcessRelated/PriceProcess.java`

### Other components

- [RunProcess](https://github.com/talmizrahii/crochet-pattern-process/blob/main/src/RunProcess.java): application entry point · Coordinates the interactive estimation session. · `src/RunProcess.java`
- **Displayed estimates**: console output · Yarn, time, and price results shown to the user.

## Connections

- Console user → RunProcess: parameters and file path
- Pattern text files → ReadLines: selected text
- RunProcess → ReadLines: loads pattern
- ReadLines → CrochetProcess: pattern lines
- Regexes → CrochetProcess: recognition rules
- CrochetProcess → PatternInfo: extracted facts
- RunProcess → Calculation: session choices
- PatternInfo → Calculation: parsed pattern
- Calculation → YarnProcess: material estimate
- Calculation → TimeProcess: time estimate
- Calculation → PriceProcess: price estimate
- YarnProcess → PriceProcess: yarn requirement
- YarnProcess → Displayed estimates: yarn need
- TimeProcess → Displayed estimates: work time
- PriceProcess → Displayed estimates: project price
- Displayed estimates → Console user: display
