---

# (DD03) Business Logic — Sortingss.vis() [8 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `algo_Calc.Sortingss` |
| Layer | Utility |
| Module | `algo_Calc` (Package: `algo_Calc`) |

## 1. Role

### Sortingss.vis()

`vis(int k, String str)` is a lightweight UI-initialization method that configures the Sortingss form for display and binds the caller-provided selection into the screen state. It copies the incoming numeric selector into the instance field `key`, then overwrites the title/name field multiple times before finally applying the supplied `str` value, which means the last assignment is the one that matters operationally. The method does not perform any business calculation, persistence, or validation; instead, it acts as a presentation-layer setup routine that prepares the window and makes it visible to the user. In the broader system, it is a shared display entry point used by the `Frame` class to open the sorting screen with a specific algorithm label. Its control flow is linear with no branching, so all behavior is deterministic and side-effect driven. The final operation is a UI state change via `frame.setVisible(true)`, which transitions the screen from initialized state to active display state.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["vis(k, str)"])
    SET_KEY["Set instance field key = k"]
    SET_TNAME_HELLO["Set instance field tname = 'Hello'"]
    SET_TNAME_POP["Set instance field tname = 'pop'"]
    SET_TNAME_STR["Set instance field tname = str"]
    SHOW_FRAME["Call frame.setVisible(true)"]
    RET["Return 0"]
    END_NODE(["End"])

    START --> SET_KEY
    SET_KEY --> SET_TNAME_HELLO
    SET_TNAME_HELLO --> SET_TNAME_POP
    SET_TNAME_POP --> SET_TNAME_STR
    SET_TNAME_STR --> SHOW_FRAME
    SHOW_FRAME --> RET
    RET --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `k` | `int` | Algorithm selector code passed from the caller. In this screen flow, it identifies which sorting option is being opened and is stored in the `key` instance field for later UI logic. |
| 2 | `str` | `String` | Display label for the selected sorting option. The method assigns this value to the `tname` field after temporary placeholder values, so it becomes the final screen title/name shown in the UI context. |

**Instance fields / external state read or written by the method:** `key`, `tname`, `frame`.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `frame.setVisible(true)` | N/A | Swing frame / UI window state | Updates the window state to visible so the sorting screen appears to the user. |

The method contains no database CRUD activity and no service-component calls. The only callable operation is a UI state update on the `frame` object.

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: -

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `Frame` | `Frame.vis(...) -> Sortingss.vis(int, String)` | `frame.setVisible(true) [U] Swing frame / UI window state` |

## 6. Per-Branch Detail Blocks

**Block 1** — [SEQUENTIAL] `(method entry)` (L190)

> Initializes the screen state using the provided selector and display name.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = k;` |
| 2 | SET | `tname = "Hello";` |
| 3 | SET | `tname = "pop";` |
| 4 | SET | `tname = str;` |
| 5 | EXEC | `frame.setVisible(true);` |
| 6 | RETURN | `return 0;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|-------------------|
| `k` | Field/Parameter | Numeric selector indicating which sorting option the caller wants to open. |
| `str` | Field/Parameter | Display string for the selected sorting option, used as the final name/title value. |
| `key` | Field | Instance field that stores the active sorting selector for later UI behavior. |
| `tname` | Field | Instance field that stores the display name/title associated with the sorting screen. |
| `frame` | Technical term | Swing window instance representing the visible application screen. |
| `vis` | Method name | Abbreviation-like method name used here as a screen visibility initializer. |
| `UI` | Acronym | User Interface — the visual window and controls shown to the user. |
| `Swing` | Framework | Java desktop UI toolkit used to render application windows and controls. |
| `sort` / `sorting` | Business term | Algorithm category for ordering data items according to a comparison rule. |
| `Frame` | Class type | Caller-side screen class that launches the sorting display with a chosen label. |
| `BUBBLE SORT` | Business term | Bubble sort algorithm label passed by the caller. |
| `INSERTION SORT` | Business term | Insertion sort algorithm label passed by the caller. |
| `SELECTION SORT` | Business term | Selection sort algorithm label passed by the caller. |
| `MERGE SORT` | Business term | Merge sort algorithm label passed by the caller. |
| `QUICK SORT` | Business term | Quick sort algorithm label passed by the caller. |
| `HEAP SORT` | Business term | Heap sort algorithm label passed by the caller. |
| `Hello` | Literal value | Temporary placeholder assigned to `tname` before being overwritten. |
| `pop` | Literal value | Temporary placeholder assigned to `tname` before being overwritten. |
| `visible` | Technical term | Window state indicating whether the screen is displayed on the desktop. |

---
