<commit_before>package teetime.framework;

import java.util.List;

import teetime.framework.signal.ISignal;
import teetime.framework.validation.InvalidPortConnection;

/**
 *
 * @author <NAME>
 *
 * @param <L>
 *            the type of the last stage in this pipeline
 */
// TODO Consider to move it in the framework
public final class Pipeline<L extends Stage> extends Stage {

	private final Stage firstStage;
	private final L lastStage;

	public Pipeline(final Stage firstStage, final L lastStage) {
		super();
		this.firstStage = firstStage;
		this.lastStage = lastStage;
	}

	@Override
	public TerminationStrategy getTerminationStrategy() {
		return firstStage.getTerminationStrategy();
	}

	@Override
	public void terminate() {
		firstStage.terminate();
	}

	@Override
	public boolean shouldBeTerminated() {
		return firstStage.shouldBeTerminated();
	}

	@Override
	public void executeWithPorts() {
		firstStage.executeWithPorts();
	}

	@Override
	public void onSignal(final ISignal signal, final InputPort<?> inputPort) {
		firstStage.onSignal(signal, inputPort);
	}

	@Override
	public void validateOutputPorts(final List<InvalidPortConnection> invalidPortConnections) {
		lastStage.validateOutputPorts(invalidPortConnections);
	}

	public L getLastStage() {
		return lastStage;
	}

	@Override
	protected InputPort<?>[] getInputPorts() {
		return firstStage.getInputPorts();
	}

	@Override
	protected boolean isStarted() {
		return firstStage.isStarted();
	}

	@Override
	public void onValidating(final List<InvalidPortConnection> invalidPortConnections) {
		firstStage.onValidating(invalidPortConnections);
	}

	@Override
	public void onStarting() throws Exception {
		firstStage.onStarting();
	}

	@Override
	public void onTerminating() throws Exception {
		firstStage.onTerminating();<commit_msg>refactored Pipeline to a composite stage<commit_after>package teetime.framework;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author <NAME>
 *
 * @param <L>
 *            the type of the last stage in this pipeline
 */
// TODO Consider to move it in the framework
public final class Pipeline<L extends Stage> extends CompositeStage {

	private final Stage firstStage;
	private final List<L> lastStages = new LinkedList<L>();

	public Pipeline(final Stage firstStage, final L lastStage) {
		super();
		this.firstStage = firstStage;
		this.lastStages.add(lastStage);
	}

	@Override
	protected Stage getFirstStage() {
		return firstStage;
	}

	public L getLastStage() {
		return lastStages.get(0);
	}

	@Override
	protected Collection<? extends Stage> getLastStages() {
		return lastStages;
	}

	@Override
	public void onValidating(final List<InvalidPortConnection> invalidPortConnections) {
		firstStage.onValidating(invalidPortConnections);
	}

	@Override
	public void onStarting() throws Exception {
		firstStage.onStarting();
	}

	@Override
	public void onTerminating() throws Exception {
		firstStage.onTerminating();
{'fraction_non_alphanumeric': 0.09445378151260504, 'fraction_numerical': 0.0003361344537815126, 'mean_word_length': 4.858267716535433, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '5891534', 'n_tokens_mistral': 925, 'n_tokens_neox': 875, 'n_words': 237}