diff options
author | 2019-06-09 15:13:00 -0400 | |
---|---|---|
committer | 2019-06-09 15:13:00 -0400 | |
commit | cd63ccf6fba2a812a9b115635bbd209c92cebad0 (patch) | |
tree | 6f2a04b6fd274dffe6bb72c1afdf87989c0ba6db /Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.java | |
parent | Simplify satellite metamodel further (diff) | |
download | VIATRA-Generator-cd63ccf6fba2a812a9b115635bbd209c92cebad0.tar.gz VIATRA-Generator-cd63ccf6fba2a812a9b115635bbd209c92cebad0.tar.zst VIATRA-Generator-cd63ccf6fba2a812a9b115635bbd209c92cebad0.zip |
Bump MDEOptimizer version
https://github.com/mde-optimiser/mde_optimiser/issues/49
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.java new file mode 100644 index 00000000..18708a37 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.java | |||
@@ -0,0 +1,39 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries; | ||
4 | import java.util.WeakHashMap; | ||
5 | import java.util.function.Function; | ||
6 | import org.eclipse.emf.ecore.EObject; | ||
7 | import org.eclipse.viatra.query.runtime.api.AdvancedViatraQueryEngine; | ||
8 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
9 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions; | ||
10 | import org.eclipse.viatra.query.runtime.emf.EMFScope; | ||
11 | import org.eclipse.viatra.query.runtime.localsearch.matcher.integration.LocalSearchHints; | ||
12 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
13 | |||
14 | @SuppressWarnings("all") | ||
15 | public class LocalSearchEngineManager { | ||
16 | public static final LocalSearchEngineManager INSTANCE = new LocalSearchEngineManager(); | ||
17 | |||
18 | private final WeakHashMap<EObject, ViatraQueryEngine> engineMap = new WeakHashMap<EObject, ViatraQueryEngine>(); | ||
19 | |||
20 | private LocalSearchEngineManager() { | ||
21 | } | ||
22 | |||
23 | public ViatraQueryEngine getEngine(final EObject eObject) { | ||
24 | final Function<EObject, ViatraQueryEngine> _function = (EObject it) -> { | ||
25 | ViatraQueryEngine _xblockexpression = null; | ||
26 | { | ||
27 | final EMFScope scope = new EMFScope(it); | ||
28 | final QueryEvaluationHint localSearchHints = LocalSearchHints.getDefault().build(); | ||
29 | final ViatraQueryEngineOptions options = ViatraQueryEngineOptions.defineOptions().withDefaultHint(localSearchHints).withDefaultBackend( | ||
30 | localSearchHints.getQueryBackendFactory()).build(); | ||
31 | final ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope, options); | ||
32 | SatelliteQueries.instance().prepare(engine); | ||
33 | _xblockexpression = engine; | ||
34 | } | ||
35 | return _xblockexpression; | ||
36 | }; | ||
37 | return this.engineMap.computeIfAbsent(eObject, _function); | ||
38 | } | ||
39 | } | ||