// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// 	public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// 	public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// 	public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// 	public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// 	public static final String DESC_KEY = "key file";
// 	public static final String CSV_FILE = "csv stats file";
// 
// 	//TODO:: rework these to better handle files, using the validation methods in MainGuiApp
// 
// 	public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// 		if(file == null){
// 			throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// 		}
// 		if(file.exists()){
// 			throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// 		}
// 	}
// 
// 	public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// 		if(file == null){
// 			throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// 		}
// 		if(!file.exists()){
// 			throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// 		}
// 	}
// }
// 
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// 	HASHED("hashed"),
// 	LINKED("linked"),
// 	ARRAY("array");
// 
// 	public final String name;
// 
// 	MatrixMode(String name){
// 		this.name = name;
// 	}
// 
// 	/**
// 	 * Determines which matrix type to use based on the number of elements in the set to hold.
// 	 * @param n The number of elements to hold
// 	 * @return The matrix mode best to use.
// 	 */
// 	public static MatrixMode determineModeToUse(long n){
// 		return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// 	}
// }
// 
// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// 	public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// 	public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// 	public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// 	public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// 	public static final String DESC_KEY = "key file";
// 	public static final String CSV_FILE = "csv stats file";
// 
// 	//TODO:: rework these to better handle files, using the validation methods in MainGuiApp
// 
// 	public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// 		if(file == null){
// 			throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// 		}
// 		if(file.exists()){
// 			throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// 		}
// 	}
// 
// 	public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// 		if(file == null){
// 			throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// 		}
// 		if(!file.exists()){
// 			throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// 		}
// 	}
// }


import com.ebp.owat.app.InputValidator;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.ebp.owat.app.InputValidator.*;
				System.out.println("Available options:");
				parser.printUsage(System.out);
				System.exit(0);
			}
			this.ensureReadyForRun();
		} catch( CmdLineException|IllegalArgumentException e ) {
			System.err.println("Error parsing arguments:");
			System.err.println("\t"+e.getMessage());
			System.err.println("");
			// print the list of available options
			System.err.println("Available options:");
			parser.printUsage(System.err);
			System.err.println();
			System.exit(1);
		}

	}

	public boolean outputCsvStats(){
		return this.csvFile == null;
	}

	private void ensureHaveInputData() throws IllegalArgumentException {
		if(this.inputString == null && this.inputFile == null){
			throw new IllegalArgumentException("No input data given. Cannot continue.");
		}
		if(this.inputString != null && this.inputFile != null){
			throw new IllegalArgumentException("Got both a input file and string. Don't know which to use.");
		}
		if(this.inputFile != null){
// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// 	public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// 	public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// 	public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// 	public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// 	public static final String DESC_KEY = "key file";
// 	public static final String CSV_FILE = "csv stats file";
// 
// 	//TODO:: rework these to better handle files, using the validation methods in MainGuiApp
// 
// 	public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// 		if(file == null){
// 			throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// 		}
// 		if(file.exists()){
// 			throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// 		}
// 	}
// 
// 	public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// 		if(file == null){
// 			throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// 		}
// 		if(!file.exists()){
// 			throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// 		}
// 	}
// }
// 
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// 	HASHED("hashed"),
// 	LINKED("linked"),
// 	ARRAY("array");
// 
// 	public final String name;
// 
// 	MatrixMode(String name){
// 		this.name = name;
// 	}
// 
// 	/**
// 	 * Determines which matrix type to use based on the number of elements in the set to hold.
// 	 * @param n The number of elements to hold
// 	 * @return The matrix mode best to use.
// 	 */
// 	public static MatrixMode determineModeToUse(long n){
// 		return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// 	}
// }
// 
// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// 	public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// 	public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// 	public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// 	public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// 	public static final String DESC_KEY = "key file";
// 	public static final String CSV_FILE = "csv stats file";
// 
// 	//TODO:: rework these to better handle files, using the validation methods in MainGuiApp
// 
// 	public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// 		if(file == null){
// 			throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// 		}
// 		if(file.exists()){
// 			throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// 		}
// 	}
// 
// 	public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// 		if(file == null){
// 			throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// 		}
// 		if(!file.exists()){
// 			throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// 		}
// 	}
// }


// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/config/CommandLineOps.java
import com.ebp.owat.app.InputValidator;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.ebp.owat.app.InputValidator.*;

				System.out.println("Available options:");
				parser.printUsage(System.out);
				System.exit(0);
			}
			this.ensureReadyForRun();
		} catch( CmdLineException|IllegalArgumentException e ) {
			System.err.println("Error parsing arguments:");
			System.err.println("\t"+e.getMessage());
			System.err.println("");
			// print the list of available options
			System.err.println("Available options:");
			parser.printUsage(System.err);
			System.err.println();
			System.exit(1);
		}

	}

	public boolean outputCsvStats(){
		return this.csvFile == null;
	}

	private void ensureHaveInputData() throws IllegalArgumentException {
		if(this.inputString == null && this.inputFile == null){
			throw new IllegalArgumentException("No input data given. Cannot continue.");
		}
		if(this.inputString != null && this.inputFile != null){
			throw new IllegalArgumentException("Got both a input file and string. Don't know which to use.");
		}
		if(this.inputFile != null){
			InputValidator.ensureCanReadFromFile(this.inputFile, DESC_SCRAMBLE_DATA_INPUT);