Description
This code generates a sequence diagram using the tikz-uml
package in LaTeX. The diagram shows a sequence of interactions between three entities: an actor named user
, an object named AudioService
, and another object named Settings
.
The diagram shows a message being sent from the user
to the AudioService
object with the operation name handleMessage()
. The AudioService
object then sends a message to itself with the operation name persistVolume()
. This operation involves sending a message to the Settings
object to store some data. The Settings
object sends two messages to itself to store the data.
Finally, the code adds a node to the diagram to display a message label below the a-op
object (which corresponds to the persistVolume()
operation). The message label reads MSG_PERSIST_VOLUME
, and is displayed in a smaller font size.
Keywords
tikz-uml, umlseqdiag, umlactor, umlobject, umlcall, op, return, name.
Source Code
\documentclass[border=20pt]{standalone}
\usepackage[english]{babel}
\usepackage{tikz-uml}
\begin{document}
\small\begin{tikzpicture}
\begin{umlseqdiag}
\umlactor{user}
\umlobject{AudioService}
\umlobject[]{Settings}
\begin{umlcall}[op=handleMessage(),return=1,name=a]{user}{AudioService}
\begin{umlcall}[op=persistVolume(),return=1]{AudioService}{AudioService}
\begin{umlcall}[op=putIntForUser(),return=1]{AudioService}{Settings}
\begin{umlcall}[op=putStringForUser(),return=1]{Settings}{Settings}
\end{umlcall}
\end{umlcall}
\end{umlcall}
\end{umlcall}
\end{umlseqdiag}
\node [below,font=\scriptsize] at (a-op.south) {MSG\_PERSIST\_VOLUME};
\end{tikzpicture}
\end{document}