% Copyright 2018 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\ProvidesFileRCS{tikzlibrarypetri.code.tex}


% Styles for places:

\tikzset{every place/.style=           {}}%
\tikzset{place/.style=                 {circle,draw,inner sep=0pt,
                                        minimum size=5ex,
                                        every place}}%


% Styles for transition:

\tikzset{every transition/.style=      {}}%
\tikzset{transition/.style=            {rectangle,draw,inner sep=0pt,
                                        minimum size=4mm,
                                        every transition}}%


% Styles for relationship types:

\tikzset{pre/.style=                   {<-,shorten <=1pt}}%
\tikzset{post/.style=                  {->,shorten >=1pt}}%
\tikzset{pre and post/.style=          {<->,shorten >=1pt,shorten <=1pt}}%



% Styles for marks:

\tikzset{every token/.style=           {}}%
\tikzset{token/.style=                 {fill=black,draw=none,circle,
                                        inner sep=0.5pt,minimum size=1ex,
                                        text=white,font=\pgfutil@font@tiny,every token}}%

\tikzoption{token distance}{\def\tikz@token@distance{#1}}%
\def\tikz@token@distance{1.5ex}%

\tikzset{children are tokens/.style=   {growth function=\tikz@grow@tokens,edge from parent path=}}%

\tikzoption{tokens}{%
  \ifnum#1>0\relax%
    \tikzset{append after command={}
     {[children are tokens]child foreach \tikz@dummy in {1,...,#1} {node[token]{}}}}%
  \fi}%

\tikzoption{colored tokens}{%
  \tikzset{append after command={}%
    {[children are tokens]child foreach \tikz@child@color in {#1} {node[token,\tikz@child@color]{}}}}%
  }%

\tikzoption{structured tokens}{%
  \tikzset{append after command={}%
    {[children are tokens]child foreach \tikzpetrichildname in {#1} {node[token]{\tikzpetrichildname}}}}%
  }%


\def\tikz@grow@tokens{%
  \pgfmathsetlength{\pgf@xa}{\tikz@token@distance}%
  \pgfmathsetlength{\pgf@ya}{\tikz@token@distance}%
  \pgf@xc=0pt%
  \pgf@yc=0pt%
  \csname tikz@grow@tokens@placer@\the\tikznumberofchildren @\the\tikznumberofcurrentchild\endcsname%
  \pgftransformshift{\pgfqpoint{\pgf@xc}{\pgf@yc}}%
}%

\def\tikz@def@grow@tokens#1#2#3#4{%
  \expandafter\def\csname tikz@grow@tokens@placer@#1@#2\endcsname{%
    \pgf@xc=#3\pgf@xa%
    \pgf@yc=#4\pgf@ya}%
}%


% Single token
\tikz@def@grow@tokens{1}{1}{0}{0}%

% Two tokens
\tikz@def@grow@tokens{2}{1}{-.5}{0}%
\tikz@def@grow@tokens{2}{2}{.5}{0}%

% Three tokens
\tikz@def@grow@tokens{3}{1}{0} {0.57}%
\tikz@def@grow@tokens{3}{2}{-.5}{-.306025}%
\tikz@def@grow@tokens{3}{3}{.5} {-.306025}%

% Four tokens
\tikz@def@grow@tokens{4}{1}{-.5}{.5}%
\tikz@def@grow@tokens{4}{2}{.5}{.5}%
\tikz@def@grow@tokens{4}{3}{-.5}{-.5}%
\tikz@def@grow@tokens{4}{4}{.5}{-.5}%

% Five tokens
\tikz@def@grow@tokens{5}{1}{0}{.85}%
\tikz@def@grow@tokens{5}{2}{-0.808398}{0.26266}%
\tikz@def@grow@tokens{5}{3}{0.808398}{0.26266}%
\tikz@def@grow@tokens{5}{4}{-0.499617}{-0.687664}%
\tikz@def@grow@tokens{5}{5}{0.499617}{-0.687664}%

% Six tokens
\tikz@def@grow@tokens{6}{1}{-1}{.5}%
\tikz@def@grow@tokens{6}{2}{0}{.5}%
\tikz@def@grow@tokens{6}{3}{1}{.5}%
\tikz@def@grow@tokens{6}{4}{-1}{-.5}%
\tikz@def@grow@tokens{6}{5}{0}{-.5}%
\tikz@def@grow@tokens{6}{6}{1}{-.5}%

% Seven tokens
\tikz@def@grow@tokens{7}{1}{0}{1}%
\tikz@def@grow@tokens{7}{2}{-1}{.5}%
\tikz@def@grow@tokens{7}{3}{0}{0}%
\tikz@def@grow@tokens{7}{4}{1}{.5}%
\tikz@def@grow@tokens{7}{5}{-1}{-.5}%
\tikz@def@grow@tokens{7}{6}{0}{-1}%
\tikz@def@grow@tokens{7}{7}{1}{-.5}%

% Eight tokens
\tikz@def@grow@tokens{8}{1}{-.5}{1}%
\tikz@def@grow@tokens{8}{2}{.5}{1}%
\tikz@def@grow@tokens{8}{3}{-1}{0}%
\tikz@def@grow@tokens{8}{4}{0}{0}%
\tikz@def@grow@tokens{8}{5}{1}{0}%
\tikz@def@grow@tokens{8}{6}{-1}{-1}%
\tikz@def@grow@tokens{8}{7}{0}{-1}%
\tikz@def@grow@tokens{8}{8}{1}{-1}%

% Eight tokens
\tikz@def@grow@tokens{9}{1}{-1}{1}%
\tikz@def@grow@tokens{9}{2}{0}{1}%
\tikz@def@grow@tokens{9}{3}{1}{1}%
\tikz@def@grow@tokens{9}{4}{-1}{0}%
\tikz@def@grow@tokens{9}{5}{0}{0}%
\tikz@def@grow@tokens{9}{6}{1}{0}%
\tikz@def@grow@tokens{9}{7}{-1}{-1}%
\tikz@def@grow@tokens{9}{8}{0}{-1}%
\tikz@def@grow@tokens{9}{9}{1}{-1}%


\endinput
