first commit

This commit is contained in:
Stefano Rossi 2025-07-12 19:18:13 +02:00
commit 21ab9f2e54
Signed by: chadmin
GPG key ID: 9EFA2130646BC893
79 changed files with 1298 additions and 0 deletions

48
.gitignore vendored Normal file
View file

@ -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*

40
.gitlab-ci.yml Normal file
View file

@ -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/

130
README.md Normal file
View file

@ -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
```

83
ci_settings.xml Normal file
View file

@ -0,0 +1,83 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>gitlab-simulife-interface</id>
<configuration>
<httpHeaders>
<property>
<name>Deploy-Token</name>
<value>gldt-oXzbD7gTxcU5N7MQXfRx</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>gitlab-simulife-view</id>
<configuration>
<httpHeaders>
<property>
<name>Deploy-Token</name>
<value>gldt-dfgBxkL8LG8LvBBLPD1q</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>gitlab-simulife-analysis</id>
<configuration>
<httpHeaders>
<property>
<name>Deploy-Token</name>
<value>gldt-uu_c9XZiPiVg1G1M2dr5</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>gitlab-simulife-simulation</id>
<configuration>
<httpHeaders>
<property>
<name>Deploy-Token</name>
<value>gldt-u8dr9YuqjpSLCrzDJHsW</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>gitlab-simulife-model</id>
<configuration>
<httpHeaders>
<property>
<name>Deploy-Token</name>
<value>gldt-U8y4yGRA7AF1yFjPsPyL</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>gitlab-simulife-elements</id>
<configuration>
<httpHeaders>
<property>
<name>Deploy-Token</name>
<value>gldt-BsJxz_P_rRHL5euvnxjn</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Deploy-Token</name>
<value>gldt-Sao53kyYyxsjcof-AdQU</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>

View file

@ -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

BIN
div/images/WDM_switch.emf Normal file

Binary file not shown.

BIN
div/images/WDM_switch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
div/images/computeNode.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
div/images/delete.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

BIN
div/images/europe_map.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
div/images/folder_close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
div/images/folder_open.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
div/images/glp_last.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

BIN
div/images/glp_next.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
div/images/node.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
div/images/pause.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

BIN
div/images/pause__other.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

BIN
div/images/play.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

BIN
div/images/resume_co.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

BIN
div/images/router.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
div/images/router2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
div/images/run_exc.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

BIN
div/images/simple_node.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

BIN
div/images/step.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

BIN
div/images/stop.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

BIN
div/images/stop_0.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

BIN
div/images/stop__other.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>Hi</comment>
<entry key="ch.epfl.javanco.testProperty">THIS IS THE VALUE OF THIS TEST PROPERTY</entry>
<entry key="ch.epfl.javanco.schemaName">schema.xsd</entry>
<entry key="ch.epfl.javanco.XMLvalidation">true</entry>
<entry key="ch.epfl.javanco.graphRepresentation">ch.epfl.javanco.network.VectorRepresentation</entry>
<entry key="ch.epfl.javanco.imageDir">div/images</entry>
<entry key="ch.epfl.javanco.schemaDir">div/xmlschemas</entry>
<entry key="ch.epfl.javanco.extraClassDir">output/classes/generatedClasses</entry>
<entry key="ch.epfl.javanco.defaultOutputDir">output</entry>
<entry key="ch.epfl.javanco.xmlFilesDir">default_graphs</entry>
<entry key="ch.epfl.javanco.groovyScriptsDir">groovy_scripts</entry>
<entry key="ch.epfl.javanco.defaultClassPathPrefixes">ch.epfl;edu;sandbox</entry>
<entry key="ch.epfl.javanco.graphics.defaultPainterClass">ch.epfl.javanco.graphics.DefaultNetworkPainter2DExtended</entry>
<entry key="ch.epfl.javanco.graphics.defaultNodeSize">32</entry>
<entry key="ch.epfl.javanco.graphics.defaultLinkWidth">3</entry>
<entry key="ch.epfl.javanco.graphics.maxNodeSize">320</entry>
<entry key="ch.epfl.javanco.graphics.minNodeSize">4</entry>
<entry key="ch.epfl.javanco.graphics.maxLinkWidth">20</entry>
<entry key="ch.epfl.javanco.graphics.defaultNodeIcon"></entry>
<entry key="ch.epfl.javanco.graphics.defaultNodeColor">#FFFFFF</entry>
<entry key="ch.epfl.javanco.graphics.defaultLinkColor">#000000</entry>
<entry key="ch.epfl.javanco.graphics.defaultBackgroundColor">#FFFFFF</entry>
<entry key="ch.epfl.javanco.graphics.defaultLabelFontSize">14</entry>
<entry key="ch.epfl.javanco.graphics.coloredIcons">true</entry>
<entry key="log4j.configuration.toURL">div/log4j.properties</entry>
<entry key="ch.epfl.random.PRGWebService.useSax">true</entry>
<entry key="ch.epfl.random.PRGWebService.direct">true</entry>
<entry key="deamon_port">15555</entry>
</properties>

View file

@ -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

14
div/log4j.properties Normal file
View file

@ -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

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="network">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

119
div/xmlschemas/schema.xsd Normal file
View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="network">
<xs:complexType>
<xs:sequence>
<!-- main_description must be the first sub-element of network (impossible to allow unspecified elements before main_description if the document is parsed by an event-based parser) -->
<xs:element name="main_description" type="main_descr_type">
<!-- the layer id must be unique within the network -->
<xs:unique name="unique_layer_id">
<xs:selector xpath="./layer"/>
<xs:field xpath="./@id"/>
</xs:unique>
<!-- the node id must be unique within the network and will be referenced by link/@orig and link/@dest -->
<xs:key name="key_node_id">
<xs:selector xpath="./*/node"/>
<xs:field xpath="@id"/>
</xs:key>
<!-- the origine of a link must reference an existing node id -->
<xs:keyref name="keyref_link_orig" refer="key_node_id">
<xs:selector xpath="./*/link"/>
<xs:field xpath="@orig"/>
</xs:keyref>
<!-- the destination of a link must reference an existing node id -->
<xs:keyref name="keyref_link_dest" refer="key_node_id">
<xs:selector xpath="./*/link"/>
<xs:field xpath="@dest"/>
</xs:keyref>
</xs:element>
<!-- COMMENT THE TWO NEXT ELEMENTS IF YOU DON'T WANT TO USE THEM IN THIS ORDER -->
<xs:element name="additional_description" minOccurs="0">
<!-- the content of additional_description is not specified -->
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="graphical_data" minOccurs="0">
<!-- the content of graphical_data is not specified -->
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- allow to have other (unspecified) sub-elements of network -->
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- content of the main_description element : -->
<xs:complexType name="main_descr_type">
<xs:sequence>
<xs:element name="layer" maxOccurs="unbounded">
<!-- content of layer elements -->
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="node">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<!-- specified attributes of node should be added in the "node_specified_att" attribute group at the bottom of this document -->
<xs:attributeGroup ref="node_specified_att"/>
<xs:anyAttribute namespace="##any" processContents="skip"/>
</xs:complexType>
</xs:element>
<xs:element name="link">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<!-- specified attributes of link should be added in the "link_specified_att" attribute group at the bottom of this document -->
<xs:attributeGroup ref="link_specified_att"/>
<xs:anyAttribute namespace="##any" processContents="skip"/>
</xs:complexType>
</xs:element>
</xs:choice>
<!-- specified attributes of layer should be added in the "layer_specified_att" attribute group at the bottom of this document -->
<xs:attributeGroup ref="layer_specified_att"/>
<xs:anyAttribute namespace="##any" processContents="skip"/>
</xs:complexType>
<!-- the couple (orig, dest) of a link must be unique within a layer -->
<xs:unique name="unique_orig_dest">
<xs:selector xpath="./link"/>
<xs:field xpath="@orig"/>
<xs:field xpath="@dest"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<!-- describe the authorized type for positions, i.e. an integer or a geographical coordinate -->
<xs:simpleType name="position_type">
<xs:union memberTypes="xs:integer">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\d{1,2}(\.\d{1,2})?\s*[ENSW]"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<!-- ADD HERE THE ATTRIBUTES YOU WANT TO SPECIFY FOR THE CORRESPONDING NETWORK OBJECT -->
<!-- Specified attributes of layer : -->
<xs:attributeGroup name="layer_specified_att">
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:attributeGroup>
<!-- Specified attributes of node : -->
<xs:attributeGroup name="node_specified_att">
<xs:attribute name="id" type="xs:integer" use="required"/>
<xs:attribute name="label" type="xs:string" use="optional"/>
<xs:attribute name="pos_x" type="position_type" use="required"/>
<xs:attribute name="pos_y" type="position_type" use="required"/>
</xs:attributeGroup>
<!-- Specified attributes of link : -->
<xs:attributeGroup name="link_specified_att">
<xs:attribute name="orig" type="xs:integer" use="required"/>
<xs:attribute name="dest" type="xs:integer" use="required"/>
</xs:attributeGroup>
</xs:schema>

View file

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View file

@ -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).

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View file

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View file

@ -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 **: <<create>> DefaultView
DefaultView --> DefaultView ++ : DefaultView()
DefaultView --> JFrame **: <<create>> 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

View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

View file

@ -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)

View file

@ -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/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View file

@ -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<SimulableElement>
+ 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 {
<<interface>>
+ 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View file

@ -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 {
<<interface>>
+ updateView()
+ setDataSource(RepresentableBoard board)
}
DefaultView <|-- Jpanel
DefaultView <|-- IView

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -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

View file

@ -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.

View file

@ -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 <i>Simulation</i> implémente l'interface <i>Simulator</i> 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

0
docs/diagrams/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

213
pom.xml Normal file
View file

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>gl1-2024-bleu</artifactId>
<version>1.0-SNAPSHOT</version>
<name>gl1-2024-bleu</name>
<url>https://gitlab.forge.hefr.ch/genie-logiciel-1/2024/enonce-final/gl1-2024-bleu</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<sonar.qualitygate.wait>true</sonar.qualitygate.wait>
</properties>
<repositories>
<repository>
<id>gitlab-simulife-interface</id>
<url>https://gitlab.forge.hefr.ch/api/v4/projects/16714/packages/maven</url>
</repository>
<repository>
<id>gitlab-simulife-view</id>
<url>https://gitlab.forge.hefr.ch/api/v4/projects/17885/packages/maven</url>
</repository>
<repository>
<id>gitlab-simulife-analysis</id>
<url>https://gitlab.forge.hefr.ch/api/v4/projects/18019/packages/maven</url>
</repository>
<repository>
<id>gitlab-simulife-simulation</id>
<url>https://gitlab.forge.hefr.ch/api/v4/projects/18021/packages/maven</url>
</repository>
<repository>
<id>gitlab-simulife-model</id>
<url>https://gitlab.forge.hefr.ch/api/v4/projects/18018/packages/maven</url>
</repository>
<repository>
<id>gitlab-simulife-elements</id>
<url>https://gitlab.forge.hefr.ch/api/v4/projects/18020/packages/maven</url>
</repository>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.forge.hefr.ch/api/v4/projects/9607/packages/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>ch.fr.heia.gl1.simulife2024</groupId>
<artifactId>interface</artifactId>
<version>1.6.2</version>
</dependency>
<!-- testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<!-- coverage -->
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
</dependency>
<!-- model -->
<dependency>
<groupId>ch.fr.hes.il.simulife2024.model</groupId>
<artifactId>gl1-2024-jul-mic-rol</artifactId>
<version>1.0</version>
</dependency>
<!-- views -->
<dependency>
<groupId>ch.fr.hes.il.simulife2024</groupId>
<artifactId>gl1-2024-bug-oli-ros</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>ch.fr.hes.il.simulife2024</groupId>
<artifactId>gl1-2024-jul-mic-rol</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>ch.fr.hes.il.simulife2024</groupId>
<artifactId>gl1-2024-and-juz-per</artifactId>
<version>1.2</version>
</dependency>
<!-- simulator -->
<!-- <dependency>-->
<!-- <groupId>ch.fr.hes.id.simulife2024.simulation</groupId>-->
<!-- <artifactId>gl1-2024-bed-her-ruf</artifactId>-->
<!-- <version>1.0.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>ch.fr.hes.id.simulife2024.simulation</groupId>
<artifactId>gl1-2024-ros</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>ch.fr.hes.id.simulife2024.simulation</groupId>
<artifactId>gl1-2024-wae-vis-bog</artifactId>
<version>1.2.1</version>
</dependency>
<!-- analyzers -->
<dependency>
<groupId>ch.fr.hes.id.simulife2024.analysis</groupId>
<artifactId>gl1-2024-bed-her-ruf</artifactId>
<version>1.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>ch.fr.hes.id.simulife2024.analysis</groupId>-->
<!-- <artifactId>gl1-2024-ros</artifactId>-->
<!-- <version>3.5.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>ch.fr.hes.id.simulife2024.analysis</groupId>
<artifactId>gl1-2024-wae-vis-bog</artifactId>
<version>1.2.1</version>
</dependency>
<!-- elements -->
<dependency>
<groupId>ch.fr.hes.rs.simulife2024.elements</groupId>
<artifactId>gl1-2024-dem-kul-gom</artifactId>
<version>1.0</version>
</dependency>
<!-- cockpit -->
<dependency>
<groupId>ch.hefr.rumley</groupId>
<artifactId>javanco-legacy</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<pluginManagement> <!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -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();
}
}

View file

@ -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<IView> views = new ArrayList<>();
views.add(new JulMicRolView());
views.add(new BugOliRosDefaultView());
views.add(new AndJuzPerView());
ArrayList<Analyzer> analyzers = new ArrayList<>();
analyzers.add(new GridAnalyzer());
analyzers.add(new PositionAnalyzer());
// analyzers.add(new CellularCollisionAnalyzer());
for (IView view : views) {
view.setDataSource(board);
}
ArrayList<SimulableElement> 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<ArrayList<Map<String, String>>> 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);
}
}

View file

@ -0,0 +1,4 @@
/**
* This package contains the main class of the application.
*/
package ch.fr.heia.isc.gl1;

BIN
tree Normal file

Binary file not shown.

BIN
tree.conf Normal file

Binary file not shown.