1- package org .variantsync .vevos .extraction ;
1+ package org .variantsync .vevos .extraction . fast ;
22
33import org .eclipse .jgit .diff .DiffEntry ;
44import org .eclipse .jgit .revwalk .RevCommit ;
77import org .variantsync .diffdetective .editclass .proposed .ProposedEditClasses ;
88import org .variantsync .diffdetective .metadata .EditClassCount ;
99import org .variantsync .diffdetective .variation .diff .Time ;
10+ import org .variantsync .vevos .extraction .GTExtraction ;
11+ import org .variantsync .vevos .extraction .common .FileGT ;
12+ import org .variantsync .vevos .extraction .common .GroundTruth ;
13+ import org .variantsync .vevos .extraction .error .MatchingException ;
14+ import org .variantsync .vevos .extraction .io .Serde ;
1015
1116import java .io .IOException ;
1217import java .io .UncheckedIOException ;
1924 * Extracts ground truths for all repositories in a dataset. The ground truth consists of presence
2025 * conditions for each file, a list of all variables, and commit metadata.
2126 */
22- public class FastPCAnalysis implements Analysis .Hooks , PCAnalysis {
27+ public class FastGTExtraction implements Analysis .Hooks , GTExtraction {
2328 private final static String SUCCESS_COMMIT_FILE = "SUCCESS_COMMITS.txt" ;
2429 private final static String ERROR_COMMIT_FILE = "ERROR_COMMITS.txt" ;
2530 private final static String EMPTY_COMMIT_FILE = "EMPTY_COMMITS.txt" ;
@@ -39,7 +44,7 @@ public class FastPCAnalysis implements Analysis.Hooks, PCAnalysis {
3944 private final Path resultsRoot ;
4045 private final boolean extractCodeMatching ;
4146
42- public FastPCAnalysis (boolean printEnabled , Path resultsRoot , boolean ignorePCChanges , boolean extractCodeMatching ) {
47+ public FastGTExtraction (boolean printEnabled , Path resultsRoot , boolean ignorePCChanges , boolean extractCodeMatching ) {
4348 this .printEnabled = printEnabled ;
4449 this .resultsRoot = resultsRoot ;
4550 this .threadBatches = new ConcurrentHashMap <>();
@@ -77,7 +82,7 @@ public void onFailedParse(Analysis analysis) {
7782 }
7883
7984 private void extractionFailed (RevCommit commit ) {
80- synchronized (FastPCAnalysis .class ) {
85+ synchronized (FastGTExtraction .class ) {
8186 Logger .warn ("Was not able to extract ground truth for commit " + commit .getName ());
8287 Serde .appendText (resultsRoot .resolve (ERROR_COMMIT_FILE ), commit .getName () + "\n " );
8388 failedCommits .add (commit .getName ());
@@ -88,10 +93,10 @@ private void extractionFailed(RevCommit commit) {
8893 public void endCommit (Analysis analysis ) {
8994 RevCommit commit = analysis .getCurrentCommit ();
9095
91- synchronized (FastPCAnalysis .class ) {
92- FastPCAnalysis .numProcessed ++;
93- if (FastPCAnalysis .numProcessed % 1_000 == 0 ) {
94- Logger .info ("End Processing of Commit ({}): {}" , FastPCAnalysis .numProcessed ,
96+ synchronized (FastGTExtraction .class ) {
97+ FastGTExtraction .numProcessed ++;
98+ if (FastGTExtraction .numProcessed % 1_000 == 0 ) {
99+ Logger .info ("End Processing of Commit ({}): {}" , FastGTExtraction .numProcessed ,
95100 commit .name ());
96101 }
97102 }
@@ -116,16 +121,16 @@ public void endCommit(Analysis analysis) {
116121 // Return early and do not save any data, if the ground truths are both empty.
117122 // In this case, no changes have been analyzed, and we are not interested in the commit's
118123 // data.
119- synchronized (FastPCAnalysis .class ) {
124+ synchronized (FastGTExtraction .class ) {
120125 Logger .debug ("No code changes for " + commit .getName ());
121126 Serde .appendText (resultsRoot .resolve (EMPTY_COMMIT_FILE ), commit .getName () + "\n " );
122127 failedCommits .add (commit .getName ());
123128 }
124129 return ;
125130 }
126131
127- PCAnalysis .makeComplete (groundTruthBefore );
128- PCAnalysis .makeComplete (groundTruthAfter );
132+ GTExtraction .makeComplete (groundTruthBefore );
133+ GTExtraction .makeComplete (groundTruthAfter );
129134
130135 if (printEnabled ) {
131136 print (groundTruthBefore , commit .getName ());
@@ -169,7 +174,7 @@ public void endCommit(Analysis analysis) {
169174 s -> Serde .writeToFile (commitSaveDir .resolve (COMMIT_PARENTS_FILE ), s ),
170175 () -> Serde .writeToFile (commitSaveDir .resolve (COMMIT_PARENTS_FILE ), "" ));
171176
172- synchronized (FastPCAnalysis .class ) {
177+ synchronized (FastGTExtraction .class ) {
173178 Serde .appendText (resultsRoot .resolve (SUCCESS_COMMIT_FILE ), commit .getName () + "\n " );
174179 }
175180
@@ -239,11 +244,11 @@ public boolean analyzeVariationDiff(Analysis analysis) {
239244 // Logger.debug("Node: {}", node);
240245 // If the file is not completely new, we consider the before case
241246 if (!(changeType == DiffEntry .ChangeType .ADD )) {
242- PCAnalysis .analyzeNode (fileGTBefore , node , Time .BEFORE , ignorePCChanges );
247+ GTExtraction .analyzeNode (fileGTBefore , node , Time .BEFORE , ignorePCChanges );
243248 }
244249 if (!(changeType == DiffEntry .ChangeType .DELETE )) {
245250 // If the file has not been deleted, we consider the after case
246- PCAnalysis .analyzeNode (fileGTAfter , node , Time .AFTER , ignorePCChanges );
251+ GTExtraction .analyzeNode (fileGTAfter , node , Time .AFTER , ignorePCChanges );
247252 }
248253 } catch (MatchingException e ) {
249254 Logger .error ("unhandled exception while analyzing {} -> {} for commit {}." ,
0 commit comments