Skip to content

Commit aba58d8

Browse files
chore: remove outdated comments
1 parent 7d95562 commit aba58d8

1 file changed

Lines changed: 6 additions & 132 deletions

File tree

src/main/java/de/hub/mse/variantsync/boosting/TraceBoosting.java

Lines changed: 6 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,6 @@
2424
import java.util.stream.Collectors;
2525

2626
public class TraceBoosting {
27-
28-
/*
29-
* This is how mappings can be changed (if no changes are to be made, only do 1
30-
* and 7): 1.
31-
* create an object ecco_light of class TraceBoosting (it will initialize
32-
* products
33-
* automatically)
34-
* 2. after initializing, load the products using
35-
* loadProducts(ecco_light.getInputFolder(),
36-
* ecco_light.getInputFile()) 3a. choose a node from Product i using
37-
* products[i].getNodeFromPosition(position) and assign the mapping that fits
38-
* the position
39-
* (compare them by using position.isBefore(otherPosition) and
40-
* position.isAfter(otherPosition))
41-
* or 3b. go through all nodes using products[i].getAstNodes() and choose a
42-
* mapping for each
43-
* node by comparing node.getStartPosition() to your mapping's position (compare
44-
* them by using
45-
* position.isBefore(otherPosition) and position.isAfter(otherPosition)) 4. set
46-
* the mapping
47-
* (which must be of type Formula) for the chosen node using
48-
* node.setMapping(mapping) 5a. repeat
49-
* 3a and 4 until all mappings have been set 6. save the altered products using
50-
* saveProducts(products, ecco_light.getInputFolder(),
51-
* ecco_light.getInputFile()) 7. run the
52-
* algorithm by ecco_light.computeEcco();
53-
*/
54-
5527
private static final DNFFactorization dnf_simplifier_1 = new DNFFactorization();
5628
private static final DNFSubsumption dnf_simplifier_2 = new DNFSubsumption();
5729
public static FormulaFactory f = new FormulaFactory();
@@ -64,54 +36,16 @@ public class TraceBoosting {
6436
f.putConfiguration(builder.build());
6537
}
6638

67-
// scenario contains the name of the ArgoUML scenario, basDir contains the name
68-
// of the path
69-
// leading to the scenario
7039
private final List<ProductPassport> sourceLocations;
7140
private final ESupportedLanguages targetLanguage;
72-
// private Product[] eccoProducts;
73-
// short explanation: "DNF" for taking the DNF formula and consider every
74-
// clause, "CNF" for
75-
// taking the CNF formula and removing clauses containing disjunctions
7641
/*
77-
* long explanation: We have implemented two different ways of how ECCO chooses
78-
* features
79-
* associated with a piece of code. Each product has a unique configuration
80-
* (combination of
81-
* features that are present or not), which is represented as a conjunctive
82-
* formula of feature
83-
* literals. Option 1: Set mapping_calculation to "DNF" ECCO associates a piece
84-
* of code with a
85-
* configuration if and only if the code appears in a product with that
86-
* configuration. ECCO
87-
* takes the disjunction of the associated configurations, since the code
88-
* appears if either one
89-
* of them is present. ECCO simplifies the formula as a DNF formula and returns
90-
* that as the
91-
* mapping of the code. Now each clause of the mapping is a condition that
92-
* causes the peace of
93-
* code to appear. Option 2 (currently used): Set mapping_calculation to "CNF"
94-
* ECCO uses a
95-
* heuristic to simplify the mapping in a sensible way. As in option 1, ECCO
96-
* takes the
97-
* disjunction of the configurations associated with a piece of code. ECCO then
98-
* simplifies the
99-
* resulting formula to a CNF formula. If all clauses in the CNF formula contain
100-
* disjunctions,
101-
* ECCO sets the mapping to the simplified DNF formula as in option 1.
102-
* Otherwise, ECCO reduces
103-
* the formula to the conjunction of all simple clauses (clauses that contain no
104-
* disjunctions
105-
* and are therefore just literals) and returns that as the mapping.. In that
106-
* case, the mapping
107-
* consists of one condition that causes the piece of code to appear.
42+
* Set mapping_calculation to "CNF".
43+
* TraceBoosting uses a heuristic to simplify the mapping in a sensible way. As
44+
* in option 1, TraceBoosting takes the disjunction of the configurations
45+
* associated with a piece of code. TraceBoosting then simplifies the resulting
46+
* formula to a CNF formula.
10847
*/
10948
public String mapping_calculation = "CNF";
110-
// inputFolder contains the products object (inputFile) java needs (after they
111-
// have been
112-
// transformed into ASTs)
113-
// resultsFolder will contain the products object (resultsFile) with mappings
114-
// after running ECCO
11549
private String inputFolder, inputFile, resultsFolder, resultsFile;
11650
private final Path workingDir;
11751

@@ -162,34 +96,6 @@ public void saveProducts(final Product[] products, final String folderName) {
16296
Logger.info("Saved all products.");
16397
}
16498

165-
// public void saveProducts(
166-
// final List<Future<ProductInitializationTask.InitResult>> products,
167-
// final String folderName) {
168-
// final List<Future<?>> futures = new ArrayList<>(products.size());
169-
// try(ExecutorService threadPool = Executors.newFixedThreadPool(this.nThreads))
170-
// {
171-
// products.stream().map(f -> {
172-
// try {
173-
// return f.get();
174-
// } catch (final InterruptedException | ExecutionException e) {
175-
// Logger.error("Was not able to initialize product.", e);
176-
// throw new RuntimeException(e);
177-
// }
178-
// }).forEach(result -> {
179-
// final ProductSaveTask task = new ProductSaveTask(result.product, folderName,
180-
// result.id);
181-
// futures.add(threadPool.submit(task));
182-
// allFeatures.addAll(result.allFeatures);
183-
// });
184-
// wait(futures);
185-
// } catch (ExecutionException | InterruptedException e) {
186-
// Logger.error("threading: ", e);
187-
// throw new RuntimeException(e);
188-
// }
189-
// ProductSaveTask.resetProcessedCount();
190-
// Logger.info("Saved all products.");
191-
// }
192-
19399
public List<Product> getProducts() {
194100
// Multi-threaded loading of products
195101
if (!this.productInitTasks.isEmpty()) {
@@ -375,17 +281,6 @@ private static void sortOutputFiles(final String outputFolder) {
375281
}
376282
}
377283

378-
/*
379-
* for each class type node add Class qualified name for each method type node
380-
* add Method
381-
* qualified name for each statement node where class is non-solid add Class
382-
* qualified name plus
383-
* refinement tag for each statement node where method is non-solid add Method
384-
* qualified name
385-
* plus refinement tag (non-solid means that the class/method declaration in
386-
* which the node
387-
* appears does not have the same mapping)
388-
*/
389284
private static String getTrace(final ASTNode astNode, final Formula mapping) {
390285
final String result;
391286
if (astNode.getType() != ASTNode.NODE_TYPE.CLASS_OR_INTERFACE_DECLARATION
@@ -431,13 +326,6 @@ private static String getName(String suffix, final ASTNode astNode, boolean insi
431326
}
432327
}
433328

434-
// private <T extends Callable<V>, V> List<Future<V>> submitToThreadPool(final
435-
// List<T> tasks) {
436-
// final List<Future<V>> futures = new ArrayList<>(tasks.size());
437-
// tasks.forEach(t -> futures.add(threadPool.submit(t)));
438-
// return futures;
439-
// }
440-
441329
public void evaluate(final AbstractAST mainTree, final String outputFolder) {
442330
Logger.info("start evaluation");
443331
final Map<String, List<String>> fileToTraceMap = new HashMap<>();
@@ -478,7 +366,7 @@ public List<ProductInitializationTask> initialize() {
478366
return products;
479367
}
480368

481-
public MainTree computeEcco() {
369+
public MainTree computeMappings() {
482370
allFeatures = new EccoSet<>();
483371
final AbstractAST mainAST;
484372
switch (targetLanguage) {
@@ -542,7 +430,6 @@ private void assignProactiveTraces(EccoSet<Association> associations) {
542430
} else {
543431
// Do nothing. If there is no existing mapping, we do not know anything. If
544432
// there is more than one, we cannot decide.
545-
// TODO: Handle more than one mapping
546433
return 0;
547434
}
548435
}));
@@ -762,17 +649,9 @@ public EccoSet<Association> traceExtractionAlgorithm(final MainTree mainTree) {
762649
Logger.info("...done.");
763650
}
764651

765-
// I tried simplifying all associations at the end - instead of simplifying them
766-
// on the fly
767-
// - but it was much slower
768-
// TODO what does she mean by simplifying here?
769-
// maybe it was just inefficiently implemented?
770652
return associations;
771653
}
772654

773-
/**
774-
* Corresponds to f2m in paper.
775-
*/
776655
private static EccoSet<Module> featuresToModules(final EccoSet<Feature> positiveFeatures,
777656
final EccoSet<Feature> negativeFeatures) {
778657
final EccoSet<Module> result = new EccoSet<>();
@@ -797,11 +676,6 @@ private static EccoSet<Module> featuresToModules(final EccoSet<Feature> positive
797676
return result;
798677
}
799678

800-
/**
801-
* Corresponds to uM function in paper.
802-
*
803-
* @return updated module set
804-
*/
805679
private static EccoSet<Module> updateModules(final EccoSet<Module> moduleSet,
806680
final EccoSet<Feature> negativeFeatures) {
807681
final EccoSet<Module> result = new EccoSet<>();

0 commit comments

Comments
 (0)