package innovimax.mixthem;

/**
* <p>Rule additional parameters management.</p>
* @author Innovimax
* @version 1.0
*/
public class RuleParam {

	private final String name;	
	private final boolean required;

	/**
 	* Creates a rule parameter.
 	* @param name The name of the parameter
 	* @param required Equals true if this parameter is required
 	*/
	RuleParam(String name, boolean required) {
		this.name = name;
		this.required = required;
	}

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

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

	// This is the unique optional parameter of rule _RANDOM_ALT_LINE
	static RuleParam RANDOM_ALT_LINE_SEED = new RuleParam("seed", false);
	// This is the first optional parameter of rule _JOIN
	static RuleParam JOIN_COL1 = new RuleParam("col1", false);
	// This is the second optional parameter of rule _JOIN
	static RuleParam JOIN_COL2 = new RuleParam("col2", false);

}

@@ -137,16 +137,125 @@
 aram %7B%0A%0A
+%09private static final String TYPE_STRING = %22string%22;%0A%09private static final String TYPE_INTEGER = %22integer%22;%0A%0A
 %09private
@@ -307,16 +307,44 @@
 equired;
+%0A%09private final String type;
 %0A%0A%09/**%0A 
@@ -521,16 +521,29 @@
 required
+, String type
 ) %7B%0A%09%09th
@@ -582,24 +582,44 @@
 = required;%0A
+%09%09this.type = type;%0A
 %09%7D%0A%0A%09/**%0A%09* 
@@ -914,16 +914,509 @@
 ed;%0A%09%7D%0A%0A
+%0A%09/**%0A %09* Returns true if this parameter is required.%0A %09* @return Returns true if this parameter is required%0A %09*/%0A%09boolean checkValue(String value) %7B%0A%09%09switch (this.type) %7B%0A            case TYPE_STRING:%0A            %09return true;%0A            case TYPE_INTEGER:%0A            %09try %7B%0A            %09%09Integer number = new Integer(value);%0A            %09%09return true;%0A            %09%7D catch (Exception e) %7B%0A            %09%09return false;%0A            %09%7D%0A            default:%0A            %09return false;%0A%09%09%7D%0A%09%7D%0A%0A
 %09// This
@@ -1534,32 +1534,46 @@
 am(%22seed%22, false
+, TYPE_INTEGER
 );%0A%09// This is t
@@ -1671,16 +1671,29 @@
 %22, false
+, TYPE_STRING
 );%0A%09// T
@@ -1800,14 +1800,27 @@
 %22, false
+, TYPE_STRING
 );%0A%0A%7D%0A

Update RuleParam.java