%%
%% This is file `decision-table.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% decision-table.dtx  (with options: `package')
%% 
%% Copyright (C) 2020-2021 by S. Vandevelde, F. Pantigny
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in:
%% 
%%      http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
\def\dmnfileversion{0.0.4}
\def\dmnfiledate{2021/10/01}


















\RequirePackage{l3keys2e}
\ProvidesExplPackage
  {decision-table}
  {\dmnfiledate}
  {\dmnfileversion}
  {Table of decision}
\RequirePackage { nicematrix }
\NewDocumentCommand \dmntable { m m m m m }
  {
    \clist_clear_new:N \l__dmn_input_clist
    \clist_set:Nn \l__dmn_input_clist { #3 }
    \clist_clear_new:N \l__dmn_output_clist
    \clist_set:Nn \l__dmn_output_clist { #4 }
    \int_zero_new:N \l__dmn_input_int
    \int_set:Nn \l__dmn_input_int { \clist_count:N \l__dmn_input_clist }
    \int_zero_new:N \l__dmn_output_int
    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
    \seq_clear_new:N \l__dmn_cells_seq
    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #5 }
    \use:x
      {
        \exp_not:N \begin { NiceTabular }
        { r \prg_replicate:nn { \l__dmn_input_int + \l__dmn_output_int } l }
        [
          hvlines-except-corners ,
          code-before =
           \exp_not:N \rectanglecolor
             { blue!10!green!60!black!30 }
             { 2 - 2 }
             { 2 - \int_eval:n { \l__dmn_input_int + 1 } }
           \exp_not:N \rectanglecolor
             { green!30!blue!15 }
             { 2 - \int_eval:n { \l__dmn_input_int + 2 } }
             { 2 - \int_eval:n { \l__dmn_input_int + \l__dmn_output_int + 1 } }
        ]
      }
    \exp_args:Ne \multicolumn
      { \int_eval:n { \l__dmn_input_int + 1 } }
      { l }
      { #1 } \\
    #2 &
    \clist_use:Nn \l__dmn_input_clist { & } &
    \clist_use:Nn \l__dmn_output_clist { & } \\
    1 &
    \seq_map_inline:Nn \l__dmn_cells_seq
      {
        \int_compare:nT { \c@jCol = 0 } { \int_eval:n { \c@iRow - 1 } & }
        ##1
        \int_compare:nTF { \c@jCol = \l__dmn_input_int + \l__dmn_output_int + 1 }
          { \\ }
          { & }
      }
    \end { NiceTabular }
  }
\NewDocumentCommand \dmnoutputtable { m m m m }
  {
    \clist_clear_new:N \l__dmn_output_clist
    \clist_set:Nn \l__dmn_output_clist { #3 }
    \int_zero_new:N \l__dmn_output_int
    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
    \seq_clear_new:N \l__dmn_cells_seq
    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #4 }
    \use:x
      {
        \exp_not:N \begin { NiceTabular }
        { r \prg_replicate:nn { \l__dmn_output_int } l }
        [
          hvlines-except-corners ,
          code-before =
           \exp_not:N \rectanglecolor
             { blue!10!green!60!black!30 }
             { 2 - 2 }
             { 2 - \int_eval:n { 1 } }
           \exp_not:N \rectanglecolor
             { green!30!blue!15 }
             { 2 - \int_eval:n { 2 } }
             { 2 - \int_eval:n { \l__dmn_output_int + 1 } }
        ]
      }
    \exp_args:Ne \multicolumn
      { \int_eval:n { 1 } }
      { l }
      { #1 } \\
    #2 &
    \clist_use:Nn \l__dmn_output_clist { & } \\
    1 &
    \seq_map_inline:Nn \l__dmn_cells_seq
      {
        \int_compare:nT { \c@jCol = 0 } { \int_eval:n { \c@iRow - 1 } & }
        ##1
        \int_compare:nTF { \c@jCol = \l__dmn_output_int + 1 }
          { \\ }
          { & }
      }
    \end { NiceTabular }
  }

\NewDocumentCommand \glossarytable { m m m }
  {
    \clist_clear_new:N \l__clist
    \clist_set:Nn \l__clist { #2 }
    \int_zero_new:N \l__cint
    \int_set:Nn \l__cint { \clist_count:N \l__clist }
    \seq_clear_new:N \l__dmn_cells_seq
    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #3 }
    \use:x
      {
        \exp_not:N \begin { NiceTabular }
        { c \prg_replicate:nn { \l__cint -1 } c }
        [
          hvlines-except-corners ,
          code-before =
           \exp_not:N \rectanglecolor
             { blue!30!green!10!red!40 }
             { 1 - \int_eval:n { 1 } }
             { 1 - \int_eval:n { \l__cint} }
        ]
      }
    \exp_args:Ne \multicolumn
      { \int_eval:n { \l__cint } }
      { c }
      { \textbf{#1} } \\
    \bf \clist_use:Nn \l__clist { & \bf } \\
    \seq_map_inline:Nn \l__dmn_cells_seq
      {
        \int_compare:nT { \c@jCol = 0 } { }
        ##1
        \int_compare:nTF { \c@jCol = \l__cint }
          { \\ }
          { & }
      }
    \end { NiceTabular }
  }
\NewDocumentCommand \pdmntable { m m m m m m}
  {
    \clist_clear_new:N \l__dmn_input_clist
    \clist_set:Nn \l__dmn_input_clist { #3 }
    \clist_clear_new:N \l__dmn_output_clist
    \clist_set:Nn \l__dmn_output_clist { #4 }
    \clist_clear_new:N \l__suboutput_clist
    \clist_set:Nn \l__dmn_suboutput_clist { #5 }
    \int_zero_new:N \l__dmn_input_int
    \int_set:Nn \l__dmn_input_int { \clist_count:N \l__dmn_input_clist }
    \int_zero_new:N \l__dmn_output_int
    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
    \int_zero_new:N \l__dmn_suboutput_int
    \int_set:Nn \l__dmn_suboutput_int { \clist_count:N \l__dmn_suboutput_clist }
    \seq_clear_new:N \l__dmn_cells_seq
    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #6 }
    \seq_clear_new:N \l__dmn_inputcells_seq
    \seq_set_split:Nnn \l__dmn_inputcells_seq { , } { #3 }
    \use:x
      {
        \exp_not:N \begin { NiceTabular }
        { r \prg_replicate:nn { \l__dmn_input_int + \l__dmn_suboutput_int  + 1} l }
        [
          hvlines-except-corners ,
          code-before =
           \exp_not:N \rectanglecolor
             { blue!10!green!60!black!30 }
             { 2 - 2 }
             { 2 - \int_eval:n { \l__dmn_input_int + 1 } }
           \exp_not:N \rectanglecolor
             { green!30!blue!15 }
             { 2 - \int_eval:n { \l__dmn_input_int + 2 } }
             { 2 - \int_eval:n { \l__dmn_input_int + \l__dmn_suboutput_int + 1 } }
          \exp_not:N \rectanglecolor
             { red!60!green!60!blue!15}
             { 3 - \int_eval:n { 1 } }
             { 3 - \int_eval:n { \l__dmn_input_int + \l__dmn_suboutput_int + 1 } }
        ]
      }
    \exp_args:Ne \multicolumn
      { \int_eval:n { \l__dmn_input_int + 1 } }
      { l }
      { #1 } \\
    #2 &
    \clist_use:Nn \l__dmn_input_clist { & } &
    \exp_args:Ne \multicolumn
      { \int_eval:n {\l__dmn_suboutput_int}}
      { c }
      { #4 } \\
    \seq_map_inline:Nn \l__dmn_inputcells_seq
      { & }
    & \clist_use:Nn \l__dmn_suboutput_clist { & } & \\
    %\clist_use:Nn \l__dmn_output_clist { & } \\
    1 &
    \seq_map_inline:Nn \l__dmn_cells_seq
      {
        \int_compare:nT { \c@jCol = 0 } { \int_eval:n { \c@iRow - 2 } & }
        ##1
        \int_compare:nTF { \c@jCol = \l__dmn_input_int + \l__dmn_suboutput_int + 1 }
          { \\ }
          { & }
      }
    \end { NiceTabular }
  }
\NewDocumentCommand \pdmnoutputtable { m m m m m }
  {
    \clist_clear_new:N \l__dmn_output_clist
    \clist_set:Nn \l__dmn_output_clist { #3 }
    \clist_clear_new:N \l__suboutput_clist
    \clist_set:Nn \l__dmn_suboutput_clist { #4 }
    \int_zero_new:N \l__dmn_output_int
    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
    \int_zero_new:N \l__dmn_suboutput_int
    \int_set:Nn \l__dmn_suboutput_int { \clist_count:N \l__dmn_suboutput_clist }
    \seq_clear_new:N \l__dmn_cells_seq
    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #5 }
    \use:x
      {
        \exp_not:N \begin { NiceTabular }
        { r \prg_replicate:nn { \l__dmn_suboutput_int } l }
        [
          hvlines-except-corners ,
          code-before =
           \exp_not:N \rectanglecolor
             { blue!10!green!60!black!30 }
             { 2 - 2 }
             { 2 - \int_eval:n { 1 } }
           \exp_not:N \rectanglecolor
             { green!30!blue!15 }
             { 2 - \int_eval:n { 2 } }
             { 2 - \int_eval:n { \l__dmn_suboutput_int + 1 } }
          \exp_not:N \rectanglecolor
             { red!60!green!60!blue!15}
             { 3 - \int_eval:n { 1 } }
             { 3 - \int_eval:n { \l__dmn_suboutput_int + 1 } }
        ]
      }
    \exp_args:Ne \multicolumn
      { \int_eval:n { 1 } }
      { l }
      { #1 } \\
    #2 &
    \exp_args:Ne \multicolumn
      { \int_eval:n {\l__dmn_suboutput_int}}
      { c }
      { #3 } \\
    & \clist_use:Nn \l__dmn_suboutput_clist { & } \\
    1 &
    \seq_map_inline:Nn \l__dmn_cells_seq
      {
        \int_compare:nT { \c@jCol = 0 } { \int_eval:n { \c@iRow - 1 } & }
        ##1
        \int_compare:nTF { \c@jCol = \l__dmn_suboutput_int + 1 }
          { \\ }
          { & }
      }
    \end { NiceTabular }
  }

\NewDocumentCommand \goaltable { m m }
  {
    \seq_clear_new:N \l__dmn_cells_seq
    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #2 }
    \use:x
      {
        \exp_not:N \begin { NiceTabular }
        { \prg_replicate:nn { 1 } c }
        [
          hvlines-except-corners ,
          code-before =
           \exp_not:N \rectanglecolor
             { blue!30!green!10!red!20 }
             { 1 - \int_eval:n { 1 } }
             { 1 - \int_eval:n { 1} }
        ]
      }
    \textbf{#1} \\
    %\exp_args:Ne \multicolumn
    %  { \int_eval:n { 1 } }
    %  { c }
    %  { \textbf{#1} } \\
    \seq_map_inline:Nn \l__dmn_cells_seq
      {
        \int_compare:nT { \c@jCol = 0 } { }
        ##1
        \int_compare:nTF { \c@jCol = 1 }
          { \\ }
          { & }
      }
    \end { NiceTabular }
  }

\endinput
%%
%% End of file `decision-table.sty'.
