// Path: src/main/java/nl/hsac/fitnesse/slimcoverage/SlimCoverageTestContextImpl.java
// public class SlimCoverageTestContextImpl extends SlimTestContextImpl {
//     private final SlimScenarioUsagePer usage;
// 
//     public SlimCoverageTestContextImpl(TestPage testPage, SlimScenarioUsagePer usageByPage) {
//         super(testPage);
//         usage = usageByPage;
//     }
// 
//     @Override
//     public void addScenario(String scenarioName, ScenarioTable scenarioTable) {
//         if (usage != null) {
//             String key = getGroupName(scenarioTable);
//             usage.addDefinition(key);
//         }
//         super.addScenario(scenarioName, scenarioTable);
//     }
// 
//     public ScenarioTable getScenario(String scenarioName) {
//         ScenarioTable scenarioTable = getScenarioNoCount(scenarioName);
//         trackUsage(scenarioTable);
//         return scenarioTable;
//     }
// 
//     public ScenarioTable getScenarioNoCount(String scenarioName) {
//         return super.getScenario(scenarioName);
//     }
// 
//     @Override
//     public ScenarioTable getScenarioByPattern(String invokingString) {
//         ScenarioTable scenarioTable = getScenarioByPatternNoCount(invokingString);
//         trackUsage(scenarioTable);
//         return scenarioTable;
//     }
// 
//     public ScenarioTable getScenarioByPatternNoCount(String invokingString) {
//         return super.getScenarioByPattern(invokingString);
//     }
// 
//     protected void trackUsage(ScenarioTable scenarioTable) {
//         if (usage != null && scenarioTable != null) {
//             String key = getGroupName(scenarioTable);
//             usage.addUsage(key);
//         }
//     }
// 
//     protected String getGroupName(ScenarioTable scenarioTable) {
//         String name = scenarioTable.getName();
//         int inputCount = scenarioTable.getInputs().size();
//         int outputCount = scenarioTable.getOutputs().size();
//         String keyPattern;
//         if (inputCount == 0 && outputCount == 0) {
//             keyPattern = "%s";
//         } else if (outputCount == 0) {
//             keyPattern = "%s[%s]";
//         } else {
//             keyPattern = "%s[%s,%s]";
//         }
//         return String.format(keyPattern, name, inputCount, outputCount);
//     }
// }


import fitnesse.testsystems.TestExecutionException;
import fitnesse.testsystems.slim.SlimTestContext;
import fitnesse.testsystems.slim.Table;
import fitnesse.testsystems.slim.tables.*;
import nl.hsac.fitnesse.slimcoverage.SlimCoverageTestContextImpl;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

    public AutoArgScenarioTable(Table table, String tableId, SlimTestContext testContext) {
        super(table, tableId, testContext);
    }

    @Override
    public List<SlimAssertion> getAssertions() throws SyntaxError {
        inputs = findArguments(ARG_PATTERN);
        outputs = findArguments(OUT_PATTERN);
        return super.getAssertions();
    }

    @Override
    protected boolean determineParameterized() {
        return !inputs.isEmpty();
    }

    @Override
    protected void getScenarioArguments() {
        for (String input : inputs) {
            addInput(input);
        }
        for (String output : outputs) {
            addOutput(output);
        }
    }

    private Set<String> findArguments(Pattern pattern) throws SyntaxError {
        Set<String> found = new LinkedHashSet<>();
        int rowCount = table.getRowCount();
// Path: src/main/java/nl/hsac/fitnesse/slimcoverage/SlimCoverageTestContextImpl.java
// public class SlimCoverageTestContextImpl extends SlimTestContextImpl {
//     private final SlimScenarioUsagePer usage;
// 
//     public SlimCoverageTestContextImpl(TestPage testPage, SlimScenarioUsagePer usageByPage) {
//         super(testPage);
//         usage = usageByPage;
//     }
// 
//     @Override
//     public void addScenario(String scenarioName, ScenarioTable scenarioTable) {
//         if (usage != null) {
//             String key = getGroupName(scenarioTable);
//             usage.addDefinition(key);
//         }
//         super.addScenario(scenarioName, scenarioTable);
//     }
// 
//     public ScenarioTable getScenario(String scenarioName) {
//         ScenarioTable scenarioTable = getScenarioNoCount(scenarioName);
//         trackUsage(scenarioTable);
//         return scenarioTable;
//     }
// 
//     public ScenarioTable getScenarioNoCount(String scenarioName) {
//         return super.getScenario(scenarioName);
//     }
// 
//     @Override
//     public ScenarioTable getScenarioByPattern(String invokingString) {
//         ScenarioTable scenarioTable = getScenarioByPatternNoCount(invokingString);
//         trackUsage(scenarioTable);
//         return scenarioTable;
//     }
// 
//     public ScenarioTable getScenarioByPatternNoCount(String invokingString) {
//         return super.getScenarioByPattern(invokingString);
//     }
// 
//     protected void trackUsage(ScenarioTable scenarioTable) {
//         if (usage != null && scenarioTable != null) {
//             String key = getGroupName(scenarioTable);
//             usage.addUsage(key);
//         }
//     }
// 
//     protected String getGroupName(ScenarioTable scenarioTable) {
//         String name = scenarioTable.getName();
//         int inputCount = scenarioTable.getInputs().size();
//         int outputCount = scenarioTable.getOutputs().size();
//         String keyPattern;
//         if (inputCount == 0 && outputCount == 0) {
//             keyPattern = "%s";
//         } else if (outputCount == 0) {
//             keyPattern = "%s[%s]";
//         } else {
//             keyPattern = "%s[%s,%s]";
//         }
//         return String.format(keyPattern, name, inputCount, outputCount);
//     }
// }


// Path: src/main/java/nl/hsac/fitnesse/slim/AutoArgScenarioTable.java
import fitnesse.testsystems.TestExecutionException;
import fitnesse.testsystems.slim.SlimTestContext;
import fitnesse.testsystems.slim.Table;
import fitnesse.testsystems.slim.tables.*;
import nl.hsac.fitnesse.slimcoverage.SlimCoverageTestContextImpl;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


    public AutoArgScenarioTable(Table table, String tableId, SlimTestContext testContext) {
        super(table, tableId, testContext);
    }

    @Override
    public List<SlimAssertion> getAssertions() throws SyntaxError {
        inputs = findArguments(ARG_PATTERN);
        outputs = findArguments(OUT_PATTERN);
        return super.getAssertions();
    }

    @Override
    protected boolean determineParameterized() {
        return !inputs.isEmpty();
    }

    @Override
    protected void getScenarioArguments() {
        for (String input : inputs) {
            addInput(input);
        }
        for (String output : outputs) {
            addOutput(output);
        }
    }

    private Set<String> findArguments(Pattern pattern) throws SyntaxError {
        Set<String> found = new LinkedHashSet<>();
        int rowCount = table.getRowCount();
        for (int row = 0; row < rowCount; row++) {