Loading e-Knife/src/main/java/eknife/EKnife.java +24 −9 Original line number Diff line number Diff line Loading @@ -27,9 +27,10 @@ import edg.graph.Node; import edg.slicing.ConstrainedAlgorithm; import edg.slicing.SlicingAlgorithm; import edg.slicing.SlicingCriterion; import eknife.config.Config; import java.io.File; import java.util.LinkedList; import java.util.List; import java.util.Set; public class EKnife Loading Loading @@ -113,8 +114,8 @@ public class EKnife help += " -l,--line <num> The line of the slicing criterion\n"; help += " -v,--var <name> The name of the slicing criterion (must be a variable)\n"; help += " -n,--occurrence <num> The occurrence of the slicing criterion in that line\n"; help += " -G --print-graph <file.dot> Exports the graph as a dot file\n"; help += " -G --print-graph <file.pdf> Exports the graph as a PDF file\n"; help += " -G,--print-graph <file.dot> Exports the graph as a dot file\n"; help += " -G,--print-graph <file.pdf> Exports the graph as a PDF file\n"; help += " --help Show this message.\n"; System.out.print(help); Loading Loading @@ -180,12 +181,26 @@ public class EKnife } boolean isValid() { return inputPath != null && new File(inputPath).exists() && outputFile != null && (outputFile.exists() || outputFile.getAbsoluteFile().getParentFile().isDirectory()) && file != null && line > 0 && name != null && !name.isEmpty() && occurrence > 0; List<String> errors = new LinkedList<>(); if (inputPath == null) errors.add("You must specify a file to analyze with '-i'."); else if (!new File(inputPath).exists()) errors.add("The input file you've specified does not exist or isn't readable(" + inputPath + ")."); if (outputFile == null) errors.add("You must specify a location for the output with '-o'."); else if (!outputFile.exists() && !outputFile.getAbsoluteFile().getParentFile().isDirectory()) errors.add("The output file's parent folder does not exist, or the output folder does not exist."); if (file == null) errors.add("The input file is a folder, so you must specify a the file that contains the slicing criterion with '-f'."); if (line <= 0) errors.add("You must specify a line number greater than 0 with '-l'."); if (name == null || name.isEmpty()) errors.add("You must specify a valid variable name with '-v'."); if (occurrence <= 0) errors.add("You must specify an occurrence greater than 0 with '-n'."); for (String error : errors) System.out.println(error); return errors.isEmpty(); } } } Loading
e-Knife/src/main/java/eknife/EKnife.java +24 −9 Original line number Diff line number Diff line Loading @@ -27,9 +27,10 @@ import edg.graph.Node; import edg.slicing.ConstrainedAlgorithm; import edg.slicing.SlicingAlgorithm; import edg.slicing.SlicingCriterion; import eknife.config.Config; import java.io.File; import java.util.LinkedList; import java.util.List; import java.util.Set; public class EKnife Loading Loading @@ -113,8 +114,8 @@ public class EKnife help += " -l,--line <num> The line of the slicing criterion\n"; help += " -v,--var <name> The name of the slicing criterion (must be a variable)\n"; help += " -n,--occurrence <num> The occurrence of the slicing criterion in that line\n"; help += " -G --print-graph <file.dot> Exports the graph as a dot file\n"; help += " -G --print-graph <file.pdf> Exports the graph as a PDF file\n"; help += " -G,--print-graph <file.dot> Exports the graph as a dot file\n"; help += " -G,--print-graph <file.pdf> Exports the graph as a PDF file\n"; help += " --help Show this message.\n"; System.out.print(help); Loading Loading @@ -180,12 +181,26 @@ public class EKnife } boolean isValid() { return inputPath != null && new File(inputPath).exists() && outputFile != null && (outputFile.exists() || outputFile.getAbsoluteFile().getParentFile().isDirectory()) && file != null && line > 0 && name != null && !name.isEmpty() && occurrence > 0; List<String> errors = new LinkedList<>(); if (inputPath == null) errors.add("You must specify a file to analyze with '-i'."); else if (!new File(inputPath).exists()) errors.add("The input file you've specified does not exist or isn't readable(" + inputPath + ")."); if (outputFile == null) errors.add("You must specify a location for the output with '-o'."); else if (!outputFile.exists() && !outputFile.getAbsoluteFile().getParentFile().isDirectory()) errors.add("The output file's parent folder does not exist, or the output folder does not exist."); if (file == null) errors.add("The input file is a folder, so you must specify a the file that contains the slicing criterion with '-f'."); if (line <= 0) errors.add("You must specify a line number greater than 0 with '-l'."); if (name == null || name.isEmpty()) errors.add("You must specify a valid variable name with '-v'."); if (occurrence <= 0) errors.add("You must specify an occurrence greater than 0 with '-n'."); for (String error : errors) System.out.println(error); return errors.isEmpty(); } } }