Search in sources :

Example 6 with ProductDecl

use of abs.frontend.ast.ProductDecl in project abstools by abstools.

the class ABSUnitTestCaseTranslator method buildProductLine.

void buildProductLine(ModuleDecl module) {
    if (deltas.isEmpty()) {
        return;
    }
    console("Generating product line description...");
    productline = new ProductLine();
    productline.setName(CONFIGURATION_NAME);
    Feature feature = new Feature();
    feature.setName(FEATURE_NAME);
    productline.addFeature(feature);
    AppCond ac = new AppCondFeature(FEATURE_NAME);
    Set<String> applicationConditions = new HashSet<String>();
    DeltaClause lastClause = null;
    for (DeltaWrapper d : deltas) {
        DeltaClause clause = new DeltaClause();
        Deltaspec spec = new Deltaspec();
        String name = d.getDelta().getName();
        spec.setDeltaID(name);
        clause.setDeltaspec(spec);
        clause.setAppCond(ac);
        if (d.isLast()) {
            lastClause = clause;
        } else {
            applicationConditions.add(name);
        }
        productline.addDeltaClause(clause);
    }
    if (lastClause != null) {
        for (String n : applicationConditions) {
            lastClause.addAfterDeltaID(new DeltaID(n));
        }
    }
    product = new ProductDecl();
    product.setName(PRODUCT_NAME);
    ProductFeatureSet featureSet = new ProductFeatureSet();
    featureSet.addFeature(feature);
    product.setProductExpr(featureSet);
}
Also used : ProductDecl(abs.frontend.ast.ProductDecl) ProductFeatureSet(abs.frontend.ast.ProductFeatureSet) Feature(abs.frontend.ast.Feature) AppCondFeature(abs.frontend.ast.AppCondFeature) AppCondFeature(abs.frontend.ast.AppCondFeature) DeltaClause(abs.frontend.ast.DeltaClause) DeltaWrapper(apet.absunit.DeltaForGetSetFieldsBuilder.DeltaWrapper) Deltaspec(abs.frontend.ast.Deltaspec) DeltaID(abs.frontend.ast.DeltaID) AppCond(abs.frontend.ast.AppCond) ProductLine(abs.frontend.ast.ProductLine) HashSet(java.util.HashSet)

Example 7 with ProductDecl

use of abs.frontend.ast.ProductDecl in project abstools by abstools.

the class DumpProducts method parse.

@Override
public Model parse(final String[] args) throws DeltaModellingException, IOException, WrongProgramArgumentException, ParserConfigurationException, InternalBackendException {
    Model m = super.parse(args);
    if (m.hasParserErrors()) {
        // Main.parse() already printed a list of parse errors in this case.
        throw new ParseException("Can't parse input.");
    }
    Iterator<ProductDecl> pi = m.getProductDecls().iterator();
    while (pi.hasNext()) {
        System.out.print(pi.next().getName());
        if (pi.hasNext())
            System.out.print(' ');
    }
    return m;
}
Also used : ProductDecl(abs.frontend.ast.ProductDecl) Model(abs.frontend.ast.Model)

Aggregations

ProductDecl (abs.frontend.ast.ProductDecl)7 Model (abs.frontend.ast.Model)6 ProductLine (abs.frontend.ast.ProductLine)3 Test (org.junit.Test)3 WrongProgramArgumentException (abs.common.WrongProgramArgumentException)1 FrontendTest (abs.frontend.FrontendTest)1 SemanticConditionList (abs.frontend.analyser.SemanticConditionList)1 SemanticError (abs.frontend.analyser.SemanticError)1 ASTNode (abs.frontend.ast.ASTNode)1 AppCond (abs.frontend.ast.AppCond)1 AppCondFeature (abs.frontend.ast.AppCondFeature)1 DeltaClause (abs.frontend.ast.DeltaClause)1 DeltaID (abs.frontend.ast.DeltaID)1 Deltaspec (abs.frontend.ast.Deltaspec)1 Feature (abs.frontend.ast.Feature)1 ProductFeatureSet (abs.frontend.ast.ProductFeatureSet)1 DeltaModellingException (abs.frontend.delta.DeltaModellingException)1 DeltaModellingWithNodeException (abs.frontend.delta.DeltaModellingWithNodeException)1 TypeCheckerException (abs.frontend.typechecker.TypeCheckerException)1 LocationType (abs.frontend.typechecker.locationtypes.LocationType)1