Skip to content

Commit f80925e

Browse files
committed
Use the term 'artifact' instead of 'code'
Note the American English spelling.
1 parent b7b7b81 commit f80925e

48 files changed

Lines changed: 159 additions & 158 deletions

Some content is hidden

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

STATUS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The `proofs` Haskell project provides an extended formal specification of our th
2828
The library is accompanied by a small demo application that shows an example test case for our proof for completeness, by creating a variation tree diff from two variation trees and re-projecting them.
2929

3030
## Claims
31-
We claim the _Artifacts Available_ badge as we made our artefacts publicly available on [Github][ddgithub] and [Zenodo][ddzenodo].
31+
We claim the _Artifacts Available_ badge as we made our artifacts publicly available on [Github][ddgithub] and [Zenodo][ddzenodo].
3232

3333
We claim the _Artifacts Evaluated Reusable_ badge as we implemented DiffDetective as a reusable library (see above).
3434
Furthermore, both DiffDetective and our Haskell formalization serve as reference implementations if researchers or practitioners want to reimplement our theory in other programming languages.

src/main/java/org/variantsync/diffdetective/diff/difftree/DiffNode.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class DiffNode {
7676
* @param nodeType The type of this node (i.e., mapping or artifact).
7777
* @param fromLines The starting line number of the corresponding text.
7878
* @param toLines The ending line number of the corresponding text.
79-
* @param featureMapping The formula stored in this node. Should be null for code (/artifact) nodes.
79+
* @param featureMapping The formula stored in this node. Should be null for artifact nodes.
8080
* @param label A text label containing information to identify the node (such as the corresponding source code).
8181
*/
8282
public DiffNode(DiffType diffType, NodeType nodeType,
@@ -123,16 +123,16 @@ public static DiffNode createRoot() {
123123
* For parameter descriptions, see {@link DiffNode#DiffNode(DiffType, NodeType, DiffLineNumber, DiffLineNumber, Node, String)}.
124124
* The <code>code</code> parameter will be set as the node's label.
125125
*/
126-
public static DiffNode createCode(DiffType diffType, DiffLineNumber fromLines, DiffLineNumber toLines, String code) {
127-
return new DiffNode(diffType, NodeType.CODE, fromLines, toLines, null, code);
126+
public static DiffNode createArtifact(DiffType diffType, DiffLineNumber fromLines, DiffLineNumber toLines, String code) {
127+
return new DiffNode(diffType, NodeType.ARTIFACT, fromLines, toLines, null, code);
128128
}
129129

130130
/**
131-
* The same as {@link DiffNode#createCode(DiffType, DiffLineNumber, DiffLineNumber, String)} but with the code for the label
131+
* The same as {@link DiffNode#createArtifact(DiffType, DiffLineNumber, DiffLineNumber, String)} but with the code for the label
132132
* given as a list of individual lines instead of a single String with linebreaks to identify newlines.
133133
*/
134-
public static DiffNode createCode(DiffType diffType, DiffLineNumber fromLines, DiffLineNumber toLines, List<String> lines) {
135-
return new DiffNode(diffType, NodeType.CODE, fromLines, toLines, null, lines);
134+
public static DiffNode createArtifact(DiffType diffType, DiffLineNumber fromLines, DiffLineNumber toLines, List<String> lines) {
135+
return new DiffNode(diffType, NodeType.ARTIFACT, fromLines, toLines, null, lines);
136136
}
137137

138138
/**
@@ -651,7 +651,7 @@ public Lines getLinesAfterEdit() {
651651

652652
/**
653653
* Returns the formula that is stored in this node.
654-
* The formula is null for artifact nodes (i.e., {@link NodeType#CODE}).
654+
* The formula is null for artifact nodes (i.e., {@link NodeType#ARTIFACT}).
655655
* The formula is not null for mapping nodes
656656
* @see NodeType#isAnnotation
657657
*/
@@ -693,7 +693,7 @@ public boolean isMultilineMacro() {
693693
* Returns the full feature mapping formula of this node.
694694
* The feature mapping of an {@link NodeType#IF} node is its {@link DiffNode#getDirectFeatureMapping direct feature mapping}.
695695
* The feature mapping of {@link NodeType#ELSE} and {@link NodeType#ELIF} nodes is determined by all formulas in the respective if-elif-else chain.
696-
* The feature mapping of an {@link NodeType#CODE artifact} node is the feature mapping of its parent.
696+
* The feature mapping of an {@link NodeType#ARTIFACT artifact} node is the feature mapping of its parent.
697697
* See Equation (1) in our paper (+ its extension to time for variation tree diffs described in Section 3.1).
698698
* @param parentOf Function that returns the parent of a node.
699699
* This function decides whether the before or after parent should be visited.
@@ -718,14 +718,14 @@ private List<Node> getFeatureMappingClauses(final Function<DiffNode, DiffNode> p
718718
and.add(negate(ancestor.getDirectFeatureMapping()));
719719
} else {
720720
throw new RuntimeException("Expected If or Elif above Else or Elif but got " + ancestor.nodeType + " from " + ancestor);
721-
// Assert.assertTrue(ancestor.isCode());
721+
// Assert.assertTrue(ancestor.isArtifact());
722722
}
723723
ancestor = parentOf.apply(ancestor);
724724
}
725725
and.add(negate(ancestor.getDirectFeatureMapping()));
726726

727727
return and;
728-
} else if (isCode()) {
728+
} else if (isArtifact()) {
729729
return parent.getFeatureMappingClauses(parentOf);
730730
}
731731

@@ -747,7 +747,7 @@ private Node getFeatureMapping(Function<DiffNode, DiffNode> parentOf) {
747747
* Returns the full feature mapping formula of this node before the edit.
748748
* The feature mapping of an {@link NodeType#IF} node is its {@link DiffNode#getDirectFeatureMapping direct feature mapping}.
749749
* The feature mapping of {@link NodeType#ELSE} and {@link NodeType#ELIF} nodes is determined by all formulas in the respective if-elif-else chain.
750-
* The feature mapping of an {@link NodeType#CODE artifact} node is the feature mapping of its parent.
750+
* The feature mapping of an {@link NodeType#ARTIFACT artifact} node is the feature mapping of its parent.
751751
* See Equation (1) in our paper (+ its extension to time for variation tree diffs described in Section 3.1).
752752
* @return The feature mapping of this node for the given parent edges.
753753
*/
@@ -759,7 +759,7 @@ public Node getBeforeFeatureMapping() {
759759
* Returns the full feature mapping formula of this node after the edit.
760760
* The feature mapping of an {@link NodeType#IF} node is its {@link DiffNode#getDirectFeatureMapping direct feature mapping}.
761761
* The feature mapping of {@link NodeType#ELSE} and {@link NodeType#ELIF} nodes is determined by all formulas in the respective if-elif-else chain.
762-
* The feature mapping of an {@link NodeType#CODE artifact} node is the feature mapping of its parent.
762+
* The feature mapping of an {@link NodeType#ARTIFACT artifact} node is the feature mapping of its parent.
763763
* See Equation (1) in our paper (+ its extension to time for variation tree diffs described in Section 3.1).
764764
* @return The feature mapping of this node for the given parent edges.
765765
*/
@@ -807,7 +807,7 @@ private List<Node> getPresenceCondition(Function<DiffNode, DiffNode> parentOf) {
807807
}
808808

809809
return clauses;
810-
} else if (isCode()) {
810+
} else if (isArtifact()) {
811811
return parent.getPresenceCondition(parentOf);
812812
}
813813

@@ -944,10 +944,10 @@ public boolean isIf() {
944944

945945
/**
946946
* Returns true if this node is an artifact node.
947-
* @see NodeType#CODE
947+
* @see NodeType#ARTIFACT
948948
*/
949-
public boolean isCode() {
950-
return this.nodeType.equals(NodeType.CODE);
949+
public boolean isArtifact() {
950+
return this.nodeType.equals(NodeType.ARTIFACT);
951951
}
952952

953953
/**
@@ -1127,7 +1127,7 @@ public String toTextDiff() {
11271127
@Override
11281128
public String toString() {
11291129
String s;
1130-
if (isCode()) {
1130+
if (isArtifact()) {
11311131
s = String.format("%s_%s from %d to %d", diffType, nodeType, from.inDiff, to.inDiff);
11321132
} else if (isRoot()) {
11331133
s = "ROOT";

src/main/java/org/variantsync/diffdetective/diff/difftree/DiffTree.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ public List<DiffNode> computeAllNodesThat(final Predicate<DiffNode> property) {
205205
* Returns all artifact nodes of this DiffTree.
206206
* @see DiffTree#computeAllNodesThat
207207
*/
208-
public List<DiffNode> computeCodeNodes() {
209-
return computeAllNodesThat(DiffNode::isCode);
208+
public List<DiffNode> computeArtifactNodes() {
209+
return computeAllNodesThat(DiffNode::isArtifact);
210210
}
211211

212212
/**

src/main/java/org/variantsync/diffdetective/diff/difftree/DiffType.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ public static DiffType thatExistsOnlyAt(Time time) {
3232

3333
/**
3434
* Runs the given procedure depending whether this diff types exists at the respective times.
35-
* Runs the first given procedure if the edited artefact existed before the edit (DiffType != ADD).
36-
* Runs the second given procedure if the edited artefact exists after the edit (DiffType != REM).
37-
* Note: Runs both procedures sequentially if the artefact was not edited and thus
35+
* Runs the first given procedure if the edited artifact existed before the edit (DiffType != ADD).
36+
* Runs the second given procedure if the edited artifact exists after the edit (DiffType != REM).
37+
* Note: Runs both procedures sequentially if the artifact was not edited and thus
3838
* exists before and after the edit (DiffType = NON).
39-
* @param ifExistsBefore Procedure to run if the edited artefact existed before the edit (DiffType != ADD).
40-
* @param ifExistsAfter Procedure to run if the edited artefact exists after the edit (DiffType != REM).
39+
* @param ifExistsBefore Procedure to run if the edited artifact existed before the edit (DiffType != ADD).
40+
* @param ifExistsAfter Procedure to run if the edited artifact exists after the edit (DiffType != REM).
4141
*/
4242
public void matchBeforeAfter(final Runnable ifExistsBefore, final Runnable ifExistsAfter) {
4343
if (this != DiffType.ADD) {
@@ -52,7 +52,7 @@ public void matchBeforeAfter(final Runnable ifExistsBefore, final Runnable ifExi
5252
* Runs the given task once for each argument that would exist at a certain time if it had this diff type.
5353
* Runs task on ifExistsBefore if the value existed before the edit (DiffType != ADD).
5454
* Runs task on ifExistsAfter if the value exists after the edit (DiffType != ADD).
55-
* Note: Runs task on both arguments sequentially if the artefact was not edited (DiffType == NON).
55+
* Note: Runs task on both arguments sequentially if the artifact was not edited (DiffType == NON).
5656
*
5757
* @param ifExistsBefore Argument that is valid if the diff did not add.
5858
* @param ifExistsAfter Argument that is valid if the edit did not remove.

src/main/java/org/variantsync/diffdetective/diff/difftree/NodeType.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public enum NodeType {
1414
ELSE("else"),
1515
ELIF("elif"),
1616

17-
// Code types
18-
CODE("code"),
17+
// Artifact types
18+
ARTIFACT("artifact"),
1919

2020
// Extra type for the root
2121
ROOT("ROOT");
@@ -36,7 +36,7 @@ public boolean isConditionalAnnotation() {
3636
* Returns true iff this node type represents a feature mapping.
3737
*/
3838
public boolean isAnnotation() {
39-
return this != ROOT && this != CODE;
39+
return this != ROOT && this != ARTIFACT;
4040
}
4141

4242
final static Pattern annotationRegex = Pattern.compile("^[+-]?\\s*#\\s*(if|endif|else|elif)");
@@ -61,7 +61,7 @@ public static NodeType ofDiffLine(String line) {
6161
}
6262
}
6363

64-
return CODE;
64+
return ARTIFACT;
6565
}
6666

6767
/**

src/main/java/org/variantsync/diffdetective/diff/difftree/filter/DiffTreeFilter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ public static TaggedPredicate<String, DiffTree> Any() {
2828

2929
/**
3030
* Returns a tagged predicate that returns true iff
31-
* the DiffTree has more than one artifact node ({@link DiffNode#isCode()}.
31+
* the DiffTree has more than one artifact node ({@link DiffNode#isArtifact()}.
3232
* The predicate is tagged with a String description of the predicate.
3333
*/
34-
public static TaggedPredicate<String, DiffTree> moreThanOneCodeNode() {
34+
public static TaggedPredicate<String, DiffTree> moreThanOneArtifactNode() {
3535
return new TaggedPredicate<>(
3636
"has more than one elementary pattern",
37-
tree -> tree.count(DiffNode::isCode) > 1
37+
tree -> tree.count(DiffNode::isArtifact) > 1
3838
);
3939
}
4040

@@ -64,7 +64,7 @@ public static TaggedPredicate<String, DiffTree> consistent() {
6464

6565
/**
6666
* Returns a tagged predicate that returns true iff
67-
* the DiffTree has at least one artifact node ({@link DiffNode#isCode()})
67+
* the DiffTree has at least one artifact node ({@link DiffNode#isArtifact()})
6868
* that does not match any pattern of
6969
* {@link org.variantsync.diffdetective.pattern.elementary.proposed.ProposedElementaryPatterns#AddToPC},
7070
* {@link org.variantsync.diffdetective.pattern.elementary.proposed.ProposedElementaryPatterns#RemFromPC},
@@ -75,7 +75,7 @@ public static TaggedPredicate<String, DiffTree> hasAtLeastOneEditToVariability()
7575
return new TaggedPredicate<>(
7676
"has edits to variability",
7777
tree -> tree.anyMatch(n ->
78-
n.isCode() && !AddToPC.matches(n) && !RemFromPC.matches(n) && !Untouched.matches(n)
78+
n.isArtifact() && !AddToPC.matches(n) && !RemFromPC.matches(n) && !Untouched.matches(n)
7979
)
8080
);
8181
}

src/main/java/org/variantsync/diffdetective/diff/difftree/parse/DiffNodeParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public DiffNode fromDiffLine(String diffLine) throws IllFormedAnnotationExceptio
3131
String label = diffLine.isEmpty() ? diffLine : diffLine.substring(1);
3232
Node featureMapping;
3333

34-
if (nodeType == NodeType.CODE || nodeType == NodeType.ENDIF || nodeType == NodeType.ELSE) {
34+
if (nodeType == NodeType.ARTIFACT || nodeType == NodeType.ENDIF || nodeType == NodeType.ELSE) {
3535
featureMapping = null;
3636
} else {
3737
featureMapping = annotationParser.parseDiffLine(diffLine);

src/main/java/org/variantsync/diffdetective/diff/difftree/parse/DiffTreeParser.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static DiffResult<DiffTree> createDiffTree(
5555
*
5656
* @param fullDiff The full diff of a patch obtained from a buffered reader.
5757
* @param collapseMultipleCodeLines Whether multiple consecutive code lines with the same diff type
58-
* should be collapsed into a single code node.
58+
* should be collapsed into a single artifact node.
5959
* @param ignoreEmptyLines Whether empty lines (no matter if they are added removed
6060
* or remained unchanged) should be ignored.
6161
* @param nodeParser The parser to parse individual lines in the diff to DiffNodes.
@@ -74,7 +74,7 @@ public static DiffResult<DiffTree> createDiffTree(
7474
final DiffLineNumber lineNo = new DiffLineNumber(0, 0, 0);
7575
final DiffLineNumber lastLineNo = DiffLineNumber.Copy(lineNo);
7676

77-
DiffNode lastCode = null;
77+
DiffNode lastArtifact = null;
7878
final AtomicReference<DiffResult<DiffTree>> error = new AtomicReference<>();
7979
final BiConsumer<DiffError, String> errorPropagation = (errType, message) -> {
8080
if (error.get() == null) {
@@ -115,8 +115,8 @@ public static DiffResult<DiffTree> createDiffTree(
115115

116116
switch (isMLMacro.type()) {
117117
case Success: {
118-
if (lastCode != null) {
119-
lastCode = endCodeBlock(lastCode, lastLineNo);
118+
if (lastArtifact != null) {
119+
lastArtifact = endCodeBlock(lastArtifact, lastLineNo);
120120
}
121121
// This line belongs to a multiline macro and was handled, so go to the next line.
122122
continue;
@@ -139,12 +139,12 @@ public static DiffResult<DiffTree> createDiffTree(
139139
}
140140

141141
// collapse multiple code lines
142-
if (lastCode != null) {
143-
if (collapseMultipleCodeLines && newNode.isCode() && lastCode.diffType.equals(newNode.diffType)) {
144-
lastCode.addLines(newNode.getLines());
142+
if (lastArtifact != null) {
143+
if (collapseMultipleCodeLines && newNode.isArtifact() && lastArtifact.diffType.equals(newNode.diffType)) {
144+
lastArtifact.addLines(newNode.getLines());
145145
continue;
146146
} else {
147-
lastCode = endCodeBlock(lastCode, lastLineNo);
147+
lastArtifact = endCodeBlock(lastArtifact, lastLineNo);
148148
}
149149
}
150150

@@ -154,8 +154,8 @@ public static DiffResult<DiffTree> createDiffTree(
154154
nodes.add(newNode);
155155
}
156156

157-
if (newNode.isCode()) {
158-
lastCode = newNode;
157+
if (newNode.isArtifact()) {
158+
lastArtifact = newNode;
159159
} else if (newNode.isEndif()) {
160160
final String currentLineFinal = currentLine;
161161
diffType.matchBeforeAfter(beforeStack, afterStack,
@@ -187,8 +187,8 @@ public static DiffResult<DiffTree> createDiffTree(
187187
return DiffResult.Failure(DiffError.NOT_ALL_ANNOTATIONS_CLOSED);
188188
}
189189

190-
if (lastCode != null) {
191-
lastCode = endCodeBlock(lastCode, lineNo);
190+
if (lastArtifact != null) {
191+
lastArtifact = endCodeBlock(lastArtifact, lineNo);
192192
}
193193

194194
endCodeBlock(root, lineNo);

src/main/java/org/variantsync/diffdetective/diff/difftree/parse/MultiLineMacroParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ParseResult consume(
103103
/* If this happens (at least) one of this happened
104104
* 1. Found line of a multiline macro without header at line " + line + "!
105105
* 2. Backslash in a comment.
106-
* 3. It is the head of a multiline #define macro that we classify as code.
106+
* 3. It is the head of a multiline #define macro that we classify as artifact.
107107
*
108108
* As 2 and 3 are most likely we just assume those.
109109
*/

src/main/java/org/variantsync/diffdetective/diff/difftree/serialize/TikzExporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void exportDiffTree(
9898
.joining(" \\\\ "));
9999

100100
output.format("%n\t\\node[%s, %s] (node_%s) at (%s) {};%n",
101-
node.isCode() ? "artefact" : "annotation",
101+
node.isArtifact() ? "artifact" : "annotation",
102102
node.getDiffType().toString().toLowerCase(Locale.ROOT),
103103
node.getID(),
104104
node.getID());

0 commit comments

Comments
 (0)