private boolean init(Map<String, AppValue> options) { inputFiles = getFiles(options); if (inputFiles == null) { return false; } outputFolder = AppUtils.getFolder(options, Options.OutputFolder); if (outputFolder == null) { LoggingUtils.getLogger().warning("Could not open folder."); return false; } // Get trace unit String traceUnitString = AppUtils.getString(options, Options.TraceUnit); traceUnitName = EnumUtils.valueOf(TraceUnits.class, traceUnitString); if (traceUnitName == null) { LoggingUtils.getLogger().warning("Could not get Trace Unit name."); return false; } String systemConfigFilename = AppUtils.getString(options, Options.SystemSetup); systemConfigFile = new File(systemConfigFilename); if (!systemConfigFile.exists()) { LoggingUtils.getLogger() .info("MicroBlaze setup file '" + systemConfigFilename + "' not found."); } return true; }
/** * Returns a list with the programs to execute. From the input folder, returns all the files * inside that folder * * @param options * @return */ public static List<File> getInputPrograms(Map<String, AppValue> options) { String programsFoldername = AppUtils.getString(options, Options.FolderWithPrograms); File programsFolder = IoUtils.safeFolder(programsFoldername); if (programsFoldername == null) { return null; } return IoUtils.getFilesRecursive(programsFolder); }
/** * @param options * @return a list with the selected partitioners */ public static List<LoopDetectors> getPartitioners(Map<String, AppValue> options) { List<String> partitioners = AppUtils.getStringList(options, Options.LoopDetectors); List<LoopDetectors> parts = new ArrayList<LoopDetectors>(); for (String partitionerName : partitioners) { // Decode name into enum LoopDetectors partEnum = EnumUtils.valueOf(LoopDetectors.class, partitionerName); if (partEnum == null) { LoggingUtils.getLogger().warning("Ignoring partitioner '" + partitionerName + "'"); continue; } parts.add(partEnum); } return parts; }
/** * Check if input is is single file or folder * * @param options * @return */ private List<File> getFiles(Map<String, AppValue> options) { String inputTypeName = AppUtils.getString(options, Options.InputType); InputType inputType = EnumUtils.valueOf(InputType.class, inputTypeName); return InputType.getFiles(options, Options.Input, inputType); }