summaryrefslogtreecommitdiff
path: root/diagrams/assignment_3/mmd/system_flow.mmd
blob: d3bd1053edc662afb15cfc36629a094dfcb6a2a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
sequenceDiagram
    participant P as Program
    participant FR as FileReader
    participant CR as CSVReader
    participant MR as MorgReader
    participant MF as MorgFactory
    participant M as Morg
    participant D as Dish
    participant S as Simulator~Morg~
    
    P->>FR: new FileReader("morgs.txt")
    FR->>CR: new CSVReader(fileReader)
    CR->>MR: new MorgReader(csvReader, factory)
    MR->>MF: CreateEntity(...)
    MF->>MF: CreateMovementStrategy()
    MF->>MF: CreateFeedingStrategy()
    MF->>MF: ParsePreyTypes()
    MF-->>MR: Morg instance
    MR-->>P: Morg
    P->>D: AddMorg(morg)
    D->>S: AddEntity(morg)
    
    P->>D: Run(RUN_TIME)
    D->>S: Run(runTime)
    loop Template Method
        S->>S: ProcessTimeStep()
        S->>S: FindPreyIfNeeded()
        S->>M: Move()
        M->>M: Notify()
        S->>S: CheckAndFeed()
    end