Skip to content

Commit b6b63a4

Browse files
committed
Add some visitor pattern UML GH-47
1 parent 9ca1a10 commit b6b63a4

4 files changed

Lines changed: 101 additions & 0 deletions

File tree

lectures/figures/gof/visitor.puml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@startuml
2+
skin rose
3+
4+
interface Visitor {
5+
+ void visit(d: Dot)
6+
+ void visit(c: Circle)
7+
+ void visit(r: Rectangle)
8+
}
9+
10+
class XMLExportVisitor {
11+
+ void visit(d: Dot)
12+
+ void visit(c: Circle)
13+
+ void visit(r: Rectangle)
14+
}
15+
16+
interface Shape {
17+
+ void draw()
18+
+ void move(x: int, y: int)
19+
+ void accept(visitor: Visitor)
20+
}
21+
22+
class Dot {
23+
...
24+
+ void draw()
25+
+ void move(x: int, y: int)
26+
+ void accept(visitor: Visitor)
27+
}
28+
29+
class Circle {
30+
...
31+
+ void draw()
32+
+ void move(x: int, y: int)
33+
+ void accept(visitor: Visitor)
34+
}
35+
36+
class Rectangle {
37+
...
38+
+ void draw()
39+
+ void move(x: int, y: int)
40+
+ void accept(visitor: Visitor)
41+
}
42+
43+
Visitor <|..right.. XMLExportVisitor
44+
Shape <|.. Dot
45+
Shape <|.. Circle
46+
Shape <|.. Rectangle
47+
48+
Visitor <..right.. Shape
49+
Visitor ..> Dot
50+
Visitor ..> Circle
51+
Visitor ..> Rectangle
52+
53+
XMLExportVisitor <.. client
54+
Shape <.. client
55+
@enduml

0 commit comments

Comments
 (0)