How talmizrahii/crochet-pattern-process works
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: Calculation.java Calculation · YarnProcess.java YarnProcess · RunProcess.java RunProcess · ReadLines.java ReadLines
Components 12
Input
- Console user · Supplies project choices and receives estimates.
- Pattern text files · Local crochet patterns selected by path.
patterns/pattern1.txt
Pattern Parsing
- ReadLines · Loads the selected pattern line by line.
src/ReadCrochetPattern/ReadLines.java - CrochetProcess · Converts pattern lines into processable facts.
src/ReadCrochetPattern/CrochetProcess.java - Regexes · Centralizes crochet notation recognition.
src/SyntexRelated/Regexes.java - PatternInfo · Carries extracted pattern attributes and counts.
src/ProcessRelated/PatternInfo.java
Estimation
- Calculation · Combines parsed facts with session parameters.
src/ProcessRelated/Calculation.java - YarnProcess · Estimates required yarn.
src/ProcessRelated/YarnProcess.java - TimeProcess · Estimates work time from speed and pattern data.
src/ProcessRelated/TimeProcess.java - PriceProcess · Calculates project cost or price.
src/ProcessRelated/PriceProcess.java
Other components
- RunProcess · Coordinates the interactive estimation session.
src/RunProcess.java - Displayed estimates · Yarn, time, and price results shown to the user.
Connections 16
- 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