Skip to content

Commit 612d5cb

Browse files
committed
Rename DiffTree -> VariationDiff
1 parent 911b2b7 commit 612d5cb

110 files changed

Lines changed: 1067 additions & 1065 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The example file content shown below should match your results when running the
9898
slowestCommit: 9838b7032ea9792bec21af424c53c07078636d21___xorg-server___7996ms
9999
runtime in seconds: 853.9739999999999
100100
runtime with multithreading in seconds: 144.549
101-
treeformat: org.variantsync.diffdetective.variation.diff.serialize.treeformat.CommitDiffDiffTreeLabelFormat
101+
treeformat: org.variantsync.diffdetective.variation.diff.serialize.treeformat.CommitDiffVariationDiffLabelFormat
102102
nodeformat: org.variantsync.diffdetective.mining.formats.ReleaseMiningDiffNodeFormat
103103
edgeformat: org.variantsync.diffdetective.mining.formats.DirectedEdgeLabelFormat with org.variantsync.diffdetective.mining.formats.ReleaseMiningDiffNodeFormat
104104
analysis: org.variantsync.diffdetective.validation.PatternValidationTask

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This replication package consists of four parts:
1919
4. **Dataset Overview**: We provide an overview of the 44 inspected datasets with updated links to their repositories in the file [docs/datasets/all.md][dataset].
2020

2121
## 1. DiffDetective
22-
DiffDetective is a java library and command-line tool to parse and classify edits to variability in git histories of preprocessor-based software product lines by creating [variation diffs][difftree_class] and operating on them.
22+
DiffDetective is a java library and command-line tool to parse and classify edits to variability in git histories of preprocessor-based software product lines by creating [variation diffs][variationdiff_class] and operating on them.
2323

2424
We offer a [Docker](https://www.docker.com/) setup to easily __replicate__ the validation performed in our paper.
2525
In the following, we provide a quickstart guide for running the replication.
@@ -69,7 +69,7 @@ Moreover, the results comprise the (LaTeX) tables that are part of our paper and
6969
### Documentation
7070

7171
DiffDetective is documented with javadoc. The documentation can be accessed on this [website][documentation]. Notable classes of our library are:
72-
- [DiffTree](https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/diff/difftree/DiffTree.html) and [DiffNode](https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/diff/difftree/DiffNode.html) implement variation diffs from our paper. A variation diff is represented by an instance of the `DiffTree` class. It stores the root node of the diff and offers various methods to parse, traverse, and analyze variation diffs. `DiffNode`s represent individual nodes within a variation diff.
72+
- [VariationDiff](https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/variation/diff/VariationDiff.html) and [DiffNode](https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/variation/diff/DiffNode.html) implement variation diffs from our paper. A variation diff is represented by an instance of the `VariationDiff` class. It stores the root node of the diff and offers various methods to parse, traverse, and analyze variation diffs. `DiffNode`s represent individual nodes within a variation diff.
7373
- [EditClassValidation](https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/validation/EditClassValidation.html) contains the main method for our validation.
7474
- [ProposedEditClasses](https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/editclass/proposed/ProposedEditClasses.html) holds the catalog of the nine edit classes we proposed in our paper. It implements the interface [EditClassCatalogue](https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/editclass/EditClassCatalogue.html), which allows to define custom edit classifications.
7575
- [BooleanAbstraction](https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/feature/BooleanAbstraction.html) contains data and methods for boolean abstraction of higher-order logic formulas. We use this for macro parsing.
@@ -112,7 +112,7 @@ You can also run DiffDetective on other datasets by providing the path to the da
112112

113113
The input file must have the same format as the other dataset files (i.e., repositories are listed in a Markdown table). You can find [dataset files](docs/datasets/all.md) in the [docs/datasets](docs/datasets) folder.
114114

115-
[difftree_class]: https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/diff/difftree/DiffTree.html
115+
[variationdiff_class]: https://variantsync.github.io/DiffDetective/docs/javadoc/org/variantsync/diffdetective/variation/diff/VariationDiff.html
116116
[haskell]: https://www.haskell.org/
117117
[dataset]: docs/datasets/all.md
118118
[appendix]: appendix.pdf

linegraph/renderLinegraph.backup.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ def plot_graphs(S, exportDir):
333333
# plt.figure(0, figsize=(FIG_WIDTH, FIG_HEIGHT))
334334
plt.figure(0)
335335
for i in range(len(S)):
336-
difftree = S[i]
336+
variation_diff = S[i]
337337

338-
# print("Render tree", difftree.name.replace("\n", JAVA_TREE_NAME_SEPARATOR))
338+
# print("Render tree", variation_diff.name.replace("\n", JAVA_TREE_NAME_SEPARATOR))
339339

340340
plt.clf()
341341
if WITH_TITLE:
@@ -344,7 +344,7 @@ def plot_graphs(S, exportDir):
344344
node_colors = []
345345
node_type_colors = []
346346
rootNode = None
347-
for v, d in difftree.nodes(data=True):
347+
for v, d in variation_diff.nodes(data=True):
348348
name = d['label']
349349
nodedata = NODE_PARSER(v, name)
350350

@@ -366,7 +366,7 @@ def plot_graphs(S, exportDir):
366366
d['label'] = nodedata.label
367367

368368
edge_colors = []
369-
for _, _, d in difftree.edges.data():
369+
for _, _, d in variation_diff.edges.data():
370370
typeName = str(d['label'])
371371
if typeName == "a":
372372
edge_colors.append('#bbeb37')
@@ -380,7 +380,7 @@ def plot_graphs(S, exportDir):
380380

381381
# We have to do this to circumvent a bug:
382382
# https://networkx.org/documentation/stable/reference/generated/networkx.drawing.nx_pydot.pydot_layout.html
383-
H = nx.convert_node_labels_to_integers(difftree, label_attribute='label')
383+
H = nx.convert_node_labels_to_integers(variation_diff, label_attribute='label')
384384
H_layout = nx.drawing.nx_pydot.pydot_layout(H, prog=NODE_POSITION_LAYOUT, root=rootNode)
385385
pos = {H.nodes[n]['label']: p for n, p in H_layout.items()}
386386

@@ -390,14 +390,14 @@ def plot_graphs(S, exportDir):
390390
pos = new_pos
391391

392392
# draw type borders
393-
nx.draw_networkx_nodes(difftree, pos,
393+
nx.draw_networkx_nodes(variation_diff, pos,
394394
node_size=int(NODE_SIZE * TYPE_BORDER_SIZE),
395395
node_color=node_type_colors)
396396

397397
# draw nodes
398398
if SHOW_LABELS:
399-
node_labels = dict([(v, d['label']) for v, d in difftree.nodes(data=True)])
400-
nx.draw(difftree, pos,
399+
node_labels = dict([(v, d['label']) for v, d in variation_diff.nodes(data=True)])
400+
nx.draw(variation_diff, pos,
401401
node_size=NODE_SIZE,
402402
node_color=node_colors,
403403
width=EDGE_SIZE,
@@ -407,15 +407,15 @@ def plot_graphs(S, exportDir):
407407
labels=node_labels,
408408
bbox=dict(facecolor="white", edgecolor='black', linewidth=0.3, boxstyle='round,pad=0.2', linestyle='solid'))
409409
else:
410-
nx.draw(difftree, pos,
410+
nx.draw(variation_diff, pos,
411411
node_size=NODE_SIZE,
412412
node_color=node_colors,
413413
width=EDGE_SIZE,
414414
arrowsize=ARROW_SIZE,
415415
edge_color=edge_colors,
416416
font_size=FONT_SIZE)
417417

418-
save_path = os.path.join(exportDir, difftree.graph['outfilename'] + OUTPUT_FORMAT)
418+
save_path = os.path.join(exportDir, variation_diff.graph['outfilename'] + OUTPUT_FORMAT)
419419

420420
# Save
421421
print("Exporting", save_path)
@@ -436,7 +436,7 @@ def getAllFilesInDirectoryRecusivelyThat(dirname, condition):
436436
return listOfFiles
437437

438438
if __name__ == "__main__":
439-
argparser = argparse.ArgumentParser(description="Render DiffTrees specified in linegraph files (.lg).")
439+
argparser = argparse.ArgumentParser(description="Render VariationDiffs specified in linegraph files (.lg).")
440440
argparser.add_argument('infile')
441441
argparser.add_argument('--nodesize', nargs='?', default=700, type=int)
442442
argparser.add_argument('--edgesize', nargs='?', default=1.0, type=float)

linegraph/renderLinegraph.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ def plot_graphs(S, exportDir):
129129
# plt.figure(0, figsize=(FIG_WIDTH, FIG_HEIGHT))
130130
fig = plt.figure(0)
131131
for i in range(len(S)):
132-
difftree = S[i]
132+
variation_diff = S[i]
133133

134-
# print("Render tree", difftree.name.replace("\n", JAVA_TREE_NAME_SEPARATOR))
134+
# print("Render tree", variation_diff.name.replace("\n", JAVA_TREE_NAME_SEPARATOR))
135135

136136
plt.clf()
137137
if WITH_TITLE:
@@ -140,7 +140,7 @@ def plot_graphs(S, exportDir):
140140
node_colors = []
141141
node_type_colors = []
142142
rootNode = None
143-
for v, d in difftree.nodes(data=True):
143+
for v, d in variation_diff.nodes(data=True):
144144
name = d['label']
145145
nodedata = NODE_PARSER(v, name)
146146

@@ -164,7 +164,7 @@ def plot_graphs(S, exportDir):
164164
d['label'] = nodedata.label
165165

166166
edge_colors = []
167-
for _, _, d in difftree.edges.data():
167+
for _, _, d in variation_diff.edges.data():
168168
typeName = str(d['label'])
169169
edge_colors.append(g.edgeColour(typeName))
170170

@@ -173,7 +173,7 @@ def plot_graphs(S, exportDir):
173173

174174
# We have to do this to circumvent a bug:
175175
# https://networkx.org/documentation/stable/reference/generated/networkx.drawing.nx_pydot.pydot_layout.html
176-
H = nx.convert_node_labels_to_integers(difftree, label_attribute='label')
176+
H = nx.convert_node_labels_to_integers(variation_diff, label_attribute='label')
177177
H_layout = nx.drawing.nx_pydot.pydot_layout(H, prog=NODE_POSITION_LAYOUT, root=rootNode)
178178
pos = {H.nodes[n]['label']: p for n, p in H_layout.items()}
179179

@@ -209,14 +209,14 @@ def plot_graphs(S, exportDir):
209209
axes.set_ylim([-yhalf, +yhalf])
210210

211211
# draw type borders
212-
nx.draw_networkx_nodes(difftree, pos,
212+
nx.draw_networkx_nodes(variation_diff, pos,
213213
node_size=int(NODE_SIZE * g.TYPE_BORDER_SIZE),
214214
node_color=node_type_colors)
215215

216216
# draw nodes
217217
if SHOW_LABELS:
218-
node_labels = dict([(v, d['label']) for v, d in difftree.nodes(data=True)])
219-
nx.draw(difftree,
218+
node_labels = dict([(v, d['label']) for v, d in variation_diff.nodes(data=True)])
219+
nx.draw(variation_diff,
220220
pos,
221221
node_size=NODE_SIZE,
222222
node_color=node_colors,
@@ -227,15 +227,15 @@ def plot_graphs(S, exportDir):
227227
labels=node_labels,
228228
bbox=dict(facecolor="white", edgecolor='black', linewidth=0.3, boxstyle='round,pad=0.2', linestyle='solid'))
229229
else:
230-
nx.draw(difftree, pos,
230+
nx.draw(variation_diff, pos,
231231
node_size=NODE_SIZE,
232232
node_color=node_colors,
233233
width=EDGE_SIZE,
234234
arrowsize=ARROW_SIZE,
235235
edge_color=edge_colors,
236236
font_size=FONT_SIZE)
237237

238-
save_path = os.path.join(exportDir, difftree.graph['outfilename'] + OUTPUT_FORMAT)
238+
save_path = os.path.join(exportDir, variation_diff.graph['outfilename'] + OUTPUT_FORMAT)
239239

240240
# Save
241241
print("Exporting", save_path)
@@ -257,7 +257,7 @@ def getAllFilesInDirectoryRecusivelyThat(dirname, condition):
257257
return listOfFiles
258258

259259
if __name__ == "__main__":
260-
argparser = argparse.ArgumentParser(description="Render DiffTrees specified in linegraph files (.lg).")
260+
argparser = argparse.ArgumentParser(description="Render VariationDiffs specified in linegraph files (.lg).")
261261
argparser.add_argument('infile')
262262
argparser.add_argument('--nodesize', nargs='?', default=700, type=int)
263263
argparser.add_argument('--edgesize', nargs='?', default=1.0, type=float)

linegraph/renderMinedTrees.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Run in project root
2-
.venv/bin/python3 linegraph/renderLinegraph.py "linegraph/data/difftrees.lg"
2+
.venv/bin/python3 linegraph/renderLinegraph.py "linegraph/data/variationdiffs.lg"

scripts/runPostprocessing.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
java -cp "target/diffdetective-1.0.0-jar-with-dependencies.jar" org.variantsync.diffdetective.mining.postprocessing.MiningPostprocessing "results/fsg/difftrees_pilot/all_results" "results/compositeCandidates"
1+
java -cp "target/diffdetective-1.0.0-jar-with-dependencies.jar" org.variantsync.diffdetective.mining.postprocessing.MiningPostprocessing "results/fsg/variationdiffs_pilot/all_results" "results/compositeCandidates"
22
echo "runPostprocessing.sh DONE"

scripts/runPreprocessing.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
java -cp "target/diffdetective-1.0.0-jar-with-dependencies.jar" org.variantsync.diffdetective.mining.DiffTreeMiner
1+
java -cp "target/diffdetective-1.0.0-jar-with-dependencies.jar" org.variantsync.diffdetective.mining.VariationDiffMiner
22
echo "runPreprocessing.sh DONE"

src/main/java/org/variantsync/diffdetective/analysis/Analysis.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
import org.variantsync.diffdetective.util.Diagnostics;
2727
import org.variantsync.diffdetective.util.InvocationCounter;
2828
import org.variantsync.diffdetective.variation.DiffLinesLabel;
29-
import org.variantsync.diffdetective.variation.diff.DiffTree;
29+
import org.variantsync.diffdetective.variation.diff.VariationDiff;
3030
import org.variantsync.functjonal.iteration.ClusteredIterator;
3131
import org.variantsync.functjonal.iteration.MappedIterator;
3232

3333
/**
3434
* Encapsulates the state and control flow during an analysis of the commit history of multiple
35-
* repositories using {@link DiffTree}s. Each repository is processed sequentially but the commits
35+
* repositories using {@link VariationDiff}s. Each repository is processed sequentially but the commits
3636
* of each repository can be processed in parallel.
3737
*
3838
* <p>For thread safety, each thread receives its own instance of {@code Analysis}. The getters
@@ -65,7 +65,7 @@ public class Analysis {
6565
protected RevCommit currentCommit;
6666
protected CommitDiff currentCommitDiff;
6767
protected PatchDiff currentPatch;
68-
protected DiffTree<DiffLinesLabel> currentDiffTree;
68+
protected VariationDiff<DiffLinesLabel> currentVariationDiff;
6969

7070
protected final Path outputDir;
7171
protected Path outputFile;
@@ -105,10 +105,10 @@ public PatchDiff getCurrentPatch() {
105105

106106
/**
107107
* The currently processed patch.
108-
* Valid only during {@link Hooks#analyzeDiffTree}.
108+
* Valid only during {@link Hooks#analyzeVariationDiff}.
109109
*/
110-
public DiffTree<DiffLinesLabel> getCurrentDiffTree() {
111-
return currentDiffTree;
110+
public VariationDiff<DiffLinesLabel> getCurrentVariationDiff() {
111+
return currentVariationDiff;
112112
}
113113

114114
/**
@@ -154,7 +154,7 @@ public <T extends Metadata<T>> void append(ResultKey<T> resultKey, T value) {
154154
}
155155

156156
/**
157-
* Hooks for analyzing commits using {@link DiffTree}s.
157+
* Hooks for analyzing commits using {@link VariationDiff}s.
158158
*
159159
* <p>In general the hooks of different {@code Hook} instances are called in sequence according
160160
* to the order specified in {@link Analysis#Analysis} (except end hooks). Hooks are separated
@@ -218,7 +218,7 @@ default void onFailedCommit(Analysis analysis) throws Exception {}
218218
* The main hook for analyzing non-empty diff trees.
219219
* Called at most once during the patch phase.
220220
*/
221-
default boolean analyzeDiffTree(Analysis analysis) throws Exception { return true; }
221+
default boolean analyzeVariationDiff(Analysis analysis) throws Exception { return true; }
222222
default void endPatch(Analysis analysis) throws Exception {}
223223
default void endCommit(Analysis analysis) throws Exception {}
224224
default void endBatch(Analysis analysis) throws Exception {}
@@ -280,7 +280,7 @@ public static AnalysisResult forEachCommit(Supplier<Analysis> analysis) {
280280
* history is processed in batches of {@code commitsToProcessPerThread} on {@code nThreads} in
281281
* parallel. {@link Hooks} passed to {@link Analysis#Analysis} are the main customization point
282282
* for executing different analyses. By default only the total number of commits and the total
283-
* runtime with multithreading of the {@link DiffTree} parsing is recorded.
283+
* runtime with multithreading of the {@link VariationDiff} parsing is recorded.
284284
*
285285
* @param analysisFactory creates independent (at least thread safe) instances the analysis
286286
* state
@@ -426,7 +426,7 @@ protected void processCommit() throws Exception {
426426
// parse the commit
427427
final CommitDiffResult commitDiffResult = differ.createCommitDiff(currentCommit);
428428

429-
// report any errors that occurred and exit in case no DiffTree could be parsed.
429+
// report any errors that occurred and exit in case no VariationDiff could be parsed.
430430
getResult().reportDiffErrors(commitDiffResult.errors());
431431
if (commitDiffResult.diff().isEmpty()) {
432432
Logger.debug("found commit that failed entirely because:\n{}", commitDiffResult.errors());
@@ -463,10 +463,10 @@ protected void processCommit() throws Exception {
463463
protected void processPatch() throws Exception {
464464
if (currentPatch.isValid()) {
465465
// generate TreeDiff
466-
currentDiffTree = currentPatch.getDiffTree();
467-
currentDiffTree.assertConsistency();
466+
currentVariationDiff = currentPatch.getVariationDiff();
467+
currentVariationDiff.assertConsistency();
468468

469-
runFilterHook(hooks.listIterator(), Hooks::analyzeDiffTree);
469+
runFilterHook(hooks.listIterator(), Hooks::analyzeVariationDiff);
470470
}
471471
}
472472

src/main/java/org/variantsync/diffdetective/analysis/AnalysisResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public AnalysisResult(final String repoName) {
128128
}
129129

130130
/**
131-
* Report errors (that for example occurred when parsing DiffTrees).
131+
* Report errors (that for example occurred when parsing VariationDiffs).
132132
* @param errors A list of errors to report.
133133
*/
134134
public void reportDiffErrors(final List<DiffError> errors) {

src/main/java/org/variantsync/diffdetective/analysis/EditClassOccurenceAnalysis.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public boolean beginCommit(Analysis analysis) {
4545
}
4646

4747
@Override
48-
public boolean analyzeDiffTree(Analysis analysis) throws IOException {
48+
public boolean analyzeVariationDiff(Analysis analysis) throws IOException {
4949
var editClassCounts = new LinkedHashMap<EditClass, Integer>();
5050
ProposedEditClasses.Instance.all().forEach(e -> editClassCounts.put(e, 0));
5151

52-
analysis.getCurrentDiffTree().forAll(node -> {
52+
analysis.getCurrentVariationDiff().forAll(node -> {
5353
if (node.isArtifact()) {
5454
final EditClass editClass = ProposedEditClasses.Instance.match(node);
5555

0 commit comments

Comments
 (0)