Christophe Weblog Wiki Code Publications Music
add work-in-progress replacement for figure
authorChristophe Rhodes <csr21@cantab.net>
Sun, 2 Mar 2014 16:00:45 +0000 (16:00 +0000)
committerChristophe Rhodes <csr21@cantab.net>
Sun, 2 Mar 2014 16:00:45 +0000 (16:00 +0000)
illustrate dispatch using tikZ because why not?

dispatch-relationships.tikz [new file with mode: 0644]

diff --git a/dispatch-relationships.tikz b/dispatch-relationships.tikz
new file mode 100644 (file)
index 0000000..18f774f
--- /dev/null
@@ -0,0 +1,33 @@
+\documentclass{article}
+
+\usepackage{tikz}
+\usetikzlibrary{shapes.geometric}
+\usetikzlibrary{arrows}
+
+\begin{document}
+
+\begin{tikzpicture}
+  \begin{scope}[minimum width=8em,minimum height=3ex]
+  \node[draw,rectangle] (eql) at (0,0) {\texttt{eql-specializer}};
+  \node[draw,rectangle] (class) at (1,2) {\texttt{class}};
+  \node[draw,rectangle] (specializer) at (0.5,6) {\texttt{specializer}};
+  \node[draw,ellipse] (argument) at (7,2) {\textit{argument}};
+
+  \node[draw,red,ellipse] (generalizer) at (7,4) {\textit{\color{red}generalizer}};
+  \node[draw,red,rectangle] (genspec) at (2,4) {\texttt{\color{red}gen.-spec.}};
+  \end{scope}
+
+  \draw[->,>=open triangle 60] (eql.168) |- (specializer);
+  \draw[->,>=open triangle 60] (class.160) -- (class.160 |- specializer.south);
+  \draw[->,>=open triangle 60,red] (genspec.150) -- (genspec.150 |- specializer.south);
+
+  \draw[dashed] (argument.south) |- node[right,near start] {\texttt{eql}} node[below,near end] {\texttt{eql-specializer-object}} (eql.east);
+  \draw[dashed] (argument.west) -- node[below] {\texttt{typep}} node[above] {\texttt{class-of}} (class.east);
+  \draw[red] (argument.north) -- node[right] {\texttt{\color{red}generalizer-of}} (generalizer.south);
+  \draw[red] (generalizer.west) -- node[above] (sagp) {\texttt{\color{red}s-a-g-p}} (genspec.east);
+  \node (specaccgenp) at (6,5.5) {\texttt{\footnotesize{\color{red}specializer-accepts-generalizer-p}}};
+  \draw[red,dotted] (sagp) -- (specaccgenp);
+
+\end{tikzpicture}
+
+\end{document}
\ No newline at end of file