diff options
author | 2019-08-01 18:38:15 +0200 | |
---|---|---|
committer | 2019-08-01 18:38:15 +0200 | |
commit | 6eb760ee960cd3efe51ca6e4107153c09838a1da (patch) | |
tree | 2edd0e21be50265f65f0cfd2fd43f18a252aef02 /Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.java | |
parent | Dump required Xbase version down to 2.17 (diff) | |
download | VIATRA-Generator-6eb760ee960cd3efe51ca6e4107153c09838a1da.tar.gz VIATRA-Generator-6eb760ee960cd3efe51ca6e4107153c09838a1da.tar.zst VIATRA-Generator-6eb760ee960cd3efe51ca6e4107153c09838a1da.zip |
Clean up CPS and Satellite domains
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.java | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.java deleted file mode 100644 index f089d469..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.java +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo; | ||
2 | |||
3 | import com.google.common.base.Objects; | ||
4 | import com.google.common.collect.ImmutableList; | ||
5 | import hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo.LocalSearchEngineManager; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries; | ||
7 | import org.eclipse.emf.ecore.EObject; | ||
8 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
9 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
10 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
11 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher; | ||
12 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
13 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | ||
14 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
15 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction; | ||
16 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution; | ||
17 | |||
18 | @SuppressWarnings("all") | ||
19 | public class PatternMatchConstraint implements IGuidanceFunction { | ||
20 | private static final String CONSTRAINT_ANNOTATION_NAME = "Constraint"; | ||
21 | |||
22 | private final ImmutableList<IQuerySpecification<?>> queries = ImmutableList.<IQuerySpecification<?>>copyOf(IterableExtensions.<IQuerySpecification<?>>filter(SatelliteQueries.instance().getSpecifications(), ((Function1<IQuerySpecification<?>, Boolean>) (IQuerySpecification<?> it) -> { | ||
23 | final Function1<PAnnotation, Boolean> _function = (PAnnotation it_1) -> { | ||
24 | String _name = it_1.getName(); | ||
25 | return Boolean.valueOf(Objects.equal(_name, PatternMatchConstraint.CONSTRAINT_ANNOTATION_NAME)); | ||
26 | }; | ||
27 | return Boolean.valueOf(IterableExtensions.<PAnnotation>exists(it.getAllAnnotations(), _function)); | ||
28 | }))); | ||
29 | |||
30 | @Override | ||
31 | public String getName() { | ||
32 | return "PatternMatch"; | ||
33 | } | ||
34 | |||
35 | @Override | ||
36 | public double computeFitness(final Solution solution) { | ||
37 | int _xblockexpression = (int) 0; | ||
38 | { | ||
39 | final EObject model = solution.getModel(); | ||
40 | final ViatraQueryEngine queryEngine = LocalSearchEngineManager.INSTANCE.getEngine(model); | ||
41 | int matchCount = 0; | ||
42 | for (final IQuerySpecification<?> query : this.queries) { | ||
43 | { | ||
44 | final ViatraQueryMatcher<? extends IPatternMatch> matcher = query.getMatcher(queryEngine); | ||
45 | int _matchCount = matchCount; | ||
46 | int _countMatches = matcher.countMatches(); | ||
47 | matchCount = (_matchCount + _countMatches); | ||
48 | } | ||
49 | } | ||
50 | _xblockexpression = matchCount; | ||
51 | } | ||
52 | return _xblockexpression; | ||
53 | } | ||
54 | } | ||