package innovimax.mixthem.arguments;

import java.io.File;

/**
* <p>This is a detailed enumeration of additional rule parameters.</p>
* @author Innovimax
* @version 1.0
*/
public enum RuleParam { 
	_SEED("seed", false, ParamType._INTEGER),
	_COL1("col1", false, ParamType._STRING),
	_COL2("col2", false, ParamType._STRING);

	private final String name;
	private final boolean required;
	private final ParamType type;

	private RuleParam(String name, boolean required, ParamType type) {
		this.name = name;
		this.required = required;
		this.type = type;
	}

	/**
	* Returns the alias name of this parameter.
	* @return The alias name of this parameter
	*/
	public String getName() {
		return this.name;
	}

	/**
	* Returns true if the parameter is required.
	* @return True if the parameter is required
	*/
	public boolean isRequired() {
		return this.required;
	}

	/**
	* Returns the type of this parameter.
	* @return The type of this parameter
	*/
	public ParamType getType() {
		return this.type;
	}

	/**
 	* Returns true if the parameter value is correct.
 	* @param value The value of the parameter on command line
 	* @return Returns true if the parameter value is correct
 	*/
	boolean checkValue(String value) {
		switch (this.type) {
        	case _STRING:
    			File file = new File(value);
        		if (file.exists()) {
        			return false;
        		} else {
        			return true;
        		}
        	case _INTEGER:
            	try {
            		Integer.parseInt(value);
            		return true;
            	} catch (Exception e) {
            		return false;
            	}
            default:
            	return false;
		}
	}

}

@@ -267,22 +267,23 @@
 amType._
-STRING
+INTEGER
 ),%0A%09_COL
@@ -310,22 +310,23 @@
 amType._
-STRING
+INTEGER
 );%0A%0A%09pri
@@ -866,148 +866,8 @@
 %09%7D%0A%0A
-%09/**%0A%09* Returns the type of this parameter.%0A%09* @return The type of this parameter%0A%09*/%0A%09public ParamType getType() %7B%0A%09%09return this.type;%0A%09%7D%0A%0A
 %09/**

remove unused method