# Getting Started

## What This Project Does

`algo_Calc` is a small Java Swing application for demonstrating sorting algorithms. A user starts on a menu screen, chooses an algorithm, enters a space-separated list of integers, and then views the sorted result in a second window. The app also includes an **Open Code** action that launches a matching text file in Notepad, so it doubles as a learning/demo tool.

## Recommended Reading Order

1. **[` .codewiki/overview.md`](../overview.md)** — start here for the repository-level summary and the big-picture flow.
2. **[` .codewiki/algo_Calc.md`](../algo_Calc.md)** — read this next for the module breakdown and class responsibilities.
3. **[`src/algo_Calc/Frame.java`](../../src/algo_Calc/Frame.java)** and **[`src/algo_Calc/Sortingss.java`](../../src/algo_Calc/Sortingss.java)** — finish with the source to see how the UI and algorithm dispatch actually work.

## Key Entry Points

The most important classes to understand first are:

- [`src/algo_Calc/Frame.java`](../../src/algo_Calc/Frame.java) — the launch screen and algorithm picker.
- [`src/algo_Calc/Sortingss.java`](../../src/algo_Calc/Sortingss.java) — the main sorting window and controller.
- Helper classes inside [`src/algo_Calc/Sortingss.java`](../../src/algo_Calc/Sortingss.java): `quiks`, `merg`, and `heaps` — quick sort, merge sort, and heap sort implementations.

If you only read one source file first, read `Sortingss.java`; it contains the UI wiring, input parsing, sort dispatch, and output formatting.

## Project Structure

The codebase is intentionally compact:

- `src/algo_Calc/` — source code for the application
- `bin/algo_Calc/` — compiled class files
- `Images/` — screenshots used by the README
- `*.txt` files in the repo root — algorithm-specific companion files opened from the UI

The application flow is simple:

```mermaid
flowchart TD
    FrameClass["Frame"] --> SortingssClass["Sortingss"]
    SortingssClass --> QuicksClass["quiks"]
    SortingssClass --> MergeClass["merg"]
    SortingssClass --> HeapClass["heaps"]
```

## Configuration

There is very little external configuration, which makes the project easy to start with:

- **`.project`** and **`.classpath`** — Eclipse project metadata.
- **`.settings/org.eclipse.jdt.core.prefs`** — Java compiler and IDE settings.
- **`bubble.txt`, `selection.txt`, `quicksort.txt`, `insertion.txt`, `merge.txt`, `maxheap.txt`** — text files opened by the **Open Code** button.
- **`README.md`** — contains the original project description and screenshots.

One important runtime assumption: the **Open Code** feature uses `Notepad.exe`, so it is Windows-oriented.

## Common Patterns

A few patterns show up throughout the code:

- **Two-window UI flow** — `Frame` handles algorithm selection, then `Sortingss` handles input and output.
- **Algorithm key dispatch** — the selected algorithm is stored in an integer `key`, and the submit handler branches on that value.
- **In-place sorting** — the algorithms mostly mutate the input `int[]` directly.
- **Simple Swing layout** — the UI uses absolute positioning rather than a layout manager.
- **Minimal validation** — input is expected to be space-separated integers, with limited error handling.

## Where to Start in the Code

When you are ready to read source, focus on these questions in order:

1. How does `Frame` choose which algorithm to open?
2. How does `Sortingss.vis(...)` pass state between windows?
3. What input format does the submit handler expect?
4. Which sorts are implemented inline, and which delegate to helper classes?
5. How does **Open Code** choose the matching `.txt` file?

If you want the shortest path to understanding the system, start with `Frame.java`, then jump straight to the submit action inside `Sortingss.java`.