Debian Codegraph @

texmf-dist/doc/metapost/metauml/manual/fig/activity_diagrams.mp

raw
1 % Part of the MetaUML manual.
2 % Copyright (C) 2005 Ovidiu Gheorghies
3 %
4 % This program is free software; you can redistribute it and/or
5 % modify it under the terms of the GNU General Public License
6 % as published by the Free Software Foundation; either version 2
7 % of the License, or (at your option) any later version.
8 %
9 % This program is distributed in the hope that it will be useful,
10 % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 % GNU General Public License for more details.
13 %
14 % You should have received a copy of the GNU General Public License
15 % along with this program; if not, write to the Free Software
16 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 % for f in `find . | grep '.*\.[1-9]'`; do echo $f; done
19
20 input metauml;
21
22 beginfig(1);
23 Begin.b;
24 Activity.eat("Eat something good", "from the kitchen");
25 Branch.enough;
26 Fork.fork("h", 50);
27 Activity.read("Read a book");
28 Activity.listen("Listen to music", "(and ignore it)");
29 Fork.join("h", 50);
30 End.e;
31
32 eat.n = b.s + (0,-20);
33 enough.n = eat.s + (0,-20);
34 fork.n = enough.s + (0, -20);
35
36 read.top = listen.top = fork.bottom - 30;
37 listen.left - read.right = 10;
38 b.midx = .5[listen.left, read.right];
39
40 join.n = (b.midx, listen.bottom - 20);
41 e.n = join.s + (0, -20);
42
43 drawObjects(b, eat, enough, fork, read, listen, join, e);
44
45 clink(transition)(b, eat);
46 clink(transition)(eat, enough);
47 link(transition)(pathStepX(enough.w, eat.w, -80));
48 clink(transition)(enough, fork);
49 clink(transition)(fork, read);
50 clink(transition)(fork, listen);
51 clink(transition)(read, join);
52 clink(transition)(listen, join);
53 clink(transition)(join, e);
54
55 item(iGuard)("still hungry")(obj.se = enough.w + (-20, 0));
56 item(iGuard)("had enough")(obj.nw = enough.s + (0, -4));
57 endfig;
58
59 end