commit 21ab9f2e548869c793bcade4ac7532f0b565981f Author: Stefano Rossi Date: Sat Jul 12 19:18:13 2025 +0200 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b086bbc --- /dev/null +++ b/.gitignore @@ -0,0 +1,48 @@ +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +## VPP Backup files ## +*.vpp.bak* + +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +/.idea/ +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +/schemas/*.vpp.* +/schemas/.*.vpp.* +/vpproject/*.vpp~1 +/.sonar/ +/**/*.vpp.bak* \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..112b371 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,40 @@ +default: + image: maven:3.9.6-eclipse-temurin-21 + +stages: + - "build" + - "check" + - "report" + +mvn-build: + stage: "build" + script: + - mvn compile -s ci_settings.xml + +checkstyle-check: + stage: "check" + script: + - mvn checkstyle:check -s ci_settings.xml + +test-check: + stage: "check" + script: + - mvn test -s ci_settings.xml + artifacts: + paths: + - target/ + +javadoc-check: + stage: "check" + script: + - mvn javadoc:javadoc -s ci_settings.xml + +site-report: + needs: + - "test-check" + stage: "report" + script: + - mvn site -s ci_settings.xml + artifacts: + paths: + - target/site/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..049c3c8 --- /dev/null +++ b/README.md @@ -0,0 +1,130 @@ +# Génie Logiciel 1 - Team gl-2024-bleu + +- Group BLEU: + - Gomes + - Pereira + - Julmy + - Bugnon + - Hertling + - Rossi + - Visvarajah +- [Repository](https://gitlab.forge.hefr.ch/genie-logiciel-1/2024/enonce-final/gl1-2024-bleu) +- [Repo énoncé](https://gitlab.forge.hefr.ch/genie-logiciel-1/2024/enonce-miniprojet-id/-/blob/main/Enonce_final.md?ref_type=heads) +- Latest Doc Update : 22.06.2024 +- Latest Version : 1.0-SNAPSHOT + +This project is a Java application built with Maven for the project +GL1-2024-BLEU. + +It integrates one board, one simulator, and various analyzers and views coming the historical group of each +member. It also implements the `Experiment` API from the cockpit project from the DevOps course. This experiment is then +used by the cockpit experiment configurator, launched in this application. +See the component diagram in the [Components and structure](#Components-and-Structure) section for a visual +representation of this integration. + +## Prerequisites + +- Java jdk 17 +- Maven 3.8.7+ + +## Dependencies + +This project implements the IL and the ID interfaces/packages: + +- [ch.fr.hes.il.simulife2024 v1.6.2](https://simulife.isc.heia-fr.ch/v1.6.2/site/apidocs/ch/fr/hes/il/simulife2024/package-summary.html) +- [ch.fr.hes.id.simulife2024 v1.6.2](https://simulife.isc.heia-fr.ch/v1.6.2/site/apidocs/ch/fr/hes/id/simulife2024/package-summary.html) +- [Vue](https://gitlab.forge.hefr.ch/genie-logiciel-1/2024/simulife-views) +- [Analysis](https://gitlab.forge.hefr.ch/genie-logiciel-1/2024/simulife-analyzers) +- [Simulation](https://gitlab.forge.hefr.ch/genie-logiciel-1/2024/simulife-simulators) +- [Model](https://gitlab.forge.hefr.ch/genie-logiciel-1/2024/simulate-models) +- [Elements](https://gitlab.forge.hefr.ch/genie-logiciel-1/2024/simulife-elements) + +## Project structure and behaviour + +### Components and structure + +The documentation for the different components of the project can be found in the `docs` folder: + +* [Composant and-juz-per](./docs/Composant%20and-juz-per): View and Model (even if not used here) components + documentation from the `And-Juz-Per` team +* [Composant bed-her-run](./docs/Composant%20bed-her-ruf): Analyzer and Simulation components documentation from + the `Bed-Her-Ruf` team +* [Composant bug-ros-oli](./docs/Composant%20bug-oli-ros): View component documentation from the `Bug-Oli-Ros` team +* [Composant dem-kul-gom](./docs/Composant%20dem-kul-gom): Element component documentation from the `Dem-Kul-Gom` team +* [Composant gl12024ros](./docs/Composant%20gl12024ros): Analyzer and Simulation components documentation from + the `gl12024ros` team +* [Composant jul-mic-rol](./docs/Composant%20jul-mic-rol): View and Model components documentation from + the `Jul-Mic-Rol` team +* [Composant wae-vis-bog](./docs/Composant%20wae-vis-bog): Analyzer and Simulation components documentation from + the `Wae-Vis-Bog` team + +The component diagram below shows how the project integrates these components: + +![Component_ProjetIntegre.jpg](docs/diagrams/Component_ProjetIntegre.jpg) + +## Behaviour + +The following use case diagram enumerates the use cases of our project and how they are related: + +![UseCase_ProjetIntegre.jpg](docs/diagrams/UseCase_ProjetIntegre.jpg) + +Below we describe, using an activity diagram, the process of configuring and launching an experiment and viewing its +results on a graph. According to the IView API, the user is also able to change the representation of the different +elements of the board on each view. + +![Activity_ProjetIntegre.jpg](docs/diagrams/Activity_ProjetIntegre.jpg) + +## Installing + +Clone the repository + +```bash +git clone git@gitlab.forge.hefr.ch:genie-logiciel-1/2024/enonce-final/gl1-2024-bleu.git +cd gl1-2024-bleu +mvn clean install -s ci_settings.xml +``` + +## Running the application + +To run the application, execute the following command: + +```bash +mvn exec:java "-Dexec.mainClass=ch.fr.heia.isc.gl1.App" +``` + +## Launch the simulation interface + +### 1. Create a New Tree + +A pop-up window titled "New tree" appears. Click on Create New to create a new tree. + +### 2. Select the Java Interface + +The Java interface appears. Right-click on the text ch.epfl.general_librairies.experiment_aut.Experiment. + +### 3. Select the Simulife Experiment + +In the context menu, select ch.fr.heia.isc.gl1.SimulifeExperiment, then navigate to SimulifeExperiment and select +default. + +### 4. Insert Simulation Parameters or display default values + +Click on each parameter to display its default value (default is 10 for each). Alternatively, enter a value for one or +more parameters and click Add. + +- BoardSize: Enter the size of the board. +- Simulation steps: Enter the number of simulation steps. +- Number of elements: Enter the number of elements. Click Add after entering each parameter. + +### 5. Run the Simulation + +Once all parameters are added, click on Run to start the simulation. + +## Running the tests + +To run the tests, execute the following command: + +```bash +mvn test +``` + diff --git a/ci_settings.xml b/ci_settings.xml new file mode 100644 index 0000000..2362566 --- /dev/null +++ b/ci_settings.xml @@ -0,0 +1,83 @@ + + + + gitlab-simulife-interface + + + + Deploy-Token + gldt-oXzbD7gTxcU5N7MQXfRx + + + + + + gitlab-simulife-view + + + + Deploy-Token + gldt-dfgBxkL8LG8LvBBLPD1q + + + + + + gitlab-simulife-analysis + + + + Deploy-Token + gldt-uu_c9XZiPiVg1G1M2dr5 + + + + + + gitlab-simulife-simulation + + + + Deploy-Token + gldt-u8dr9YuqjpSLCrzDJHsW + + + + + + gitlab-simulife-model + + + + Deploy-Token + gldt-U8y4yGRA7AF1yFjPsPyL + + + + + + gitlab-simulife-elements + + + + Deploy-Token + gldt-BsJxz_P_rRHL5euvnxjn + + + + + + gitlab-maven + + + + Deploy-Token + gldt-Sao53kyYyxsjcof-AdQU + + + + + + + diff --git a/div/graphProperties.properties b/div/graphProperties.properties new file mode 100644 index 0000000..344d7fd --- /dev/null +++ b/div/graphProperties.properties @@ -0,0 +1,13 @@ +ch.epfl.javancox.topology_analysis.link_metrics.LinkBetweennessComputer +ch.epfl.javancox.topology_analysis.network_metrics.ClusteringCoefficientComputer +ch.epfl.javancox.topology_analysis.network_metrics.ComponentNumberComputer +ch.epfl.javancox.topology_analysis.network_metrics.DiameterComputer +ch.epfl.javancox.topology_analysis.network_metrics.GiantComponentSizeComputer +ch.epfl.javancox.topology_analysis.network_metrics.GiantComponentSizeComputer$RelativeGiantComponentSizeComputer +ch.epfl.javancox.topology_analysis.network_metrics.TransivityComputer +ch.epfl.javancox.topology_analysis.node_metrics.DegreeComputer +ch.epfl.javancox.topology_analysis.node_metrics.NodeBetweennessComputer +ch.epfl.javancox.topology_analysis.node_pair_metrics.AlgebraicalDistanceComputer +ch.epfl.javancox.topology_analysis.node_pair_metrics.GeodesicalDistanceComputer +ch.epfl.javancox.topology_analysis.node_pair_metrics.PathDistanceComputer +ch.epfl.javancox.topology_analysis.node_pair_metrics.TopologicalDistanceComputer diff --git a/div/images/WDM_switch.emf b/div/images/WDM_switch.emf new file mode 100644 index 0000000..2e40605 Binary files /dev/null and b/div/images/WDM_switch.emf differ diff --git a/div/images/WDM_switch.png b/div/images/WDM_switch.png new file mode 100644 index 0000000..ab9327b Binary files /dev/null and b/div/images/WDM_switch.png differ diff --git a/div/images/computeNode.png b/div/images/computeNode.png new file mode 100644 index 0000000..d6e48b4 Binary files /dev/null and b/div/images/computeNode.png differ diff --git a/div/images/delete.gif b/div/images/delete.gif new file mode 100644 index 0000000..db490d9 Binary files /dev/null and b/div/images/delete.gif differ diff --git a/div/images/europe_map.jpg b/div/images/europe_map.jpg new file mode 100644 index 0000000..a5a5fd3 Binary files /dev/null and b/div/images/europe_map.jpg differ diff --git a/div/images/folder_close.png b/div/images/folder_close.png new file mode 100644 index 0000000..1b30514 Binary files /dev/null and b/div/images/folder_close.png differ diff --git a/div/images/folder_open.png b/div/images/folder_open.png new file mode 100644 index 0000000..cf64c6a Binary files /dev/null and b/div/images/folder_open.png differ diff --git a/div/images/glp_last.gif b/div/images/glp_last.gif new file mode 100644 index 0000000..68b3041 Binary files /dev/null and b/div/images/glp_last.gif differ diff --git a/div/images/glp_next.gif b/div/images/glp_next.gif new file mode 100644 index 0000000..e6b308f Binary files /dev/null and b/div/images/glp_next.gif differ diff --git a/div/images/icon_warning_sml.gif b/div/images/icon_warning_sml.gif new file mode 100644 index 0000000..873bbb5 Binary files /dev/null and b/div/images/icon_warning_sml.gif differ diff --git a/div/images/node.png b/div/images/node.png new file mode 100644 index 0000000..07edc08 Binary files /dev/null and b/div/images/node.png differ diff --git a/div/images/not_selected_menu_icon.png b/div/images/not_selected_menu_icon.png new file mode 100644 index 0000000..b37eb10 Binary files /dev/null and b/div/images/not_selected_menu_icon.png differ diff --git a/div/images/pause.gif b/div/images/pause.gif new file mode 100644 index 0000000..161e3f5 Binary files /dev/null and b/div/images/pause.gif differ diff --git a/div/images/pause__other.gif b/div/images/pause__other.gif new file mode 100644 index 0000000..3fd3cac Binary files /dev/null and b/div/images/pause__other.gif differ diff --git a/div/images/play.gif b/div/images/play.gif new file mode 100644 index 0000000..ebb1837 Binary files /dev/null and b/div/images/play.gif differ diff --git a/div/images/resume_co.gif b/div/images/resume_co.gif new file mode 100644 index 0000000..16f4e25 Binary files /dev/null and b/div/images/resume_co.gif differ diff --git a/div/images/router.png b/div/images/router.png new file mode 100644 index 0000000..0a3a943 Binary files /dev/null and b/div/images/router.png differ diff --git a/div/images/router2.png b/div/images/router2.png new file mode 100644 index 0000000..49011ff Binary files /dev/null and b/div/images/router2.png differ diff --git a/div/images/run_exc.gif b/div/images/run_exc.gif new file mode 100644 index 0000000..57f4102 Binary files /dev/null and b/div/images/run_exc.gif differ diff --git a/div/images/selected_menu_icon.png b/div/images/selected_menu_icon.png new file mode 100644 index 0000000..58a64cf Binary files /dev/null and b/div/images/selected_menu_icon.png differ diff --git a/div/images/simple_node.png b/div/images/simple_node.png new file mode 100644 index 0000000..6478554 Binary files /dev/null and b/div/images/simple_node.png differ diff --git a/div/images/step.gif b/div/images/step.gif new file mode 100644 index 0000000..bbc98ba Binary files /dev/null and b/div/images/step.gif differ diff --git a/div/images/stop.gif b/div/images/stop.gif new file mode 100644 index 0000000..dc47edf Binary files /dev/null and b/div/images/stop.gif differ diff --git a/div/images/stop_0.gif b/div/images/stop_0.gif new file mode 100644 index 0000000..578bf32 Binary files /dev/null and b/div/images/stop_0.gif differ diff --git a/div/images/stop__other.gif b/div/images/stop__other.gif new file mode 100644 index 0000000..f8e4031 Binary files /dev/null and b/div/images/stop__other.gif differ diff --git a/div/javanco.properties.xml b/div/javanco.properties.xml new file mode 100644 index 0000000..2ac3a84 --- /dev/null +++ b/div/javanco.properties.xml @@ -0,0 +1,38 @@ + + + +Hi + +THIS IS THE VALUE OF THIS TEST PROPERTY + +schema.xsd +true +ch.epfl.javanco.network.VectorRepresentation +div/images +div/xmlschemas +output/classes/generatedClasses +output +default_graphs +groovy_scripts + +ch.epfl;edu;sandbox + +ch.epfl.javanco.graphics.DefaultNetworkPainter2DExtended +32 +3 +320 +4 +20 + +#FFFFFF +#000000 +#FFFFFF +14 +true + +div/log4j.properties + +true +true + 15555 + diff --git a/div/javancoTopologyGenerators.properties b/div/javancoTopologyGenerators.properties new file mode 100644 index 0000000..17f4ad0 --- /dev/null +++ b/div/javancoTopologyGenerators.properties @@ -0,0 +1,11 @@ +ch.epfl.javancox.inputs.topology.CirclesPlanarGenerator$RandomCircles +ch.epfl.javancox.inputs.topology.DivisionPlanarGenerator$RandomDivisions +ch.epfl.javancox.inputs.topology.GridRandomGenerator$RandomGrid +ch.epfl.javancox.inputs.topology.MNDBasedProvider$Predefined +ch.epfl.javancox.inputs.topology.PolygonGenerator$Ring +ch.epfl.javancox.inputs.topology.ReyniErdosGenerator$ErdosReyni +ch.epfl.javancox.inputs.topology.ScaleFreeNetworkGenerator$BarabasiAlbert +ch.epfl.javancox.inputs.topology.TessellationGenerator$Tesselation +ch.epfl.javancox.inputs.topology.TorusGenerator$Torus +ch.epfl.javancox.inputs.topology.WattsStrogatzGenerator$WattsStrogatz +ch.epfl.javancox.inputs.topology.WebsGenerator$Webs diff --git a/div/log4j.properties b/div/log4j.properties new file mode 100644 index 0000000..00338fc --- /dev/null +++ b/div/log4j.properties @@ -0,0 +1,14 @@ +# Set root category priority to DEBUG and set its only appender to A1 (set priority to INFO for normal testing and WARN for production) +log4j.rootLogger=DEBUG,A1 + + +# A1 is a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 has a simple layout +log4j.appender.A1.layout=org.apache.log4j.SimpleLayout + + +# Uncomment these linessv for more detailed output +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern= %-5p %.60c- %m%n diff --git a/div/xmlschemas/SimplifiedSchema.xsd b/div/xmlschemas/SimplifiedSchema.xsd new file mode 100644 index 0000000..530e6f7 --- /dev/null +++ b/div/xmlschemas/SimplifiedSchema.xsd @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/div/xmlschemas/schema.xsd b/div/xmlschemas/schema.xsd new file mode 100644 index 0000000..fb12422 --- /dev/null +++ b/div/xmlschemas/schema.xsd @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/Composant and-juz-per/and-juz-per_components.md b/docs/Composant and-juz-per/and-juz-per_components.md new file mode 100644 index 0000000..d01d0bb --- /dev/null +++ b/docs/Composant and-juz-per/and-juz-per_components.md @@ -0,0 +1,26 @@ +# And-Juz-Per - Components + +## View + +This class diagram describes the internal structure of our view component : +![and-juz-per_defaultview_class_diagram.jpg](and-juz-per_defaultview_class_diagram.jpg) +The "main" class was initially called `DefaultView` but it had to be renamed to `AndJuzPerView` to avoid conflicts with +other view components, also named `DefaultView`. + +Here below, the sequence diagram explains how interactions with our view component are handled: +![and-juz-per_defaultview_sequence_diagram.jpg](and-juz-per_defaultview_sequence_diagram.jpg) + +Additionally, the user can, in the GUI, chose to display the elements in the board as icons, text or colors. By default, +the text representation is used. + +# Model (Board) + +> **Note:** In this integrated project (team blue), we chose to use the model from the Jul-Mic-Rol group. Because the +> And-Juz-Per model wasn't used in any integrated project, it does not implement the `SimulableBoard` API. + +The diagrams below explain the structure and behaviour of this component. Because it is not used in this project, it +won't be explained further. + +![and-juz-per_model_class_diagram.jpg](and-juz-per_model_class_diagram.jpg) + +![and-juz-per_model_sequence_diagram.jpg](and-juz-per_model_sequence_diagram.jpg) \ No newline at end of file diff --git a/docs/Composant and-juz-per/and-juz-per_defaultview_class_diagram.jpg b/docs/Composant and-juz-per/and-juz-per_defaultview_class_diagram.jpg new file mode 100644 index 0000000..03d12eb Binary files /dev/null and b/docs/Composant and-juz-per/and-juz-per_defaultview_class_diagram.jpg differ diff --git a/docs/Composant and-juz-per/and-juz-per_defaultview_sequence_diagram.jpg b/docs/Composant and-juz-per/and-juz-per_defaultview_sequence_diagram.jpg new file mode 100644 index 0000000..8d05af1 Binary files /dev/null and b/docs/Composant and-juz-per/and-juz-per_defaultview_sequence_diagram.jpg differ diff --git a/docs/Composant and-juz-per/and-juz-per_model_class_diagram.jpg b/docs/Composant and-juz-per/and-juz-per_model_class_diagram.jpg new file mode 100644 index 0000000..c77bd9c Binary files /dev/null and b/docs/Composant and-juz-per/and-juz-per_model_class_diagram.jpg differ diff --git a/docs/Composant and-juz-per/and-juz-per_model_sequence_diagram.jpg b/docs/Composant and-juz-per/and-juz-per_model_sequence_diagram.jpg new file mode 100644 index 0000000..8c6dbde Binary files /dev/null and b/docs/Composant and-juz-per/and-juz-per_model_sequence_diagram.jpg differ diff --git a/docs/Composant bed-her-ruf/ClassDiagram-GridAnalyser.png b/docs/Composant bed-her-ruf/ClassDiagram-GridAnalyser.png new file mode 100644 index 0000000..fc38cc0 Binary files /dev/null and b/docs/Composant bed-her-ruf/ClassDiagram-GridAnalyser.png differ diff --git a/docs/Composant bed-her-ruf/ClassDiagram-Simulation.jpg b/docs/Composant bed-her-ruf/ClassDiagram-Simulation.jpg new file mode 100644 index 0000000..057510e Binary files /dev/null and b/docs/Composant bed-her-ruf/ClassDiagram-Simulation.jpg differ diff --git a/docs/Composant bed-her-ruf/SequenceDiagram_EnonceFinale.png b/docs/Composant bed-her-ruf/SequenceDiagram_EnonceFinale.png new file mode 100644 index 0000000..40fe7e1 Binary files /dev/null and b/docs/Composant bed-her-ruf/SequenceDiagram_EnonceFinale.png differ diff --git a/docs/Composant bed-her-ruf/SequenceDiagram_Simulation.jpg b/docs/Composant bed-her-ruf/SequenceDiagram_Simulation.jpg new file mode 100644 index 0000000..772760d Binary files /dev/null and b/docs/Composant bed-her-ruf/SequenceDiagram_Simulation.jpg differ diff --git a/docs/Composant bed-her-ruf/elements-doc.md b/docs/Composant bed-her-ruf/elements-doc.md new file mode 100644 index 0000000..57a6ef1 --- /dev/null +++ b/docs/Composant bed-her-ruf/elements-doc.md @@ -0,0 +1,6 @@ +# Documentation + +La documentation des composants du groupe bed-her-ruf a été réaliser sur le wiki du groupe en question. + +Vous pouvez accédez à la documentation du [GridAnalyser](ttps://gitlab.forge.hefr.ch/yohan.ruffieux/gl1-bed-her-ruf/-/wikis/GridAnalyser) et du [Simulation](https://gitlab.forge.hefr.ch/yohan.ruffieux/gl1-bed-her-ruf/-/wikis/Simulation). + diff --git a/docs/Composant bug-oli-ros/bug-oli-ros-view-class-diagram.puml b/docs/Composant bug-oli-ros/bug-oli-ros-view-class-diagram.puml new file mode 100644 index 0000000..ff19eeb --- /dev/null +++ b/docs/Composant bug-oli-ros/bug-oli-ros-view-class-diagram.puml @@ -0,0 +1,28 @@ +@startuml +skinparam classAttributeIconSize 0 + +class DefaultView extends JFrame + +class DefaultView extends ActionListener + +class DefaultView { + + enum: RepresentableType + - board: RepresentableBoard + - frame: JFrame +} +interface IView { + + void: updateView() + + void: setDataSource(RepresentableBoard) + + void: actionPerformed(ActionEvent e) +} +interface RepresentableBoard { + + getWidth(): int + + getHeight(): int + + getCoordinateAsColor(int x, int y): color + + getCoordinateAsString(int x, int y): String + + getCoordinateAsIcon(int x, int y): Icon +} + +DefaultView .down.|> IView +DefaultView "1" o-Right- "0..1" RepresentableBoard : displays +@enduml \ No newline at end of file diff --git a/docs/Composant bug-oli-ros/bug-oli-ros-view_class_diagram.png b/docs/Composant bug-oli-ros/bug-oli-ros-view_class_diagram.png new file mode 100644 index 0000000..4a13f02 Binary files /dev/null and b/docs/Composant bug-oli-ros/bug-oli-ros-view_class_diagram.png differ diff --git a/docs/Composant bug-oli-ros/bug-oli-ros-view_component.md b/docs/Composant bug-oli-ros/bug-oli-ros-view_component.md new file mode 100644 index 0000000..79f48b1 --- /dev/null +++ b/docs/Composant bug-oli-ros/bug-oli-ros-view_component.md @@ -0,0 +1,18 @@ +# Bug-oli-ros - Components + +## View + +This class diagram describes the internal structure of our view component : +![bug-oli-ros-view_class_diagram.png](bug-oli-ros-view_class_diagram.png) +The "main" class was initially called `DefaultView` but it had to be renamed to `BugOliRosDefaultView` to avoid conflicts with +other view components, also named `DefaultView`. + +Here below, the sequence diagram explains how interactions with our view component are handled: +![bug-oli-ros-view_sequence_diagram.png](bug-oli-ros-view_sequence_diagram.png) + +Additionally, the user can, in the GUI, chose to display the elements in the board as icons, text or colors. By default, +the text representation is used. + +# Model (Board) + +> **Note:** In this integrated project (team blue), we chose to use the model from the Jul-Mic-Rol group. diff --git a/docs/Composant bug-oli-ros/bug-oli-ros-view_sequence_diagram.png b/docs/Composant bug-oli-ros/bug-oli-ros-view_sequence_diagram.png new file mode 100644 index 0000000..ba8f62b Binary files /dev/null and b/docs/Composant bug-oli-ros/bug-oli-ros-view_sequence_diagram.png differ diff --git a/docs/Composant bug-oli-ros/bug-oli-ros-view_sequence_diagram.puml b/docs/Composant bug-oli-ros/bug-oli-ros-view_sequence_diagram.puml new file mode 100644 index 0000000..01c8920 --- /dev/null +++ b/docs/Composant bug-oli-ros/bug-oli-ros-view_sequence_diagram.puml @@ -0,0 +1,62 @@ +@startuml + +actor Client order 10 +participant DefaultView order 20 +participant JFrame order 30 +participant ActionListener order 40 + +activate Client +'defaultView()' +Client --> DefaultView **: <> DefaultView + +DefaultView --> DefaultView ++ : DefaultView() + +DefaultView --> JFrame **: <> JFrame +activate JFrame +DefaultView --> JFrame: set up frame +DefaultView --> ActionListener ++: set up ActionListener +return ok +return ok + +return ok + +'updateView()' +Client -> DefaultView ++: updateView() + + 'loop' + loop x - number of height + loop y - number of width + opt String is selected + DefaultView -> JFrame++ : set text in cell + JFrame --> DefaultView-- : String + else Color is selected + DefaultView -> JFrame++ : set color in cell + JFrame --> DefaultView-- : Color + else Icon is selected + DefaultView -> JFrame++ : set icon in cell + JFrame --> DefaultView-- : Icon + end + DefaultView -> JFrame ++: add the cell + JFrame --> DefaultView --: ok + end + DefaultView -> JFrame ++ : revalidate the frame + JFrame --> DefaultView --: ok + end + +DefaultView --> Client --: ok + + +'setDataSource(RepresentableBoard)' +Client -> DefaultView ++: setDataSource(representableBoard) +return ok + + +'actionPerformed(ActionEvent)' +DefaultView -> ActionListener ++: actionPerformed(ActionEvent) +return ok +DefaultView -> ActionListener ++ : handle type of event +return ok +DefaultView -> DefaultView ++ : update the view +return ok + +@enduml diff --git a/docs/Composant dem-kul-gom/.gitkeep b/docs/Composant dem-kul-gom/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/Composant dem-kul-gom/ActivityDiagram.jpg b/docs/Composant dem-kul-gom/ActivityDiagram.jpg new file mode 100644 index 0000000..63cda6b Binary files /dev/null and b/docs/Composant dem-kul-gom/ActivityDiagram.jpg differ diff --git a/docs/Composant dem-kul-gom/SequenceDiagrammElements.jpg b/docs/Composant dem-kul-gom/SequenceDiagrammElements.jpg new file mode 100644 index 0000000..0f8b5cc Binary files /dev/null and b/docs/Composant dem-kul-gom/SequenceDiagrammElements.jpg differ diff --git a/docs/Composant dem-kul-gom/element_ClassDiagramm.jpg b/docs/Composant dem-kul-gom/element_ClassDiagramm.jpg new file mode 100644 index 0000000..7e4c5c9 Binary files /dev/null and b/docs/Composant dem-kul-gom/element_ClassDiagramm.jpg differ diff --git a/docs/Composant dem-kul-gom/elements_doc.md b/docs/Composant dem-kul-gom/elements_doc.md new file mode 100644 index 0000000..d5ddafb --- /dev/null +++ b/docs/Composant dem-kul-gom/elements_doc.md @@ -0,0 +1,47 @@ +# Documentation des Elements +## Diagramme de Classe +### Diagramme +Les classes Engineer et SolarPannel implémentent l'interface SimulableElements. + +![Diagramme de Classe](./element_ClassDiagramm.jpg) + +### Explications des méthodes et variables +#### Simulable Element +- setSimulableBoard(SimulableBoard board) est une méthode qui permet de définir la board. Il est également possible de déassigner la board en passant le mot-clé null. Une exception est levée si on essaie de changer la board +- getSimulableBoard() est la méthode qui permet de récupérer la board où se trouve l'élément. +- action() permet d'effectuer une action spécifique à l'ingénieur ou au SolarPannel. Une exception est générée en cas de board non définie. +- getState() permet de récupérer l'état de l'élément en fournissant au minimum la position "x" et "y". Une exception est générée en cas de board non définie. +#### SolarPannel +Variables : +- energy contient l'énergie produite par le panneau solaire +- timetolive contient la durée de vie restante du panneau +- name contient le nom du Panneau Solaire selon "SP" + ID +- elementBoard contient la board définie pour l'élément + +Méthodes : +- SolarPannel(int id) permet d'initialiser le SolarPannel en générant aléatoirement sa durée de vie et en y définissant un nom +- toString() offre la représentation en caractère du SolarPannel +- damageSolarPannel() offre la possibilité d'endommager le panneau solaire à chaque fois qu'un ingénieur rencontre un SolarPannel. Dans le pire des cas, l'ingénieur peut détruire l'élément +- action() permet de produire un nombre aléatoire d'énergie et va décrémenter la durée de vie de l'élément. Si le temps de vie est 0, alors le panneau solaire sera retiré de la board +### Engineer +Variables : +- name contient le nom de l'ingénieur selon "EN" + ID +- elementBoard contient la board définie pour l'élément +- actualID contient l'identifiant du futur panneau solaire placé par l'ingénieur + +Méthodes : +- Engineer(int id) est le constructeur permettant d'initialiser l'ingénieur +- toString() offre la représentation en caractère du SolarPannel +- action() va effectuer un déplacement aléatoire dans la grille, contrôler qu'aucun panneau solaire n'est déjà présent. Si ce n'est pas le cas alors il en crée un nouveau. Sinon, il va endommager le panneau. + +## Diagramme de séquence +Le diagramme suivant représente le fonctionnement des éléments à savoir : +- la création d'un ingénieur +- L'action d'un ingénieur (avec création d'un panneau) +- La récupération de l'état des éléments + +![Diagramme de Classe](./SequenceDiagrammElements.jpg) + +## Diagramme d'activité +Le diagramme d'activité suivant représente les étapes de fonctionnement des éléments +![Diagramme de Classe](./ActivityDiagram.jpg) \ No newline at end of file diff --git a/docs/Composant gl12024ros/README.md b/docs/Composant gl12024ros/README.md new file mode 100644 index 0000000..a9a621d --- /dev/null +++ b/docs/Composant gl12024ros/README.md @@ -0,0 +1,16 @@ +# gl2024ros Shared components + +Author: Rossi Stefano + +With this project I share 3 components, 2 analyzers and a simulator. + +**Note: It's a cached site, so if it's not the latest version, force a page +refresh** + +- [VitroSimulator](https://stefano.rossi.pages.forge.hefr.ch/gl1-2024-ros/ch/fr/hes/id/simulife2024/simulation/VitroSimulator.html) +- [CellularCollisionAnalyzer](https://stefano.rossi.pages.forge.hefr.ch/gl1-2024-ros/ch/fr/hes/id/simulife2024/analysis/CellularCollisionAnalyzer.html) +- [TypesCounterAnalyzer](https://stefano.rossi.pages.forge.hefr.ch/gl1-2024-ros/ch/fr/hes/id/simulife2024/analysis/TypesCounterAnalyzer.html) + +The base link with the complete documentation for the historical project: + +[gl12024ros](https://stefano.rossi.pages.forge.hefr.ch/gl1-2024-ros/) \ No newline at end of file diff --git a/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_board_jul-mic-rol.PNG b/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_board_jul-mic-rol.PNG new file mode 100644 index 0000000..c428f51 Binary files /dev/null and b/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_board_jul-mic-rol.PNG differ diff --git a/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_board_jul-mic-rol.mmd b/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_board_jul-mic-rol.mmd new file mode 100644 index 0000000..7cfe1d5 --- /dev/null +++ b/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_board_jul-mic-rol.mmd @@ -0,0 +1,43 @@ +classDiagram + +class Coordinate { + - int x + - int y + + - Coordinate(int x, int y) + + + containedWithin(final Coordinate a, final Coordinate b) : boolean +} + +class Board { + + - Coordinate minCoordinates + - Coordinate maxCoordinates + - Map~Element~ ~Coordinate~ elements + + Board() + Board(int width, int height) + + + toString() : String + + addElement(int arg0, int arg1, final SimulableElement arg2) : boolean + + getCoordinatesOfSimulableElement(final SimulableElement arg0) : int[] + + getSimulableElements() : ArrayList + + moveElement(int arg0, int arg1, final SimulableElement arg2) : boolean + + removeElement(final SimulableElement arg0) : boolean + - testCoordinates(final Coordinate coord) : boolean + - getElements(int x, int y) : List~SimulableElement~ + - drawLine(final StringBuilder sb, int i) + - drawCells(final StringBuilder sb, int i) +} + +class RepresentableBoard { + <> + + getCoordinateAsColor(int x, int y) : Color + + getCoordinateAsString(int x, int y) : String + + getCoordinateAsIcon(int x, int y) : Icon + + getWidth() : int + + getHeight() : int +} + +Board *-- Coordinate +Board <|-- RepresentableBoard diff --git a/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_defaultview_jul-mic-rol.PNG b/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_defaultview_jul-mic-rol.PNG new file mode 100644 index 0000000..5c69e9b Binary files /dev/null and b/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_defaultview_jul-mic-rol.PNG differ diff --git a/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_defaultview_jul-mic-rol.mmd b/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_defaultview_jul-mic-rol.mmd new file mode 100644 index 0000000..7e224d1 --- /dev/null +++ b/docs/Composant jul-mic-rol/gl1_teamblue_class_diagram_defaultview_jul-mic-rol.mmd @@ -0,0 +1,24 @@ +classDiagram + +class DefaultView { + # enum RepresentationMode + - RepresentableBoard board + - RepresentationMode mode + - JPanel panel + + DefaultView() + + + setDataSource(RepresentableBoard board) + + updateView() + - fillAndAddCell(int y, int x, AndAddCell(int y, int x, final JLabel cellLabel) + # setRepresentationMode(final RepresentationMode mode) +} + +class IView { + <> + + updateView() + + setDataSource(RepresentableBoard board) +} + +DefaultView <|-- Jpanel +DefaultView <|-- IView diff --git a/docs/Composant jul-mic-rol/gl1_teamblue_sequence_diagram_board-jul-mic-rol.mmd b/docs/Composant jul-mic-rol/gl1_teamblue_sequence_diagram_board-jul-mic-rol.mmd new file mode 100644 index 0000000..9239aab --- /dev/null +++ b/docs/Composant jul-mic-rol/gl1_teamblue_sequence_diagram_board-jul-mic-rol.mmd @@ -0,0 +1,65 @@ +sequenceDiagram + actor User + + rect rgb(204, 255, 255) + note right of User: Create a board + create participant Board + User--)Board: Board(int width, int height) + create participant CollectionElements + Board--)CollectionElements: HashMap<>(); + create participant Coordinate + Board--)Coordinate: Coordinate(int minX, int minY) + Board--)Coordinate: Coordinate(int maxX, int maxY) + end + + rect rgb(229, 255, 204) + note right of User: Create and add an element + create participant Element + User--)Element: Element() implement ElementInterface + User->>Board: addElement(Element element, int x, int y) + Board--)Coordinate: Coordinate(int x, int y) + Board-)Coordinate: testCoordinate(Coordinate(int x, int y) + alt coordinate are invalid + Coordinate--)Board: IndexOutOfBoundsException() + Board--)User: IndexOutOfBoundsException() + else coordinate are valid + Board->>CollectionElements: put(Element element, Coordinate coordinate) + end + end + + rect rgb(255, 204, 204) + note right of User: Get elements of a coordinate + User-)Board: getElements(int x, int y) + Board-)Coordinate: testCoordinate(Coordinate(int x, int y) + alt coordinate are invalid + Coordinate--)Board: IndexOutOfBoundsException() + Board->>User: IndexOutOfBoundsException() + else coordinate are valid + Board-)CollectionElements: Get elements at given coordinate + CollectionElements--)Board: return elements + Board->>User: return elements + end + end + + rect rgb(255, 204, 255) + note right of User: Remove an element + User-)Board: removeElement(Element element) + Board-)CollectionElements: containsKey(Element element) + alt element not in CollectionElements + CollectionElements--)Board: return false + Board--)User: return false + else element in CollectionElements + CollectionElements--)Board: return true + Board-)CollectionElements: remove(Element element) + Board--)User: return true + end + end + + rect rgb(204, 204, 255) + note right of User: Clear coordinate + User-)Board: clearCoordinate(int x, int y) + Board->>Board: getElements(int x, int y) + note over Board: see Get elements of a coordinate + Board->>Board: removeElement(Element element) + note over Board: For each element found, see Remove an element + end diff --git a/docs/Composant jul-mic-rol/gl1_teamblue_sequence_diagram_defaultview_jul-mic-rol.PNG b/docs/Composant jul-mic-rol/gl1_teamblue_sequence_diagram_defaultview_jul-mic-rol.PNG new file mode 100644 index 0000000..1b30fe3 Binary files /dev/null and b/docs/Composant jul-mic-rol/gl1_teamblue_sequence_diagram_defaultview_jul-mic-rol.PNG differ diff --git a/docs/Composant jul-mic-rol/gl1_teamblue_sequence_diagram_defaultview_jul-mic-rol.mmd b/docs/Composant jul-mic-rol/gl1_teamblue_sequence_diagram_defaultview_jul-mic-rol.mmd new file mode 100644 index 0000000..31f3382 --- /dev/null +++ b/docs/Composant jul-mic-rol/gl1_teamblue_sequence_diagram_defaultview_jul-mic-rol.mmd @@ -0,0 +1,18 @@ +sequenceDiagram + actor User + + rect rgb(204, 255, 255) + note right of User: Create a DefaultView + create participant DefaultView + User--)DefaultView: DefaultView() + end + + rect rgb(229, 255, 204) + note right of User: Set a new data Source for the view + User ->> DefaultView: setDataSource(final RepresentableBoard board) + end + + rect rgb(255, 204, 204) + note right of User: Update the view + User ->> DefaultView: updateView() + end diff --git a/docs/Composant jul-mic-rol/jul-mic-rol_components.md b/docs/Composant jul-mic-rol/jul-mic-rol_components.md new file mode 100644 index 0000000..a46ed52 --- /dev/null +++ b/docs/Composant jul-mic-rol/jul-mic-rol_components.md @@ -0,0 +1,24 @@ +# jul-mic-rol - Components + +## View + +This class diagram describes the internal structure of our view component : +![View class diagram](gl1_teamblue_class_diagram_defaultview_jul-mic-rol.PNG) +The "main" class was initially called `DefaultView` but it had to be renamed to `JulMicRolView` to avoid conflicts with +other view components, also named `DefaultView`. + +Here below, the sequence diagram explains how interactions with our view component are handled: +![View sequence diagram](gl1_teamblue_sequence_diagram_defaultview_jul-mic-rol.PNG) + +Additionally, the user can, in the GUI, chose to display the elements in the board as icons, text or colors. By default, +the text representation is used. + +# Model (Board) + +> **Note:** In this integrated project (team blue), we chose to use the model from the Jul-Mic-Rol group. + +The diagrams below explain the structure and behaviour of this component. + +![Board class diagram](gl1_teamblue_class_diagram_board_jul-mic-rol.PNG) + +Unfortunately, the sequence diagram is too long to be put as an image in this document. \ No newline at end of file diff --git a/docs/Composant wae-vis-bog/Composant-Simulator.md b/docs/Composant wae-vis-bog/Composant-Simulator.md new file mode 100644 index 0000000..c59532d --- /dev/null +++ b/docs/Composant wae-vis-bog/Composant-Simulator.md @@ -0,0 +1,21 @@ +# Composant: Analyzer + +## Author: gl1-2024-wae-vis-bog ID + +## Diagramme de classe : + +![class-diagram.png](Diagramme%20de%20classe%20de%20Simulation.png) + +## Description + + +La classe Simulation implémente l'interface Simulator et elle est utilisé afin d'effectuer une Simulation de la Grid ainsi que des ses divers éléments + +Détails dans la [javadoc](https://simulife.isc.heia-fr.ch/v1.5.1/site/apidocs/ch/fr/hes/id/simulife2024/Simulator.html). + +### Digramme de sequence : + +Fonctionnement : + +![sequence-analyzer.png](Diagramme%20de%20sequence%20de%20Simulation.png) + diff --git a/docs/Composant wae-vis-bog/Diagramme de classe Analyseur.png b/docs/Composant wae-vis-bog/Diagramme de classe Analyseur.png new file mode 100644 index 0000000..2a528c1 Binary files /dev/null and b/docs/Composant wae-vis-bog/Diagramme de classe Analyseur.png differ diff --git a/docs/Composant wae-vis-bog/Diagramme de classe de Simulation.png b/docs/Composant wae-vis-bog/Diagramme de classe de Simulation.png new file mode 100644 index 0000000..2ab980c Binary files /dev/null and b/docs/Composant wae-vis-bog/Diagramme de classe de Simulation.png differ diff --git a/docs/Composant wae-vis-bog/Diagramme de sequence de Simulation.png b/docs/Composant wae-vis-bog/Diagramme de sequence de Simulation.png new file mode 100644 index 0000000..d005571 Binary files /dev/null and b/docs/Composant wae-vis-bog/Diagramme de sequence de Simulation.png differ diff --git a/docs/Composant wae-vis-bog/diagSeq-Analyzer.PNG b/docs/Composant wae-vis-bog/diagSeq-Analyzer.PNG new file mode 100644 index 0000000..1634673 Binary files /dev/null and b/docs/Composant wae-vis-bog/diagSeq-Analyzer.PNG differ diff --git a/docs/diagrams/.gitkeep b/docs/diagrams/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/diagrams/Activity_ProjetIntegre.jpg b/docs/diagrams/Activity_ProjetIntegre.jpg new file mode 100644 index 0000000..d8b675d Binary files /dev/null and b/docs/diagrams/Activity_ProjetIntegre.jpg differ diff --git a/docs/diagrams/Component_ProjetIntegre.jpg b/docs/diagrams/Component_ProjetIntegre.jpg new file mode 100644 index 0000000..c81e5c6 Binary files /dev/null and b/docs/diagrams/Component_ProjetIntegre.jpg differ diff --git a/docs/diagrams/UseCase_ProjetIntegre.jpg b/docs/diagrams/UseCase_ProjetIntegre.jpg new file mode 100644 index 0000000..da69d9d Binary files /dev/null and b/docs/diagrams/UseCase_ProjetIntegre.jpg differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7bd0651 --- /dev/null +++ b/pom.xml @@ -0,0 +1,213 @@ + + + + 4.0.0 + + org.example + gl1-2024-bleu + 1.0-SNAPSHOT + + gl1-2024-bleu + https://gitlab.forge.hefr.ch/genie-logiciel-1/2024/enonce-final/gl1-2024-bleu + + + UTF-8 + 1.8 + 1.8 + true + + + + + gitlab-simulife-interface + https://gitlab.forge.hefr.ch/api/v4/projects/16714/packages/maven + + + gitlab-simulife-view + https://gitlab.forge.hefr.ch/api/v4/projects/17885/packages/maven + + + gitlab-simulife-analysis + https://gitlab.forge.hefr.ch/api/v4/projects/18019/packages/maven + + + gitlab-simulife-simulation + https://gitlab.forge.hefr.ch/api/v4/projects/18021/packages/maven + + + gitlab-simulife-model + https://gitlab.forge.hefr.ch/api/v4/projects/18018/packages/maven + + + gitlab-simulife-elements + https://gitlab.forge.hefr.ch/api/v4/projects/18020/packages/maven + + + gitlab-maven + https://gitlab.forge.hefr.ch/api/v4/projects/9607/packages/maven + + + + + + ch.fr.heia.gl1.simulife2024 + interface + 1.6.2 + + + + org.junit.jupiter + junit-jupiter + 5.10.2 + test + + + + org.jacoco + jacoco-maven-plugin + 0.8.11 + + + + ch.fr.hes.il.simulife2024.model + gl1-2024-jul-mic-rol + 1.0 + + + + ch.fr.hes.il.simulife2024 + gl1-2024-bug-oli-ros + 1.4 + + + ch.fr.hes.il.simulife2024 + gl1-2024-jul-mic-rol + 1.0 + + + ch.fr.hes.il.simulife2024 + gl1-2024-and-juz-per + 1.2 + + + + + + + + + ch.fr.hes.id.simulife2024.simulation + gl1-2024-ros + 3.5.0 + + + ch.fr.hes.id.simulife2024.simulation + gl1-2024-wae-vis-bog + 1.2.1 + + + + ch.fr.hes.id.simulife2024.analysis + gl1-2024-bed-her-ruf + 1.0 + + + + + + + + ch.fr.hes.id.simulife2024.analysis + gl1-2024-wae-vis-bog + 1.2.1 + + + + ch.fr.hes.rs.simulife2024.elements + gl1-2024-dem-kul-gom + 1.0 + + + + ch.hefr.rumley + javanco-legacy + 1.0-SNAPSHOT + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.11 + + + + prepare-agent + + + + report + prepare-package + + report + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 9 + 9 + + + + + diff --git a/src/main/java/ch/fr/heia/isc/gl1/App.java b/src/main/java/ch/fr/heia/isc/gl1/App.java new file mode 100644 index 0000000..8cb69ff --- /dev/null +++ b/src/main/java/ch/fr/heia/isc/gl1/App.java @@ -0,0 +1,29 @@ +package ch.fr.heia.isc.gl1; + + + +import ch.epfl.javancox.experiments.builder.ExperimentConfigurationCockpit; + +/** + * Main class of the program. + */ +public final class App { + /** + * Private constructor to prevent instantiation. + */ + private App() { + throw new UnsupportedOperationException( + "This is a utility class and cannot be instantiated."); + } + + /** + * Main method. + * + * @param args program arguments. + */ + public static void main(final String[] args) { + ExperimentConfigurationCockpit cockpit = + new ExperimentConfigurationCockpit(); + cockpit.show(); + } +} diff --git a/src/main/java/ch/fr/heia/isc/gl1/SimulifeExperiment.java b/src/main/java/ch/fr/heia/isc/gl1/SimulifeExperiment.java new file mode 100644 index 0000000..92053f8 --- /dev/null +++ b/src/main/java/ch/fr/heia/isc/gl1/SimulifeExperiment.java @@ -0,0 +1,148 @@ +package ch.fr.heia.isc.gl1; + +// Import of the DefaultView classes +import ch.fr.hes.il.simulife2024.IView; +import ch.fr.hes.il.simulife2024.AndJuzPerView; +import ch.fr.hes.il.simulife2024.BugOliRosDefaultView; +import ch.fr.hes.il.simulife2024.JulMicRolView; +// Import of the model class +import ch.fr.hes.il.simulife2024.model.Board; +// Import of the simulator classes +import ch.fr.hes.id.simulife2024.Simulator; +import ch.fr.hes.id.simulife2024.SimulableElement; +import ch.fr.hes.id.simulife2024.simulation.VitroSimulator; +// Import of the elements classes +import ch.fr.hes.rs.simulife2024.elements.Engineer; +//import ch.fr.hes.rs.simulife2024.elements.SolarPannel; +// Import of the analysis classes +import ch.fr.hes.id.simulife2024.Analyzer; +import ch.fr.hes.id.simulife2024.analysis.GridAnalyzer; +import ch.fr.hes.id.simulife2024.analysis.PositionAnalyzer; +//import ch.fr.hes.id.simulife2024.analysis.CellularCollisionAnalyzer; +// Import of cockpit classes +import ch.epfl.general_libraries.clazzes.ParamName; +import ch.epfl.general_libraries.experiment_aut.Experiment; +import ch.epfl.general_libraries.experiment_aut.WrongExperimentException; +import ch.epfl.general_libraries.results.AbstractResultsDisplayer; +import ch.epfl.general_libraries.results.AbstractResultsManager; +import ch.epfl.general_libraries.results.DataPoint; +import ch.epfl.general_libraries.results.Execution; +// Import of the java.util classes +import java.util.ArrayList; +import java.util.Map; +import java.util.Random; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Simulife experiment which will be shown on the GUI (it shows as unused but + * that's not true). + */ +public final class SimulifeExperiment implements Experiment { + /** + * To log messages. + */ + private static final Logger LOGGER = + Logger.getLogger(SimulifeExperiment.class.getName()); + /** + * Board size. + */ + private final int boardSize; + /** + * Simulation steps. + */ + private final int simulationSteps; + /** + * Number of initial elements. + */ + private final int numElements; + + /** + * Constructor. + * + * @param bS given in the UI - size of the square board. + * @param sS given in the UI - number of steps for the + * simulation. + * @param nE given in the UI - number of element to place. + */ + public SimulifeExperiment( + @ParamName(name = "Board Size", default_ = "10") final int bS, + @ParamName(name = "Simulation Steps", default_ = "10") final int sS, + @ParamName(name = "Number of Elements", default_ = "10") + final int nE) { + this.boardSize = bS; + this.simulationSteps = sS; + this.numElements = nE; + } + + @Override + public void run(final AbstractResultsManager man, + final AbstractResultsDisplayer dis) + throws WrongExperimentException { + Execution exec = new Execution(); + DataPoint dp = new DataPoint(); + dp.addProperty("Board Size", String.valueOf(boardSize)); + dp.addProperty( + "Simulation Steps", + String.valueOf(simulationSteps) + ); + dp.addProperty( + "Number of Elements", + String.valueOf(numElements) + ); + + Board board = new Board(boardSize, boardSize); + Simulator mySimulator = new VitroSimulator(); + mySimulator.setSimulableBoard(board); + + ArrayList views = new ArrayList<>(); + views.add(new JulMicRolView()); + views.add(new BugOliRosDefaultView()); + views.add(new AndJuzPerView()); + + ArrayList analyzers = new ArrayList<>(); + analyzers.add(new GridAnalyzer()); + analyzers.add(new PositionAnalyzer()); +// analyzers.add(new CellularCollisionAnalyzer()); + + for (IView view : views) { + view.setDataSource(board); + } + + ArrayList elements = new ArrayList<>(); + for (int i = 0; i < numElements; i++) { + elements.add(new Engineer(i)); +// elements.add(new SolarPannel(i)); + } + + Random random = new Random(); + for (SimulableElement elt : elements) { + elt.setSimulableBoard(board); + board.addElement( + random.nextInt(boardSize), + random.nextInt(boardSize), + elt + ); + } + + for (IView view : views) { + view.updateView(); + } + + ArrayList>> simResult = + mySimulator.run(simulationSteps); + + for (Analyzer analyzer : analyzers) { + String analysisResult = analyzer.getAnalysis(simResult).toString(); + dp.addResultProperty( + analyzer.getClass().getSimpleName(), + analysisResult + ); + } + + exec.addDataPoint(dp); + man.addExecution(exec); + + LOGGER.log(Level.INFO, "\n{0}", dp); + } +} diff --git a/src/main/java/ch/fr/heia/isc/gl1/package-info.java b/src/main/java/ch/fr/heia/isc/gl1/package-info.java new file mode 100644 index 0000000..5862b2f --- /dev/null +++ b/src/main/java/ch/fr/heia/isc/gl1/package-info.java @@ -0,0 +1,4 @@ +/** + * This package contains the main class of the application. + */ +package ch.fr.heia.isc.gl1; diff --git a/tree b/tree new file mode 100644 index 0000000..5e1dfe2 Binary files /dev/null and b/tree differ diff --git a/tree.conf b/tree.conf new file mode 100644 index 0000000..5e1dfe2 Binary files /dev/null and b/tree.conf differ