<commit_before>package fitnesse.slim.test.statementexecutorconsumer;

import fitnesse.slim.SlimSymbol;
import fitnesse.slim.StatementExecutor;
import fitnesse.slim.StatementExecutorConsumer;
import fitnesse.slim.StatementExecutorInterface;

import java.util.List;
import java.util.regex.Matcher;

/**
 * Base class for TableTables wanting do their own symbol management.
 */
public abstract class SymbolManagingTableTable implements StatementExecutorConsumer {
  protected StatementExecutorInterface context;

  public List<List<String>> doTable(List<List<?>> table) {
    try {
      return doTableImpl(table);
    } finally {
      // IMPORTANT: Switch symbol replacement on again
      //            or you get bad surprises
      context.assign(StatementExecutor.SLIM_AGENT_FIXTURE_HANDLES_SYMBOLS, null);
    }
  }

  /**
   * Override this method to perform actual table table work.
   * @param table wiki content.
   * @return result table.
   */
  protected abstract List<List<String>> doTableImpl(List<List<?>> table);

  @Override
  public void setStatementExecutor(StatementExecutorInterface statementExecutor) {
    context = statementExecutor;

    // Tell Slim Agent that the fixture takes care of symbol replacements in all "doTable" methods
    // IMPORTANT: Don't forget to set this back to null at the end of your fixture code
    context.assign(StatementExecutor.SLIM_AGENT_FIXTURE_HANDLES_SYMBOLS,"tableTable.*\\.doTable");
  }

  protected String replaceSymbolsInString(String arg) {
    int startingPosition = 0;
    while (true) {
      if ("".equals(arg) || null == arg) {
        break;
      }
      Matcher symbolMatcher = SlimSymbol.SYMBOL_PATTERN.matcher(arg);
      if (symbolMatcher.find(startingPosition)) {
        String symbolName = symbolMatcher.group(1);
        arg = replaceSymbolInArg(symbolMatcher, arg, symbolName);<commit_msg>Allow subclasses access to statement executor<commit_after>package fitnesse.slim.test.statementexecutorconsumer;

import fitnesse.slim.SlimSymbol;
import fitnesse.slim.StatementExecutor;
import fitnesse.slim.StatementExecutorConsumer;
import fitnesse.slim.StatementExecutorInterface;

import java.util.List;
import java.util.regex.Matcher;

/**
 * Base class for TableTables wanting do their own symbol management.
 */
public abstract class SymbolManagingTableTable implements StatementExecutorConsumer {
  protected StatementExecutorInterface context;

  public List<List<String>> doTable(List<List<?>> table) {
    try {
      return doTableImpl(table);
    } finally {
      // IMPORTANT: Switch symbol replacement on again
      //            or you get bad surprises
      context.assign(StatementExecutor.SLIM_AGENT_FIXTURE_HANDLES_SYMBOLS, null);
    }
  }

  /**
   * Override this method to perform actual table table work.
   * @param table wiki content.
   * @return result table.
   */
  protected abstract List<List<String>> doTableImpl(List<List<?>> table);

  @Override
  public void setStatementExecutor(StatementExecutorInterface statementExecutor) {
    context = statementExecutor;

    // Tell Slim Agent that the fixture takes care of symbol replacements in all "doTable" methods
    // IMPORTANT: Don't forget to set this back to null at the end of your fixture code
    context.assign(StatementExecutor.SLIM_AGENT_FIXTURE_HANDLES_SYMBOLS,"tableTable.*\\.doTable");
  }

  protected StatementExecutorInterface getStatementExecutor() {
    return context;
  }

  protected String replaceSymbolsInString(String arg) {
    int startingPosition = 0;
    while (true) {
      if ("".equals(arg) || null == arg) {
        break;
      }
      Matcher symbolMatcher = SlimSymbol.SYMBOL_PATTERN.matcher(arg);
      if (symbolMatcher.find(startingPosition)) {
        String symbolName = symbolMatcher.group(1);
        arg = replaceSymbolInArg(symbolMatcher, arg, symbolName);
{'fraction_non_alphanumeric': 0.08629178543664162, 'fraction_numerical': 0.0010365379632029023, 'mean_word_length': 3.987080103359173, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6963931', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1038, 'n_words': 289}