diff options
Diffstat (limited to 'subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/internal/DesignSpaceExplorationStoreAdapterImpl.java')
-rw-r--r-- | subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/internal/DesignSpaceExplorationStoreAdapterImpl.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/internal/DesignSpaceExplorationStoreAdapterImpl.java b/subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/internal/DesignSpaceExplorationStoreAdapterImpl.java new file mode 100644 index 00000000..3319e148 --- /dev/null +++ b/subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/internal/DesignSpaceExplorationStoreAdapterImpl.java | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.dse.transition.internal; | ||
7 | |||
8 | import tools.refinery.store.dse.transition.DesignSpaceExplorationStoreAdapter; | ||
9 | import tools.refinery.store.dse.transition.Transformation; | ||
10 | import tools.refinery.store.dse.transition.TransformationRule; | ||
11 | import tools.refinery.store.dse.transition.objectives.Criterion; | ||
12 | import tools.refinery.store.dse.transition.objectives.CriterionCalculator; | ||
13 | import tools.refinery.store.dse.transition.objectives.Objective; | ||
14 | import tools.refinery.store.dse.transition.objectives.ObjectiveCalculator; | ||
15 | import tools.refinery.store.model.Model; | ||
16 | import tools.refinery.store.model.ModelStore; | ||
17 | |||
18 | import java.util.List; | ||
19 | |||
20 | public class DesignSpaceExplorationStoreAdapterImpl implements DesignSpaceExplorationStoreAdapter { | ||
21 | protected final ModelStore store; | ||
22 | |||
23 | protected final List<TransformationRule> transformationRuleDefinitions; | ||
24 | protected final List<Criterion> accepts; | ||
25 | protected final List<Criterion> excludes; | ||
26 | protected final List<Objective> objectives; | ||
27 | |||
28 | public DesignSpaceExplorationStoreAdapterImpl(ModelStore store, | ||
29 | List<TransformationRule> transformationRuleDefinitions, | ||
30 | List<Criterion> accepts, List<Criterion> excludes, | ||
31 | List<Objective> objectives) { | ||
32 | this.store = store; | ||
33 | |||
34 | this.transformationRuleDefinitions = transformationRuleDefinitions; | ||
35 | this.accepts = accepts; | ||
36 | this.excludes = excludes; | ||
37 | this.objectives = objectives; | ||
38 | } | ||
39 | |||
40 | @Override | ||
41 | public ModelStore getStore() { | ||
42 | return store; | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | public DesignSpaceExplorationAdapterImpl createModelAdapter(Model model) { | ||
47 | final List<Transformation> t = this.transformationRuleDefinitions.stream().map(x->x.prepare(model)).toList(); | ||
48 | final List<CriterionCalculator> a = this.accepts.stream().map(x->x.createCalculator(model)).toList(); | ||
49 | final List<CriterionCalculator> e = this.excludes.stream().map(x->x.createCalculator(model)).toList(); | ||
50 | final List<ObjectiveCalculator> o = this.objectives.stream().map(x->x.createCalculator(model)).toList(); | ||
51 | |||
52 | return new DesignSpaceExplorationAdapterImpl(model, this, t, a, e, o); | ||
53 | } | ||
54 | @Override | ||
55 | public List<TransformationRule> getTransformations() { | ||
56 | return transformationRuleDefinitions; | ||
57 | } | ||
58 | @Override | ||
59 | public List<Criterion> getAccepts() { | ||
60 | return accepts; | ||
61 | } | ||
62 | @Override | ||
63 | public List<Criterion> getExcludes() { | ||
64 | return excludes; | ||
65 | } | ||
66 | @Override | ||
67 | public List<Objective> getObjectives() { | ||
68 | return objectives; | ||
69 | } | ||
70 | } | ||