How dpedwards/java-petrinet-simulator works
Based on your project’s file tree and README, this is a Java-based Petri Net Simulator that integrates a graphical user interface (GUI) with a simulation engine for Petri Nets. The project is structured in layers and follows an MVC-like separation – with the “business” package representing the core simulation/model logic, the “presentation” package implementing the GUI (views and controllers), and the “data” package handling file management. You also have external assets, tests, build configuration (Ant), and several third-party libraries for mocking and testing.
Main Components
• GUI / Presentation Layer:
– Located in the “src/presentation” directory.
• Business / Simulation Engine Layer:
– Found in “src/business”.
– Houses the core Petri Net simulation classes such as PetriNet, Transition, Place, Arc (InputArc, OutputArc), Simulation, TimedSimulation, and other related model classes.
• Data / File Management Layer:
– In the “src/data” package.
– Includes FileManager.java which is likely used for import/export of Petri Net descriptions (supported also by XML import templates in assets/import_templates).
• Asset and UML Documentation:
• Testing:
– The “test” directory shows unit tests for almost every business class, reinforcing design accuracy.
• Build and Dependencies:
– The existence of build.xml, nbproject files, and dependency libraries (e.g., JUnit) indicates integration and build management using Apache Ant along with IDE support (NetBeans, Visual Studio Code).
Relationships and Interactions
• The GUI layer interacts with the Business layer by triggering operations to create, simulate, and analyze a Petri Net.
– For example, GUI actions (like “Run PetriNet” or “Add Transition”) invoke methods in the PetriNet or Simulation classes.
• The Business layer is architected to encapsulate core simulation data and logic.
– It models the Petri Net components (Places, Transitions, Arcs) and simulation steps.
• The Data layer provides file I/O and persistence functionality.
– It enables import and export of net definitions and simulation settings, bridged with the Business layer.
• The testing suite validates these interactions and core functionalities ensuring that each component works correctly.
Architectural Patterns and Design Principles
• Model-View Separation:
– The separation between the “business” (model/simulation) and “presentation” (GUI) packages reflects a Model-View-Controller (MVC)–esque approach.
• Modularization:
– Splitting concerns into distinct packages allows clear dependency management and easier maintenance.
• Extensibility:
Incorporate Key Technologies
• Java 19 for the runtime environment.
• Apache Ant for build automation.
• NetBeans and Visual Studio Code for IDE and dependency management.
• Libraries like JUnit for testing, Mockito for mock testing, as well as byte-buddy and janino for any underlying dynamic or compilation features.
Elements
• Use clear labels for each major component:
• “GUI/Presentation”
• “Simulation Engine/Business Logic”
• “File Management/Data Layer”
• “Testing Suite”
• And optionally “Assets & Documentation”
• E.g., from GUI components to Simulation Engine (user actions trigger simulation events).
• Rectangles for main components.
Detail and Clarity
• As many essential architectural elements as possible.