From e5c815342378614d1050b7468150feccebf981f3 Mon Sep 17 00:00:00 2001 From: ksiadzrobak Date: Tue, 19 Jun 2018 21:06:27 +0200 Subject: [PATCH] Alignment of -c and -a --- jplag/src/main/java/jplag/Program.java | 39 ++++++++++++------- .../jplag/options/CommandLineOptions.java | 4 +- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/jplag/src/main/java/jplag/Program.java b/jplag/src/main/java/jplag/Program.java index deb3d20df..58e0dec53 100644 --- a/jplag/src/main/java/jplag/Program.java +++ b/jplag/src/main/java/jplag/Program.java @@ -429,19 +429,23 @@ private Vector createSubmissions(File f, SubmissionType type) throws return result; } - private void createSubmissionsFileList() throws jplag.ExitException { - submissions = new Vector(); - 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 createSubmissionsFileList() throws jplag.ExitException { + Vector result = new Vector(); + 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) @@ -1162,7 +1166,8 @@ 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(); @@ -1170,6 +1175,12 @@ public void run() throws jplag.ExitException { } 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); diff --git a/jplag/src/main/java/jplag/options/CommandLineOptions.java b/jplag/src/main/java/jplag/options/CommandLineOptions.java index e1fad3a83..e28467b39 100644 --- a/jplag/src/main/java/jplag/options/CommandLineOptions.java +++ b/jplag/src/main/java/jplag/options/CommandLineOptions.java @@ -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++; @@ -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]);