summaryrefslogtreecommitdiff
path: root/diagrams/assignment_3/mmd/template_method_pattern.mmd
blob: 96e7605a57da0aa086a12b6ab496b35ce9af71ee (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
classDiagram
    class Simulator~T~ {
        <<abstract>>
        +Run(runTime: int)
        #ProcessTimeStep()
        #FindPreyIfNeeded(entity: T)
        #CheckAndFeed(entity: T)
        #FindNearestPrey(predator: T) Entity*
    }
    
    class Dish {
        #FindNearestPrey(predator: Morg) Entity*
    }
    
    Simulator~T~ <|-- Dish
    
    note for Simulator~T~ "Template Method Pattern:
Run() defines the algorithm
ProcessTimeStep() is the template
FindPreyIfNeeded() is virtual
CheckAndFeed() is virtual
FindNearestPrey() is abstract"
    
    note for Dish "Concrete implementation:
Implements FindNearestPrey()
for Morg-specific prey finding"