| 1 |
|
| 2 |
\begin{tikzpicture}[show background grid] |
| 3 |
\begin{interface}{AbstractFactory}{0,0} |
| 4 |
\operation[0]{+ CreateProductA()} |
| 5 |
\operation[0]{+ CreateProductB()} |
| 6 |
\end{interface} |
| 7 |
|
| 8 |
\begin{class}{ConcreteFactory2}{-3,-4} |
| 9 |
\implement{AbstractFactory} |
| 10 |
\operation{+ CreateProductA()} |
| 11 |
\operation{+ CreateProductB()} |
| 12 |
\end{class} |
| 13 |
|
| 14 |
\begin{class}{ConcreteFactory1}{3,-4} |
| 15 |
\implement{AbstractFactory} |
| 16 |
\operation{+ CreateProductA()} |
| 17 |
\operation{+ CreateProductB()} |
| 18 |
\end{class} |
| 19 |
|
| 20 |
\begin{interface}{AbstractProductA}{15,-2} |
| 21 |
\end{interface} |
| 22 |
|
| 23 |
\begin{class}{ProductA1}{12,-5} |
| 24 |
\implement{AbstractProductA} |
| 25 |
\end{class} |
| 26 |
|
| 27 |
\begin{class}{ProductA2}{18,-5} |
| 28 |
\implement{AbstractProductA} |
| 29 |
\end{class} |
| 30 |
|
| 31 |
\draw[umlcd style dashed line,->] (ConcreteFactory1) --node[above, |
| 32 |
sloped, black]{$<<$instantiate$>>$} (ProductA1); |
| 33 |
|
| 34 |
\draw[umlcd style dashed line,->] (ConcreteFactory2.south) ++ |
| 35 |
(1,0) -- ++(0,-1) -- node[above, sloped, |
| 36 |
black]{$<<$instantiate$>>$} ++(20,0) -| (ProductA2); |
| 37 |
|
| 38 |
\begin{interface}{AbstractProductB}{15,-8} |
| 39 |
\end{interface} |
| 40 |
|
| 41 |
\begin{class}{ProductB1}{12,-11} |
| 42 |
\implement{AbstractProductB} |
| 43 |
\end{class} |
| 44 |
|
| 45 |
\begin{class}{ProductB2}{18,-11} |
| 46 |
\implement{AbstractProductB} |
| 47 |
\end{class} |
| 48 |
|
| 49 |
\draw[umlcd style dashed line,->] (ConcreteFactory1) |-node[above, |
| 50 |
sloped, black]{$<<$instantiate$>>$} (ProductB1); |
| 51 |
|
| 52 |
\draw[umlcd style dashed line,->] (ConcreteFactory2.south) ++ |
| 53 |
(-1,0) -- ++(0,-7) -- node[above, sloped, |
| 54 |
black]{$<<$instantiate$>>$} ++(20,0) -| (ProductB2); |
| 55 |
|
| 56 |
\begin{class}{Client}{22,-0.5} |
| 57 |
\end{class} |
| 58 |
|
| 59 |
\draw[umlcd style dashed line,->] (Client) --node[above, sloped, |
| 60 |
black]{$<<$import$>>$} (AbstractFactory); |
| 61 |
|
| 62 |
\draw[umlcd style dashed line,->] (Client) |-node[above, sloped, |
| 63 |
black]{$<<$import$>>$} (AbstractProductA); |
| 64 |
|
| 65 |
\draw[umlcd style dashed line,->] (Client) |-node[above, sloped, |
| 66 |
black]{$<<$import$>>$} (AbstractProductB); |
| 67 |
\end{tikzpicture} |
| 68 |
|
| 69 |
|