first commit
This commit is contained in:
commit
21ab9f2e54
79 changed files with 1298 additions and 0 deletions
Binary file not shown.
After Width: | Height: | Size: 98 KiB |
|
@ -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 |
|
@ -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
|
|
@ -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 |
|
@ -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
|
24
docs/Composant jul-mic-rol/jul-mic-rol_components.md
Normal file
24
docs/Composant jul-mic-rol/jul-mic-rol_components.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# jul-mic-rol - Components
|
||||
|
||||
## View
|
||||
|
||||
This class diagram describes the internal structure of our view component :
|
||||

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

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

|
||||
|
||||
Unfortunately, the sequence diagram is too long to be put as an image in this document.
|
Loading…
Add table
Add a link
Reference in a new issue