Debian Codegraph @

texmf-dist/doc/latex/uml/example.tex

raw
1 %%
2 %% This is file `example.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% uml.dtx (with options: `example')
8 %%
9 %% IMPORTANT NOTICE:
10 %%
11 %% For the copyright see the source file.
12 %%
13 %% Any modified versions of this file must be renamed
14 %% with new filenames distinct from example.tex.
15 %%
16 %% For distribution of the original source see the terms
17 %% for copying and modification in the file uml.dtx.
18 %%
19 %% This generated file may be distributed as long as the
20 %% original source files, as listed above, are part of the
21 %% same distribution. (The sources need not necessarily be
22 %% in the same archive or directory.)
23 \def\filedate{2010/03/17}
24 \def\docdate{2010/03/17}
25 \def\fileversion{0.11}
26 \def\basename{uml}
27 %% Package 'uml' to use with LaTeX2e and PSTricks
28 %% Copyright 2006 by Ellef Fange Gjelstad.
29 %% http://www.ifi.uio.no/~ellefg/uml.sty/
30 %% This program can be redistributed and/or modified under the terms
31 %% of the LaTeX Project Public License Distributed from CTAN archives
32 %% in directory macros/latex/base/lppl.txt.
33 %% \CharacterTable
34 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
35 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
36 %% Digits \0\1\2\3\4\5\6\7\8\9
37 %% Exclamation \! Double quote \" Hash (number) \#
38 %% Dollar \$ Percent \% Ampersand \&
39 %% Acute accent \' Left paren \( Right paren \)
40 %% Asterisk \* Plus \+ Comma \,
41 %% Minus \- Point \. Solidus \/
42 %% Colon \: Semicolon \; Less than \<
43 %% Equals \= Greater than \> Question mark \?
44 %% Commercial at \@ Left bracket \[ Backslash \\
45 %% Right bracket \] Circumflex \^ Underscore \_
46 %% Grave accent \` Left brace \{ Vertical bar \|
47 %% Right brace \} Tilde \~}
48
49
50
51 \newcommand\umlADTExample{%
52 \umlDiagram[box=,sizeX=15cm, sizeY=16cm,ref=ADTdiagram,
53 grayness=0.92]{}% End of diagram
54 \umlSchema[pos=\umlTopRight{ADTdiagram}, posDelta={-.5,-.5},
55 refpoint=tr]{ADT}{% Attributes
56 \umlAttribute[visibility,type=String]{name}}{}{}{}{}
57 \umlSchema[pos=\umlTopLeft{ADTdiagram}, posDelta={.5,-1},
58 refpoint=lt, abstract,
59 ref=ADTexample]{ADT-example}{%
60 \umlAttribute[visibility=-,
61 type=\emph{\umlColorsArgument\umlColorsAdjust type},default=null]{%
62 firstNode}
63 }{%Methods
64 }{%Arguments
65 \umlArgument[type=Metaclass]{type}
66 }{%Constraints
67 }{%Structure
68 \umlDiagram[box=,innerBorder=2mm,outerBorder]{%
69 \umlClass[pos={.5,.5}, ref=adtNode,box=]{Node}{%
70 \umlAttribute[visibility,
71 type=\emph{\umlColorsArgument\umlColorsAdjust type}]{%
72 data}}{}%
73 \umlAssociation[angleA=20, angleB=-20,
74 arm=1em, arm=1em]{adtNode}{adtNode}%
75 }\cr% End of Diagram
76 }% End of ADT-example
77 \umlInstance{ADTexample}{ADT}%
78 \umlSchema[pos=\umlRight{ADTexample}, posDelta={3,-1},
79 refpoint=tl, ]{Graph}{% Attributes
80 }{% Methods
81 \umlMethod[visibility,]{%
82 insert}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
83 \umlMethod[visibility,
84 type=\emph{\umlColorsArgument\umlColorsAdjust type}]{%
85 dijkstra}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
86 \umlMethod[visibility, type=boolean]{%
87 insertEdge}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
88 \umlMethod[visibility, ]{%
89 delete}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
90 }{% Arguments
91 }{% Constraints
92 }{% Structure
93 \umlDiagram[box=,innerBorder=2mm, outerBorder,
94 sizeX=11em,sizeY=3.5em,ref=GraphDiagram]{%
95 \begin{umlColors}{\umlColorsSub}
96 \umlClass[pos=\umlBottomLeft{GraphDiagram},
97 posDelta={1,1}, ref=graphNode]{Node}{}{}%
98 \umlAssociation[angleA=20, angleB=-20, armA=1em, armB=1em
99 ]{graphNode}{graphNode}%
100 \end{umlColors}
101 \umlLabelA[height=0mm,offset=1ex]{graphNodegraphNode}{*}%
102 \umlLabelB[height=0mm,offset=1ex,refpoint=t
103 ]{graphNodegraphNode}{*}%
104 \umlSymbol[fraction=.5]{graphNodegraphNode}{\pnode{gngn}}
105 \umlClass[pos=gngn, posDelta={2,0},
106 ref=graphEdge, refpoint=l]{Edge}{%
107 \umlAttribute[type=real]{cost}}{}%
108 \umlAssociationClass[]{graphEdge}{gngn}%
109 }\cr% End of diagram
110 }% End of Graph
111 \umlSubclass{Graph}{ADTexample}
112 \umlSchema[posX=\umlLeft{ADTexample}, posDelta={3em,-1em},
113 posY=\umlBottom{Graph},
114 refpoint=tl, ref=searchTree]{Search Tree}{% Attributes
115 }{% Methods
116 \umlMethod[visibility,]{%
117 insert}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
118 \umlMethod[visibility,
119 type=\emph{\umlColorsArgument\umlColorsAdjust type}]{%
120 search}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
121 \umlMethod[visibility, type=boolean]{%
122 search}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
123 \umlMethod[visibility, ]{%
124 delete}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
125 }{% Arguments
126 \umlArgument[type=Integer, initialValue=2]{arity}
127 \umlArgument[type={${\umlColorsArgument\umlColorsAdjust type}
128 \times {\umlColorsArgument\umlColorsAdjust type}\rightarrow$
129 boolean}, default=>]{sort}
130 }{% Constraints
131 }{% Structure
132 \umlDiagram[box=, sizeX=14em, sizeY=4em,
133 innerBorder=2mm, outerBorder]{%
134 \begin{umlColors}{\umlColorsSub}
135 \umlClass[pos={.5, .5}, ref=treeNode]{Node}{}{}%
136 \umlAssociation[angleA=30, angleB=-30, armA=1em, armB=1em
137 ]{treeNode}{treeNode}%
138 \end{umlColors}
139 \umlLabelA[height=1mm, offset=4mm,refpoint=l
140 ]{treeNodetreeNode}{%
141 \emph{\umlColorsArgument\umlColorsAdjust arity}}%
142 \umlLabelB[refpoint=tl,height=-1mm, offset=4mm,
143 ]{treeNodetreeNode}{1}%
144 }\cr% End of diagram
145 }%
146 \umlSubclass{searchTree}{ADTexample}%
147 \umlSchema[pos=\umlBottomLeft{searchTree},posDelta={0,-1},
148 refpoint=lt]{List}{%Attributes
149 }{% Methods
150 }{% Arguments
151 }{% Constraints
152 }{% Structure
153 \umlDiagram[box=, sizeX=6em, sizeY=4em,
154 innerBorder=2mm, outerBorder]{%
155 \begin{umlColors}{\umlColorsSub}
156 \umlClass[pos={.5, .5}, ref=listNode]{Node}{}{}%
157 \umlAssociation[angleA=30, angleB=-30, armA=1em, armB=1em
158 ]{listNode}{listNode}%
159 \end{umlColors}
160 \umlLabelA[height=1mm, offset=5mm, refpoint=l
161 ]{listNodelistNode}{1}%
162 \umlLabelB[refpoint=tl, height=-1mm,offset=5mm
163 ]{listNodelistNode}{1}%
164 }\cr% End of diagram
165 }% End of Schema List
166 \umlPlaceNode[leftside, top, down=1em]{List}{Listtl}
167 \umlPlaceNode[leftside,right=2em,bottom]{ADTexample}{ADTexamplebl}
168 \umlSubclass[armA=1.4142em, armAngleA=135]{Listtl}{ADTexamplebl}%
169 \umlSchema[pos=\umlTopRight{List},posDelta={1em,-2em},
170 refpoint=tl]{Queue}{% Attributes
171 }{\umlMethod[visibility]{%
172 enqueue}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
173 \umlMethod[visibility, type=\emph{\umlColorsArgument\umlColorsAdjust type}]{%
174 dequeue}{}}{%Arguments
175 }{%Constraints
176 \umlCompartmentline{First come, first served.}
177 }{% Structure
178 }% End of Queue
179 \umlPlaceNode[rightside, top, down=1em]{List}{Listtr}
180 \umlSubclass[angleA=90, armAngleA=135, armA=1.4142em]{Queue}{Listtr}%
181 \umlSchema[pos=\umlTopRight{Queue},posDelta={\umlNodeSep,0em},
182 refpoint=tl]{Stack}{%Attributes
183 }{% Methods
184 \umlMethod[visibility]{
185 push}{\emph{\umlColorsArgument\umlColorsAdjust type} x}
186 \umlMethod[visibility, type=\emph{\umlColorsArgument\umlColorsAdjust type}]{%
187 pop}{}
188 }{% Arguments
189 }{% Constraints
190 \umlCompartmentline{S:Stack = S.push(x).pop()}
191 }{% Structure
192 }% End of Stack
193 \umlSubclass[angleA=90, armAngleA=135, armA=1.4142em]{Stack}{Listtr}%
194 }
195 \endinput
196 %%
197 %% End of file `example.tex'.