-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2. Contributing to JPlag #3
Comments
I would suggest to use uppercase in headlines.
I like the idea of using italic type for the classes. It would be nice if you could keep that consistent throughout the documentation. In "Adding and displaying new attributes from JPlagResult" I would suggest using a consistent tense. So either adding or added. |
Here is some more feedback:
|
Here is the Syntax for UML in Mermaid: https://mermaid-js.github.io/mermaid/#/classDiagram |
Reporting design
The CLI uses the Report, which takes a JPlagResult in order to create report files. Currently JPlag supports reporting in JSON format. JsonReport implements the Report interface. Upon receiving the JPlagResult, the JsonReport uses the ReportObejctFactory in order to convert the JPlagResult in a simple Java DTO JPlagReport. After that the created JPlagReport is passed to the JsonFactory which converts the Java DTO JPlagReport to JSON strings and saves the files with the JACKSON library. The OverviewReport of the JPlagReport is saved as overveiw.json. Each ComparisonReport is saved as {id1}-{id2}.json where id1 is the name of the first submission in the comparison and id2 is the second submission's name. The class diagram represents the strucutre of the report generation process. The process flow can be observed in the following sequence diagram.
Class Diagram
Sequence Diagram
JPlagReport
A report in JPlag is represented by the JPlagReport class, which contains a single overview and a list of comparison reports. The overview encapsulates the main information from a JPlagResult such as base directory path, language, metrics used, etc. The comparison report encapsulates the information about a single comparison such as participating submissions, their files, similarity and matches between them. The full structure of the JPlagReport DTO can be observed in the following class diagram.
Specifying additional report formats
In order to specify a new report format (example: XML reporting), the report interface needs to be implemented. The existing logic for converting a JPlagResult to JPlagReport can be reused and the created DTO can be used as an input to a factory creating the new report format.
Report viewer
The report viewer accepts JSON files and displays them. When a JSON file is provided, the application uses the OverviewFactory or ComparisonFactory in order to convert the JSON file to a Typescript DTO. The DTOs are then used by the view components to get the needed information.
Adding and displaying new attributes from JPlagResult
The new design of JPlag reporting and viewing enables the easy addition of new attributes. Adding a new attribute follows the pattern:
##Example
An example is provided in the following section which explains how new attributes can be introduced to the JPlagReport and then processed in the report viewer. In the following example we add the number of tokens per match to the JPlag report and view.
Task: Adding the number of tokens in a match, which has to be displayed in the MatchesTable in the ComparisonView.
private final int tokens;
to Match.java [JPlag]and save it in the Match DTO [JPlag]
tokens: number
to Match.ts [report-viewer]The text was updated successfully, but these errors were encountered: