// 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.*;
package com.ebp.owat.app.config;




/**
 * Processes command line options for the program.
 *
 * TODO:: add ability to specify key data in the argument
 */
public class CommandLineOps {
	private static final Logger LOGGER = LoggerFactory.getLogger(CommandLineOps.class);
	
	private final String[] argsGotten;

	@Option(name="-m", aliases={"--mode"}, usage="The mode that this will run with. Required. ", required = true)
	private RunMode runMode = null;

	@Option(name="-i", aliases={"--input"}, usage="Input data straight from the command line.")
	private String inputString = null;

	@Option(name="-f", aliases={"--input-file"}, usage="Input data from a file.")
	private File inputFile = null;

	@Option(name = "-o", aliases = {"--output-file"}, usage = "Where to output the data.")
	private File dataOutputFile = null;

	@Option(name = "-k", aliases = {"--key-file"}, usage = "The key file.")
	private File keyFile = null;

	@Option(name = "-c", aliases = {"--csv-stats"}, usage = "For outputting timing data to a CSV file.")
	private File csvFile = null;

	@Option(name = "--matrix-mode", usage = "For specifying a specific matrix type to use.")
// 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.*;

package com.ebp.owat.app.config;




/**
 * Processes command line options for the program.
 *
 * TODO:: add ability to specify key data in the argument
 */
public class CommandLineOps {
	private static final Logger LOGGER = LoggerFactory.getLogger(CommandLineOps.class);
	
	private final String[] argsGotten;

	@Option(name="-m", aliases={"--mode"}, usage="The mode that this will run with. Required. ", required = true)
	private RunMode runMode = null;

	@Option(name="-i", aliases={"--input"}, usage="Input data straight from the command line.")
	private String inputString = null;

	@Option(name="-f", aliases={"--input-file"}, usage="Input data from a file.")
	private File inputFile = null;

	@Option(name = "-o", aliases = {"--output-file"}, usage = "Where to output the data.")
	private File dataOutputFile = null;

	@Option(name = "-k", aliases = {"--key-file"}, usage = "The key file.")
	private File keyFile = null;

	@Option(name = "-c", aliases = {"--csv-stats"}, usage = "For outputting timing data to a CSV file.")
	private File csvFile = null;

	@Option(name = "--matrix-mode", usage = "For specifying a specific matrix type to use.")
	private MatrixMode matrixMode = null;