diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-22 14:44:47 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-22 14:44:47 +0200 |
commit | 8c0562c8ef37cd5e80c58609f7bc7ae352365f65 (patch) | |
tree | 42e9906c5ddf1b0e719ee3eb7b965a444be64c38 /docs/class-diag.puml | |
parent | bc02054d56118110a36aea72d21f9d5e73d07d1f (diff) |
refactor parser factory
Diffstat (limited to 'docs/class-diag.puml')
-rw-r--r-- | docs/class-diag.puml | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/docs/class-diag.puml b/docs/class-diag.puml index 6c38d9c..58ed950 100644 --- a/docs/class-diag.puml +++ b/docs/class-diag.puml @@ -50,15 +50,20 @@ rectangle Group_FileReading as "File reading" <<group>> { HTTPFileReader -r[hidden] LocalFileReader } rectangle Group_ParsingDeserialization as "Parsing & deserialization" <<group>> { - class ParserFactory { - + parse(FileReader &, MuseumDeserializer &) <<static>> - + register_strategy(Parser *) <<static>> + class ParserFactory <<factory>> { + + ParserFactory() + + get_parser(FileReader &) : Parser & -- - - get_collection() : ParserCollection <<static>> + - parsers : vec<uniq<Parser>> } - interface Parser { - + parse(FileReader &, MuseumDeserializer &) <<static>> - + heuristic(FileReader &) : unsigned int <<static>> + interface Parser { + + parse(FileReader &, MuseumDeserializer &) + + heuristic(FileReader &) : unsigned int + -- + # set_file(FileReader &) + # get_file() : FileReader & + -- + file : FileReader * } class XMLParser @@ -86,9 +91,7 @@ rectangle Group_ParsingDeserialization as "Parsing & deserialization" <<group>> + add_type(type : string, Color, weight : unsigned int) } - CSVParser -up-> MuseumDeserializer - XMLParser -up-> MuseumDeserializer - TXTParser -up-> MuseumDeserializer + Parser .> MuseumDeserializer ' LAYOUT CSVParser -r[hidden] TXTParser @@ -103,9 +106,10 @@ rectangle Group_Algorithms as "Algorithms" <<group>> { class CollisionContext { + CollisionContext(Museum &) } - class CollisionChecker { + class CollisionChecker <<abstract>> { + CollisionChecker(Museum &) - + check(Artist & a, Artist & b) + + compare(Artist & a, Artist & b) + + check() <<pure virtual>> } class QuadTreeCollisionChecker { + QuadTree(Museum &) @@ -208,7 +212,7 @@ rectangle Group_Model as "Model" <<group>> { green : unsigned int blue : unsigned int } - class TileColorFactory <<singleton>> { + class TileColorFactory <<factory>> <<singleton>> { + get_color(string) : Color <<static>> + register_color(string, Color) <<static>> } @@ -224,7 +228,7 @@ rectangle Group_Model as "Model" <<group>> { # interactions : unsigned int # museum : Museum & } - class TileBehaviorFactory { + class TileBehaviorFactory <<factory>> { + TileBehaviorFactory(Museum &) + create(string) : uniq<TileBehavior> -- @@ -322,9 +326,9 @@ rectangle Group_Visualization as "Visualization" <<group>> { } class ViewController { + update() - + ev_keydown(KeyboardCode); - + ev_mousedown(MouseCode); - + ev_mousemove(x, y); + + ev_keydown(KeyboardCode) + + ev_mousedown(MouseCode) + + ev_mousemove(x, y) -- - draw_artists : bool <<+get>> <<+set>> } @@ -355,11 +359,6 @@ rectangle Group_Commands as "Commands" <<group>> { - museum : Museum & - view : View & } - class ToggleArtistVisibilityCommand { - + constructor(ViewController &) - -- - - controller : ViewController & - } class LoadFilesCommand { + constructor(Museum &, files : vec<string>) + constructor(Museum &, argc, argv) @@ -381,10 +380,18 @@ rectangle Group_Commands as "Commands" <<group>> { - museum : Museum & - forwards : bool } + class ControlBooleanCommand { + + constructor(target : bool &) + + constructor(target : bool &, set : bool) + -- + - toggle : bool + - value : bool + - target : bool & + } Command <|-d- ToggleMuseumPauseCommand Command <|-u- OpenFileGUICommand - Command <|-u- ToggleArtistVisibilityCommand + Command <|-u- ControlBooleanCommand Command <|-d- StepTileCommand Command <|-d- LoadFilesCommand Command <|-d- TimeTravelCommand |