Debian Codegraph @

texmf-dist/doc/metapost/metauml/manual/fig/test_class.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 input metauml;
19
20 beginfig(0);
21 show "Copying class info...";
22 ClassInfoCopy.foo(iClass);
23 endfig;
24
25 beginfig(1);
26 Class.A("A")()();
27 Class_setDebugMode.A;
28
29 A.nw=(0,0);
30 Class_draw.A;
31 endfig;
32
33 beginfig(2);
34 save B;
35 Class.B("B")("+ a:int")();
36 Class_setDebugMode.B;
37
38 B.nw=(0,0);
39 Class_draw.B;
40 endfig;
41
42 beginfig(3);
43 save C;
44 Class.C("C")("+ a-#~+:int", "- b-#~+:int", "- g-#~+:int", "~ c-#~+:int", "# g-#~+:double")();
45 Class_setDebugMode.C;
46
47 C.nw=(0,0);
48 Class_draw.C;
49 endfig;
50
51 beginfig(4);
52 save D;
53 Class.D("D")
54 ("+ a-#~+:int", "- b-#~+:int", "- g-#~+:int", "~ c-#~+:int", "# g-#~+:double")
55 ("+ a()-#~+:int", "- b()-#~+:int", "- g()-#~+:int", "~ c()-#~+:int", "# g()-#~+:double");
56 Class_setDebugMode.D;
57
58 D.nw=(0,0);
59 Class_draw.D;
60 endfig;
61
62 beginfig(5);
63 save P, Q;
64
65 Class.P("AAA")()();
66 Class_stereotypes.P("ooo", "home", "interface");
67 Class_setDebugMode.P;
68 P.nw=(0,0);
69 Class_draw.P;
70
71 Class.Q("AAA")()();
72 Class_stereotypes.Q("ooo", "home", "interface");
73 Q.nw=P.ne + (20,0);
74 Class_draw.Q;
75 endfig;
76
77 beginfig(6);
78 save A;
79
80 Class.A("User6")()();
81 Class_stereotypes.A("<<interface>>","<<home>>");
82 A.nw=(0,0);
83 drawObject(A);
84 endfig;
85
86 beginfig(7)
87 save A;
88 Class.A("User7")()();
89 A.info.iMethodStack.left := A.info.iMethodStack.right := 50;
90 A.info.iMethodStack.top := A.info.iMethodStack.bottom := 20;
91
92 drawObject(A);
93 endfig;
94
95 beginfig(8)
96 save inter;
97 EClass.inter(iInterface)("Observer")()("+update(src: Object)");
98 drawObjects(inter);
99 endfig;
100
101 beginfig(9)
102 save inter;
103 EInterface.inter(iInterface)("Observer")("+update(src: Object)");
104 drawObjects(inter);
105 endfig;
106
107 beginfig(10)
108 save inter;
109 Interface.inter("Observer")("+update(src: Object)");
110 drawObjects(inter);
111 endfig;
112
113 beginfig(11)
114 save A;
115 EClass.A(iAbstractClass)("AbstractClass")("[]{}")("+update(src: Object)");
116 drawObjects(A);
117 endfig;
118
119 beginfig(12)
120 save A;
121 AbstractClass.A("AbstractClass")("[]{}")("+update(src: Object)");
122 drawObjects(A);
123 endfig;
124
125 beginfig(13)
126 save A;
127 EClass.A(iClassNameOnly)("AClassWithNoCompartments")()();
128 drawObjects(A);
129 endfig;
130
131 beginfig(14)
132 save A;
133 ClassName.A("AnotherClass");
134 drawObjects(A);
135 endfig;
136
137 beginfig(15)
138 save A;
139 ClassName.A("AnotherClass");
140 classStereotypes.A("<<interface>>","<<remote>>");
141
142 drawObjects(A);
143 endfig;
144
145 beginfig(16);
146 save A, B, C;
147
148 Class.A("Foo")
149 ("+a: int", "-b: int", "#c: int", "d: int")
150 ("+x()", "-y()", "#z()", "t()");
151 Class_noVisibilityMarkers.A;
152
153 drawObjects(A);
154 endfig;
155
156 end