%%
%% This is file `uml.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% uml.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from uml.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file uml.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\def\filedate{2006/11/28}
\def\docdate{2006/11/28}
\def\fileversion{0.10}
\def\basename{uml}
%% Package 'uml' to use with LaTeX2e and PSTricks
%% Copyright 2006 by Ellef Fange Gjelstad.
%% http://www.ifi.uio.no/~ellefg/uml.sty/
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%% \CharacterTable
%%  {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
%%   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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}




\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{uml}



\DeclareOption{debug}{
  \def\umlDebugLineStyle{dashed}
  \def\umlDebugLength{1pt}
  }
\DeclareOption{nodebug}{
  \def\umlDebugLineStyle{none}
  \def\umlDebugLength{0pt}
}
\def\umlDebugLinestyle{none}
\def\umlDebugLength{0pt}
\newcommand\umlIndexOn{\renewcommand\umlIndex[2]{\index{##1!##2}}}
\newcommand\umlIndexOff{\renewcommand\umlIndex[2]{}}
\DeclareOption{index}{\umlIndexOn}
\DeclareOption{noindex}{\umlIndexOff}
\newcommand\umlIndex[2]{\index{#1!#2}}
\ExecuteOptions{nodebug}
\ProcessOptions
\RequirePackage{pstricks}
\RequirePackage{pst-node}

\RequirePackage{pst-xkey}
\pst@addfams{uml,umlAE,umlPlaceNode}

\RequirePackage{relsize}




\def\umlTrueVariable{true}

\psset{unit=1em}
\def\umlDrawableNull{%
   \def\umlImport{}%
   \def\umlKind{Drawable}%
   \gdef\umlName{DrawableNameDefault}%
   \def\umlNameDefault{DrawableNameDefault}%
   %\ifx\umlName\umlNameDefault\else umlName is changed
}

\define@key[psset]{uml}{kind}{\def\umlKind{#1}}

\define@key[psset]{uml}{name}{\gdef\umlName{#1}}


\define@key[psset]{uml}{import}{\umlColorsImport}
\define@key[psset]{uml}{noimport}{\umlColorsDefault}
\define@key[psset]{uml}{argument}{\umlColorsArgument}
\define@key[psset]{uml}{colorset}[\umlColorsDefault]{#1}
\newcommand\umlDrawable[2][]{%
  \umlDrawableNull%
  \psset[uml]{kind=Drawable,#1}%
  #2%
}
\def\umlElementNull{%
  \def\umlReference{refdef}%
  \def\umlStereotype{}%
  \def\umlSubof{}%
  \def\umlImportedFrom{}%
  \def\umlComment{}%
  \def\umlAbstract{}%
}

\define@key[psset]{uml}{reference}{\def\umlReference{#1}}
\define@key[psset]{uml}{ref}{\def\umlReference{#1}}
\define@key[psset]{uml}{stereotype}{%
  \def\umlStereotype{{\hfil\phantom{x}<<#1>>\phantom{x}\hfil}\\}}
\define@key[psset]{uml}{subof}{\def\umlSubof{{~Sub of: #1}\\}}
\define@key[psset]{uml}{abstract}[]{\def\umlAbstract{\emph}}%
\define@key[psset]{uml}{importedFrom}{%
  \def\umlImportedFrom{{~From: #1}\\}%
  \umlColorsImport%
}
\define@key[psset]{uml}{comment}{\def\umlComment{{~#1}\\}}
\newcommand\umlElement[2][]{%
  \umlElementNull%
  {\umlDrawable[kind=Element,#1]{%
      \umlColorsAdjust%
      #2}}}
\def\umlBoxNullPositions{%
  \def\umlPosCommand{%
    \rput[\umlRefpoint](\umlPos)}%
  \def\umlPos{\umlPosX|\umlPosY}%
  \def\umlPosX{0,0}%
  \def\umlPosY{0,0}%
  \def\umlPosDeltaCommand{%
    \rput[\umlRefpoint](\umlPosDelta)}%
  \def\umlPosDelta{\umlPosDeltaX|\umlPosDeltaY}%
  \def\umlPosDeltaX{0,0}%
  \def\umlPosDeltaY{0,0}%
  \def\umlRefpoint{bl}%
  }%
\define@key[psset]{uml}{pos}[0,0]{\def\umlPos{#1}}
\define@key[psset]{uml}{posX}[0,0]{\def\umlPosX{#1}}
\define@key[psset]{uml}{posY}[0,0]{\def\umlPosY{#1}}
\define@key[psset]{uml}{posDelta}[0,0]{\def\umlPosDelta{#1}}
\define@key[psset]{uml}{posDeltaX}[0,0]{\def\umlPosDeltaX{#1}}
\define@key[psset]{uml}{posDeltaY}[0,0]{\def\umlPosDeltaY{#1}}
\define@key[psset]{uml}{refpoint}{\def\umlRefpoint{#1}}
\def\umlBoxNullBoxes{%
  \def\umlBoxH{\hbox to 0cm}%
  \def\umlBoxV{\smash}%
  }%
\define@key[psset]{uml}{box}{%
  \def\umlBoxH{}% no \hbox to 0cm
  \def\umlBoxV{}% no \smash anymore
  \def\umlPosCommand{}% no \rput... anymore
  \def\umlPosDeltaCommand{}}% Ditto
\def\umlBoxNullVisual{%
  \def\umlGrayness{1}%
  \def\umlBorder{0mm}%
  \def\umlInnerBorder{0mm}%
  \def\umlOuterBorder{0mm}%
  \def\umlFillcolorCommand{umlFillcolor}%
  }%
\define@key[psset]{uml}{grayness}[.85]{\definecolor{umlFillcolor}{gray}{#1}}
\define@key[psset]{uml}{fillcolorCommand}[umlFillcolor]{%
  \def\umlFillcolorCommand{#1}}
\define@key[psset]{uml}{border}[0.4pt]{\gdef\umlBorder{#1}}
\define@key[psset]{uml}{outerBorder}[1pt]{\def\umlOuterBorder{#1}}
\define@key[psset]{uml}{innerBorder}[\umlhsep]{\def\umlInnerBorder{#1}}
\def\umlBoxNullSize{%
  \def\umlSizeX{5mm}%
  \def\umlSizeY{7mm}%
}
\define@key[psset]{uml}{sizeX}{\def\umlSizeX{#1}}
\define@key[psset]{uml}{sizeY}{\def\umlSizeY{#1}}
\def\umlBoxNull{%
  \umlBoxNullPositions%
  \umlBoxNullBoxes%
  \umlBoxNullVisual%
  \umlBoxNullSize%
  }%
\newcommand\umlBox[2][]{\leavevmode%
  \umlBoxNull%
  \umlElement[kind=Box,#1]{%
    \umlBoxH{% \hbox to 0cm or nothing
      \umlBoxV{% \smash or nothing
        \umlPosCommand{%
          \umlPosDeltaCommand{%
          \rnode{\umlReference}{%
              \setlength{\fboxrule}{0mm}%
              \setlength{\fboxsep}{\umlOuterBorder}%
              \fbox{%
                \psframebox[framesep=\umlInnerBorder,
                    linewidth=\umlBorder,
                    fillcolor=\umlFillcolorCommand, fillstyle=solid]{%
                    #2}%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }

\newcommand\umlDiagramNull{%
  \def\umlGrid{}%
  }
\define@key[psset]{uml}{grid}[1]{\message{named option grid is deprecated and of no use}}
\newcommand\umlDiagram[2][]{%
  \umlDiagramNull%
  \umlBox[kind=Diagram, fillcolorCommand=umlDiagramFillcolor,
          box=,#1]{%

      \expandafter{#2}{%
        \rule{\umlDebugLength}{\umlSizeY}%
        \rule{\umlSizeX}{\umlDebugLength}}%
    }%
  }%


\newcommand\umlStretchboxNull{%
  \def\umlGraphicalName{StrechboxDefault{\umlAbstract\umlName}\\}%
}



\newcommand\umlStretchbox[3][]{%
  \umlStretchboxNull%
  \umlBox[kind=Stretchbox, name={#2}, ref={#2}, #1]{%
    \umlIndex{\umlName}{\umlKind}%
    \rnode{\umlReference}{#3}%
    }%
  }%

\newcommand\umlPackage[3][]{%
  % Null unneccessary
  \def\umlName{#1}%
  \begin{tabular}{@{}l@{}}%
    \umlStretchbox[kind=Package, border=0.4pt,#1]{#2}{%
      \def\umlGraphicalName{%
        {\umlhspace\hfill\relsize{2}\textbf{\umlName}%
          \rule{0mm}{2.3ex}\hfill\umlhspace}\\%
        }%
      \rnode{small\umlReference}{%
        \begin{tabular}{@{}l@{}}%
          \umlStereotype%
          \umlGraphicalName%
          \umlImportedFrom%
          \umlComment%
          \umlSubof%
        \end{tabular}}}%
    \cr\noalign{\vskip -\umlBorder}%
    \umlStretchbox[kind=Package,border=0.4pt,#1]{#2}{%
      \rnode{big\umlReference}{%
        \begin{tabular}{@{}l@{}}%
          #3%
          \cr%
        \end{tabular}}}% End of lower rectangle
  \end{tabular}%
  }%


\newcommand\umlClassifierNull{%
  \def\umlObject{}%
  \umlClassifierEmptytrue%
}
\newif\ifumlClassifierEmpty%

\define@key[psset]{uml}{object}{\def\umlObject{\underbar}}


\define@key[psset]{uml}{instance}{\def\umlObject{\underbar}}

\newcommand\umlClassifier[3][]{%
  \umlClassifierNull%
  \def\umlName{#2}%
  \umlStretchbox[kind=Classifier,border=.4pt,
    fillcolorCommand=umlClassifierFillcolor,#1]{#2}{%
      \def\umlGraphicalName{%
        \rule{0mm}{2.8ex}%
        \umlhspace\larger\hfill\textbf{%
          \umlAbstract{\umlObject{\umlName}}}\hfill\umlhspace\\}%
      \begin{tabular}[tl]{@{}l@{}}%
        \umlStereotype%
        \umlGraphicalName%
        \umlImportedFrom%
        \umlComment%
        \umlSubof%
        #3%
        \ifumlClassifierEmpty\\\noalign{\vskip -2.5ex}\fi
      \end{tabular}%
    }%
  }%


\newcommand\umlClass[4][]{%
  \umlClassifier[kind=Class,#1]{#2}{%
    \umlCompartment[name=attributes]{#3}%
    \umlCompartment[name=operations]{#4}%
    }%
  }%


\newcommand\umlSchema[7][]{%
  \umlClassifier[kind=Schema,#1]{#2}{%
    \umlCompartment[name=attributes]{#3}% Attributes
    \umlCompartment[name=operations]{#4}% Methods
    \umlCompartment[name=arguments]{#5}% Arguments
    \umlCompartment[name=constraints]{#6}% Constraints
    \umlCompartment[name=structure]{#7}% Structure
    }%
  }%





\newcommand\umlCompartmentNull{%
}
\def\ifisnull#1#2#3{\def\inner{#1}%
  \ifx\inner\empty%
  #2\else{}#3%
  \fi}
\define@key[psset]{uml}{last}[]{%
  \message{The named option last= is deprecated and of no use.}%
}


\newif\ifumlCompartmentSuppress

\define@key[psset]{uml}{suppress}[true]{%
  \def\arg{#1}%
  \ifx\arg\umlTrueVariable\umlCompartmentSuppresstrue%
  \else\umlCompartmentSuppressfalse%
  \fi%
}




\newif\ifumlCompartmentNamesShow

\define@key[psset]{uml}{showname}[true]{%
  \def\arg{#1}%
  \ifx\arg\umlTrueVariable\umlCompartmentNamesShowtrue%
  \else\umlCompartmentNamesShowfalse%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%







\newcommand\umlCompartmentCommon[2][]{%

  \ifhmode \vspace*{-2.5ex}\\\fi%
  \hline%
  \ifumlCompartmentNamesShow%
    \ifx\umlName\umlNameDefault\else%
      \omit\hfil\textbf{\umlName}\hfil\\%
    \fi%
  \fi%
  \def\umlCompartmentContents{#2}%
  \ifx\umlCompartmentContents\empty%
    \vspace*{-1.5ex}%
  \else% There is contents
    \umlClassifierEmptyfalse%
    #2%
  \fi%
  \ifhmode\\\fi%
  }
\newcommand\umlCompartment[2][]{%
  \umlCompartmentNull%
  \def\umlCompartmentContents{#2}%
  \umlDrawable[kind=Compartment,#1]{%
    \umlColorsAdjust%
    \ifumlCompartmentSuppress%
      \ifx\umlCompartmentContents\empty\else%
        \umlCompartmentCommon[#1]{#2}%
      \fi%
    \else%
      \umlClassifierEmptyfalse%
      \umlCompartmentCommon[#1]{#2}%
    \fi}}%



\def\umlhsep{.5ex}
\newcommand\umlhspace{\hspace*{\umlhsep}}

\newcommand\umlCompartmentline[2][]{%
  \umlDrawable[kind=Compartmentline,#1]{%
    {\umlColorsAdjust\umlhspace{}#2{}\umlhspace}\\}}

\newcommand\umlCompartmentText[1]{%
  \umlhspace#1\umlhspace}


\def\umlVisibilityLength{2ex}

\newcommand\umlFeatureNull{%
  \def\umlVisibility{}%
  \def\umlType{}%
  \def\umlPropertyString{}%
  \def\umlInitialValue{}%
  \def\umlName{FeatureNameDefault}%
}

\define@key[psset]{uml}{visibility}[+]{%
  \def\umlVisibility{\hbox to \umlVisibilityLength{#1\hfil}}}

\newcommand\umlTilde{\ensuremath{\sim}}

\define@key[psset]{uml}{propertyString}{%
  \def\umlPropertyString{#1}}
\define@key[psset]{uml}{type}{%
  \def\umlType{: #1}}
\define@key[psset]{uml}{initialValue}{%
  \def\umlInitialValue{= #1}}
\newcommand\umlFeature[2][]{%
  \umlFeatureNull%
  \umlCompartmentline[kind=Feature, #1]{%
    \umlIndex{\umlName}{\umlKind}%
    #2}%
  }%
\def\umlAttributeNull{%
  \def\umlMultiplicity{}%
  \def\umlOrdering{}%
  \def\umlMultiplicityOrdering{}%
}
\define@key[psset]{uml}{default}{%
  \def\umlInitialValue{ = #1}}
\define@key[psset]{uml}{multiplicity}{%
  \def\umlMultiplicity{#1}%
  \def\umlMultiplicityOrdering{[\umlMultiplicity{} \umlOrdering]}}
\define@key[psset]{uml}{ordering}[ordered]{%
  \def\umlOrdering{#1}%
  \def\umlMultiplicityOrdering{[\umlMultiplicity{} \umlOrdering]}}

\newcommand\umlAttribute[2][]{%
  \umlAttributeNull%
  \umlFeature[kind=Attribute, name={#2}, #1]{%
    \umlVisibility #2 \umlType \umlMultiplicityOrdering
    \umlInitialValue \umlPropertyString}}


\newcommand\umlMethodNull{%
}

\define@key[psset]{uml}{returntype}{%
  \def\umlType{: #1}}

\newcommand\umlMethod[3][]{%
  \umlMethodNull%
  \def\umlName{#2}%
  \umlFeature[kind=Method, name={#2}, #1]{%
    \umlVisibility #2(#3) \umlType \umlPropertyString}}


\newcommand\umlArgumentNull{%
}

\newcommand\umlArgument[2][]{%
  \umlArgumentNull%
  \def\umlName{#2}%
  \umlFeature[kind=Argument, name={#2}, #1]{%
    \emph{#2} \umlType \umlInitialValue}}



\newcommand\umlRelationNullConnection{%
  \def\umlNodesepA{0pt}%
  \def\umlNodesepB{0pt}%
  \def\umlOffsetA{0pt}%
  \def\umlOffsetB{0pt}%
  \def\umlAngleA{}%
  \def\umlAngleB{}%
}%
\define@key[psset]{uml}{angleA}{\def\umlAngleA{#1}}
\define@key[psset]{uml}{angleB}{\def\umlAngleB{#1}}
\define@key[psset]{uml}{angle}{\def\umlAngleA{#1}\def\umlAngleB{#1}}
\define@key[psset]{uml}{nodesepA}{\def\umlNodesepA{#1}}
\define@key[psset]{uml}{nodesepB}{\def\umlNodesepB{#1}}
\define@key[psset]{uml}{nodesep}{\def\umlNodesepA{#1}\def\umlNodesepB{#1}}

\define@key[psset]{uml}{offsetA}{\def\umlOffsetA{#1}}
\define@key[psset]{uml}{offsetB}{\def\umlOffsetB{#1}}
\define@key[psset]{uml}{offset}{\def\umlOffsetA{#1}\def\umlOffsetB{#1}}
\newcommand\umlRelationNullArmGeometry{%
  \pssetlength\umlArmA{0pt}%
  \pssetlength\umlArmB{0pt}%
  \def\umlArmAngleA{0}%
  \def\umlArmAngleB{0}%
}
\newlength\umlArmA
\newlength\umlArmB
\define@key[psset]{uml}{armA}{\pssetlength\umlArmA{#1}}
\define@key[psset]{uml}{armB}{\pssetlength\umlArmB{#1}}
\define@key[psset]{uml}{arm}{%
  \pssetlength\umlArmA{#1}%
  \pssetlength\umlArmB{#1}}
\define@key[psset]{uml}{armAngleA}{\def\umlArmAngleA{#1}}
\define@key[psset]{uml}{armAngleB}{\def\umlArmAngleB{#1}}
\define@key[psset]{uml}{armAngle}{%
  \def\umlArmAngleA{#1}%
  \def\umlArmAngleB{#1}%
}
\newcommand\umlRelationNullVisual{%
  \def\umlLinestyle{solid}%
}
\define@key[psset]{uml}{linestyle}{\def\umlLinestyle{#1}}
\define@key[psset]{uml}{relationColor}[black]{\pst@getcolor{#1}\pslinecolor}
\define@key[psset]{uml}{linecolor}{\pst@getcolor{#1}\pslinecolor}
\newcommand\umlRelationNull{%
  \umlRelationNullConnection%
  \umlRelationNullArmGeometry%
  \umlRelationNullVisual%
}
\newcommand\umlRelation[4][]{%
  \umlRelationNull%
  \umlElement[kind=Relation,ref={#2#3}, #1]{%
  \ncline[linecolor=green, linestyle=\umlDebugLinestyle,
          offsetA=\umlOffsetA, nodesepA=\umlNodesepA,
          offsetB=\umlOffsetB, nodesepB=\umlNodesepB]{#2}{#3}%
  \lput{:R}(0){\pnode{Aa\umlReference}}%
  \lput{:R}(1){\pnode{Ba\umlReference}}%
  \ifx\umlAngleA\empty \else
     \ncdiag[linestyle=\umlDebugLinestyle, linecolor=magenta, %
             angleA=\umlAngleA,
             offsetA=\umlOffsetA, nodesepA=\umlNodesepA,
             offsetB=\umlOffsetB, nodesepB=\umlNodesepB
            ]{#2}{#2}%
     \lput{:R}(0){\pnode{Aa\umlReference}}\fi%
  \ifx\umlAngleB\empty \else
     \ncdiag[linestyle=\umlDebugLinestyle, linecolor=magenta, %
             angleA=\umlAngleB,
             offsetA=\umlOffsetA, nodesepA=\umlNodesepA,
             offsetB=\umlOffsetB, nodesepB=\umlNodesepB
            ]{#3}{#3}%
     \lput{:R}(0){\pnode{Ba\umlReference}}\fi%
    \ncdiag[linestyle=\umlLinestyle,  linecolor=umlLinecolor,
            angleA=\umlArmAngleA, angleB=\umlArmAngleB,
            armA=\umlArmA, armB=\umlArmB
            ]{%
              Aa\umlReference}{%
              Ba\umlReference}%
  \ifdim \umlArmA=0pt \lput{:R}(2){\pnode{Ab\umlReference}}%
  \else \lput{:R}(1){\pnode{Ab\umlReference}} \fi%
  \ifdim \umlArmB=0pt \lput{:R}(1){\pnode{Bb\umlReference}}%
  \else \lput{:R}(2){\pnode{Bb\umlReference}} \fi%
   \lput{:R}(1){\pnode{Ac\umlReference}}%
   \lput{:R}(2){\pnode{Bc\umlReference}}%
   #4}% of \umlElement
}



\newlength\umlSymbolHeightDefault
\setlength\umlSymbolHeightDefault{1em}
\newlength\umlSymbolWidthDefault
\setlength\umlSymbolWidthDefault{.5em}


\newcommand\umlAssociation[3][]{%
  \umlRelation[kind=Association, #1]{#2}{#3}{}%
}


\newcommand\umlSubclass[3][]{%
  \def\umlEndSymbol{%
     \pspolygon*[linecolor=white](0,0)%
       (-\umlSymbolWidthDefault,-\umlSymbolHeightDefault)%
       (\umlSymbolWidthDefault,-\umlSymbolHeightDefault)%
     \pspolygon[](0,0)% Why does not dimen=inner work?
       (-\umlSymbolWidthDefault,-\umlSymbolHeightDefault)%
       (\umlSymbolWidthDefault,-\umlSymbolHeightDefault)%
      }%
  \umlRelation[kind=Subclass, #1]{#2}{#3}{%
    \umlSymbol[fraction=B]{\umlReference}{\umlEndSymbol}}%
  }
\def\umlGeneralization{\umlSubclass}



\newlength\umlInnerWidthDefault
\setlength\umlInnerWidthDefault{0.75em}
\newlength\umlInnerRadiusDefault
\setlength\umlInnerRadiusDefault{1.25em}
\newcommand\umlInner[3][]{%
  \def\umlEndSymbol{%
     \pspolygon*[linecolor=white](0,0)%
       (-\umlSymbolWidthDefault,-\umlSymbolHeightDefault)%
       (\umlSymbolWidthDefault,-\umlSymbolHeightDefault)%
    \psclip{%
      \psframe[linewidth=0pt]%
        (-\umlSymbolWidthDefault, -\umlSymbolHeightDefault)(0,0)}
      \pscircle(\umlInnerWidthDefault,-\umlSymbolHeightDefault)%
        {\umlInnerRadiusDefault}
    \endpsclip
    \psclip{%
      \psframe[linewidth=0pt]%
        (\umlSymbolWidthDefault, -\umlSymbolHeightDefault)(0,0)}
      \pscircle(-\umlInnerWidthDefault,-\umlSymbolHeightDefault)%
        {\umlInnerRadiusDefault}
    \endpsclip
    \psline(-\umlSymbolWidthDefault, -\umlSymbolHeightDefault)%
      (\umlSymbolWidthDefault, -\umlSymbolHeightDefault)}
  \umlRelation[kind=Inner, #1]{#2}{#3}{%
    \umlSymbol[fraction=B]{\umlReference}{\umlEndSymbol}
  }}
\newcommand\umlInstance[3][]{%
  \def\umlEndSymbol{%
    \psline(-\umlSymbolWidthDefault, -\umlSymbolHeightDefault)%
      (0,0)%
      (\umlSymbolWidthDefault, -\umlSymbolHeightDefault)}%
  \umlRelation[kind={Instance-of}, linestyle=dashed, #1]{#2}{#3}{%
    \umlSymbol[fraction=B]{\umlReference}{\umlEndSymbol}}
  }
\newcommand\umlAggregation[3][]{%
  \def\umlEndSymbol{%
    \rput(0,-\umlSymbolHeightDefault){%
      \psline*[linecolor=white](-\umlSymbolWidthDefault, 0)%
        (0,-\umlSymbolHeightDefault)%
        (\umlSymbolWidthDefault, 0)}
    \psline*[linecolor=white]%
      (-\umlSymbolWidthDefault, -\umlSymbolHeightDefault)%
      (0,0)%
      (\umlSymbolWidthDefault, -\umlSymbolHeightDefault)
    \rput(0,-\umlSymbolHeightDefault){%
      \psline(-\umlSymbolWidthDefault, 0)%
        (0,-\umlSymbolHeightDefault)%
        (\umlSymbolWidthDefault, 0)}
    \psline(-\umlSymbolWidthDefault, -\umlSymbolHeightDefault)%
      (0,0)%
      (\umlSymbolWidthDefault,
      -\umlSymbolHeightDefault)}
  \umlRelation[kind=Aggregation, #1]{#2}{#3}{%
    \umlSymbol[fraction=B]{\umlReference}{\umlEndSymbol}}
}
\newcommand\umlComposition[3][]{%
  \def\umlEndSymbol{%
    \rput(0,-\umlSymbolHeightDefault){%
      \psline*(-\umlSymbolWidthDefault, 0)%
        (0,-\umlSymbolHeightDefault)%
        (\umlSymbolWidthDefault, 0)}
    \psline*(-\umlSymbolWidthDefault, -\umlSymbolHeightDefault)%
      (0,0)%
      (\umlSymbolWidthDefault,
      -\umlSymbolHeightDefault)}
  \umlRelation[kind=Composition, #1]{#2}{#3}{%
    \umlSymbol[fraction=B]{\umlReference}{\umlEndSymbol}}
}
\newcommand\umlApplication[3][]{%
  \def\umlEndSymbol{%
    \pspolygon*(-\umlSymbolWidthDefault, -\umlSymbolHeightDefault)%
      (0,0)%
      (\umlSymbolWidthDefault, -\umlSymbolHeightDefault)%
      (0,-\umlSymbolWidthDefault)}%
  \umlRelation[kind=Application, #1]{#2}{#3}{%
    \lput(1.2){\pnode{argument\umlReference}}%
    \umlSymbol[fraction=B]{\umlReference}{\umlEndSymbol}}
  }
\newcommand\umlToRelationNull{%
  \def\umlPosMeetLine{.5}%
}
\define@key[psset]{uml}{posMeetLine}[.5]{\def\umlPosMeetLine{#1}}
\newcommand\umlToRelation[3][]{%
  \umlToRelationNull%
  \psset[uml]{kind=ToRelation, #1}%
  \ncline[linecolor=red, linestyle=\umlDebugLinestyle]{Ac#3}{Bc#3}%
  \lput{:R}(\umlPosMeetLine){\pnode{ToRelation#3}}%
  \umlRelation[ref={#2#3}, #1]{#2}{ToRelation#3}{}%
}
\newcommand\umlAssociationSchema[3][]{%
  \umlToRelation[kind=AssociationSchema,
    posMeetLine=.5, linestyle=dashed,#1]{#2}{#3}%
}
\newcommand\umlAssociationClass[3][]{%
  \umlAssociationSchema[kind=AssociationClass,#1]{#2}{#3}}
\newcommand\umlArgumentRelation[3][]{%
  \umlToRelation[kind=ArgumentRelation,
    posMeetLine=.2,linestyle=dotted,#1]{#2}{#3}%
  }
\newcommand\umlAssociationEndNull{%
  \def\umlAEOffset{\umlAEOffsetDefault}%
  \def\umlAEOffsetDefault{0pt}%
  \def\umlAEFraction{0}%
  \def\umlAEFractionAngle{\umlAEFractionAngleDefault}%
  \def\umlAEFractionAngleDefault{:U}%
  \def\umlAEAngle{\umlAEAngleDefault}%
  \def\umlAEAngleDefault{U}%
  \def\umlAERefpoint{B}%
  \def\umlAEHeight{\umlAEHeightDefault}%
  \def\umlAEHeightDefault{0pt}%
  \def\umlAENoderefClose{Ac}%
  \def\umlAENoderefFar{Bc}%
  \def\umlAEType{AssociationEnd}%
  \def\umlAEKind{AssociationEnd}
}
\define@key[psset]{umlAE}{import}{\def\umlAEColor{red}}
\define@key[psset]{umlAE}{type}{\def\umlType{#1}}
\define@key[psset]{umlAE}{kind}{\def\umlKind{#1}}
\define@key[psset]{umlAE}{offset}{\def\umlAEOffset{#1}}
\define@key[psset]{umlAE}{angle}{\def\umlAEAngle{#1}}
\define@key[psset]{umlAE}{fractionAngle}{\def\umlAEFractionAngle{#1}}
\define@key[psset]{umlAE}{height}{\def\umlAEHeight{#1}}
\define@key[psset]{umlAE}{refpoint}{\def\umlAERefpoint{#1}}
%% \define@key[psset]{umlAE}{type}{\def\umlAEType{#1}}%   %%%%%%%%%%%%
\define@key[psset]{umlAE}{fraction}{\def\umlAEFraction{#1}}
\newcommand\umlFromTo[3]{%
  \edef\umlAEFractionArgument{#1}%
  \def\umlAEFractionTmp{From}\ifx\umlAEFractionArgument\umlAEFractionTmp{}#2\fi%
  \def\umlAEFractionTmp{A}\ifx\umlAEFractionArgument\umlAEFractionTmp{}#2\fi%
  \def\umlAEFractionTmp{To}\ifx\umlAEFractionArgument\umlAEFractionTmp{}#3\fi%
  \def\umlAEFractionTmp{B}\ifx\umlAEFractionArgument\umlAEFractionTmp{}#3\fi%
}
\newcommand\umlAssociationEndUseFraction{%
  \umlFromTo{\umlAEFraction}{% If A or From
    \def\umlAENoderefClose{Aa}%
    \def\umlAENoderefFar{Ab}%
    \def\umlAEFraction{0}%
    }{%
    \def\umlAENoderefClose{Ba}% If B or To
    \def\umlAENoderefFar{Bb}%
    \def\umlAEFraction{0}%
    \def\umlTmp{Label}%
    \ifx\umlTmp\umlAEType%
      \edef\umlAEHeight{-\umlAEHeight}\fi%
    }%
  }
\newcommand\umlAssociationEnd[3][]{%
  \umlAssociationEndNull%
  \psset[umlAE]{kind=AssociationEnd,#1}%
  \umlAssociationEndUseFraction%
  \ncline[linecolor=red, linestyle=\umlDebugLinestyle]{%
    \umlAENoderefClose#2}{\umlAENoderefFar#2}%
  {\umlColorsAdjust%
    \lput[\umlAERefpoint]{\umlAEFractionAngle}(\umlAEFraction){%
      \rput[\umlAERefpoint]{\umlAEAngle}(\umlAEOffset, \umlAEHeight){%
        #3}%
      }%
    }%
  }%
\newcommand\umlLabel[3][]{% Null unneccesary
  \umlAssociationEnd[kind=Label,offset=4ex,height=2ex,angle=N, #1]{#2}{#3}%
}
\newcommand\umlLabelA[2][]{\umlLabel[#1,fraction=A]{#2}}
\newcommand\umlLabelB[2][]{\umlLabel[#1,fraction=B]{#2}}
\newcommand\umlSymbol[3][]{%  Null unneccesary
  \umlAssociationEnd[kind=Symbol,offset=0ex,height=0ex,
                     fractionAngle=:L,refpoint=t,#1]{%
    #2}{\umlSymbolUseFraction%
    #3}}
\newcommand\umlSymbolUseFraction{%
  \umlFromTo{\umlAEFraction}{%
    }{%
    }%
  }
\newcommand\umlSymbolA[2][]{\umlSymbol[#1,fraction=A]{#2}}
\newcommand\umlSymbolB[2][]{\umlSymbol[#1,fraction=B]{#2}}
\newcommand\umlNavigability[2][]{
  \def\umlEndSymbol{\psline%
    (-1ex, -1.618ex)%
    (0,0)%
    (1ex, -1.618ex)}%
  \umlSymbol[kind=Navigability, #1]{#2}{\umlEndSymbol}%
  }
\newcommand\umlNavigabilityA[2][]{\umlNavigability[#1,fraction=A]{#2}}
\newcommand\umlNavigabilityB[2][]{\umlNavigability[#1,fraction=B]{#2}}
\newcommand\umlColorset[1]{%
  \def\umlColorsAdjust{#1%
  \psset{linecolor=umlLinecolor, fillcolor=umlFillcolor}}}
\newcommand\umlColorsDefault{%
  \umlColorset{%
    \definecolor{umlColor}{gray}{0}%
    \definecolor{umlLinecolor}{gray}{0}%
    \definecolor{umlFillcolor}{gray}{1}%
    \definecolor{umlClassifierFillcolor}{gray}{0.85}%
    \definecolor{umlDiagramFillcolor}{gray}{0.95}%
    \definecolor{umlRelationColor}{gray}{0}%
}}
\newcommand\umlColorsGray{%
  \umlColorset{%
    \definecolor{umlColor}{gray}{0.4}%
    \definecolor{umlLinecolor}{gray}{0.4}%
    \definecolor{umlFillcolor}{gray}{1}%
    \definecolor{umlClassifierFillcolor}{gray}{0.90}%
    \definecolor{umlDiagramFillcolor}{gray}{0.98}%
    \definecolor{umlRelationColor}{gray}{0.4}%
}}
\newcommand\umlColorsImport{%
  \umlColorset{%
    \definecolor{umlColor}{rgb}{0, 0, 0.4}%
    \definecolor{umlLinecolor}{rgb}{0, 0, 0.4}%
    \definecolor{umlFillcolor}{rgb}{.8, .8, 1}%
    \definecolor{umlClassifierFillcolor}{rgb}{.85, .85, 1}%
    \definecolor{umlDiagramFillcolor}{rgb}{.95, .95, 1}%
    \definecolor{umlRelationColor}{rgb}{0, 0, 0.4}%
}}
\newcommand\umlColorsArgument{%
  \umlColorset{%
    \definecolor{umlColor}{rgb}{0, 0.4, 0}%
    \definecolor{umlLinecolor}{rgb}{0, 0.4, 0}%
    \definecolor{umlFillcolor}{rgb}{.8, 1, .8}%
    \definecolor{umlClassifierFillcolor}{rgb}{.85, 1, .85}%
    \definecolor{umlDiagramFillcolor}{rgb}{.95, 1, .95}%
   \definecolor{umlRelationColor}{rgb}{0, 0.7, 0}%
}}
\newcommand\umlColorsRed{%
  \umlColorset{%
    \definecolor{umlColor}{rgb}{0.4, 0, 0}%
    \definecolor{umlLinecolor}{rgb}{0.4, 0, 0}%
    \definecolor{umlFillcolor}{rgb}{1, .8, .8}%
    \definecolor{umlClassifierFillcolor}{rgb}{1, .85, .85}%
    \definecolor{umlDiagramFillcolor}{rgb}{1, .95, .95}%
    \definecolor{umlRelationColor}{rgb}{0.4, 0, 0}%
}}
\newcommand\umlColorsSub{%
  \umlColorset{%
    \definecolor{umlColor}{rgb}{.6, .2, .2}%
    \definecolor{umlLinecolor}{rgb}{.6, .2, .2}%
    \definecolor{umlFillcolor}{rgb}{.9, .8, .8}%
    \definecolor{umlClassifierFillcolor}{rgb}{.9, .8, .8}%
    \definecolor{umlDiagramFillcolor}{rgb}{.97, .95, .95}%
    \definecolor{umlRelationColor}{rgb}{.6, .2, .2}%
}}
\umlColorsDefault
\umlColorsAdjust
\newenvironment{umlColors}[1]{\bgroup#1}{\egroup}
\SpecialCoor
\newlength{\umlNodeSep}
\setlength{\umlNodeSep}{1em}
\newlength\umlPlaceNodeX
\newlength\umlPlaceNodeY
\newcommand\umlPlaceNodeNull{%
  \def\umlPlaceNodeNodesepX{0pt}%
  \def\umlPlaceNodeNodesepY{0pt}%
  \def\umlPlaceNodeAngleX{}%
  \def\umlPlaceNodeAngleY{}%
  \def\umlPlaceNodeOffsetX{}%
  \def\umlPlaceNodeOffsetY{}%
  \setlength\umlPlaceNodeX{0pt}%
  \setlength\umlPlaceNodeY{0pt}%
}
\define@key[psset]{umlPlaceNode}{leftside}[0pt]{%
  \def\umlPlaceNodeAngleX{,angle=180}%
  \def\umlPlaceNodeNodesepX{#1}}%
\define@key[psset]{umlPlaceNode}{rightside}[0pt]{%
  \def\umlPlaceNodeAngleX{,angle=0}%
  \def\umlPlaceNodeNodesepX{#1}}%
\define@key[psset]{umlPlaceNode}{top}[0pt]{%
  \def\umlPlaceNodeAngleY{,angle=90}%
  \def\umlPlaceNodeNodesepY{#1}}%
\define@key[psset]{umlPlaceNode}{bottom}[0pt]{%
  \def\umlPlaceNodeAngleY{,angle=270}%
  \def\umlPlaceNodeNodesepY{#1}}%
\define@key[psset]{umlPlaceNode}{left}[0pt]{%
  \addtolength\umlPlaceNodeX{-#1}}%
\define@key[psset]{umlPlaceNode}{right}[0pt]{\addtolength\umlPlaceNodeX{#1}}
\define@key[psset]{umlPlaceNode}{up}[0pt]{\addtolength\umlPlaceNodeY{#1}}
\define@key[psset]{umlPlaceNode}{down}[0pt]{\addtolength\umlPlaceNodeY{-#1}}
\define@key[psset]{umlPlaceNode}{angle}{%
  \def\umlPlaceNodeAngleX{,angle=#1}%
  \def\umlPlaceNodeAngleY{,angle=#1}}%
\define@key[psset]{umlPlaceNode}{angleX}{\def\umlPlaceNodeAngleX{,angle=#1}}%
\define@key[psset]{umlPlaceNode}{angleY}{\def\umlPlaceNodeAngleY{,angle=#1}}%
\define@key[psset]{umlPlaceNode}{offset}{
  \def\umlPlaceNodeOffsetX{,offset=#1}%
  \def\umlPlaceNodeOffsetY{,offset=#1}}%
\define@key[psset]{umlPlaceNode}{offsetX}{\def\umlPlaceNodeOffsetX{,offset=#1}}%
\define@key[psset]{umlPlaceNode}{offsetY}{\def\umlPlaceNodeOffsetY{,offset=#1}}%
\define@key[psset]{umlPlaceNode}{nodesep}{%
  \def\umlPlaceNodeNodesepX{#1}%
  \def\umlPlaceNodeNodesepY{#1}}%
\define@key[psset]{umlPlaceNode}{nodesepX}{\def\umlPlaceNodeNodesepX{#1}}%
\define@key[psset]{umlPlaceNode}{nodesepY}{\def\umlPlaceNodeNodesepY{#1}}%
\newcommand\umlPlaceNode[3][]{%
  \umlPlaceNodeNull%
  \psset[umlPlaceNode]{#1}%
  \rput(%
    [nodesep=\umlPlaceNodeNodesepX\umlPlaceNodeOffsetX\umlPlaceNodeAngleX]#2|%
    [nodesep=\umlPlaceNodeNodesepY\umlPlaceNodeOffsetY\umlPlaceNodeAngleY]#2){%
      \pnode(\umlPlaceNodeX, \umlPlaceNodeY){#3}}%
}
\newcommand\umlRight[1]{[angle=0]#1}
\newcommand\umlTop[1]{[angle=90]#1}
\newcommand\umlLeft[1]{[angle=180]#1}
\newcommand\umlBottom[1]{[angle=270]#1}
\newcommand\umlTopRight[1]{[angle=0]#1|[angle=90]#1}
\newcommand\umlBottomRight[1]{[angle=0]#1|[angle=270]#1}
\newcommand\umlTopLeft[1]{[angle=180]#1|[angle=90]#1}
\newcommand\umlBottomLeft[1]{[angle=180]#1|[angle=270]#1}
\newcommand\umlRightSep[1]{[angle=0, nodesep=\umlNodeSep]#1}
\newcommand\umlTopSep[1]{[angle=90, nodesep=\umlNodeSep]#1}
\newcommand\umlLeftSep[1]{[angle=180, nodesep=\umlNodeSep]#1}
\newcommand\umlBottomSep[1]{[angle=270, nodesep=\umlNodeSep]#1}
\newcommand\umlTopRightSep[1]{%
    [angle=0, nodesep=\umlNodeSep]#1|[angle=90, nodesep=\umlNodeSep]#1}
\newcommand\umlBottomRightSep[1]{%
  [angle=0, nodesep=\umlNodeSep]#1|[angle=270, nodesep=\umlNodeSep]#1}
\newcommand\umlTopLeftSep[1]{%
  [angle=180, nodesep=\umlNodeSep]#1|[angle=90, nodesep=\umlNodeSep]#1}
\newcommand\umlBottomLeftSep[1]{%
  [angle=180, nodesep=\umlNodeSep]#1|[angle=270, nodesep=\umlNodeSep]#1}
\newcommand\umlRightOpt[2]{[angle=0, #1]#2}
\newcommand\umlTopOpt[2]{[angle=90, #1]#2}
\newcommand\umlLeftOpt[2]{[angle=180, #1]#2}
\newcommand\umlBottomOpt[2]{[angle=270, #1]#2}
\newcommand\umlTopRightOpt[2]{[angle=0, #1]#2|[angle=90, #1]#2}
\newcommand\umlBottomRightOpt[2]{[angle=0, #1]#2|[angle=270, #1]#2}
\newcommand\umlTopLeftOpt[2]{[angle=180, #1]#2|[angle=90, #1]#2}
\newcommand\umlBottomLeftOpt[2]{[angle=180, #1]#2|[angle=270, #1]#2}
\newcommand\umlRightSepOpt[2]{[angle=0, nodesep=\umlNodeSep, #1]#2}
\newcommand\umlTopSepOpt[2]{[angle=90, nodesep=\umlNodeSep, #1]#2}
\newcommand\umlLeftSepOpt[2]{[angle=180, nodesep=\umlNodeSep, #1]#2}
\newcommand\umlBottomSepOpt[2]{[angle=270, nodesep=\umlNodeSep, #1]#2}
\newcommand\umlTopRightSepOpt[2]{[angle=0, nodesep=\umlNodeSep, #1]#2|[angle=90, nodesep=\umlNodeSep, #1]#2}
\newcommand\umlBottomRightSepOpt[2]{[angle=0, nodesep=\umlNodeSep, #1]#2|[angle=270, nodesep=\umlNodeSep, #1]#2}
\newcommand\umlTopLeftSepOpt[2]{%
  [angle=180, nodesep=\umlNodeSep, #1]#2|[angle=90, nodesep=\umlNodeSep, #1]#2}
\newcommand\umlBottomLeftSepOpt[2]{%
  [angle=180, nodesep=\umlNodeSep, #1]#2|[angle=270, nodesep=\umlNodeSep, #1]#2}
\endinput
%%
%% End of file `uml.sty'.
