blob: 638ec641025fec3402847798cf68c2337508b61a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
package tools.refinery.store.query.dse.internal;
import tools.refinery.store.adapter.AbstractModelAdapterBuilder;
import tools.refinery.store.model.ModelStore;
import tools.refinery.store.model.ModelStoreBuilder;
import tools.refinery.store.query.dnf.RelationalQuery;
import tools.refinery.store.query.dse.DesignSpaceExplorationBuilder;
import tools.refinery.store.query.dse.Strategy;
import tools.refinery.store.query.dse.objectives.Objective;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
public class DesignSpaceExplorationBuilderImpl
extends AbstractModelAdapterBuilder<DesignSpaceExplorationStoreAdapterImpl>
implements DesignSpaceExplorationBuilder {
private final LinkedHashSet<TransformationRule> transformationSpecifications = new LinkedHashSet<>();
private final LinkedHashSet<RelationalQuery> globalConstraints = new LinkedHashSet<>();
private final List<Objective> objectives = new LinkedList<>();
private Strategy strategy;
@Override
protected DesignSpaceExplorationStoreAdapterImpl doBuild(ModelStore store) {
return new DesignSpaceExplorationStoreAdapterImpl(store, transformationSpecifications, globalConstraints,
objectives, strategy);
}
@Override
public DesignSpaceExplorationBuilder transformation(TransformationRule transformationRule) {
checkNotConfigured();
transformationSpecifications.add(transformationRule);
return this;
}
@Override
public DesignSpaceExplorationBuilder globalConstraint(RelationalQuery globalConstraint) {
checkNotConfigured();
globalConstraints.add(globalConstraint);
return this;
}
@Override
public DesignSpaceExplorationBuilder objective(Objective objective) {
checkNotConfigured();
objectives.add(objective);
return this;
}
@Override
public DesignSpaceExplorationBuilder strategy(Strategy strategy) {
checkNotConfigured();
this.strategy = strategy;
return this;
}
@Override
protected void doConfigure(ModelStoreBuilder storeBuilder) {
storeBuilder.symbols(DesignSpaceExplorationAdapterImpl.NODE_COUNT_SYMBOL);
super.doConfigure(storeBuilder);
}
}
|