# cooo22/stack architecture

> Architecture diagram of the GitHub repository cooo22/stack, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cooo22/stack
- Repository: https://github.com/cooo22/stack

## Overview

This repository provides two interfaces for learning bounded, array-based LIFO stacks: a Java Swing application and a browser demo. In each, users operate one or two stacks through push, pop, peek, check, clear, random fill, transfer, capacity selection, and undo; the interface updates the visual stack, status, and history. The Java entry point opens the Swing window, whose controller invokes the stack model and supplies snapshots to its drawing panels. The web controller manages its own stack models and renders the results. Relationships are limited to those shown in source or documented in the README.

Main entry points: [`dude/stack-visualization-group-X/src/StackGUI.java`](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/StackGUI.java) (Swing controller), [`dude/stack-visualization-group-X/src/Main.java`](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/Main.java) (Swing entry point), [`dude/stack-visualization-group-X/web/js/app.js`](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/web/js/app.js) (Web controller and UI), [`dude/stack-visualization-group-X/src/StackPanel.java`](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/StackPanel.java) (Stack drawing panels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_java["Java Swing"]
  node_main["Swing entry point<br/>[Main.java]"]
  node_gui["Swing controller<br/>[StackGUI.java]"]
  node_panel["Stack drawing panels<br/>[StackPanel.java]"]
end

subgraph group_web["Web Demo"]
  node_web_page["Browser demo page<br/>[index.html]"]
  node_web_app["Web controller and UI<br/>[app.js]"]
end

subgraph group_models["Stack Models"]
  node_java_stack["Java array stack<br/>[ArrayStack.java]"]
  node_web_stack["Web array stack<br/>[stack.js]"]
end

node_user(("User"))

node_user -->|"launches"| node_main
node_main -->|"opens"| node_gui
node_gui -->|"operates"| node_java_stack
node_gui -->|"updates"| node_panel
node_user -->|"opens"| node_web_page
node_web_app -->|"operates"| node_web_stack

click node_main "https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/Main.java"
click node_gui "https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/StackGUI.java"
click node_panel "https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/StackPanel.java"
click node_java_stack "https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/ArrayStack.java"
click node_web_page "https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/web/index.html"
click node_web_app "https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/web/js/app.js"
click node_web_stack "https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/web/js/stack.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_gui,node_panel,node_user toneBlue
class node_web_page,node_web_app toneAmber
class node_java_stack,node_web_stack toneMint
```

## Components

### Java Swing

- [Swing entry point](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/Main.java): `dude/stack-visualization-group-X/src/Main.java`
- [Swing controller](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/StackGUI.java): `dude/stack-visualization-group-X/src/StackGUI.java`
- [Stack drawing panels](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/StackPanel.java): `dude/stack-visualization-group-X/src/StackPanel.java`

### Web Demo

- [Browser demo page](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/web/index.html): `dude/stack-visualization-group-X/web/index.html`
- [Web controller and UI](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/web/js/app.js): `dude/stack-visualization-group-X/web/js/app.js`

### Stack Models

- [Java array stack](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/src/ArrayStack.java): `dude/stack-visualization-group-X/src/ArrayStack.java`
- [Web array stack](https://github.com/cooo22/stack/blob/main/dude/stack-visualization-group-X/web/js/stack.js): `dude/stack-visualization-group-X/web/js/stack.js`

### Other components

- **User**

## Connections

- User → Swing entry point: launches (evidence: `README.md`)
- Swing entry point → Swing controller: opens (evidence: `dude/stack-visualization-group-X/src/Main.java`)
- Swing controller → Java array stack: operates (evidence: `dude/stack-visualization-group-X/src/StackGUI.java`)
- Swing controller → Stack drawing panels: updates (evidence: `dude/stack-visualization-group-X/src/StackGUI.java`)
- User → Browser demo page: opens (evidence: `README.md`)
- Web controller and UI → Web array stack: operates (evidence: `dude/stack-visualization-group-X/web/js/app.js`)
