Skip to content

Commit

Permalink
Alignment of -c and -a
Browse files Browse the repository at this point in the history
  • Loading branch information
ksiadzrobak committed Jun 19, 2018
1 parent 8d550a4 commit e5c8153
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
39 changes: 25 additions & 14 deletions jplag/src/main/java/jplag/Program.java
Original file line number Diff line number Diff line change
Expand Up @@ -429,19 +429,23 @@ private Vector<Submission> createSubmissions(File f, SubmissionType type) throws
return result;
}

private void createSubmissionsFileList() throws jplag.ExitException {
submissions = new Vector<Submission>();
File f = null;
if (options.root_dir != null) {
f = new File(options.root_dir);
if (!f.isDirectory()) {
throw new jplag.ExitException(options.root_dir + " is not a directory!");
}
}
for (String file : options.fileList){
submissions.addElement(new Submission(file, f, this, get_language(), SubmissionType.REGULAR));
}
}
private Vector<Submission> createSubmissionsFileList() throws jplag.ExitException {
Vector<Submission> result = new Vector<Submission>();
File f = null;

if (options.root_dir != null) {
f = new File(options.root_dir);
if (!f.isDirectory()) {
throw new jplag.ExitException(options.root_dir + " is not a directory!");
}
}

for (String file : options.fileList){
result.addElement(new Submission(file, f, this, get_language(), SubmissionType.REGULAR));
}

return result;
}

private Submission createBasecodeSubmission() throws jplag.ExitException {
if (!options.useBasecode)
Expand Down Expand Up @@ -1162,14 +1166,21 @@ public void run() throws jplag.ExitException {
readExclusionFile();

if (options.fileListMode) {
createSubmissionsFileList();
submissions = createSubmissionsFileList();
basecodeSubmission = createBasecodeSubmission();
} else if (options.include_file == null) {
submissions = createSubmissions(new File(options.root_dir), SubmissionType.REGULAR);
basecodeSubmission = createBasecodeSubmission();
System.out.println(submissions.size() + " submissions\n");
} else
createSubmissionsExp();

if (options.useArchivalSubmissions) {
archivalSubmissions = createSubmissions(new File(options.archivalSubmissions),
SubmissionType.ARCHIVAL);
System.out.println(archivalSubmissions.size() + " archival submissions\n");
}

if (!options.skipParse) {
try {
parseAll(submissions);
Expand Down
4 changes: 2 additions & 2 deletions jplag/src/main/java/jplag/options/CommandLineOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ else if (tmp.equals("avr"))
else
throw new jplag.ExitException("Illegal clustertype: \"" + tmp
+ "\"\nAvailable types are 'min', 'max' and 'avr'!");

System.out.println("Clustering activated; type: "
+ args[i + 1].toUpperCase());
i++;
Expand Down Expand Up @@ -325,7 +325,7 @@ else if (tmp.equals("avr"))
}
this.title = args[i + 1];
i++;
} else if (arg.equals("-c") && i + 2 < args.length){
} else if (arg.equals("-c") && i + 1 < args.length) {
this.fileListMode = true;
while (i + 1 < args.length){
this.fileList.add(args[i + 1]);
Expand Down

0 comments on commit e5c8153

Please sign in to comment.