diff options
author | Kristóf Marussy <kris7topher@gmail.com> | 2019-06-08 19:17:34 -0400 |
---|---|---|
committer | Kristóf Marussy <kris7topher@gmail.com> | 2019-06-08 19:17:34 -0400 |
commit | b21af04ea821c3daa9ce8a6d26c63e9cd198f9a5 (patch) | |
tree | 4be566b25415ca97cb007b5da7d89f216ef515b2 /Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java | |
parent | Merge remote-tracking branch 'origin/master' into kris (diff) | |
download | VIATRA-Generator-b21af04ea821c3daa9ce8a6d26c63e9cd198f9a5.tar.gz VIATRA-Generator-b21af04ea821c3daa9ce8a6d26c63e9cd198f9a5.tar.zst VIATRA-Generator-b21af04ea821c3daa9ce8a6d26c63e9cd198f9a5.zip |
Trying to simplify Satellite case study
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java | 544 |
1 files changed, 0 insertions, 544 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java deleted file mode 100644 index 474719b2..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java +++ /dev/null | |||
@@ -1,544 +0,0 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.Collection; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Objects; | ||
12 | import java.util.Optional; | ||
13 | import java.util.Set; | ||
14 | import java.util.function.Consumer; | ||
15 | import java.util.stream.Collectors; | ||
16 | import java.util.stream.Stream; | ||
17 | import org.apache.log4j.Logger; | ||
18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
21 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
39 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
40 | |||
41 | /** | ||
42 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
43 | * | ||
44 | * <p>Original source: | ||
45 | * <code><pre> | ||
46 | * // Cost | ||
47 | * | ||
48 | * pattern costMetric(Cost : java Double) { | ||
49 | * Cost == sum find missionCost(_, #_); | ||
50 | * } | ||
51 | * </pre></code> | ||
52 | * | ||
53 | * @see Matcher | ||
54 | * @see Match | ||
55 | * | ||
56 | */ | ||
57 | @SuppressWarnings("all") | ||
58 | public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMetric.Matcher> { | ||
59 | /** | ||
60 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric pattern, | ||
61 | * to be used in conjunction with {@link Matcher}. | ||
62 | * | ||
63 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
64 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
65 | * usable to represent a match of the pattern in the result of a query, | ||
66 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
67 | * | ||
68 | * @see Matcher | ||
69 | * | ||
70 | */ | ||
71 | public static abstract class Match extends BasePatternMatch { | ||
72 | private Double fCost; | ||
73 | |||
74 | private static List<String> parameterNames = makeImmutableList("Cost"); | ||
75 | |||
76 | private Match(final Double pCost) { | ||
77 | this.fCost = pCost; | ||
78 | } | ||
79 | |||
80 | @Override | ||
81 | public Object get(final String parameterName) { | ||
82 | if ("Cost".equals(parameterName)) return this.fCost; | ||
83 | return null; | ||
84 | } | ||
85 | |||
86 | public Double getCost() { | ||
87 | return this.fCost; | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public boolean set(final String parameterName, final Object newValue) { | ||
92 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
93 | if ("Cost".equals(parameterName) ) { | ||
94 | this.fCost = (Double) newValue; | ||
95 | return true; | ||
96 | } | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | public void setCost(final Double pCost) { | ||
101 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
102 | this.fCost = pCost; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String patternName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> parameterNames() { | ||
112 | return CostMetric.Match.parameterNames; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Object[] toArray() { | ||
117 | return new Object[]{fCost}; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public CostMetric.Match toImmutable() { | ||
122 | return isMutable() ? newMatch(fCost) : this; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public String prettyPrint() { | ||
127 | StringBuilder result = new StringBuilder(); | ||
128 | result.append("\"Cost\"=" + prettyPrintValue(fCost)); | ||
129 | return result.toString(); | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public int hashCode() { | ||
134 | return Objects.hash(fCost); | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public boolean equals(final Object obj) { | ||
139 | if (this == obj) | ||
140 | return true; | ||
141 | if (obj == null) { | ||
142 | return false; | ||
143 | } | ||
144 | if ((obj instanceof CostMetric.Match)) { | ||
145 | CostMetric.Match other = (CostMetric.Match) obj; | ||
146 | return Objects.equals(fCost, other.fCost); | ||
147 | } else { | ||
148 | // this should be infrequent | ||
149 | if (!(obj instanceof IPatternMatch)) { | ||
150 | return false; | ||
151 | } | ||
152 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
153 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | @Override | ||
158 | public CostMetric specification() { | ||
159 | return CostMetric.instance(); | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * Returns an empty, mutable match. | ||
164 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
165 | * | ||
166 | * @return the empty match. | ||
167 | * | ||
168 | */ | ||
169 | public static CostMetric.Match newEmptyMatch() { | ||
170 | return new Mutable(null); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * Returns a mutable (partial) match. | ||
175 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
176 | * | ||
177 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
178 | * @return the new, mutable (partial) match object. | ||
179 | * | ||
180 | */ | ||
181 | public static CostMetric.Match newMutableMatch(final Double pCost) { | ||
182 | return new Mutable(pCost); | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | * Returns a new (partial) match. | ||
187 | * This can be used e.g. to call the matcher with a partial match. | ||
188 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
189 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
190 | * @return the (partial) match object. | ||
191 | * | ||
192 | */ | ||
193 | public static CostMetric.Match newMatch(final Double pCost) { | ||
194 | return new Immutable(pCost); | ||
195 | } | ||
196 | |||
197 | private static final class Mutable extends CostMetric.Match { | ||
198 | Mutable(final Double pCost) { | ||
199 | super(pCost); | ||
200 | } | ||
201 | |||
202 | @Override | ||
203 | public boolean isMutable() { | ||
204 | return true; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | private static final class Immutable extends CostMetric.Match { | ||
209 | Immutable(final Double pCost) { | ||
210 | super(pCost); | ||
211 | } | ||
212 | |||
213 | @Override | ||
214 | public boolean isMutable() { | ||
215 | return false; | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric pattern, | ||
222 | * providing pattern-specific query methods. | ||
223 | * | ||
224 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
225 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
226 | * | ||
227 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
228 | * | ||
229 | * <p>Original source: | ||
230 | * <code><pre> | ||
231 | * // Cost | ||
232 | * | ||
233 | * pattern costMetric(Cost : java Double) { | ||
234 | * Cost == sum find missionCost(_, #_); | ||
235 | * } | ||
236 | * </pre></code> | ||
237 | * | ||
238 | * @see Match | ||
239 | * @see CostMetric | ||
240 | * | ||
241 | */ | ||
242 | public static class Matcher extends BaseMatcher<CostMetric.Match> { | ||
243 | /** | ||
244 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
245 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
246 | * | ||
247 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
248 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
249 | * | ||
250 | */ | ||
251 | public static CostMetric.Matcher on(final ViatraQueryEngine engine) { | ||
252 | // check if matcher already exists | ||
253 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
254 | if (matcher == null) { | ||
255 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
256 | } | ||
257 | return matcher; | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
262 | * @return an initialized matcher | ||
263 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
264 | * | ||
265 | */ | ||
266 | public static CostMetric.Matcher create() { | ||
267 | return new Matcher(); | ||
268 | } | ||
269 | |||
270 | private static final int POSITION_COST = 0; | ||
271 | |||
272 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CostMetric.Matcher.class); | ||
273 | |||
274 | /** | ||
275 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
276 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
277 | * | ||
278 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
279 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
280 | * | ||
281 | */ | ||
282 | private Matcher() { | ||
283 | super(querySpecification()); | ||
284 | } | ||
285 | |||
286 | /** | ||
287 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
288 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
289 | * @return matches represented as a Match object. | ||
290 | * | ||
291 | */ | ||
292 | public Collection<CostMetric.Match> getAllMatches(final Double pCost) { | ||
293 | return rawStreamAllMatches(new Object[]{pCost}).collect(Collectors.toSet()); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
298 | * </p> | ||
299 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
300 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
301 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
302 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
303 | * @return a stream of matches represented as a Match object. | ||
304 | * | ||
305 | */ | ||
306 | public Stream<CostMetric.Match> streamAllMatches(final Double pCost) { | ||
307 | return rawStreamAllMatches(new Object[]{pCost}); | ||
308 | } | ||
309 | |||
310 | /** | ||
311 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
312 | * Neither determinism nor randomness of selection is guaranteed. | ||
313 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
314 | * @return a match represented as a Match object, or null if no match is found. | ||
315 | * | ||
316 | */ | ||
317 | public Optional<CostMetric.Match> getOneArbitraryMatch(final Double pCost) { | ||
318 | return rawGetOneArbitraryMatch(new Object[]{pCost}); | ||
319 | } | ||
320 | |||
321 | /** | ||
322 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
323 | * under any possible substitution of the unspecified parameters (if any). | ||
324 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
325 | * @return true if the input is a valid (partial) match of the pattern. | ||
326 | * | ||
327 | */ | ||
328 | public boolean hasMatch(final Double pCost) { | ||
329 | return rawHasMatch(new Object[]{pCost}); | ||
330 | } | ||
331 | |||
332 | /** | ||
333 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
334 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
335 | * @return the number of pattern matches found. | ||
336 | * | ||
337 | */ | ||
338 | public int countMatches(final Double pCost) { | ||
339 | return rawCountMatches(new Object[]{pCost}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
344 | * Neither determinism nor randomness of selection is guaranteed. | ||
345 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
346 | * @param processor the action that will process the selected match. | ||
347 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
348 | * | ||
349 | */ | ||
350 | public boolean forOneArbitraryMatch(final Double pCost, final Consumer<? super CostMetric.Match> processor) { | ||
351 | return rawForOneArbitraryMatch(new Object[]{pCost}, processor); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * Returns a new (partial) match. | ||
356 | * This can be used e.g. to call the matcher with a partial match. | ||
357 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
358 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
359 | * @return the (partial) match object. | ||
360 | * | ||
361 | */ | ||
362 | public CostMetric.Match newMatch(final Double pCost) { | ||
363 | return CostMetric.Match.newMatch(pCost); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Retrieve the set of values that occur in matches for Cost. | ||
368 | * @return the Set of all values or empty set if there are no matches | ||
369 | * | ||
370 | */ | ||
371 | protected Stream<Double> rawStreamAllValuesOfCost(final Object[] parameters) { | ||
372 | return rawStreamAllValues(POSITION_COST, parameters).map(Double.class::cast); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * Retrieve the set of values that occur in matches for Cost. | ||
377 | * @return the Set of all values or empty set if there are no matches | ||
378 | * | ||
379 | */ | ||
380 | public Set<Double> getAllValuesOfCost() { | ||
381 | return rawStreamAllValuesOfCost(emptyArray()).collect(Collectors.toSet()); | ||
382 | } | ||
383 | |||
384 | /** | ||
385 | * Retrieve the set of values that occur in matches for Cost. | ||
386 | * @return the Set of all values or empty set if there are no matches | ||
387 | * | ||
388 | */ | ||
389 | public Stream<Double> streamAllValuesOfCost() { | ||
390 | return rawStreamAllValuesOfCost(emptyArray()); | ||
391 | } | ||
392 | |||
393 | @Override | ||
394 | protected CostMetric.Match tupleToMatch(final Tuple t) { | ||
395 | try { | ||
396 | return CostMetric.Match.newMatch((Double) t.get(POSITION_COST)); | ||
397 | } catch(ClassCastException e) { | ||
398 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
399 | return null; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | @Override | ||
404 | protected CostMetric.Match arrayToMatch(final Object[] match) { | ||
405 | try { | ||
406 | return CostMetric.Match.newMatch((Double) match[POSITION_COST]); | ||
407 | } catch(ClassCastException e) { | ||
408 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
409 | return null; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | @Override | ||
414 | protected CostMetric.Match arrayToMatchMutable(final Object[] match) { | ||
415 | try { | ||
416 | return CostMetric.Match.newMutableMatch((Double) match[POSITION_COST]); | ||
417 | } catch(ClassCastException e) { | ||
418 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
419 | return null; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | /** | ||
424 | * @return the singleton instance of the query specification of this pattern | ||
425 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
426 | * | ||
427 | */ | ||
428 | public static IQuerySpecification<CostMetric.Matcher> querySpecification() { | ||
429 | return CostMetric.instance(); | ||
430 | } | ||
431 | } | ||
432 | |||
433 | private CostMetric() { | ||
434 | super(GeneratedPQuery.INSTANCE); | ||
435 | } | ||
436 | |||
437 | /** | ||
438 | * @return the singleton instance of the query specification | ||
439 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
440 | * | ||
441 | */ | ||
442 | public static CostMetric instance() { | ||
443 | try{ | ||
444 | return LazyHolder.INSTANCE; | ||
445 | } catch (ExceptionInInitializerError err) { | ||
446 | throw processInitializerError(err); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | @Override | ||
451 | protected CostMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
452 | return CostMetric.Matcher.on(engine); | ||
453 | } | ||
454 | |||
455 | @Override | ||
456 | public CostMetric.Matcher instantiate() { | ||
457 | return CostMetric.Matcher.create(); | ||
458 | } | ||
459 | |||
460 | @Override | ||
461 | public CostMetric.Match newEmptyMatch() { | ||
462 | return CostMetric.Match.newEmptyMatch(); | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | public CostMetric.Match newMatch(final Object... parameters) { | ||
467 | return CostMetric.Match.newMatch((java.lang.Double) parameters[0]); | ||
468 | } | ||
469 | |||
470 | /** | ||
471 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric (visibility: PUBLIC, simpleName: CostMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
472 | * <b>not</b> at the class load time of the outer class, | ||
473 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric (visibility: PUBLIC, simpleName: CostMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
474 | * | ||
475 | * <p> This workaround is required e.g. to support recursion. | ||
476 | * | ||
477 | */ | ||
478 | private static class LazyHolder { | ||
479 | private static final CostMetric INSTANCE = new CostMetric(); | ||
480 | |||
481 | /** | ||
482 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
483 | * This initialization order is required to support indirect recursion. | ||
484 | * | ||
485 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
486 | * | ||
487 | */ | ||
488 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
489 | |||
490 | public static Object ensureInitialized() { | ||
491 | INSTANCE.ensureInitializedInternal(); | ||
492 | return null; | ||
493 | } | ||
494 | } | ||
495 | |||
496 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
497 | private static final CostMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
498 | |||
499 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
500 | |||
501 | private final List<PParameter> parameters = Arrays.asList(parameter_Cost); | ||
502 | |||
503 | private GeneratedPQuery() { | ||
504 | super(PVisibility.PUBLIC); | ||
505 | } | ||
506 | |||
507 | @Override | ||
508 | public String getFullyQualifiedName() { | ||
509 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric"; | ||
510 | } | ||
511 | |||
512 | @Override | ||
513 | public List<String> getParameterNames() { | ||
514 | return Arrays.asList("Cost"); | ||
515 | } | ||
516 | |||
517 | @Override | ||
518 | public List<PParameter> getParameters() { | ||
519 | return parameters; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public Set<PBody> doGetContainedBodies() { | ||
524 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
525 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
526 | { | ||
527 | PBody body = new PBody(this); | ||
528 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
529 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
530 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
531 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
532 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
533 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
534 | )); | ||
535 | // Cost == sum find missionCost(_, #_) | ||
536 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
537 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), MissionCost.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
538 | new Equality(body, var_Cost, var__virtual_0_); | ||
539 | bodies.add(body); | ||
540 | } | ||
541 | return bodies; | ||
542 | } | ||
543 | } | ||
544 | } | ||