Skip to content

Commit b1fe739

Browse files
committed
renaming package and refining comments
1 parent fa4c9f5 commit b1fe739

25 files changed

Lines changed: 107 additions & 103 deletions

src/main/java/de/hub/mse/variantsync/boosting/TraceBoosting.java renamed to src/main/java/org/variantsync/boosting/TraceBoosting.java

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.boosting;
1+
package org.variantsync.boosting;
22

33
import java.io.File;
44
import java.io.FileInputStream;
@@ -35,31 +35,31 @@
3535
import org.logicng.transformations.dnf.DNFSubsumption;
3636
import org.tinylog.Logger;
3737

38-
import de.hub.mse.variantsync.boosting.ecco.ASTNode;
39-
import de.hub.mse.variantsync.boosting.ecco.Association;
40-
import de.hub.mse.variantsync.boosting.ecco.EccoSet;
41-
import de.hub.mse.variantsync.boosting.ecco.Feature;
42-
import de.hub.mse.variantsync.boosting.ecco.MainTree;
43-
import de.hub.mse.variantsync.boosting.ecco.Module;
44-
import de.hub.mse.variantsync.boosting.parsing.AbstractAST;
45-
import de.hub.mse.variantsync.boosting.parsing.CAST;
46-
import de.hub.mse.variantsync.boosting.parsing.ESupportedLanguages;
47-
import de.hub.mse.variantsync.boosting.parsing.JavaAST;
48-
import de.hub.mse.variantsync.boosting.parsing.LineAST;
49-
import de.hub.mse.variantsync.boosting.product.Product;
50-
import de.hub.mse.variantsync.boosting.product.ProductInitializationTask;
51-
import de.hub.mse.variantsync.boosting.product.ProductLoadTask;
52-
import de.hub.mse.variantsync.boosting.product.ProductLoader;
53-
import de.hub.mse.variantsync.boosting.product.ProductPassport;
54-
import de.hub.mse.variantsync.boosting.product.ProductSaveTask;
38+
import org.variantsync.boosting.datastructure.ASTNode;
39+
import org.variantsync.boosting.datastructure.Association;
40+
import org.variantsync.boosting.datastructure.EccoSet;
41+
import org.variantsync.boosting.datastructure.Feature;
42+
import org.variantsync.boosting.datastructure.MainTree;
43+
import org.variantsync.boosting.datastructure.Module;
44+
import org.variantsync.boosting.parsing.AbstractAST;
45+
import org.variantsync.boosting.parsing.CAST;
46+
import org.variantsync.boosting.parsing.ESupportedLanguages;
47+
import org.variantsync.boosting.parsing.JavaAST;
48+
import org.variantsync.boosting.parsing.LineAST;
49+
import org.variantsync.boosting.product.Product;
50+
import org.variantsync.boosting.product.ProductInitializationTask;
51+
import org.variantsync.boosting.product.ProductLoadTask;
52+
import org.variantsync.boosting.product.ProductLoader;
53+
import org.variantsync.boosting.product.ProductPassport;
54+
import org.variantsync.boosting.product.ProductSaveTask;
5555

5656
/**
5757
* The {@code TraceBoosting} class encapsulates the algorithm for enhancing
58-
* retroactive feature tracing with proactively collected feature traces.
58+
* retroactive comparison-based feature tracing with proactively collected feature traces.
5959
* It is designed to work with a set of product variants and their associated
6060
* feature traces to produce a more accurate and efficient tracing process.
61-
* The algorithm is inspired by the ECCO tracing algorithm and is tailored to
62-
* improve upon it by utilizing additional trace information.
61+
* The algorithm is inspired by the <a href="https://jku-isse.github.io/ecco/">ECCO tracing algorithm</a>
62+
* and is tailored to improve it by utilizing additional trace information.
6363
*
6464
* <p>
6565
* Usage example:
@@ -69,31 +69,36 @@
6969
* // Initialize a list to hold ProductPassport objects that describe the
7070
* // artifact locations for each variant
7171
* List<ProductPassport> productPassports = new ArrayList<>();
72-
* // Iterate over the collection of variants
72+
*
73+
* // Iterate the collection of variants
7374
* for (Variant variant : variants) {
7475
* String variantName = variant.getName();
7576
* // Create a new ProductPassport for the variant and add it to the list
7677
* productPassports.add(new ProductPassport(variantName,
7778
* variantsDirectory.resolve(variantName), configFileMap.get(variantName)));
7879
* }
80+
*
7981
* // Instantiate the TraceBoosting algorithm with the product passports,
8082
* // working directory, and the supported language for tracing.
8183
* // LINES creates a simple line-based AST that is language-agnostic.
8284
* TraceBoosting traceBoosting = new TraceBoosting(productPassports,
8385
* workingDirectory, ESupportedLanguages.LINES);
86+
*
8487
* // Retrieve the list of products from the TraceBoosting instance
8588
* List<Product> products = traceBoosting.getProducts();
89+
*
8690
* // Apply the proactively collected traces to the products
8791
* distributeMappings(products, variantGenerationResult.variantGroundTruthMap(),
8892
* percentage, config.getStrip());
89-
* // Compute the Main tree which represents the merged variant AST with feature
90-
* // traces
93+
*
94+
* // Compute the main tree which represents the AST resulting from merging all variants
95+
* // together with feature traces
9196
* MainTree mainTree = traceBoosting.compute();
9297
* }</pre>
9398
*
9499
* <p>
95100
* Note: The actual implementation of methods like {@code distributeMappings}
96-
* and {@code computeEcco} are not shown in this example and should be defined
101+
* and {@code compute} are not shown in this example and should be defined
97102
* elsewhere in the codebase.
98103
* </p>
99104
*/
@@ -116,7 +121,7 @@ public class TraceBoosting {
116121
/**
117122
* Returns the FormulaFactory instance that is currently in use.
118123
*
119-
* @return the FormulaFactory instance that is is currently in use
124+
* @return the FormulaFactory instance that is currently in use
120125
*/
121126
public static FormulaFactory getFormulaFactory() {
122127
return f;
@@ -285,7 +290,7 @@ private static String getName(String suffix, final ASTNode astNode, boolean insi
285290
}
286291

287292
private static EccoSet<Module> featuresToModules(final EccoSet<Feature> positiveFeatures,
288-
final EccoSet<Feature> negativeFeatures) {
293+
final EccoSet<Feature> negativeFeatures) {
289294
final EccoSet<Module> result = new EccoSet<>();
290295
final EccoSet<EccoSet<Feature>> positivePowerSet = positiveFeatures.powerSet();
291296
final EccoSet<EccoSet<Feature>> negativePowerSet = negativeFeatures.powerSet();

src/main/java/de/hub/mse/variantsync/boosting/ecco/ASTNode.java renamed to src/main/java/org/variantsync/boosting/datastructure/ASTNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package de.hub.mse.variantsync.boosting.ecco;
1+
package org.variantsync.boosting.datastructure;
22

3-
import de.hub.mse.variantsync.boosting.TraceBoosting;
4-
import de.hub.mse.variantsync.boosting.position.Position;
3+
import org.variantsync.boosting.TraceBoosting;
4+
import org.variantsync.boosting.position.Position;
55

66
import org.logicng.formulas.FType;
77
import org.logicng.formulas.Formula;

src/main/java/de/hub/mse/variantsync/boosting/ecco/Association.java renamed to src/main/java/org/variantsync/boosting/datastructure/Association.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.boosting.ecco;
1+
package org.variantsync.boosting.datastructure;
22

33
import org.logicng.formulas.Formula;
44

@@ -49,7 +49,7 @@ public class Association {
4949
* @param astNodes the set of AST nodes associated with the modules
5050
*/
5151
public Association(final EccoSet<Module> min, final EccoSet<Module> all, final EccoSet<Module> max,
52-
final EccoSet<Module> not, final EccoSet<ASTNode> astNodes) {
52+
final EccoSet<Module> not, final EccoSet<ASTNode> astNodes) {
5353
this.min = new EccoSet<>(min);
5454
this.all = new EccoSet<>(all);
5555
this.max = new EccoSet<>(max);

src/main/java/de/hub/mse/variantsync/boosting/ecco/EccoSet.java renamed to src/main/java/org/variantsync/boosting/datastructure/EccoSet.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.boosting.ecco;
1+
package org.variantsync.boosting.datastructure;
22

33
import java.util.Collection;
44
import java.util.HashSet;
@@ -35,7 +35,7 @@ public void overwrite(final E element) {
3535
}
3636

3737
/**
38-
* Return a new set that is the union of this set and the given set
38+
* Returns a new set that is the union of this set and the given set
3939
*
4040
* @param toUnite The set to form the union with
4141
* @return A new set that contains the union of elements from this set and the
@@ -48,7 +48,7 @@ public EccoSet<E> unite(final EccoSet<E> toUnite) {
4848
}
4949

5050
/**
51-
* Return a new set that is the union of this set and the given set
51+
* Returns a new set that is the union of this set and the given set
5252
*
5353
* @param toUnite The set to form the union with
5454
* @return A new set that contains the union of elements from this set and the
@@ -61,7 +61,7 @@ public EccoSet<E> uniteElement(final E toUnite) {
6161
}
6262

6363
/**
64-
* Return a new set that contains all elements in this set after removing the
64+
* Returns a new set that contains all elements in this set after removing the
6565
* elements in the given set
6666
*
6767
* @param without The elements that should not be in the new set
@@ -75,7 +75,7 @@ public EccoSet<E> without(final EccoSet<E> without) {
7575
}
7676

7777
/**
78-
* Return a new set that contains all elements in this set after removing the
78+
* Returns a new set that contains all elements in this set after removing the
7979
* elements in the given set
8080
*
8181
* @param without The elements that should not be in the new set
@@ -89,7 +89,7 @@ public EccoSet<E> withoutElement(final E without) {
8989
}
9090

9191
/**
92-
* Return a new set that is an intersection between this set and the given set
92+
* Returns a new set that is an intersection between this set and the given set
9393
*
9494
* @param toIntersect set to intersect with
9595
* @return a new set with the elements that represent the intersection of both
@@ -102,7 +102,7 @@ public EccoSet<E> intersect(final EccoSet<E> toIntersect) {
102102
}
103103

104104
/**
105-
* Return a new set that is an intersection between this set and the given set
105+
* Returns a new set that is an intersection between this set and the given set
106106
*
107107
* @param toIntersect set to intersect with
108108
* @return a new set with the elements that represent the intersection of both

src/main/java/de/hub/mse/variantsync/boosting/ecco/Feature.java renamed to src/main/java/org/variantsync/boosting/datastructure/Feature.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.boosting.ecco;
1+
package org.variantsync.boosting.datastructure;
22

33
import java.io.Serializable;
44
import java.util.Objects;

src/main/java/de/hub/mse/variantsync/boosting/ecco/MainTree.java renamed to src/main/java/org/variantsync/boosting/datastructure/MainTree.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
package de.hub.mse.variantsync.boosting.ecco;
1+
package org.variantsync.boosting.datastructure;
22

3-
import de.hub.mse.variantsync.boosting.TraceBoosting;
4-
import de.hub.mse.variantsync.boosting.parsing.AbstractAST;
5-
import de.hub.mse.variantsync.boosting.position.ProductPosition;
6-
import de.hub.mse.variantsync.boosting.position.UnspecifiedPosition;
7-
import de.hub.mse.variantsync.boosting.product.Product;
3+
import org.variantsync.boosting.TraceBoosting;
4+
import org.variantsync.boosting.parsing.AbstractAST;
5+
import org.variantsync.boosting.position.ProductPosition;
6+
import org.variantsync.boosting.position.UnspecifiedPosition;
7+
import org.variantsync.boosting.product.Product;
88

99
import org.logicng.formulas.Formula;
1010

1111
import java.io.Serializable;
1212
import java.util.*;
1313

1414
/**
15-
* Represents the merged AST of several product ASTs.
15+
* The MainTree represents the AST resulting from merging several product ASTs.
1616
*/
1717
public class MainTree implements Serializable {
1818

@@ -21,7 +21,7 @@ public class MainTree implements Serializable {
2121
private Map<ProductPosition, ASTNode> inversePositionMap;
2222

2323
/**
24-
* Constructs a MainTree object with the given AbstractAST tree.
24+
* Initializes a MainTree object with the given AbstractAST tree.
2525
*
2626
* @param tree the AbstractAST tree to be set for this MainTree
2727
*/
@@ -32,8 +32,8 @@ public MainTree(final AbstractAST tree) {
3232
}
3333

3434
/**
35-
* Merge this Abstract Syntax Tree (AST) into another AST (main tree) and return
36-
* the set of all nodes
35+
* Merges the Abstract Syntax Tree (AST) of the given product into the of this
36+
* main AST (main tree) and returns the set of all nodes
3737
* in the resulting main tree corresponding to the nodes of this AST.
3838
*
3939
* @param product The product containing the main tree to merge this AST into.
@@ -60,7 +60,6 @@ private void uniteChildren(final EccoSet<ASTNode> result, final ASTNode productN
6060
// update mapping of the main tree node
6161
if (productChild.getMapping() != null) {
6262
// only if they are not the same, but
63-
// TODO how can we compare the formulas, better option than with string?
6463
if (mainTreeEquivalent.getMapping() != null && !mainTreeEquivalent.getMapping().toString()
6564
.equals(productChild.getMapping().toString())) {
6665
mainTreeEquivalent.setMapping(

src/main/java/de/hub/mse/variantsync/boosting/ecco/Module.java renamed to src/main/java/org/variantsync/boosting/datastructure/Module.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.boosting.ecco;
1+
package org.variantsync.boosting.datastructure;
22

33
import org.logicng.formulas.Literal;
44

src/main/java/de/hub/mse/variantsync/boosting/parsing/AbstractAST.java renamed to src/main/java/org/variantsync/boosting/parsing/AbstractAST.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package de.hub.mse.variantsync.boosting.parsing;
1+
package org.variantsync.boosting.parsing;
22

3-
import de.hub.mse.variantsync.boosting.ecco.ASTNode;
4-
import de.hub.mse.variantsync.boosting.ecco.EccoSet;
5-
import de.hub.mse.variantsync.boosting.position.FilePosition;
6-
import de.hub.mse.variantsync.boosting.position.RootPosition;
3+
import org.variantsync.boosting.datastructure.ASTNode;
4+
import org.variantsync.boosting.datastructure.EccoSet;
5+
import org.variantsync.boosting.position.FilePosition;
6+
import org.variantsync.boosting.position.RootPosition;
77

88
import java.io.File;
99
import java.io.Serializable;

src/main/java/de/hub/mse/variantsync/boosting/parsing/CAST.java renamed to src/main/java/org/variantsync/boosting/parsing/CAST.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package de.hub.mse.variantsync.boosting.parsing;
1+
package org.variantsync.boosting.parsing;
22

33
import java.io.File;
44

5-
import de.hub.mse.variantsync.boosting.ecco.ASTNode;
6-
import de.hub.mse.variantsync.boosting.ecco.EccoSet;
5+
import org.variantsync.boosting.datastructure.ASTNode;
6+
import org.variantsync.boosting.datastructure.EccoSet;
77

88
/**
99
* Represents a Syntax Tree (CAST) for C source code files.

src/main/java/de/hub/mse/variantsync/boosting/parsing/ESupportedLanguages.java renamed to src/main/java/org/variantsync/boosting/parsing/ESupportedLanguages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.boosting.parsing;
1+
package org.variantsync.boosting.parsing;
22

33
/**
44
* Enum representing supported programming languages.

0 commit comments

Comments
 (0)