<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% Source Code Description for Unified Process Methodology
%
% Copyright (c) 2006-2007 Stephane GALLAND &lt;galland@arakhne.org&gt;
% 
% This program is free library; you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation; either version 3 of the
% License, or any later version.
%
% This library is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% Lesser General Public License for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License along with this library; see the file COPYING.  If not,
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite
% 330, Boston, MA 02111-1307, USA.
%
% Creation date: 2006-04-27
% Modifications:
%   2009-10-30   Clean code.
%

\global\edef\upm@package@code@ver{2009/10/30}

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{upmethodology-code}[\upm@package@code@ver]

\RequirePackage{upmethodology-p-common}

\def\upm@code@eat@spaces#1{#1}
\def\upm@code@makemul#1{\upm@code@eat@spaces{#1}\bgroup\textbf{s}\egroup\xspace}

%-----
%Language
%0: UML
%1: java
%2: C++
\newcount\upm@code@current@lang

\DeclareOption{uml}{\upm@code@current@lang=0}
\DeclareOption{java}{\upm@code@current@lang=1}
\DeclareOption{cpp}{\upm@code@current@lang=2}

\ExecuteOptions{uml}
\ProcessOptions

%-----
%Language changes
\newcommand{\upmcodelang}[1]{%
	\ifthenelse{\equal{#1}{java}}{%
		\upm@code@current@lang=1%
	}{%
	\ifthenelse{\equal{#1}{cpp}}{%
		\upm@code@current@lang=2%
	}{%
		\upm@code@current@lang=0%
	}%
	}%
	\upm@code@declarations%
}

\def\upm@code@declarations {
%-----
%PROTOTYPES
\gdef\jclass##1{\mbox{\textsc{##1}}\xspace}
\gdef\jinterface##1{\mbox{\textit{##1}}\xspace}
\gdef\jpackage##1{\mbox{\textsc{##1}}\xspace}
\gdef\jfunc##1{\texttt{##1}\xspace}

%-----
%TYPES
\if\the\upm@code@current@lang 1
	%Java
	\gdef\jclazz{\textbf{Class}\xspace}
	\gdef\jvoid{\textbf{void}\xspace}
	\gdef\jint{\textbf{int}\xspace}
	\gdef\jlong{\textbf{long}\xspace}
	\gdef\jfloat{\textbf{float}\xspace}
	\gdef\jboolean{\textbf{boolean}\xspace}
	\gdef\jdouble{\textbf{double}\xspace}
	\gdef\jchar{\textbf{char}\xspace}
	\gdef\jstring{\jclass{String}\xspace}
	\gdef\jarray##1{{{##1}\bgroup\textbf{\string[\string]}\egroup}\xspace}
	\gdef\jcollection##1{{\jclass{Collection}\textless{##1}\bgroup\textgreater\egroup}\xspace}
	\gdef\jset##1{{\jclass{Set}\textless{##1}\bgroup\textgreater\egroup}\xspace}
\else\if\the\upm@code@current@lang 2
	%C++
	\gdef\jclazz{\textbf{class}\xspace}
	\gdef\jvoid{\textbf{void}\xspace}
	\gdef\jint{\textbf{int}\xspace}
	\gdef\jlong{\textbf{long}\xspace}
	\gdef\jfloat{\textbf{float}\xspace}
	\gdef\jboolean{\textbf{bool}\xspace}
	\gdef\jdouble{\textbf{double}\xspace}
	\gdef\jchar{\textbf{char}\xspace}
	\gdef\jstring{\jclass{std\string:\string:string}\xspace}
	\gdef\jarray##1{{{##1}\bgroup\textbf{\string[\string]}\egroup}\xspace}
	\gdef\jcollection##1{{\jclass{std\string:\string:vector}\textless{##1}\bgroup\textgreater\egroup}\xspace}
	\gdef\jset##1{{\jclass{std\string:\string:set}\textless{##1}\bgroup\textgreater\egroup}\xspace}
\else
	%UML
	\gdef\jclazz{\textbf{class}\xspace}
	\gdef\jvoid{\textbf{void}\xspace}
	\gdef\jint{\textbf{integer}\xspace}
	\gdef\jlong{\textbf{long integer}\xspace}
	\gdef\jfloat{\textbf{float}\xspace}
	\gdef\jboolean{\textbf{boolean}\xspace}
	\gdef\jdouble{\textbf{double}\xspace}
	\gdef\jchar{\textbf{character}\xspace}
	\gdef\jstring{\textbf{string}\xspace}
	\gdef\jcollection##1{{\textbf{collection of} \upm@code@makemul{##1}\bgroup\egroup}\xspace}
	\gdef\jarray##1{{\textbf{array of} \upm@code@makemul{##1}\bgroup\egroup}\xspace}
	\gdef\jset##1{{\textbf{set of} \upm@code@makemul{##1}\bgroup\egroup}\xspace}
\fi\fi

%-----
%CONSTANTS
\if\the\upm@code@current@lang 1
	%Java
	\gdef\jtrue{\textsc{true}\xspace}
	\gdef\jfalse{\textsc{false}\xspace}
\else\if\upm@code@current@lang 2
	%C++
	\gdef\jtrue{\textsc{true}\xspace}
	\gdef\jfalse{\textsc{false}\xspace}
\else
	\gdef\jtrue{\textsc{true}\xspace}
	\gdef\jfalse{\textsc{false}\xspace}
\fi\fi

%-----
%OPERATIONS
\gdef\jop##1{\bgroup\jcode{##1}\egroup}
\gdef\jcall##1##2{\mbox{\jfunc{##1}\bgroup\texttt{\string({##2}\string)}\egroup}\xspace}
\gdef\jcode##1{\texttt{##1}\xspace}

}

\upm@code@declarations

\endinput
</pre></body></html>