# (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()

This method acts as a simple UI initializer and handoff point for the sorting demo screen. It captures the selected sorting type identifier in the instance field `key`, updates the display title text in `tname`, and then makes the Swing frame visible to the user. From a business perspective, it is not performing the sort itself; instead, it configures the screen so the user can view the selected sorting experience with the correct label.

The method follows a direct assignment-and-display pattern rather than a branching workflow. It temporarily assigns two hardcoded labels, `"Hello"` and `"pop"`, but both are immediately overwritten by the caller-provided `str`, so the effective business label is the caller-supplied value. In the larger system, this method is a shared presentation utility invoked by the frame menu actions to launch the appropriate sorting view for each algorithm category.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["vis(k, str)"])
    SET_KEY["Set instance field key = k"]
    SET_TNAME1["Set instance field tname = \"Hello\""]
    SET_TNAME2["Set instance field tname = \"pop\""]
    SET_TNAME3["Set instance field tname = str"]
    CALL_VISIBLE["Call frame.setVisible(true)"]
    RET["Return 0"]
    START --> SET_KEY
    SET_KEY --> SET_TNAME1
    SET_TNAME1 --> SET_TNAME2
    SET_TNAME2 --> SET_TNAME3
    SET_TNAME3 --> CALL_VISIBLE
    CALL_VISIBLE --> RET
```

**Constant Resolution:**

No external constants are referenced in this method. The visible labels `"Hello"`, `"pop"`, and the caller-provided `str` are literal or parameter values.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `k` | `int` | Sorting option identifier used to determine which algorithm selection was requested by the caller. In the current method it is stored directly into the instance field `key` and does not branch the logic here. |
| 2 | `str` | `String` | Display title or sorting name supplied by the caller, such as a human-readable algorithm label. This value overwrites prior placeholder values and becomes the effective title text used by the screen. |

Instance fields read or written by the method: `key`, `tname`, and `frame`.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `setVisible(true)` | - | Swing `JFrame` UI state | Makes the frame visible so the sorting screen can be displayed to the user. |

## 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: -

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:Frame | `Frame.visSelectorAction` -> `Sortingss.vis` | `setVisible(true) [R] Swing JFrame` |

## 6. Per-Branch Detail Blocks

### Block 1 — Sequential assignment flow (L190-L196)

> This method contains no conditional branching. It executes a fixed sequence of field assignments followed by UI display activation.

| # | 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 |
|------|------|------------------|
| `vis` | Method name | Visibility launcher for the sorting UI screen. |
| `k` | Field/Parameter | Sorting option identifier passed from the menu or caller. |
| `str` | Field/Parameter | Human-readable sorting title or algorithm name. |
| `key` | Field | Instance field that stores the selected sorting option identifier. |
| `tname` | Field | Instance field that stores the displayed title name for the screen. |
| `frame` | Technical term | Swing window object used to render the sorting UI. |
| `JFrame` | UI component | Java Swing top-level application window. |
| `setVisible(true)` | UI action | Opens and displays the window to the end user. |
| `BUBBLE SORT` | Business term | Bubble sort algorithm label used by callers of this method. |
| `INSERTION SORT` | Business term | Insertion sort algorithm label used by callers of this method. |
| `SELECTION SORT` | Business term | Selection sort algorithm label used by callers of this method. |
| `MERGE SORT` | Business term | Merge sort algorithm label used by callers of this method. |
| `QUICK SORT` | Business term | Quick sort algorithm label used by callers of this method. |
| `HEAP SORT` | Business term | Heap sort algorithm label used by callers of this method. |
