package innovimax.mixthem.arguments;

import java.util.EnumSet;

/**
* <p>This is a detailed enumeration of rules used to mix files.</p>
* <p>Some rules may not be implemented yet.<.p>
* <p>(Also used to print usage.)</p>
* @author Innovimax
* @version 1.0
*/
public enum Rule { 
    _1(              "1",               "1",               "will output file1", true, EnumSet.noneOf(RuleParam.class)),
    _2(              "2",               "2",               "will output file2", true, EnumSet.noneOf(RuleParam.class)),
    _ADD(            "+",               "add",             "will output file1+file2", true, EnumSet.noneOf(RuleParam.class)),
    _ALT_LINE(       "alt-line",        "altline",         "will output one line of each starting with first line of file1", true, EnumSet.noneOf(RuleParam.class)), 
    _ALT_CHAR(       "alt-char",        "altchar",         "will output one char of each starting with first char of file1", true, EnumSet.noneOf(RuleParam.class)),
    _RANDOM_ALT_LINE("random-alt-line", "random-altline",  "will output one line of each code randomly based on a seed for reproducability", true, EnumSet.of(RuleParam._RANDOM_SEED)),
    _JOIN(           "join",            "join",            "will output merging of lines that have common occurrence", true, EnumSet.of(RuleParam._JOIN_COL1, RuleParam._JOIN_COL2)),    
    _ZIP_LINE(       "zip-line",        "zipline",         "will output zip of line from file1 and file2", true, EnumSet.of(RuleParam._ZIP_SEP)),
    _ZIP_CHAR(       "zip-char",        "zipchar",         "will output zip of char from file1 and file2", true, EnumSet.of(RuleParam._ZIP_SEP)),
    _ZIP_CELL(       "zip-cell",        "zipcell",         "will output zip of cell from file1 and file2", true, EnumSet.of(RuleParam._ZIP_SEP));

    private final String name, extension, description;
    private final boolean implemented;
    private final EnumSet<RuleParam> params;

    private Rule(String name, String extension, String description, boolean implemented, EnumSet<RuleParam> params) {
        this.name = name;
        this.extension = extension;
        this.description = description;
        this.implemented = implemented;
        this.params = params;
    }

    /**
    * Returns true if the rule is currently implemented.
    * @return True if the rule is currently implemented
    */
    public boolean isImplemented() {
        return this.implemented;
    }

    /**
    * Returns the name of this rule on command line.
    * @return The name of the rule on command line
    */
    public String getName() {
        return this.name;
    }

    /**
    * Returns the file extension used for outputting.
    * @return The file extension for the rule
    */ 
    public String getExtension() {
        return this.extension;
    }

    /**
    * Returns the description of this rule.
    * @return The description of the rule
    */ 
    public String getDescription() {
        return this.description;
    }

    /**
    * Returns an iterator over the additional parameters in this rule.
    * @return An iterator over the additional parameters in this rule
    */ 
    public Iterable<RuleParam> getParams() {
        return this.params;
    }

    /**
    * Finds the Rule object correponding to a name
    * @param name The name of the rule in command line
    * @return The {@link Rule} object
    */    
    public static Rule findByName(String name) {
        for(Rule rule : values()){
            if (rule.getName().equals(name)) {
                return rule;
            }
        }
        return null;
    }

}

@@ -281,62 +281,24 @@
     
-_1(              %221%22,               %221%22,              
+FILE_1(%221%22, %221%22,
  %22wi
@@ -363,62 +363,24 @@
     
-_2(              %222%22,               %222%22,              
+FILE_2(%222%22, %222%22,
  %22wi
@@ -445,62 +445,23 @@
     
-_
 ADD(
-            %22+%22,               %22add%22,            
+%22+%22, %22add%22,
  %22wi
@@ -524,25 +524,24 @@
 lass)),%0A    
-_
 ALT_LINE(   
@@ -537,23 +537,16 @@
 LT_LINE(
-       
 %22alt-lin
@@ -548,23 +548,16 @@
 t-line%22,
-       
  %22altlin
@@ -555,32 +555,24 @@
 , %22altline%22,
-        
  %22will outpu
@@ -671,17 +671,16 @@
 ), %0A    
-_
 ALT_CHAR
@@ -680,23 +680,16 @@
 LT_CHAR(
-       
 %22alt-cha
@@ -691,23 +691,16 @@
 t-char%22,
-       
  %22altcha
@@ -698,32 +698,24 @@
 , %22altchar%22,
-        
  %22will outpu
@@ -813,17 +813,16 @@
 )),%0A    
-_
 RANDOM_A
@@ -865,17 +865,16 @@
 ltline%22,
- 
  %22will o
@@ -999,62 +999,28 @@
     
-_
 JOIN(
-           %22join%22,            %22join%22,           
+%22join%22, %22join%22,
  %22wi
@@ -1143,25 +1143,24 @@
 )),    %0A    
-_
 ZIP_LINE(   
@@ -1156,23 +1156,16 @@
 IP_LINE(
-       
 %22zip-lin
@@ -1167,23 +1167,16 @@
 p-line%22,
-       
  %22ziplin
@@ -1178,24 +1178,16 @@
 ipline%22,
-        
  %22will o
@@ -1266,25 +1266,24 @@
 _SEP)),%0A    
-_
 ZIP_CHAR(   
@@ -1279,23 +1279,16 @@
 IP_CHAR(
-       
 %22zip-cha
@@ -1290,23 +1290,16 @@
 p-char%22,
-       
  %22zipcha
@@ -1301,24 +1301,16 @@
 ipchar%22,
-        
  %22will o
@@ -1393,17 +1393,16 @@
 )),%0A    
-_
 ZIP_CELL
@@ -1402,23 +1402,16 @@
 IP_CELL(
-       
 %22zip-cel
@@ -1413,23 +1413,16 @@
 p-cell%22,
-       
  %22zipcel
@@ -1424,24 +1424,16 @@
 ipcell%22,
-        
  %22will o

Update Rule.java