# Getting Started

## What This Project Does

`algo_Calc` is a small Java Swing application for learning and demonstrating classic sorting algorithms. Users choose an algorithm from a menu, enter space-separated integers, and see the sorted result in a second window. The app also includes an **Open Code** action that opens algorithm notes in Notepad, so it reads more like an interactive teaching tool than a production utility.

## Recommended Reading Order

1. [`README.md`](README.md) — quickest overview of the app and its two-window flow.
2. [`Frame`](src/algo_Calc/Frame.java) — the launcher menu and the algorithm selection buttons.
3. [`Sortingss`](src/algo_Calc/Sortingss.java) — the main UI, input parsing, and algorithm dispatch logic.
4. `.codewiki/algo_Calc.md` — deeper class-by-class documentation after you understand the flow.

## Key Entry Points

Start with the classes that define the application flow:

- [`Frame`](src/algo_Calc/Frame.java) — opens the main menu and routes the user to a chosen algorithm.
- [`Sortingss`](src/algo_Calc/Sortingss.java) — builds the sorter window and runs the selected algorithm.
- [`quiks`](src/algo_Calc/Sortingss.java) — quick sort helper.
- [`merg`](src/algo_Calc/Sortingss.java) — merge sort helper.
- [`heaps`](src/algo_Calc/Sortingss.java) — heap sort helper.

If you only read two files first, make them [`Frame`](src/algo_Calc/Frame.java) and [`Sortingss`](src/algo_Calc/Sortingss.java).

## Project Structure

The codebase is intentionally small and mostly flat:

- `src/algo_Calc/` — Java source for the application.
  - [`Frame.java`](src/algo_Calc/Frame.java) — first window / algorithm chooser.
  - [`Sortingss.java`](src/algo_Calc/Sortingss.java) — second window, sorting logic, and helper classes.
- `bin/algo_Calc/` — compiled `.class` files.
- `Images/` — screenshots used in the repository docs.
- `*.txt` files at the repository root — algorithm notes opened by the app's **Open Code** button.
- `.codewiki/` — generated documentation for the repo.

A simple view of the runtime relationships:

```mermaid
flowchart TD
FrameClass["Frame"] --> SortingssClass["Sortingss"]
SortingssClass --> QuiksClass["quiks"]
SortingssClass --> MergClass["merg"]
SortingssClass --> HeapsClass["heaps"]
```

## Configuration

There is very little external configuration. The important files to know are:

- [`README.md`](README.md) — describes the learning/demo workflow and references the screenshots.
- [`.project`](.project) and [`.classpath`](.classpath) — Eclipse project metadata.
- [`.settings/org.eclipse.jdt.core.prefs`](.settings/org.eclipse.jdt.core.prefs) — Java compiler preferences for Eclipse.
- `bubble.txt`, `selection.txt`, `insertion.txt`, `quicksort.txt`, `merge.txt`, `maxheap.txt` — content opened from the **Open Code** button.

The app expects a Windows environment for the Notepad launch path used by **Open Code**.

## Common Patterns

A few conventions repeat throughout the codebase:

- **Swing with absolute positioning** — both frames use `null` layouts and `setBounds(...)` instead of a layout manager.
- **Event-driven UI** — buttons use inline `ActionListener` implementations to switch windows or trigger sorting.
- **Manual input parsing** — the sorter expects integers separated by spaces and converts them with `Integer.parseInt(...)`.
- **Mixed algorithm placement** — bubble sort, selection sort, and insertion sort are implemented inline in `Sortingss`, while quick sort, merge sort, and heap sort are handled by helper classes in the same file.
- **Mutable selection state** — `Sortingss` stores the chosen algorithm in `key` and a display label in `tname` before running the sort.
- **Windows-specific helper action** — the **Open Code** button uses `ProcessBuilder` to open a text file in Notepad.

## Where to Go Next

After you are comfortable with the startup flow, read the submit handler inside [`Sortingss.initialize()`](src/algo_Calc/Sortingss.java) to see exactly how each sort is dispatched. If you plan to change the UI, keep the absolute-position layout in mind — small visual edits often require updating multiple `setBounds(...)` calls.