Commit 52f657de authored by Jonathan Shahen's avatar Jonathan Shahen

Allows for 2 versions of CanEnable Reduction

parent 777f425c
package mohawk.converter.to.mohawk;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.*;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -14,12 +12,7 @@ import org.stringtemplate.v4.ST;
import mohawk.converter.to.ConvertTo;
import mohawk.global.helper.RoleHelper;
import mohawk.global.helper.TimeIntervalHelper;
import mohawk.global.pieces.MohawkT;
import mohawk.global.pieces.Query;
import mohawk.global.pieces.Role;
import mohawk.global.pieces.Rule;
import mohawk.global.pieces.RuleType;
import mohawk.global.pieces.TimeSlot;
import mohawk.global.pieces.*;
import mohawk.global.pieces.reduced.query.Mohawk_Query;
import mohawk.global.pieces.reduced.rules.MohawkCA_Rule;
import mohawk.global.pieces.reduced.rules.MohawkCR_Rule;
......@@ -28,6 +21,7 @@ import mohawk.global.timing.MohawkTiming;
public class ConvertToMohawk extends ConvertTo {
public static final Logger logger = Logger.getLogger("mohawk");
public boolean shortRolenames = false;
public int canEnableVersion = 1;
public ConvertToMohawk(MohawkTiming timing) {
super(timing);
......@@ -49,12 +43,21 @@ public class ConvertToMohawk extends ConvertTo {
/* Timing */timing.stopTimer(tPrefix + "_deepcopy");
/* Timing */timing.startTimer(tPrefix + "_removeEnableDisableRules");
workableRules = roleHelper.removeEnableDisableRules(m.getAllRules());
switch (canEnableVersion) {
case 1:
workableRules = roleHelper.removeEnableDisableRules(m.getAllRules());
break;
case 2:
workableRules = roleHelper.removeEnableDisableRulesv2(m.getAllRules());
break;
}
// (3)
/* Timing */timing.stopTimer(tPrefix + "_removeEnableDisableRules");
// Convert Query to Reduced ASAPTime SA Query and add any extra rules as needed
//Mohawk_Query query = toMohawk_Query(workableQuery, workableRules, roleHelper, timeIntervalHelper);
// Mohawk_Query query = toMohawk_Query(workableQuery, workableRules, roleHelper, timeIntervalHelper);
/* Timing */timing.startTimer(tPrefix + "_alwaysOnRules");
workableRules = roleHelper.alwaysOnRules(workableRules, workableQuery, timeIntervalHelper);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment