Commit
·
39c2603
1
Parent(s):
890628b
Add finalized README
Browse files
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ParcelSortX - Smart Package Sorting and Routing Simulation
|
| 2 |
+
|
| 3 |
+
**ParcelSortX** is a simulation project developed in Java with a Swing-based GUI. It was created for an academic *Data Structures* course and demonstrates the effective use of classic data structures such as Queue, Stack, AVL Tree, Hash Table, and Circular Linked List.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## 📦 Project Overview
|
| 8 |
+
|
| 9 |
+
In each simulation tick, new parcels are randomly generated and first placed into a queue. They are then sorted into destination cities using an AVL tree structure. Misrouted parcels are sent to a stack and reprocessed at intervals. All parcel data is tracked via a hash table, and terminal rotation (active city) is managed through a circular linked list.
|
| 10 |
+
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
## 🧱 Data Structures Used
|
| 14 |
+
|
| 15 |
+
- **Queue (ArrivalBuffer):** Stores newly arriving parcels.
|
| 16 |
+
- **Stack (ReturnStack):** Holds misrouted parcels to be reprocessed.
|
| 17 |
+
- **AVL Tree (CityBST):** Organizes parcels based on destination city, each city has its own priority queue.
|
| 18 |
+
- **Hash Table:** Tracks parcel status and enables quick access.
|
| 19 |
+
- **Circular Linked List:** Manages the rotation of active terminal cities.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## 🚀 How to Use
|
| 24 |
+
|
| 25 |
+
1. Open the project with **IntelliJ IDEA**.
|
| 26 |
+
2. In the `src/` directory, run the `ParcelSortXGUI.java` main method.
|
| 27 |
+
3. (Optional) Create a `config.txt` file to customize the simulation. Example:
|
| 28 |
+
```
|
| 29 |
+
MAX TICKS=30
|
| 30 |
+
QUEUE CAPACITY=20
|
| 31 |
+
TERMINAL ROTATION INTERVAL=5
|
| 32 |
+
PARCEL PER TICK MIN=1
|
| 33 |
+
PARCEL PER TICK MAX=3
|
| 34 |
+
MISROUTING RATE=0.1
|
| 35 |
+
CITY LIST=Istanbul,Ankara,Izmir,Bursa
|
| 36 |
+
```
|
| 37 |
+
4. Monitor the simulation via the GUI.
|
| 38 |
+
5. Upon completion, the system generates two output files: `report.txt` and `log.txt`.
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## 🔄 Simulation Flow
|
| 43 |
+
|
| 44 |
+
- Parcels are randomly generated and added to the arrival queue.
|
| 45 |
+
- They are sorted into the AVL tree based on destination city.
|
| 46 |
+
- Highest-priority parcels are dispatched to the currently active terminal.
|
| 47 |
+
- Misrouted parcels are pushed to the return stack.
|
| 48 |
+
- Return parcels are retried up to 3 times before being canceled.
|
| 49 |
+
- Parcel statuses are continuously tracked via a hash table.
|
| 50 |
+
- At the end, summary and logs are exported automatically.
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
## 🖥️ Interface Features
|
| 55 |
+
|
| 56 |
+
- Dark-themed Swing-based graphical user interface.
|
| 57 |
+
- Real-time visual simulation of parcel flow and data structures.
|
| 58 |
+
- ASCII-based structural representation.
|
| 59 |
+
- Final simulation report displayed in a separate window in HTML format.
|
| 60 |
+
|
| 61 |
+
---
|
| 62 |
+
|
| 63 |
+
## 📁 File Structure
|
| 64 |
+
|
| 65 |
+
```
|
| 66 |
+
src/
|
| 67 |
+
├── ParcelSortX.java # Simulation engine and core logic
|
| 68 |
+
├── ParcelSortXGUI.java # GUI entry point and layout
|
| 69 |
+
config.txt # (Optional) Simulation configuration file
|
| 70 |
+
report.txt # Automatically generated summary report
|
| 71 |
+
log.txt # Step-by-step simulation log
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## 👩💻 Author
|
| 77 |
+
|
| 78 |
+
- **elifbasboga** | [Hugging Face Profile](https://huggingface.co/elifbasboga)
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
## 📄 License
|
| 83 |
+
|
| 84 |
+
This project is intended for educational use only. Not for commercial distribution.
|