|
@@ -101,6 +101,8 @@ Clustering:
|
|
|
|
|
|
|
|
The new API makes it easy to integrate JPlag's plagiarism detection into external Java projects:
|
|
The new API makes it easy to integrate JPlag's plagiarism detection into external Java projects:
|
|
|
|
|
|
|
|
|
|
+<!-- To assure that the code example is always correct, it must be kept in sync
|
|
|
|
|
+with [`ReadmeCodeExampleTest#testReadmeCodeExample`](core/src/test/java/de/jplag/special/ReadmeCodeExampleTest.java). -->
|
|
|
```java
|
|
```java
|
|
|
Language language = new de.jplag.java.Language();
|
|
Language language = new de.jplag.java.Language();
|
|
|
Set<File> submissionDirectories = Set.of(new File("/path/to/rootDir"));
|
|
Set<File> submissionDirectories = Set.of(new File("/path/to/rootDir"));
|
|
@@ -108,11 +110,15 @@ File baseCode = new File("/path/to/baseCode");
|
|
|
JPlagOptions options = new JPlagOptions(language, submissionDirectories, Set.of()).withBaseCodeSubmissionDirectory(baseCode);
|
|
JPlagOptions options = new JPlagOptions(language, submissionDirectories, Set.of()).withBaseCodeSubmissionDirectory(baseCode);
|
|
|
|
|
|
|
|
JPlag jplag = new JPlag(options);
|
|
JPlag jplag = new JPlag(options);
|
|
|
-JPlagResult result = jplag.run(); // Exception handling required here
|
|
|
|
|
-
|
|
|
|
|
-// Optional
|
|
|
|
|
-ReportObjectFactory reportObjectFactory = new ReportObjectFactory();
|
|
|
|
|
-reportObjectFactory.createAndSaveReport(result, "/path/to/output");
|
|
|
|
|
|
|
+try {
|
|
|
|
|
+ JPlagResult result = jplag.run();
|
|
|
|
|
+
|
|
|
|
|
+ // Optional
|
|
|
|
|
+ ReportObjectFactory reportObjectFactory = new ReportObjectFactory();
|
|
|
|
|
+ reportObjectFactory.createAndSaveReport(result, "/path/to/output");
|
|
|
|
|
+} catch (ExitException e) {
|
|
|
|
|
+ // error handling here
|
|
|
|
|
+}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## Contributing
|
|
## Contributing
|