summaryrefslogtreecommitdiff
path: root/diagrams/assignment_3/mmd/iterator_pattern.mmd
blob: 5b8775c6c6ce380e7b18827c6c133682a4e8e8e4 (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
32
33
34
classDiagram
    class IEntityIterator~T~ {
        <<interface>>
        +HasNext() bool
        +Next() T*
        +Reset()
    }
    
    class EntityIterator~T~ {
        -List~T~ _entities
        -int _currentIndex
        +HasNext() bool
        +Next() T*
        +Reset()
    }
    
    class Simulator~T~ {
        <<abstract>>
        -List~T~ _entities
        +CreateIterator() IEntityIterator~T~
    }
    
    class Dish {
    }
    
    IEntityIterator~T~ <|.. EntityIterator~T~
    Simulator~T~ --> IEntityIterator~T~ : creates
    Simulator~T~ <|-- Dish
    EntityIterator~T~ *-- List~T~ : iterates over
    
    note for Simulator~T~ "Provides iterator for
entity collections"
    note for EntityIterator~T~ "Iterates over entities
in the simulator"