Sfoglia il codice sorgente

[192-webreport] Added number of tokens per match information to the report, tested maintainability, documented in Maintainability.md

Evgeni 4 anni fa
parent
commit
a046de2f0f

+ 3 - 1
jplag/src/main/java/de/jplag/reportingV2/reportobject/ReportObjectFactory.java

@@ -136,12 +136,14 @@ public class ReportObjectFactory {
 		int endFirst = usesIndex ? endFirstToken.getIndex() : endFirstToken.getLine();
 		int startSecond = usesIndex ? startSecondToken.getIndex() : startSecondToken.getLine();
 		int endSecond = usesIndex ? endSecondToken.getIndex() : endSecondToken.getLine();
+		int tokens = match.getLength();
 
 		return new Match(startFirstToken.file, startSecondToken.file,
 				startFirst,
 				endFirst,
 				startSecond,
-				endSecond
+				endSecond,
+				tokens
 		);
 	}
 	private static List<String> readFileLines(File file) {

+ 8 - 1
jplag/src/main/java/de/jplag/reportingV2/reportobject/model/Match.java

@@ -8,13 +8,15 @@ public class Match {
 	private int end_in_first;
 	private int start_in_second;
 	private int end_in_second;
+	private int tokens;
 
 	public Match(String first_file_name,
 				 String second_file_name,
 				 int start_in_first,
 				 int end_in_first,
 				 int start_in_second,
-				 int end_in_second) {
+				 int end_in_second,
+				 int tokens) {
 
 		this.first_file_name = first_file_name;
 		this.second_file_name = second_file_name;
@@ -22,6 +24,7 @@ public class Match {
 		this.end_in_first = end_in_first;
 		this.start_in_second = start_in_second;
 		this.end_in_second = end_in_second;
+		this.tokens = tokens;
 	}
 
 	public String getFirst_file_name() {
@@ -48,6 +51,8 @@ public class Match {
 		return end_in_second;
 	}
 
+	public int getTokens() { return tokens; }
+
 	public void setFirst_file_name(String first_file_name) {
 		this.first_file_name = first_file_name;
 	}
@@ -71,4 +76,6 @@ public class Match {
 	public void setEnd_in_second(int end_in_second) {
 		this.end_in_second = end_in_second;
 	}
+
+	public void setTokens(int tokens) { this.tokens = tokens; }
 }

+ 11 - 0
report-viewer/src/MaintainabilityTest.md

@@ -0,0 +1,11 @@
+Testing Maintainability
+--
+Observing the number of affected artefacts when adding new information to the
+report to be displayed.
+Adding the number of tokens in a match, which has to be displayed in the MatchesTable in the ComparisonView.
+1. Adding int tokens to Match.java [JPlag]
+2. Edited convertMatchToReportMatch in ReportObejctFactory to get # token from de.jplag.Match
+	and save it in Match DTO [JPlag]
+3. Added tokens: number to Match.ts [report-viewer]
+4. Edited mapMatch in ComparisonFactory.ts to get # tokens from the json file [report-viewer]
+5. Edited MatchTable.vue to display the tokens number in the ComparisonView

+ 1 - 1
report-viewer/src/components/MatchTable.vue

@@ -25,7 +25,7 @@
           <p>({{ match.startInSecond }} - {{ match.endInSecond }})</p>
         </div>
       </td>
-      <td>TODO</td>
+      <td>{{ match.tokens }}</td>
     </tr>
   </table>
 </div>

+ 1 - 0
report-viewer/src/model/Match.ts

@@ -5,5 +5,6 @@ export type Match = {
     endInFirst: number,
     startInSecond: number,
     endInSecond: number,
+    tokens: number,
     color: string
 }

+ 1 - 0
report-viewer/src/model/factories/ComparisonFactory.ts

@@ -98,6 +98,7 @@ export class ComparisonFactory {
             endInFirst: match.end_in_first as number,
             startInSecond: match.start_in_second as number,
             endInSecond: match.end_in_second as number,
+            tokens: match.tokens as number,
             color: color
         };
     }