<commit_before>package teetime.framework;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import teetime.framework.pipe.SpScPipeFactory;
import teetime.framework.signal.InitializingSignal;
import teetime.framework.signal.StartingSignal;

public class DynamicConfigurationContext {

	private static final Logger LOGGER = LoggerFactory.getLogger(DynamicConfigurationContext.class);
	private static final SpScPipeFactory PIPE_FACTORY = new SpScPipeFactory();
	private static final DynamicActuator DYNAMIC_ACTUATOR = new DynamicActuator();

	public void beginThread(final Stage stage) {
		DYNAMIC_ACTUATOR.startWithinNewThread(stage);
	}

	public void sendSignals(final OutputPort<?> outputPort) {
		outputPort.sendSignal(new InitializingSignal());
		outputPort.sendSignal(new StartingSignal());
	}

	/**
	 * Connects two ports with a pipe with a default capacity of currently {@value #DEFAULT_CAPACITY}.
	 *
	 * @param sourcePort
	 *            {@link OutputPort} of the sending stage
	 * @param targetPort
	 *            {@link InputPort} of the sending stage
	 * @param <T>
	 *            the type of elements to be sent
	 */
	public <T> void connectPorts(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) {
		if (sourcePort.getPipe() != null || targetPort.getPipe() != null) {
			LOGGER.warn("Overwriting existing pipe while connecting stages " +
					sourcePort.getOwningStage().getId() + " and " + targetPort.getOwningStage().getId() + ".");
		}
		PIPE_FACTORY.create(sourcePort, targetPort);
	}

	/**
	 * Connects to ports with a pipe of a certain capacity
	 *
	 * @param sourcePort
	 *            {@link OutputPort} of the sending stage
	 * @param targetPort<commit_msg>added javadoc<commit_after>package teetime.framework;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import teetime.framework.pipe.SpScPipeFactory;
import teetime.framework.signal.InitializingSignal;
import teetime.framework.signal.StartingSignal;

public class DynamicConfigurationContext {

	private static final Logger LOGGER = LoggerFactory.getLogger(DynamicConfigurationContext.class);
	private static final SpScPipeFactory PIPE_FACTORY = new SpScPipeFactory();
	private static final DynamicActuator DYNAMIC_ACTUATOR = new DynamicActuator();

	public void beginThread(final Stage stage) {
		DYNAMIC_ACTUATOR.startWithinNewThread(stage);
	}

	/**
	 * Sends the {@linkInitializingSignal} and the {@link StartingSignal}.
	 *
	 * @param outputPort
	 */
	public void sendSignals(final OutputPort<?> outputPort) {
		outputPort.sendSignal(new InitializingSignal());
		outputPort.sendSignal(new StartingSignal());
	}

	/**
	 * Connects two ports with a pipe with a default capacity of currently {@value #DEFAULT_CAPACITY}.
	 *
	 * @param sourcePort
	 *            {@link OutputPort} of the sending stage
	 * @param targetPort
	 *            {@link InputPort} of the sending stage
	 * @param <T>
	 *            the type of elements to be sent
	 */
	public <T> void connectPorts(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) {
		if (sourcePort.getPipe() != null || targetPort.getPipe() != null) {
			LOGGER.warn("Overwriting existing pipe while connecting stages " +
					sourcePort.getOwningStage().getId() + " and " + targetPort.getOwningStage().getId() + ".");
		}
		PIPE_FACTORY.create(sourcePort, targetPort);
	}

	/**
	 * Connects to ports with a pipe of a certain capacity
	 *
	 * @param sourcePort
	 *            {@link OutputPort} of the sending stage
	 * @param targetPort
{'fraction_non_alphanumeric': 0.09931895573212259, 'fraction_numerical': 0.0011350737797956867, 'mean_word_length': 4.324773413897281, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '2768857', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1015, 'n_words': 281}