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

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