Commit 90a0296e authored by Jonathan Shahen's avatar Jonathan Shahen

Reorganizing code for cleaner appearance

parent e12afcc0
......@@ -40,51 +40,36 @@ public class ConverterInstance {
public MohawkTiming timing = new MohawkTiming();
public FileExtensions fileExt = new FileExtensions();
public int run(String[] args) {
try {
Options options = new Options();
setupOptions(options);
private CommandLine init(String[] args) throws Exception {
Options options = new Options();
setupOptions(options);
CommandLineParser cmdParser = new BasicParser();
CommandLine cmd = cmdParser.parse(options, args);
CommandLineParser cmdParser = new BasicParser();
CommandLine cmd = cmdParser.parse(options, args);
setupLoggerOptions(cmd, options);
setupLoggerOptions(cmd, options);
if (setupReturnImmediatelyOptions(cmd, options)) { return null; }
if (setupReturnImmediatelyOptions(cmd, options)) { return 0; }
/* Timing */timing.startTimer("totalTime");
/* Timing */timing.startTimer("totalTime");
setupUserPreferenceOptions(cmd, options);
setupSpecOptions(cmd, options);
setupResultOptions(cmd, options);
setupUserPreferenceOptions(cmd, options);
return cmd;
}
setupSpecOptions(cmd, options);
public int run(String[] args) {
try {
CommandLine cmd = init(args);
setupResultOptions(cmd, options);
if (cmd == null) { return 0; }
/* Timing */timing.startTimer("loadFile");
if (cmd.hasOption("bulk")) {
specHelper.bulk = true;
}
specHelper.loadSpecFiles();
/* Timing */timing.stopTimer("loadFile");
if (!cmd.hasOption(OptionString.TO_ALL.toString())) {
if (!cmd.hasOption(OptionString.TO_ASAPTIME_NSA.toString())) {
logger.info("[SKIP] Skipping converting to ASAPTime NSA");
}
if (!cmd.hasOption(OptionString.TO_ASAPTIME_SA.toString())) {
logger.info("[SKIP] Skipping converting to ASAPTime SA");
}
if (!cmd.hasOption(OptionString.TO_TROLE.toString())) {
logger.info("[SKIP] Skipping converting to TRole");
}
if (!cmd.hasOption(OptionString.TO_TRULE.toString())) {
logger.info("[SKIP] Skipping converting to TRule");
}
if (!cmd.hasOption(OptionString.TO_MOHAWK.toString())) {
logger.info("[SKIP] Skipping converting to Mohawk");
}
}
logger.info("Spec File(s) to Convert: " + specHelper.specFiles);
for (Integer i = 1; i <= specHelper.specFiles.size(); i++) {
File specFile = specHelper.specFiles.get(i - 1);
......@@ -520,5 +505,23 @@ public class ConverterInstance {
resultsFile = cmd.getOptionValue("results");
}
logger.info("Results File: " + resultsFile);
if (!cmd.hasOption(OptionString.TO_ALL.toString())) {
if (!cmd.hasOption(OptionString.TO_ASAPTIME_NSA.toString())) {
logger.info("[SKIP] Skipping converting to ASAPTime NSA");
}
if (!cmd.hasOption(OptionString.TO_ASAPTIME_SA.toString())) {
logger.info("[SKIP] Skipping converting to ASAPTime SA");
}
if (!cmd.hasOption(OptionString.TO_TROLE.toString())) {
logger.info("[SKIP] Skipping converting to TRole");
}
if (!cmd.hasOption(OptionString.TO_TRULE.toString())) {
logger.info("[SKIP] Skipping converting to TRule");
}
if (!cmd.hasOption(OptionString.TO_MOHAWK.toString())) {
logger.info("[SKIP] Skipping converting to Mohawk");
}
}
}
}
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