From 76950c6100371c28f82f2e130dcfdb7d7dac97df Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 9 Oct 2024 17:08:46 +0200 Subject: WIP boilerplate engineering --- docs/class-diag.puml | 104 ++++++++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 46 deletions(-) (limited to 'docs') diff --git a/docs/class-diag.puml b/docs/class-diag.puml index 96a57f2..8d4fa68 100644 --- a/docs/class-diag.puml +++ b/docs/class-diag.puml @@ -3,10 +3,13 @@ ' TODO: ' - state snapshots (memento) ' - send commands from GUI +' - TileAppearance should have some kind of tile type -> color registry +' - everything added by the algorithms +' - artist collision behavior (both edges and artist-artist) !include style.ipuml -' !include hide-groups.ipuml +!include hide-groups.ipuml ' !include hide-details.ipuml class main as "main()" @@ -54,12 +57,18 @@ rectangle Group_FileReading as "File reading" <> { } rectangle Group_ParsingDeserialization as "Parsing & deserialization" <> { - interface ParserStrategy { - + parse(File, Deserializer) - + heuristic(File) : unsigned int + class Parser { + + parse(File, Deserializer) <> + -- + - register_strategy(ParserStrategy) <> + } + interface ParserStrategy { + + parse(File, Deserializer) <> + + heuristic(File) : unsigned int <> } - ParserStrategy ..> File + ParserStrategy .> Parser + ParserStrategy <. Parser class CSVParser class XMLParser @@ -71,23 +80,16 @@ rectangle Group_ParsingDeserialization as "Parsing & deserialization" <> class Deserializer { + set_target(Museum &) - } - class PeopleDeserializer { + add_artist(uniq) - } - class CanvasDeserializer { + set_rows(unsigned int) + set_cols(unsigned int) + add_type(string, Color, unsigned int) + add_tile(unsigned int x, unsigned int y, uniq) } - PeopleDeserializer -up-|> Deserializer - CanvasDeserializer -up-|> Deserializer - - CSVParser -up-> PeopleDeserializer - XMLParser -up-> CanvasDeserializer - TXTParser -up-> CanvasDeserializer + CSVParser -up-> Deserializer + XMLParser -up-> Deserializer + TXTParser -up-> Deserializer ' ParserStrategy ..> Deserializer } @@ -95,20 +97,18 @@ rectangle Group_ParsingDeserialization as "Parsing & deserialization" <> rectangle Group_Model as "Model" <> { class Canvas { + get_tile(x, y) - + set_tile(x, y) + + set_tile(x, y, TileData) - data : CanvasData - tiles : Tile[] } class People { - + add_artist(uniq) : void + + add_artist(uniq) - artists : Artist[] } class Museum { - + load : - - artists : People + - people : People - canvas : Canvas } - ' TODO color : Color? class Tile { + data : TileData } @@ -130,6 +130,41 @@ rectangle Group_Model as "Model" <> { + rows : unsigned int + columns : unsigned int } + rectangle Group_Tile_Appearance as "Tile appearance" <> { + struct Color { + red : unsigned int + green : unsigned int + blue : unsigned int + } + class TileAppearance { + + color : Color + } + + TileAppearance --> Color + + Tile --> "state" TileAppearance + } + rectangle Group_Tile_Behavior as "Tile behavior" <> { + interface TileBehavior + + together { + class GrayTileBehavior + class RedTileBehavior + class BlueTileBehavior + class YellowTileBehavior + + GrayTileBehavior -d[hidden]- RedTileBehavior + RedTileBehavior -d[hidden]- BlueTileBehavior + BlueTileBehavior -d[hidden]- YellowTileBehavior + } + + TileBehavior <|.. GrayTileBehavior + TileBehavior <|.. RedTileBehavior + TileBehavior <|.. BlueTileBehavior + TileBehavior <|.. YellowTileBehavior + + Tile --> "state" TileBehavior + } Museum --> People Museum --> Canvas @@ -139,11 +174,11 @@ rectangle Group_Model as "Model" <> { Tile --> TileData Artist --> ArtistData - Canvas --> CanvasData + + Canvas -> CanvasData ' LAYOUT Artist -r[hidden] Tile - Tile -r[hidden] CanvasData } rectangle "Visualization" <> { @@ -159,34 +194,11 @@ rectangle "Visualization" <> { View --> SDL2 } -' class TileBehavior -' -' class GrayTileBehavior -' class RedTileBehavior -' class BlueTileBehavior -' class YellowTileBehavior -' -' TileBehavior <|-- GrayTileBehavior -' TileBehavior <|-- RedTileBehavior -' TileBehavior <|-- BlueTileBehavior -' TileBehavior <|-- YellowTileBehavior - -' struct Color { -' red : unsigned int -' green : unsigned int -' blue : unsigned int -' } - ' PeopleDeserializer <... People ' CanvasDeserializer <... Canvas ' Deserializer <... Museum -' class TileAppearance { -' + color : Color -' } -' -' TileAppearance .r Color - +ParserStrategy ..> File ' Museum .> Deserializer : friend Deserializer .> Museum -- cgit v1.2.3