\section{Enacting a Binding}

After the search for an enabled binding has been 
successfully completed, a \texttt{Binding} object is created
and handed to the finder, as already indicated in
Fig.~\ref{fig:finder}. The binding object knows about all
transition occurrences that are involved in the firing.

\singlediagram{binding}{The class \texttt{Binding}}

For each occurrence, the state of the variable mapper
immediately after the successful search is preserved in
a copy of that variable mapper. All unifiable objects
in the mapper are copied, too, in order to protect them 
from backtracking. These mappers are used to determine the
string representation of the binding, if the binding is to be
presented to the user.

Separate from that, the binding keeps two sets of executable
objects. These objects are generated by the inscription
occurrences that were described in Section~\ref{sec:occrea}.
The executable objects come in two flavors: early and
late executables.

\begin{table}[htbp]
  \def\naentry#1{\texttt{#1}&&N/A\\\hline}
  \def\simpleentry#1#2{\texttt{#1}&&\texttt{#2}\\\hline}
  \def\optionentry#1#2#3{\texttt{#1}&#2&\texttt{#3}\\}
  \begin{center}
    \begin{tabular}{lll}
      occurrence & case & executable \\\hline
      \simpleentry{ActionOccurrence}{ActionExecutable}
      \optionentry{ArcOccurrence}{in}{InputArcExecutable}\cline{2-3}
      \optionentry{}{out}{OutputArcExecutable}\cline{2-3}
      \optionentry{}{in/out}{InputArcExecutable}
      \optionentry{}{}{OutputArcExecutable}\cline{2-3}
      \optionentry{}{fast in/out}{InputArcExecutable}\cline{2-3}
      \optionentry{}{test}{TestArcExecutable}
      \optionentry{}{}{UntestArcExecutable}\cline{2-3}
      \optionentry{}{fast test}{TestArcExecutable}\cline{2-3}
      \optionentry{}{inhibitor}{InhibitorExecutable}\hline
      \simpleentry{ClearArcOccurrence}{ClearArcExecutable}
      \naentry{ConditionalOccurrence}
      \optionentry{CreationOccurrence}{}{EarlyConfirmer}
      \optionentry{}{}{LateConfirmer}\hline
      \naentry{DownlinkOccurrence}
      \naentry{EnumeratorOccurrence}
      \optionentry{FlexibleArcOccurrence}{in}
        {FlexibleInArcExecutable}\cline{2-3}
      \optionentry{}{out}{FlexibleOutArcExecutable}\cline{2-3}
      \optionentry{}{fast in/out}{FlexibleInArcExecutable}
    \end{tabular}
  \end{center}
  \caption{Occurrence classes and associated executable classes}
  \label{tab:executables}
\end{table}

The interface
\texttt{EarlyExecutable} is intended for those effects of a transition
that may turn out to be impossible if the current
marking changes currently to the search process. Such
executables are required to be reversible, i.e., they must support
a rollback operation.

The other interface is \texttt{LateExecutable}, which may contain
irreversible effects. However, a late executable may not report an
error in any case, it must always complete.

In Table~\ref{tab:executables} you can see a summary of
all occurrences and the executables that they create.
Most executables depend on the binding of certain variables.
If the exact valuation of the variable may not be determined during the
creation of the executable, the executable references a variable
of the unification algorithm, as witnessed by the class
\texttt{OutputArcExecutable}. All variables are copied before
recording them in the executable object, because backtracking must be
eliminated. The same copier is used for all executables, so that
executables that bind variable, e.g.~the \texttt{ActionExecutable},
may pass their results to other executables. 
The common copier is not reused for the storage of the
variable mappers in the binding, because we do not want the
string representation of a binding to change.

\singlediagram{executable}{The \texttt{Executable} classes}

Fig.~\ref{fig:executable} gives a class diagram of
all subclasses of \texttt{Executable} and the main related classes.

An \texttt{UntestArcExecutable}, which removes the test status from a token,
references that executable that originally tested the token.
This ensure that the token can be put back using the correct
time stamp, if a timed simulation is intended.

Before the executability of early executables is checked, all
early executables are locked. The executables may request
a certain lock order to avoid deadlocks. Afterward, the
check for executability can be performed without disturbances.

Note that the \texttt{EarlyConfirmer} does not actually have to lock
anything, because it only prints trace messages and it does so
only if all other executables succeeded. It cannot even fail, but
nevertheless, this executable is considered early, because it
must be executed before the first trace messages about removed tokens are
printed.

The \texttt{FiringStartExecutable} and \texttt{FiringCompleteExecutable}
are not created by inscription occurrences, but by the firing
transition instance itself. They ensure that an event is sent
to listeners of the transition regarding the start and
end of the firing. The \texttt{FiringStartExecutable} may be made
an early executable, ultimately.

Note that the classes \texttt{FlexibleInArcExecutable} and
\texttt{FlexibleOutArcExecutable} are not represented in
the class diagram. They are not essentially different
from the other arc classes.

\singlediagram{executenet}{The life cycle of an early executable object}

Fig.~\ref{fig:executenet} summarizes the life cycle of an
early executable object. Note that, if the \texttt{verify()} method
fails, it is not required to rollback any actions by the
executable that failed, but that it is still required to
unlock the executable just as all the other executables.
All executables whose verification already succeeded must
be rolled back, if the binding turns out to be not executable.

