Commit 8517e505 authored by Jonathan Shahen's avatar Jonathan Shahen

Skeleton code for Timeinterval Reduction

Changed Commandline Options to a ENUM for better organization and to make sure that strings aren't misspelt
parent 8715e660
...@@ -17,7 +17,8 @@ import mohawk.converter.logging.MohawkConsoleFormatter; ...@@ -17,7 +17,8 @@ import mohawk.converter.logging.MohawkConsoleFormatter;
import mohawk.converter.logging.MohawkTiming; import mohawk.converter.logging.MohawkTiming;
import mohawk.converter.to.asaptime.ConvertToASAPTimeNSA; import mohawk.converter.to.asaptime.ConvertToASAPTimeNSA;
import mohawk.converter.to.mohawk.ConvertToMohawk; import mohawk.converter.to.mohawk.ConvertToMohawk;
import mohawk.converter.to.tred.ConvertToTRedRule; import mohawk.converter.to.tred.ConvertToTRule;
import mohawk.global.pieces.MohawkT;
import org.apache.commons.cli.BasicParser; import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
...@@ -44,6 +45,25 @@ public class ConverterInstance { ...@@ -44,6 +45,25 @@ public class ConverterInstance {
public SpecHelper specHelper = new SpecHelper(); public SpecHelper specHelper = new SpecHelper();
public MohawkTiming timing = new MohawkTiming(); public MohawkTiming timing = new MohawkTiming();
public enum OptionString {
HELP("help"), AUTHORS("authors"), VERSION("version"), CHECKNUSMV("checknusmv"), LOGLEVEL("loglevel"), LOGFILE(
"logfile"), LOGFOLDER("logfolder"), NOHEADER("noheader"), RESULTSFILE("output"), MAXW("maxw"), LINESTR(
"linstr"), SPECFILE("input"), SPECEXT("specext"), BULK("bulk"), TO_ASAPTIME_NSA("to_asaptime_nsa"), TO_ASAPTIME_SA(
"to_asaptime_sa"), TO_TROLE("to_trole"), TO_TRULE("to_trule"), TO_MOHAWK("to_mohawk"), TO_MOHAWK_T(
"to_mohawk_t"), TO_ALL("to_all");
private String _str;
private OptionString(String s) {
_str = s;
}
@Override
public String toString() {
return _str;
}
}
public int run(String[] args) { public int run(String[] args) {
try { try {
Options options = new Options(); Options options = new Options();
...@@ -83,6 +103,8 @@ public class ConverterInstance { ...@@ -83,6 +103,8 @@ public class ConverterInstance {
MohawkTARBACParser parser = specHelper.parseSpecFile(specFile); MohawkTARBACParser parser = specHelper.parseSpecFile(specFile);
/* Timing */timing.stopTimer("parseFile (" + i + ")"); /* Timing */timing.stopTimer("parseFile (" + i + ")");
MohawkT m = parser.mohawkT;
if (specHelper.error.errorFound) { if (specHelper.error.errorFound) {
logger.warning("[PARSING ERROR] Skipping this file due to a parsing error"); logger.warning("[PARSING ERROR] Skipping this file due to a parsing error");
continue; continue;
...@@ -90,12 +112,13 @@ public class ConverterInstance { ...@@ -90,12 +112,13 @@ public class ConverterInstance {
logger.info("No errors found while parsing file, continuing on to converting"); logger.info("No errors found while parsing file, continuing on to converting");
} }
if (cmd.hasOption("to_ranise") || cmd.hasOption("to_all")) { if (cmd.hasOption(OptionString.TO_ASAPTIME_NSA.toString())
|| cmd.hasOption(OptionString.TO_ALL.toString())) {
logger.info("[CONVERTING] Converting to Rainse..."); logger.info("[CONVERTING] Converting to Rainse...");
/* Timing */timing.startTimer("convertToRanise (" + i + ")"); /* Timing */timing.startTimer("convertToRanise (" + i + ")");
ConvertToASAPTimeNSA toRanise = new ConvertToASAPTimeNSA(); ConvertToASAPTimeNSA toRanise = new ConvertToASAPTimeNSA();
String raniseStr = toRanise.convert(parser, specFile, true); String raniseStr = toRanise.convert(m, specFile, true);
if (toRanise.lastError == null) { if (toRanise.lastError == null) {
logger.info("[SUCCESS] Successfully converted to Ranise's Input Format"); logger.info("[SUCCESS] Successfully converted to Ranise's Input Format");
...@@ -110,13 +133,13 @@ public class ConverterInstance { ...@@ -110,13 +133,13 @@ public class ConverterInstance {
logger.info("[SKIP] Skipping converting to Ranise"); logger.info("[SKIP] Skipping converting to Ranise");
} }
if (cmd.hasOption("to_uzun") || cmd.hasOption("to_all")) { if (cmd.hasOption(OptionString.TO_TROLE.toString()) || cmd.hasOption(OptionString.TO_ALL.toString())) {
logger.info("[CONVERTING] Converting to Uzun..."); logger.info("[CONVERTING] Converting to Uzun...");
/* Timing */timing.startTimer("convertToUzun (" + i + ")"); /* Timing */timing.startTimer("convertToUzun (" + i + ")");
// TODO: Convert imported spec files to Uzun format // TODO: Convert imported spec files to Uzun format
ConvertToTRedRule toUzun = new ConvertToTRedRule(); ConvertToTRule toUzun = new ConvertToTRule();
String uzunStr = toUzun.convert(parser, specFile, true); String uzunStr = toUzun.convert(m, specFile, true);
if (toUzun.lastError == null) { if (toUzun.lastError == null) {
logger.info("[SUCCESS] Successfully converted to Uzun's Input Format"); logger.info("[SUCCESS] Successfully converted to Uzun's Input Format");
...@@ -131,13 +154,13 @@ public class ConverterInstance { ...@@ -131,13 +154,13 @@ public class ConverterInstance {
logger.info("[SKIP] Skipping converting to Uzun"); logger.info("[SKIP] Skipping converting to Uzun");
} }
if (cmd.hasOption("to_mohawk") || cmd.hasOption("to_all")) { if (cmd.hasOption(OptionString.TO_MOHAWK.toString()) || cmd.hasOption(OptionString.TO_ALL.toString())) {
logger.info("[CONVERTING] Converting to Mohawk..."); logger.info("[CONVERTING] Converting to Mohawk...");
/* Timing */timing.startTimer("convertToMohawk (" + i + ")"); /* Timing */timing.startTimer("convertToMohawk (" + i + ")");
// TODO: Convert imported spec files to Mohawk format // TODO: Convert imported spec files to Mohawk format
ConvertToMohawk toMohawk = new ConvertToMohawk(); ConvertToMohawk toMohawk = new ConvertToMohawk();
String mohawkStr = toMohawk.convert(parser, specFile, true); String mohawkStr = toMohawk.convert(m, specFile, true);
if (toMohawk.lastError == null) { if (toMohawk.lastError == null) {
logger.info("[SUCCESS] Successfully converted to Mohawk's Input Format"); logger.info("[SUCCESS] Successfully converted to Mohawk's Input Format");
...@@ -192,10 +215,10 @@ public class ConverterInstance { ...@@ -192,10 +215,10 @@ public class ConverterInstance {
@SuppressWarnings("static-access") @SuppressWarnings("static-access")
public void setupOptions(Options options) { public void setupOptions(Options options) {
// Add Information Options // Add Information Options
options.addOption("help", false, "Print this message"); options.addOption(OptionString.HELP.toString(), false, "Print this message");
options.addOption("authors", false, "Prints the authors"); options.addOption(OptionString.AUTHORS.toString(), false, "Prints the authors");
options.addOption("version", false, "Prints the version (" + VERSION + ") information"); options.addOption(OptionString.VERSION.toString(), false, "Prints the version (" + VERSION + ") information");
options.addOption("checknusmv", false, options.addOption(OptionString.CHECKNUSMV.toString(), false,
"Checks that NuSMV is on the system and displays which version is installed"); "Checks that NuSMV is on the system and displays which version is installed");
// Add Logging Level Options // Add Logging Level Options
...@@ -204,7 +227,7 @@ public class ConverterInstance { ...@@ -204,7 +227,7 @@ public class ConverterInstance {
.withDescription( .withDescription(
"Be extra quiet only errors are shown; " + "Show debugging information; " "Be extra quiet only errors are shown; " + "Show debugging information; "
+ "extra information is given for Verbose; " + "default is warning level").hasArg() + "extra information is given for Verbose; " + "default is warning level").hasArg()
.create("loglevel")); .create(OptionString.LOGLEVEL.toString()));
options.addOption(OptionBuilder options.addOption(OptionBuilder
.withArgName("logfile|'n'|'u'") .withArgName("logfile|'n'|'u'")
.withDescription( .withDescription(
...@@ -212,38 +235,54 @@ public class ConverterInstance { ...@@ -212,38 +235,54 @@ public class ConverterInstance {
+ "No file will be created when equal to 'n'; " + "No file will be created when equal to 'n'; "
+ "A unique filename will be created when equal to 'u'; " + "A unique filename will be created when equal to 'u'; "
+ "default it creates a log called '" + Logger_filepath + "'").hasArg() + "default it creates a log called '" + Logger_filepath + "'").hasArg()
.create("output")); .create(OptionString.LOGFILE.toString()));
options.addOption("noheader", false, "Does not write the CSV file header to the output log"); options.addOption(OptionBuilder
.withArgName("folder path")
.withDescription(
"The path to the location that the logs should be placed, "
+ "default it puts the logs in the folder '" + Logger_folderpath + "'").hasArg()
.create(OptionString.LOGFOLDER.toString()));
options.addOption(OptionString.NOHEADER.toString(), false,
"Does not write the CSV file header to the output log");
options.addOption(OptionBuilder.withArgName("csvfile") options.addOption(OptionBuilder.withArgName("csvfile")
.withDescription("The file where the result should be stored").hasArg().create("results")); .withDescription("The file where the result should be stored").hasArg()
.create(OptionString.RESULTSFILE.toString()));
// custom Console Logging Options // custom Console Logging Options
options.addOption(OptionBuilder.withArgName("num") options.addOption(OptionBuilder.withArgName("num")
.withDescription("The maximum width of the console (default 120)").hasArg().create("maxw")); .withDescription("The maximum width of the console (default 120)").hasArg()
.create(OptionString.MAXW.toString()));
options.addOption(OptionBuilder.withArgName("string") options.addOption(OptionBuilder.withArgName("string")
.withDescription("The new line string when wrapping a long line (default '\\n ')").hasArg() .withDescription("The new line string when wrapping a long line (default '\\n ')").hasArg()
.create("linestr")); .create(OptionString.LINESTR.toString()));
// Add File IO Options // Add File IO Options
options.addOption(OptionBuilder.withArgName("file|folder") options.addOption(OptionBuilder.withArgName("file|folder")
.withDescription("Path to the RBAC Spec file or Folder if the 'bulk' option is set").hasArg() .withDescription("Path to the Mohawk-T Spec File, or Folder if the 'bulk' option is set").hasArg()
.create("rbacspec")); .create(OptionString.SPECFILE.toString()));
options.addOption(OptionBuilder options.addOption(OptionBuilder
.withArgName("extension") .withArgName("extension")
.withDescription( .withDescription(
"File extention used when searching for SPEC files when the 'bulk' option is used. Default:'" "File extention used when searching for SPEC files when the 'bulk' option is used. Default:'"
+ specHelper.specFileExt + "'").hasArg().create("specext")); + specHelper.specFileExt + "'").hasArg().create(OptionString.SPECEXT.toString()));
// Add Functional Options // Add Functional Options
options.addOption("bulk", false, "Use the folder that rbacspec points to and run against all *.spec"); options.addOption(OptionString.BULK.toString(), false,
"Use the folder that rbacspec points to and run against all *.spec");
options.addOption("to_ranise", false, "Convert input SPEC file to Ranise's format");
options.addOption("to_uzun", false, "Convert input SPEC file to Uzun's format"); options.addOption(OptionString.TO_ASAPTIME_NSA.toString(), false,
options.addOption("to_mohawk", false, "Convert input SPEC file to Mohawk's RBAC format"); "Convert input SPEC file to ASAPTime NSA format");
options.addOption("to_all", false, "Convert input SPEC file to All formats (Mohawk, Ranise, Uzun)"); options.addOption(OptionString.TO_ASAPTIME_SA.toString(), false,
"Convert input SPEC file to ASAPTime SA format");
options.addOption(OptionString.TO_TROLE.toString(), false, "Convert input SPEC file to TRole format");
options.addOption(OptionString.TO_TRULE.toString(), false, "Convert input SPEC file to TRule format");
options.addOption(OptionString.TO_MOHAWK.toString(), false, "Convert input SPEC file to Mohawk's ARBAC format");
options.addOption(OptionString.TO_MOHAWK_T.toString(), false,
"Convert input SPEC file to Mohawk-T's ATRBAC format");
options.addOption(OptionString.TO_ALL.toString(), false,
"Convert input SPEC file to All formats except Mohawk-T (Mohawk, ASAPTime NSA, ASAPTime SA, TRole, TRule)");
} }
public Level getLoggerLevel() { public Level getLoggerLevel() {
...@@ -258,9 +297,9 @@ public class ConverterInstance { ...@@ -258,9 +297,9 @@ public class ConverterInstance {
// Logging Level // Logging Level
logger.setUseParentHandlers(false); logger.setUseParentHandlers(false);
consoleHandler.setFormatter(new MohawkConsoleFormatter()); consoleHandler.setFormatter(new MohawkConsoleFormatter());
setLoggerLevel(Level.WARNING); // Default Level setLoggerLevel(Level.INFO); // Default Level
if (cmd.hasOption("loglevel")) { if (cmd.hasOption(OptionString.LOGLEVEL.toString())) {
String loglevel = cmd.getOptionValue("loglevel"); String loglevel = cmd.getOptionValue(OptionString.LOGLEVEL.toString());
if (loglevel.equalsIgnoreCase("quiet")) { if (loglevel.equalsIgnoreCase("quiet")) {
setLoggerLevel(Level.SEVERE); setLoggerLevel(Level.SEVERE);
} else if (loglevel.equalsIgnoreCase("debug")) { } else if (loglevel.equalsIgnoreCase("debug")) {
...@@ -275,38 +314,29 @@ public class ConverterInstance { ...@@ -275,38 +314,29 @@ public class ConverterInstance {
logger.addHandler(consoleHandler); logger.addHandler(consoleHandler);
// Add CSV File Headers // Add CSV File Headers
if (cmd.hasOption("noheader")) { if (cmd.hasOption(OptionString.NOHEADER.toString())) {
WriteCSVFileHeader = false; WriteCSVFileHeader = false;
} }
// Set Logger Folder // Set Logger Folder
if (cmd.hasOption("logfolder")) { if (cmd.hasOption(OptionString.LOGFOLDER.toString())) {
File logfile = new File(cmd.getOptionValue("logfolder")); Logger_folderpath = cmd.getOptionValue(OptionString.LOGFOLDER.toString());
if (!logfile.exists()) {
logfile.mkdir();
}
if (logfile.isDirectory()) {
Logger_folderpath = cmd.getOptionValue("logfolder");
} else {
logger.severe("logfolder did not contain a folder that exists or that could be created!");
}
} }
// Set File Logger // Set File Logger
if (cmd.hasOption("logfile")) { if (cmd.hasOption(OptionString.LOGFILE.toString())) {
// Check if no log file was requested // Check if no log file was requested
if (cmd.getOptionValue("logfile").equals("n")) { if (cmd.getOptionValue(OptionString.LOGFILE.toString()).equals("n")) {
// Create no log file // Create no log file
Logger_filepath = ""; Logger_filepath = "";
} else if (cmd.getOptionValue("logfile").equals("u")) { } else if (cmd.getOptionValue(OptionString.LOGFILE.toString()).equals("u")) {
// Create a unique log file // Create a unique log file
Logger_filepath = "mohawk-log.%u.%g.txt"; Logger_filepath = "mohawk-log.%u.%g.txt";
} else { } else {
try { try {
// Create a log file with a specific name // Create a log file with a specific name
File logfile = new File(Logger_folderpath + File.separator + cmd.getOptionValue("logfile")); File logfile = new File(Logger_folderpath + File.separator
+ cmd.getOptionValue(OptionString.LOGFILE.toString()));
if (!logfile.exists()) { if (!logfile.exists()) {
logfile.createNewFile(); logfile.createNewFile();
...@@ -328,6 +358,14 @@ public class ConverterInstance { ...@@ -328,6 +358,14 @@ public class ConverterInstance {
} }
// Add Logger File Handler // Add Logger File Handler
if (!Logger_filepath.isEmpty()) { if (!Logger_filepath.isEmpty()) {
File logfile = new File(cmd.getOptionValue(OptionString.LOGFOLDER.toString()));
logfile.mkdirs();
if (logfile.isDirectory()) {
Logger_folderpath = cmd.getOptionValue(OptionString.LOGFOLDER.toString());
} else {
logger.severe("logfolder did not contain a folder that exists or that could be created!");
}
fileHandler = new FileHandler(Logger_folderpath + File.separator + Logger_filepath); fileHandler = new FileHandler(Logger_folderpath + File.separator + Logger_filepath);
fileHandler.setLevel(getLoggerLevel()); fileHandler.setLevel(getLoggerLevel());
fileHandler.setFormatter(new MohawkCSVFileFormatter()); fileHandler.setFormatter(new MohawkCSVFileFormatter());
...@@ -336,18 +374,18 @@ public class ConverterInstance { ...@@ -336,18 +374,18 @@ public class ConverterInstance {
} }
private Boolean setupReturnImmediatelyOptions(CommandLine cmd, Options options) throws Exception { private Boolean setupReturnImmediatelyOptions(CommandLine cmd, Options options) throws Exception {
if (cmd.hasOption("help") == true || cmd.getOptions().length == 0) { if (cmd.hasOption(OptionString.HELP.toString()) == true || cmd.getOptions().length == 0) {
printHelp(cmd, options); printHelp(cmd, options);
return true; return true;
} }
if (cmd.hasOption("version")) { if (cmd.hasOption(OptionString.VERSION.toString())) {
// keep it as simple as possible for the version // keep it as simple as possible for the version
System.out.println(VERSION); System.out.println(VERSION);
return true; return true;
} }
if (cmd.hasOption("authors")) { if (cmd.hasOption(OptionString.AUTHORS.toString())) {
// keep it as simple as possible for the version // keep it as simple as possible for the version
System.out.println(AUTHORS); System.out.println(AUTHORS);
return true; return true;
...@@ -358,22 +396,23 @@ public class ConverterInstance { ...@@ -358,22 +396,23 @@ public class ConverterInstance {
private void setupSpecOptions(CommandLine cmd, Options options) { private void setupSpecOptions(CommandLine cmd, Options options) {
// Grab the SPEC file // Grab the SPEC file
if (cmd.hasOption("rbacspec")) { if (cmd.hasOption(OptionString.SPECFILE.toString())) {
logger.fine("[OPTION] Using a specific SPEC File: " + cmd.getOptionValue("rbacspec")); logger.fine("[OPTION] Using a specific SPEC File: " + cmd.getOptionValue(OptionString.SPECFILE.toString()));
specHelper.specFile = cmd.getOptionValue("rbacspec"); specHelper.specFile = cmd.getOptionValue(OptionString.SPECFILE.toString());
} else { } else {
logger.fine("[OPTION] No Spec File included"); logger.fine("[OPTION] No Spec File included");
} }
if (cmd.hasOption("specext")) { if (cmd.hasOption(OptionString.SPECEXT.toString())) {
logger.fine("[OPTION] Using a specific SPEC File Extension: " + cmd.getOptionValue("specext")); logger.fine("[OPTION] Using a specific SPEC File Extension: "
specHelper.specFileExt = cmd.getOptionValue("specext"); + cmd.getOptionValue(OptionString.SPECEXT.toString()));
specHelper.specFileExt = cmd.getOptionValue(OptionString.SPECEXT.toString());
} else { } else {
logger.fine("[OPTION] Using the default SPEC File Extension: " + specHelper.specFileExt); logger.fine("[OPTION] Using the default SPEC File Extension: " + specHelper.specFileExt);
} }
// Load more than one file from the SPEC File? // Load more than one file from the SPEC File?
if (cmd.hasOption("bulk")) { if (cmd.hasOption(OptionString.BULK.toString())) {
logger.fine("[OPTION] Bulk SPEC File inclusion: Enabled"); logger.fine("[OPTION] Bulk SPEC File inclusion: Enabled");
specHelper.bulk = true; specHelper.bulk = true;
} else { } else {
...@@ -383,11 +422,11 @@ public class ConverterInstance { ...@@ -383,11 +422,11 @@ public class ConverterInstance {
private void setupUserPreferenceOptions(CommandLine cmd, Options options) { private void setupUserPreferenceOptions(CommandLine cmd, Options options) {
// Set the Console's Max Width // Set the Console's Max Width
if (cmd.hasOption("maxw")) { if (cmd.hasOption(OptionString.MAXW.toString())) {
logger.fine("[OPTION] Setting the console's maximum width"); logger.fine("[OPTION] Setting the console's maximum width");
String maxw = ""; String maxw = "";
try { try {
maxw = cmd.getOptionValue("maxw"); maxw = cmd.getOptionValue(OptionString.MAXW.toString());
((MohawkConsoleFormatter) consoleHandler.getFormatter()).maxWidth = Integer.decode(maxw); ((MohawkConsoleFormatter) consoleHandler.getFormatter()).maxWidth = Integer.decode(maxw);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
logger.severe("[ERROR] Could not decode 'maxw': " + maxw + ";\n" + e.getMessage()); logger.severe("[ERROR] Could not decode 'maxw': " + maxw + ";\n" + e.getMessage());
...@@ -397,9 +436,10 @@ public class ConverterInstance { ...@@ -397,9 +436,10 @@ public class ConverterInstance {
} }
// Set the Console's Wrap String // Set the Console's Wrap String
if (cmd.hasOption("linestr")) { if (cmd.hasOption(OptionString.LINESTR.toString())) {
logger.fine("[OPTION] Setting the console's new line string"); logger.fine("[OPTION] Setting the console's new line string");
((MohawkConsoleFormatter) consoleHandler.getFormatter()).newLineStr = cmd.getOptionValue("linestr"); ((MohawkConsoleFormatter) consoleHandler.getFormatter()).newLineStr = cmd
.getOptionValue(OptionString.LINESTR.toString());
} else { } else {
logger.fine("[OPTION] Default Line String Used"); logger.fine("[OPTION] Default Line String Used");
} }
...@@ -407,7 +447,7 @@ public class ConverterInstance { ...@@ -407,7 +447,7 @@ public class ConverterInstance {
} }
private void setupResultOptions(CommandLine cmd, Options options) { private void setupResultOptions(CommandLine cmd, Options options) {
if (cmd.hasOption("results")) { if (cmd.hasOption(OptionString.RESULTSFILE.toString())) {
logger.fine("[OPTION] Changing the results file"); logger.fine("[OPTION] Changing the results file");
resultsFile = cmd.getOptionValue("results"); resultsFile = cmd.getOptionValue("results");
} }
......
...@@ -28,17 +28,7 @@ import mohawk.global.helper.*; ...@@ -28,17 +28,7 @@ import mohawk.global.helper.*;
int tabsize = 1; int tabsize = 1;
/* Global States */ /* Global States */
public RoleHelper roleHelper = new RoleHelper(); public MohawkT mohawkT = new MohawkT("Mohawk Converter");
public TimeIntervalHelper timeIntervalHelper = new TimeIntervalHelper();
/* Blocks */
public CanAssign canAssign = new CanAssign();
public CanRevoke canRevoke = new CanRevoke();
public CanEnable canEnable = new CanEnable();
public CanDisable canDisable = new CanDisable();
public Query query = new Query();
public ExpectedResult expectedResult = ExpectedResult.UNKNOWN;
private void logmsg(String msg) { private void logmsg(String msg) {
...@@ -98,7 +88,7 @@ canassign ...@@ -98,7 +88,7 @@ canassign
( (
myrule [RuleType.ASSIGN] myrule [RuleType.ASSIGN]
{ {
canAssign.addRule($myrule.r); mohawkT.canAssign.addRule($myrule.r);
} }
)* RightBrace )* RightBrace
...@@ -114,7 +104,7 @@ canrevoke ...@@ -114,7 +104,7 @@ canrevoke
( (
myrule [RuleType.REVOKE] myrule [RuleType.REVOKE]
{ {
canRevoke.addRule($myrule.r); mohawkT.canRevoke.addRule($myrule.r);
} }
)* RightBrace )* RightBrace
...@@ -130,7 +120,7 @@ canenable ...@@ -130,7 +120,7 @@ canenable
( (
myrule [RuleType.ENABLE] myrule [RuleType.ENABLE]
{ {
canEnable.addRule($myrule.r); mohawkT.canEnable.addRule($myrule.r);
} }
)* RightBrace )* RightBrace
...@@ -146,7 +136,7 @@ candisable ...@@ -146,7 +136,7 @@ candisable
( (
myrule [RuleType.DISABLE] myrule [RuleType.DISABLE]
{ {
canDisable.addRule($myrule.r); mohawkT.canDisable.addRule($myrule.r);
} }
)* RightBrace )* RightBrace
...@@ -158,8 +148,8 @@ query ...@@ -158,8 +148,8 @@ query
: :
Query Colon t = timeslot Comma ra = roleArray Query Colon t = timeslot Comma ra = roleArray
{ {
query._timeslot = new TimeSlot($t.val); mohawkT.query._timeslot = new TimeSlot($t.val);
query._roles = $ra.r; mohawkT.query._roles = $ra.r;
} }
; ;
...@@ -169,13 +159,13 @@ expected ...@@ -169,13 +159,13 @@ expected
Expected Colon Expected Colon
( (
Reachable Reachable
{expectedResult = ExpectedResult.REACHABLE;} {mohawkT.expectedResult = ExpectedResult.REACHABLE;}
| Unreachable | Unreachable
{expectedResult = ExpectedResult.UNREACHABLE;} {mohawkT.expectedResult = ExpectedResult.UNREACHABLE;}
| Unknown | Unknown
{expectedResult = ExpectedResult.UNKNOWN;} {mohawkT.expectedResult = ExpectedResult.UNKNOWN;}
) )
; ;
...@@ -290,7 +280,7 @@ timeslot returns [Integer val] ...@@ -290,7 +280,7 @@ timeslot returns [Integer val]
Timeslot Timeslot
{ {
$val = new Integer($Timeslot.text.substring(1)); $val = new Integer($Timeslot.text.substring(1));
timeIntervalHelper.add(new TimeInterval($val)); mohawkT.timeIntervalHelper.add(new TimeInterval($val));
} }
; ;
...@@ -301,7 +291,7 @@ myrole returns [String rolet, Role role] ...@@ -301,7 +291,7 @@ myrole returns [String rolet, Role role]
{ {
$rolet = $MyRole.getText(); $rolet = $MyRole.getText();
$role = new Role($rolet); $role = new Role($rolet);
roleHelper.add($role); mohawkT.roleHelper.add($role);