<commit_before>package info.vancauwenberge.filedriver.filepostprocess;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import com.novell.nds.dirxml.driver.Trace;
import com.novell.nds.dirxml.driver.xds.Constraint;
import com.novell.nds.dirxml.driver.xds.DataType;
import com.novell.nds.dirxml.driver.xds.Parameter;
import com.novell.nds.dirxml.driver.xds.RangeConstraint;

import info.vancauwenberge.filedriver.api.AbstractStrategy;
import info.vancauwenberge.filedriver.api.IDriver;
import info.vancauwenberge.filedriver.api.IPostProcessStrategy;
import info.vancauwenberge.filedriver.filereader.csv.CSVFileParser;
import info.vancauwenberge.filedriver.shim.ConnectionInfo;
import info.vancauwenberge.filedriver.util.TraceLevel;
import info.vancauwenberge.filedriver.util.Util;

public class ExternalExec extends AbstractStrategy implements IPostProcessStrategy {

	private class LineScanner{
		private final String stringToMatch;
		private final int stringToMatchLen;
		private int currentIndex;

		public LineScanner(final String stringToMatch){
			this.stringToMatchLen = stringToMatch==null?-1:stringToMatch.length();
			this.stringToMatch = stringToMatch;
			currentIndex=0;
		}

		/**
		 * Test if thisChar matches the next char in triggerString.
		 * If as a result the complete string is matched, true is returned, otherwise false.
		 * @param thisChar
		 * @return true of a match was found, false otherwise
		 * @throws IOException
		 */
		public boolean nextChar(final char thisChar) throws IOException {
			if (stringToMatch != null){
				if (thisChar == stringToMatch.charAt(currentIndex)) {
					currentIndex++;
				} else {
					currentIndex=0;
				}
			}
			if (currentIndex == stringToMatchLen){
				currentIndex=0;//Start over again
				return true;
			}
			return false;
		}
	}
	public enum Parameters implements IStrategyParameters{
		/**
		 * Close the file after <i>nnn</i> seconds of inactivity
		 */
		EXTERNALEXEC_MAXWAITTIMESECONDS{
			@Override
			public String getParameterName() {
				return "externalExec_maxWaitTimeSeconds";
			}

			@Override
			public String getDefaultValue() {
				return "0";
			}

			@Override
			public DataType getDataType() {
				return DataType.INT;
			}

			@Override
			public Constraint[] getConstraints() {<commit_msg>Package access the enum<commit_after>package info.vancauwenberge.filedriver.filepostprocess;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import com.novell.nds.dirxml.driver.Trace;
import com.novell.nds.dirxml.driver.xds.Constraint;
import com.novell.nds.dirxml.driver.xds.DataType;
import com.novell.nds.dirxml.driver.xds.Parameter;
import com.novell.nds.dirxml.driver.xds.RangeConstraint;

import info.vancauwenberge.filedriver.api.AbstractStrategy;
import info.vancauwenberge.filedriver.api.IDriver;
import info.vancauwenberge.filedriver.api.IPostProcessStrategy;
import info.vancauwenberge.filedriver.filereader.csv.CSVFileParser;
import info.vancauwenberge.filedriver.shim.ConnectionInfo;
import info.vancauwenberge.filedriver.util.TraceLevel;
import info.vancauwenberge.filedriver.util.Util;

public class ExternalExec extends AbstractStrategy implements IPostProcessStrategy {

	private class LineScanner{
		private final String stringToMatch;
		private final int stringToMatchLen;
		private int currentIndex;

		public LineScanner(final String stringToMatch){
			this.stringToMatchLen = stringToMatch==null?-1:stringToMatch.length();
			this.stringToMatch = stringToMatch;
			currentIndex=0;
		}

		/**
		 * Test if thisChar matches the next char in triggerString.
		 * If as a result the complete string is matched, true is returned, otherwise false.
		 * @param thisChar
		 * @return true of a match was found, false otherwise
		 * @throws IOException
		 */
		public boolean nextChar(final char thisChar) throws IOException {
			if (stringToMatch != null){
				if (thisChar == stringToMatch.charAt(currentIndex)) {
					currentIndex++;
				} else {
					currentIndex=0;
				}
			}
			if (currentIndex == stringToMatchLen){
				currentIndex=0;//Start over again
				return true;
			}
			return false;
		}
	}
	enum Parameters implements IStrategyParameters{
		/**
		 * Close the file after <i>nnn</i> seconds of inactivity
		 */
		EXTERNALEXEC_MAXWAITTIMESECONDS{
			@Override
			public String getParameterName() {
				return "externalExec_maxWaitTimeSeconds";
			}

			@Override
			public String getDefaultValue() {
				return "0";
			}

			@Override
			public DataType getDataType() {
				return DataType.INT;
			}

			@Override
			public Constraint[] getConstraints() {
{'fraction_non_alphanumeric': 0.09213879631444814, 'fraction_numerical': 0.001960399921584003, 'mean_word_length': 4.491926803013993, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '3024548', 'n_tokens_mistral': 1773, 'n_tokens_neox': 1556, 'n_words': 354}