<commit_before>package fitnesse;

import java.io.IOException;
import java.util.Properties;

import fitnesse.components.ComponentFactory;
import fitnesse.responders.editing.ContentFilter;
import fitnesse.responders.editing.ContentFilterResponder;
import fitnesse.testrunner.MultipleTestSystemFactory;
import fitnesse.testsystems.slim.CustomComparatorRegistry;
import fitnesse.testsystems.slim.tables.SlimTableFactory;
import fitnesse.wiki.RecentChanges;
import fitnesse.wiki.RecentChangesWikiPage;
import fitnesse.wiki.WikiPageFactory;
import fitnesse.wiki.fs.FileSystemPageFactory;
import fitnesse.wiki.fs.VersionsController;
import fitnesse.wiki.fs.ZipFileVersionsController;
import fitnesse.wikitext.parser.SymbolProvider;

import static fitnesse.ConfigurationParameter.*;

/**
 * Set up a context for running a FitNesse Instance.
 *
 * Please call this only once: some features are registered on (static) factories.
 */
public class ContextConfigurator {

  public static final String DEFAULT_PATH = ".";
  public static final String DEFAULT_ROOT = "FitNesseRoot";
  public static final int DEFAULT_VERSION_DAYS = 14;
  public static final int DEFAULT_COMMAND_PORT = 9123;
  public static final int DEFAULT_PORT = 80;
  public static final String DEFAULT_CONFIG_FILE = "plugins.properties";

  private final Properties properties;

  private ContextConfigurator(Properties properties) {
    this.properties = properties;
  }

  public static ContextConfigurator systemDefaults() {
    Properties systemDefaults = new Properties();
    systemDefaults.setProperty(ROOT_PATH.getKey(), DEFAULT_PATH);
    systemDefaults.setProperty(ROOT_DIRECTORY.getKey(), DEFAULT_ROOT);
    systemDefaults.setProperty(VERSIONS_CONTROLLER_DAYS.getKey(), Integer.toString(DEFAULT_VERSION_DAYS));
    systemDefaults.setProperty(CONFIG_FILE.getKey(), DEFAULT_CONFIG_FILE);
    return new ContextConfigurator(systemDefaults);
  }

  public ContextConfigurator updatedWith(Properties newProperties) {
    Properties combinedProperties = new Properties();
    addAll(this.properties, combinedProperties);
    addAll(newProperties, combinedProperties);
    return new ContextConfigurator(combinedProperties);
  }

  private void addAll(Properties source, Properties target) {
    for (String key : source.stringPropertyNames()) {
      target.setProperty(key, source.getProperty(key));
    }
  }

  public String get(ConfigurationParameter parameter) {
    return properties.getProperty(parameter.getKey());<commit_msg>Re-use ContextConfigurator's private properties, Builder-style<commit_after>package fitnesse;

import java.io.IOException;
import java.util.Properties;

import fitnesse.components.ComponentFactory;
import fitnesse.responders.editing.ContentFilter;
import fitnesse.responders.editing.ContentFilterResponder;
import fitnesse.testrunner.MultipleTestSystemFactory;
import fitnesse.testsystems.slim.CustomComparatorRegistry;
import fitnesse.testsystems.slim.tables.SlimTableFactory;
import fitnesse.wiki.RecentChanges;
import fitnesse.wiki.RecentChangesWikiPage;
import fitnesse.wiki.WikiPageFactory;
import fitnesse.wiki.fs.FileSystemPageFactory;
import fitnesse.wiki.fs.VersionsController;
import fitnesse.wiki.fs.ZipFileVersionsController;
import fitnesse.wikitext.parser.SymbolProvider;

import static fitnesse.ConfigurationParameter.*;

/**
 * Set up a context for running a FitNesse Instance.
 *
 * Please call this only once: some features are registered on (static) factories.
 */
public class ContextConfigurator {

  public static final String DEFAULT_PATH = ".";
  public static final String DEFAULT_ROOT = "FitNesseRoot";
  public static final int DEFAULT_VERSION_DAYS = 14;
  public static final int DEFAULT_COMMAND_PORT = 9123;
  public static final int DEFAULT_PORT = 80;
  public static final String DEFAULT_CONFIG_FILE = "plugins.properties";

  private final Properties properties;

  private ContextConfigurator(Properties properties) {
    this.properties = properties;
  }

  public static ContextConfigurator systemDefaults() {
    Properties systemDefaults = new Properties();
    systemDefaults.setProperty(ROOT_PATH.getKey(), DEFAULT_PATH);
    systemDefaults.setProperty(ROOT_DIRECTORY.getKey(), DEFAULT_ROOT);
    systemDefaults.setProperty(VERSIONS_CONTROLLER_DAYS.getKey(), Integer.toString(DEFAULT_VERSION_DAYS));
    systemDefaults.setProperty(CONFIG_FILE.getKey(), DEFAULT_CONFIG_FILE);
    return new ContextConfigurator(systemDefaults);
  }

  public ContextConfigurator updatedWith(Properties newProperties) {
    for (String key : newProperties.stringPropertyNames()) {
      properties.setProperty(key, newProperties.getProperty(key));
    }
    return this;
  }

  public String get(ConfigurationParameter parameter) {
    return properties.getProperty(parameter.getKey());
{'fraction_non_alphanumeric': 0.08039991668402416, 'fraction_numerical': 0.0033326390335346803, 'mean_word_length': 6.072164948453608, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3853485', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1288, 'n_words': 298}