package innovimax.mixthem;

import innovimax.mixthem.arguments.Rule;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Provides different runs for testing a rule according ths additional parameters
* @author Innovimax
* @version 1.0
*/
public class RuleRuns {

  final private Map<Rule, List<RuleRun>> runMap;

  /*
  * Creates the rule run maker.
  */
  public RuleRuns() {
    runMap = new HashMap<Rule, List<RuleRun>>();
    for (Rule rule : Rule.values()) {
      List<RuleRun> runs = new ArrayList<RuleRun>();
      if (rule.hasParams()) {
        switch (rule) {
          case _RANDOM_ALT_LINE:
            runs.add(new RuleRun(1, Collections.emptyList()));
            runs.add(new RuleRun(1, Collections.singletonList("1789")));
            break;
          case _JOIN:
	    runs.add(new RuleRun(3, "first", Collections.emptyList()));
	    runs.add(new RuleRun(3, "same", Collections.singletonList("2")));
            runs.add(new RuleRun(3, "diff", Arrays.asList("4", "3")));			
            break;
	}
      } else {
        runs.add(new RuleRun(Collections.emptyList()));
      }
      runMap.put(rule, runs);
    }
  }

  /**
  * Returns a list of test runs for the rule.
  * @param The rule to test
  * @return Returns a list of test runs for the rule
    */	
  public List<RuleRun> getRuns(Rule rule) {
    return runMap.get(rule);
  }

}

@@ -172,16 +172,45 @@
 ashMap;%0A
+import java.util.LinkedList;%0A
 import j
@@ -1328,16 +1328,21 @@
  @param 
+rule 
 The rule
@@ -1489,10 +1489,404 @@
 );%0A  %7D%0A%0A
+  %09/**%0A  %09* Returns a list of test runs for the rule.%0A  %09* @param params The URL of rule additional parameters file%0A  %09* @return Returns a list of test runs for the rule%0A    %09*/%09%0A%09public List%3CRuleRun%3E getRuns(URL params) %7B%0A    %09%09List%3CRuleRun%3E runs = new LinkedList%3CRuleRun%3E();%0A    %09%09runs.add(new RuleRun(Collections.emptyList()));%0A%09%09if (params != null) %7B%0A%09%09%09//TODO%0A%09%09%7D%0A    %09%09return runs;%0A  %09%7D%0A%0A
 %7D%0A

add new method