|
53 | 53 | import de.hub.mse.variantsync.boosting.product.ProductPassport; |
54 | 54 | import de.hub.mse.variantsync.boosting.product.ProductSaveTask; |
55 | 55 |
|
| 56 | +/** |
| 57 | + * The {@code TraceBoosting} class encapsulates the algorithm for enhancing |
| 58 | + * retroactive feature tracing with proactively collected feature traces. |
| 59 | + * It is designed to work with a set of product variants and their associated |
| 60 | + * 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. |
| 63 | + * |
| 64 | + * <p> |
| 65 | + * Usage example: |
| 66 | + * </p> |
| 67 | + * |
| 68 | + * <pre>{@code |
| 69 | + * // Initialize a list to hold ProductPassport objects that describe the |
| 70 | + * // artifact locations for each variant |
| 71 | + * List<ProductPassport> productPassports = new ArrayList<>(); |
| 72 | + * // Iterate over the collection of variants |
| 73 | + * for (Variant variant : variants) { |
| 74 | + * String variantName = variant.getName(); |
| 75 | + * // Create a new ProductPassport for the variant and add it to the list |
| 76 | + * productPassports.add(new ProductPassport(variantName, |
| 77 | + * variantsDirectory.resolve(variantName), configFileMap.get(variantName))); |
| 78 | + * } |
| 79 | + * // Instantiate the TraceBoosting algorithm with the product passports, |
| 80 | + * // working directory, and the supported language for tracing. |
| 81 | + * // LINES creates a simple line-based AST that is language-agnostic. |
| 82 | + * TraceBoosting traceBoosting = new TraceBoosting(productPassports, |
| 83 | + * workingDirectory, ESupportedLanguages.LINES); |
| 84 | + * // Retrieve the list of products from the TraceBoosting instance |
| 85 | + * List<Product> products = traceBoosting.getProducts(); |
| 86 | + * // Apply the proactively collected traces to the products |
| 87 | + * distributeMappings(products, variantGenerationResult.variantGroundTruthMap(), |
| 88 | + * percentage, config.getStrip()); |
| 89 | + * // Compute the Main tree which represents the merged variant AST with feature |
| 90 | + * // traces |
| 91 | + * MainTree mainTree = traceBoosting.compute(); |
| 92 | + * }</pre> |
| 93 | + * |
| 94 | + * <p> |
| 95 | + * Note: The actual implementation of methods like {@code distributeMappings} |
| 96 | + * and {@code computeEcco} are not shown in this example and should be defined |
| 97 | + * elsewhere in the codebase. |
| 98 | + * </p> |
| 99 | + */ |
56 | 100 | public class TraceBoosting { |
57 | 101 |
|
58 | 102 | private static final DNFFactorization dnf_simplifier_1 = new DNFFactorization(); |
59 | 103 | private static final DNFSubsumption dnf_simplifier_2 = new DNFSubsumption(); |
60 | 104 | public static FormulaFactory f = new FormulaFactory(); |
| 105 | + |
| 106 | + /** |
| 107 | + * Static block to initialize the FormulaFactory object with a CNFConfig object |
| 108 | + * that specifies the simplification algorithm. |
| 109 | + */ |
61 | 110 | static { |
62 | 111 | final var builder = CNFConfig.builder(); |
63 | 112 | builder.algorithm(CNFConfig.Algorithm.FACTORIZATION); |
|
0 commit comments