diff options
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf')
37 files changed, 294 insertions, 7834 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore index cf45bfe0..f6cfd36a 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore | |||
@@ -24,3 +24,20 @@ | |||
24 | /.NoPotentialLinkToGroundStation.java._trace | 24 | /.NoPotentialLinkToGroundStation.java._trace |
25 | /.SmallSat.java._trace | 25 | /.SmallSat.java._trace |
26 | /CommunicationLinkDoesNotStartAtContainingElement.java | 26 | /CommunicationLinkDoesNotStartAtContainingElement.java |
27 | /CommunicationLoop.java | ||
28 | /CostMetric.java | ||
29 | /CoverageMetric.java | ||
30 | /CubeSatWithKaAntenna.java | ||
31 | /IncompatibleSourceAndTargetBand.java | ||
32 | /IncompatibleSourceAndTargetGain.java | ||
33 | /KaAntennaGainLow.java | ||
34 | /NoLinkToGroundStation.java | ||
35 | /NoPotentialLinkToGroundStation.java | ||
36 | /NotEnoughInterferometryPayloads.java | ||
37 | /SatelliteQueries.java | ||
38 | /SmallSat.java | ||
39 | /SpacecraftOfKind.java | ||
40 | /ThreeUCubeSatWithNonUhfCrossLink.java | ||
41 | /TimeMetric.java | ||
42 | /UhfAntennaGainNotLow.java | ||
43 | /XAntennaGainNotMedium.java | ||
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 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CoverageMetric.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CoverageMetric.java deleted file mode 100644 index 23b02ce4..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CoverageMetric.java +++ /dev/null | |||
@@ -1,552 +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.MissionCoverage; | ||
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 | * // | ||
47 | * // Metrics | ||
48 | * // | ||
49 | * | ||
50 | * // Coverage | ||
51 | * | ||
52 | * pattern coverageMetric(Coverage : java Double) { | ||
53 | * Coverage == sum find missionCoverage(_, #_); | ||
54 | * } | ||
55 | * </pre></code> | ||
56 | * | ||
57 | * @see Matcher | ||
58 | * @see Match | ||
59 | * | ||
60 | */ | ||
61 | @SuppressWarnings("all") | ||
62 | public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<CoverageMetric.Matcher> { | ||
63 | /** | ||
64 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric pattern, | ||
65 | * to be used in conjunction with {@link Matcher}. | ||
66 | * | ||
67 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
68 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
69 | * usable to represent a match of the pattern in the result of a query, | ||
70 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
71 | * | ||
72 | * @see Matcher | ||
73 | * | ||
74 | */ | ||
75 | public static abstract class Match extends BasePatternMatch { | ||
76 | private Double fCoverage; | ||
77 | |||
78 | private static List<String> parameterNames = makeImmutableList("Coverage"); | ||
79 | |||
80 | private Match(final Double pCoverage) { | ||
81 | this.fCoverage = pCoverage; | ||
82 | } | ||
83 | |||
84 | @Override | ||
85 | public Object get(final String parameterName) { | ||
86 | if ("Coverage".equals(parameterName)) return this.fCoverage; | ||
87 | return null; | ||
88 | } | ||
89 | |||
90 | public Double getCoverage() { | ||
91 | return this.fCoverage; | ||
92 | } | ||
93 | |||
94 | @Override | ||
95 | public boolean set(final String parameterName, final Object newValue) { | ||
96 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
97 | if ("Coverage".equals(parameterName) ) { | ||
98 | this.fCoverage = (Double) newValue; | ||
99 | return true; | ||
100 | } | ||
101 | return false; | ||
102 | } | ||
103 | |||
104 | public void setCoverage(final Double pCoverage) { | ||
105 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
106 | this.fCoverage = pCoverage; | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public String patternName() { | ||
111 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric"; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public List<String> parameterNames() { | ||
116 | return CoverageMetric.Match.parameterNames; | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public Object[] toArray() { | ||
121 | return new Object[]{fCoverage}; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public CoverageMetric.Match toImmutable() { | ||
126 | return isMutable() ? newMatch(fCoverage) : this; | ||
127 | } | ||
128 | |||
129 | @Override | ||
130 | public String prettyPrint() { | ||
131 | StringBuilder result = new StringBuilder(); | ||
132 | result.append("\"Coverage\"=" + prettyPrintValue(fCoverage)); | ||
133 | return result.toString(); | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public int hashCode() { | ||
138 | return Objects.hash(fCoverage); | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public boolean equals(final Object obj) { | ||
143 | if (this == obj) | ||
144 | return true; | ||
145 | if (obj == null) { | ||
146 | return false; | ||
147 | } | ||
148 | if ((obj instanceof CoverageMetric.Match)) { | ||
149 | CoverageMetric.Match other = (CoverageMetric.Match) obj; | ||
150 | return Objects.equals(fCoverage, other.fCoverage); | ||
151 | } else { | ||
152 | // this should be infrequent | ||
153 | if (!(obj instanceof IPatternMatch)) { | ||
154 | return false; | ||
155 | } | ||
156 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
157 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | @Override | ||
162 | public CoverageMetric specification() { | ||
163 | return CoverageMetric.instance(); | ||
164 | } | ||
165 | |||
166 | /** | ||
167 | * Returns an empty, mutable match. | ||
168 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
169 | * | ||
170 | * @return the empty match. | ||
171 | * | ||
172 | */ | ||
173 | public static CoverageMetric.Match newEmptyMatch() { | ||
174 | return new Mutable(null); | ||
175 | } | ||
176 | |||
177 | /** | ||
178 | * Returns a mutable (partial) match. | ||
179 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
180 | * | ||
181 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | ||
182 | * @return the new, mutable (partial) match object. | ||
183 | * | ||
184 | */ | ||
185 | public static CoverageMetric.Match newMutableMatch(final Double pCoverage) { | ||
186 | return new Mutable(pCoverage); | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * Returns a new (partial) match. | ||
191 | * This can be used e.g. to call the matcher with a partial match. | ||
192 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
193 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | ||
194 | * @return the (partial) match object. | ||
195 | * | ||
196 | */ | ||
197 | public static CoverageMetric.Match newMatch(final Double pCoverage) { | ||
198 | return new Immutable(pCoverage); | ||
199 | } | ||
200 | |||
201 | private static final class Mutable extends CoverageMetric.Match { | ||
202 | Mutable(final Double pCoverage) { | ||
203 | super(pCoverage); | ||
204 | } | ||
205 | |||
206 | @Override | ||
207 | public boolean isMutable() { | ||
208 | return true; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | private static final class Immutable extends CoverageMetric.Match { | ||
213 | Immutable(final Double pCoverage) { | ||
214 | super(pCoverage); | ||
215 | } | ||
216 | |||
217 | @Override | ||
218 | public boolean isMutable() { | ||
219 | return false; | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | |||
224 | /** | ||
225 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric pattern, | ||
226 | * providing pattern-specific query methods. | ||
227 | * | ||
228 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
229 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
230 | * | ||
231 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
232 | * | ||
233 | * <p>Original source: | ||
234 | * <code><pre> | ||
235 | * // | ||
236 | * // Metrics | ||
237 | * // | ||
238 | * | ||
239 | * // Coverage | ||
240 | * | ||
241 | * pattern coverageMetric(Coverage : java Double) { | ||
242 | * Coverage == sum find missionCoverage(_, #_); | ||
243 | * } | ||
244 | * </pre></code> | ||
245 | * | ||
246 | * @see Match | ||
247 | * @see CoverageMetric | ||
248 | * | ||
249 | */ | ||
250 | public static class Matcher extends BaseMatcher<CoverageMetric.Match> { | ||
251 | /** | ||
252 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
253 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
254 | * | ||
255 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
256 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
257 | * | ||
258 | */ | ||
259 | public static CoverageMetric.Matcher on(final ViatraQueryEngine engine) { | ||
260 | // check if matcher already exists | ||
261 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
262 | if (matcher == null) { | ||
263 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
264 | } | ||
265 | return matcher; | ||
266 | } | ||
267 | |||
268 | /** | ||
269 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
270 | * @return an initialized matcher | ||
271 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
272 | * | ||
273 | */ | ||
274 | public static CoverageMetric.Matcher create() { | ||
275 | return new Matcher(); | ||
276 | } | ||
277 | |||
278 | private static final int POSITION_COVERAGE = 0; | ||
279 | |||
280 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CoverageMetric.Matcher.class); | ||
281 | |||
282 | /** | ||
283 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
284 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
285 | * | ||
286 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
287 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
288 | * | ||
289 | */ | ||
290 | private Matcher() { | ||
291 | super(querySpecification()); | ||
292 | } | ||
293 | |||
294 | /** | ||
295 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
296 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | ||
297 | * @return matches represented as a Match object. | ||
298 | * | ||
299 | */ | ||
300 | public Collection<CoverageMetric.Match> getAllMatches(final Double pCoverage) { | ||
301 | return rawStreamAllMatches(new Object[]{pCoverage}).collect(Collectors.toSet()); | ||
302 | } | ||
303 | |||
304 | /** | ||
305 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
306 | * </p> | ||
307 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
308 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
309 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
310 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | ||
311 | * @return a stream of matches represented as a Match object. | ||
312 | * | ||
313 | */ | ||
314 | public Stream<CoverageMetric.Match> streamAllMatches(final Double pCoverage) { | ||
315 | return rawStreamAllMatches(new Object[]{pCoverage}); | ||
316 | } | ||
317 | |||
318 | /** | ||
319 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
320 | * Neither determinism nor randomness of selection is guaranteed. | ||
321 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | ||
322 | * @return a match represented as a Match object, or null if no match is found. | ||
323 | * | ||
324 | */ | ||
325 | public Optional<CoverageMetric.Match> getOneArbitraryMatch(final Double pCoverage) { | ||
326 | return rawGetOneArbitraryMatch(new Object[]{pCoverage}); | ||
327 | } | ||
328 | |||
329 | /** | ||
330 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
331 | * under any possible substitution of the unspecified parameters (if any). | ||
332 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | ||
333 | * @return true if the input is a valid (partial) match of the pattern. | ||
334 | * | ||
335 | */ | ||
336 | public boolean hasMatch(final Double pCoverage) { | ||
337 | return rawHasMatch(new Object[]{pCoverage}); | ||
338 | } | ||
339 | |||
340 | /** | ||
341 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
342 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | ||
343 | * @return the number of pattern matches found. | ||
344 | * | ||
345 | */ | ||
346 | public int countMatches(final Double pCoverage) { | ||
347 | return rawCountMatches(new Object[]{pCoverage}); | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
352 | * Neither determinism nor randomness of selection is guaranteed. | ||
353 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | ||
354 | * @param processor the action that will process the selected match. | ||
355 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
356 | * | ||
357 | */ | ||
358 | public boolean forOneArbitraryMatch(final Double pCoverage, final Consumer<? super CoverageMetric.Match> processor) { | ||
359 | return rawForOneArbitraryMatch(new Object[]{pCoverage}, processor); | ||
360 | } | ||
361 | |||
362 | /** | ||
363 | * Returns a new (partial) match. | ||
364 | * This can be used e.g. to call the matcher with a partial match. | ||
365 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
366 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | ||
367 | * @return the (partial) match object. | ||
368 | * | ||
369 | */ | ||
370 | public CoverageMetric.Match newMatch(final Double pCoverage) { | ||
371 | return CoverageMetric.Match.newMatch(pCoverage); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * Retrieve the set of values that occur in matches for Coverage. | ||
376 | * @return the Set of all values or empty set if there are no matches | ||
377 | * | ||
378 | */ | ||
379 | protected Stream<Double> rawStreamAllValuesOfCoverage(final Object[] parameters) { | ||
380 | return rawStreamAllValues(POSITION_COVERAGE, parameters).map(Double.class::cast); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * Retrieve the set of values that occur in matches for Coverage. | ||
385 | * @return the Set of all values or empty set if there are no matches | ||
386 | * | ||
387 | */ | ||
388 | public Set<Double> getAllValuesOfCoverage() { | ||
389 | return rawStreamAllValuesOfCoverage(emptyArray()).collect(Collectors.toSet()); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * Retrieve the set of values that occur in matches for Coverage. | ||
394 | * @return the Set of all values or empty set if there are no matches | ||
395 | * | ||
396 | */ | ||
397 | public Stream<Double> streamAllValuesOfCoverage() { | ||
398 | return rawStreamAllValuesOfCoverage(emptyArray()); | ||
399 | } | ||
400 | |||
401 | @Override | ||
402 | protected CoverageMetric.Match tupleToMatch(final Tuple t) { | ||
403 | try { | ||
404 | return CoverageMetric.Match.newMatch((Double) t.get(POSITION_COVERAGE)); | ||
405 | } catch(ClassCastException e) { | ||
406 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
407 | return null; | ||
408 | } | ||
409 | } | ||
410 | |||
411 | @Override | ||
412 | protected CoverageMetric.Match arrayToMatch(final Object[] match) { | ||
413 | try { | ||
414 | return CoverageMetric.Match.newMatch((Double) match[POSITION_COVERAGE]); | ||
415 | } catch(ClassCastException e) { | ||
416 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
417 | return null; | ||
418 | } | ||
419 | } | ||
420 | |||
421 | @Override | ||
422 | protected CoverageMetric.Match arrayToMatchMutable(final Object[] match) { | ||
423 | try { | ||
424 | return CoverageMetric.Match.newMutableMatch((Double) match[POSITION_COVERAGE]); | ||
425 | } catch(ClassCastException e) { | ||
426 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
427 | return null; | ||
428 | } | ||
429 | } | ||
430 | |||
431 | /** | ||
432 | * @return the singleton instance of the query specification of this pattern | ||
433 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
434 | * | ||
435 | */ | ||
436 | public static IQuerySpecification<CoverageMetric.Matcher> querySpecification() { | ||
437 | return CoverageMetric.instance(); | ||
438 | } | ||
439 | } | ||
440 | |||
441 | private CoverageMetric() { | ||
442 | super(GeneratedPQuery.INSTANCE); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * @return the singleton instance of the query specification | ||
447 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
448 | * | ||
449 | */ | ||
450 | public static CoverageMetric instance() { | ||
451 | try{ | ||
452 | return LazyHolder.INSTANCE; | ||
453 | } catch (ExceptionInInitializerError err) { | ||
454 | throw processInitializerError(err); | ||
455 | } | ||
456 | } | ||
457 | |||
458 | @Override | ||
459 | protected CoverageMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
460 | return CoverageMetric.Matcher.on(engine); | ||
461 | } | ||
462 | |||
463 | @Override | ||
464 | public CoverageMetric.Matcher instantiate() { | ||
465 | return CoverageMetric.Matcher.create(); | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | public CoverageMetric.Match newEmptyMatch() { | ||
470 | return CoverageMetric.Match.newEmptyMatch(); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public CoverageMetric.Match newMatch(final Object... parameters) { | ||
475 | return CoverageMetric.Match.newMatch((java.lang.Double) parameters[0]); | ||
476 | } | ||
477 | |||
478 | /** | ||
479 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric (visibility: PUBLIC, simpleName: CoverageMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric, 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 | ||
480 | * <b>not</b> at the class load time of the outer class, | ||
481 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric (visibility: PUBLIC, simpleName: CoverageMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
482 | * | ||
483 | * <p> This workaround is required e.g. to support recursion. | ||
484 | * | ||
485 | */ | ||
486 | private static class LazyHolder { | ||
487 | private static final CoverageMetric INSTANCE = new CoverageMetric(); | ||
488 | |||
489 | /** | ||
490 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
491 | * This initialization order is required to support indirect recursion. | ||
492 | * | ||
493 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
494 | * | ||
495 | */ | ||
496 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
497 | |||
498 | public static Object ensureInitialized() { | ||
499 | INSTANCE.ensureInitializedInternal(); | ||
500 | return null; | ||
501 | } | ||
502 | } | ||
503 | |||
504 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
505 | private static final CoverageMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
506 | |||
507 | private final PParameter parameter_Coverage = new PParameter("Coverage", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
508 | |||
509 | private final List<PParameter> parameters = Arrays.asList(parameter_Coverage); | ||
510 | |||
511 | private GeneratedPQuery() { | ||
512 | super(PVisibility.PUBLIC); | ||
513 | } | ||
514 | |||
515 | @Override | ||
516 | public String getFullyQualifiedName() { | ||
517 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric"; | ||
518 | } | ||
519 | |||
520 | @Override | ||
521 | public List<String> getParameterNames() { | ||
522 | return Arrays.asList("Coverage"); | ||
523 | } | ||
524 | |||
525 | @Override | ||
526 | public List<PParameter> getParameters() { | ||
527 | return parameters; | ||
528 | } | ||
529 | |||
530 | @Override | ||
531 | public Set<PBody> doGetContainedBodies() { | ||
532 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
533 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
534 | { | ||
535 | PBody body = new PBody(this); | ||
536 | PVariable var_Coverage = body.getOrCreateVariableByName("Coverage"); | ||
537 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
538 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
539 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Coverage), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
540 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
541 | new ExportedParameter(body, var_Coverage, parameter_Coverage) | ||
542 | )); | ||
543 | // Coverage == sum find missionCoverage(_, #_) | ||
544 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
545 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), MissionCoverage.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
546 | new Equality(body, var_Coverage, var__virtual_0_); | ||
547 | bodies.add(body); | ||
548 | } | ||
549 | return bodies; | ||
550 | } | ||
551 | } | ||
552 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java index b73cb23f..f372da70 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java | |||
@@ -16,7 +16,6 @@ import java.util.stream.Collectors; | |||
16 | import java.util.stream.Stream; | 16 | import java.util.stream.Stream; |
17 | import org.apache.log4j.Logger; | 17 | import org.apache.log4j.Logger; |
18 | import org.eclipse.emf.ecore.EClass; | 18 | import org.eclipse.emf.ecore.EClass; |
19 | import org.eclipse.emf.ecore.EDataType; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | 19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; |
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | 20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; |
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | 21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; |
@@ -25,7 +24,6 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificat | |||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | 24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; |
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | 25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; |
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | 26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
28 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | 27 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; |
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
@@ -35,7 +33,6 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterRe | |||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | 33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; |
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | 35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; |
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
@@ -55,7 +52,8 @@ import satellite.Spacecraft; | |||
55 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, | 52 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, |
56 | * message = "Only a Small Satellite can be configured with a Ka-band communication system.") | 53 | * message = "Only a Small Satellite can be configured with a Ka-band communication system.") |
57 | * pattern cubeSatWithKaAntenna(Spacecraft : Spacecraft) { | 54 | * pattern cubeSatWithKaAntenna(Spacecraft : Spacecraft) { |
58 | * CommunicatingElement.commSubsystem.band(Spacecraft, TransceiverBand::Ka); | 55 | * CommunicatingElement.commSubsystem(Spacecraft, Comm); |
56 | * KaCommSubsystem(Comm); | ||
59 | * neg find smallSat(Spacecraft); | 57 | * neg find smallSat(Spacecraft); |
60 | * } | 58 | * } |
61 | * </pre></code> | 59 | * </pre></code> |
@@ -243,7 +241,8 @@ public final class CubeSatWithKaAntenna extends BaseGeneratedEMFQuerySpecificati | |||
243 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, | 241 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, |
244 | * message = "Only a Small Satellite can be configured with a Ka-band communication system.") | 242 | * message = "Only a Small Satellite can be configured with a Ka-band communication system.") |
245 | * pattern cubeSatWithKaAntenna(Spacecraft : Spacecraft) { | 243 | * pattern cubeSatWithKaAntenna(Spacecraft : Spacecraft) { |
246 | * CommunicatingElement.commSubsystem.band(Spacecraft, TransceiverBand::Ka); | 244 | * CommunicatingElement.commSubsystem(Spacecraft, Comm); |
245 | * KaCommSubsystem(Comm); | ||
247 | * neg find smallSat(Spacecraft); | 246 | * neg find smallSat(Spacecraft); |
248 | * } | 247 | * } |
249 | * </pre></code> | 248 | * </pre></code> |
@@ -539,21 +538,19 @@ public final class CubeSatWithKaAntenna extends BaseGeneratedEMFQuerySpecificati | |||
539 | { | 538 | { |
540 | PBody body = new PBody(this); | 539 | PBody body = new PBody(this); |
541 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | 540 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); |
541 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); | ||
542 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | 542 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); |
543 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 543 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
544 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft) | 544 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft) |
545 | )); | 545 | )); |
546 | // CommunicatingElement.commSubsystem.band(Spacecraft, TransceiverBand::Ka) | 546 | // CommunicatingElement.commSubsystem(Spacecraft, Comm) |
547 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
548 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance()); | ||
549 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | 547 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
550 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | 548 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); |
551 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | 549 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); |
552 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 550 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); |
553 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | 551 | new Equality(body, var__virtual_0_, var_Comm); |
554 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | 552 | // KaCommSubsystem(Comm) |
555 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | 553 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "KaCommSubsystem"))); |
556 | new Equality(body, var__virtual_2_, var__virtual_0_); | ||
557 | // neg find smallSat(Spacecraft) | 554 | // neg find smallSat(Spacecraft) |
558 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft), SmallSat.instance().getInternalQueryRepresentation()); | 555 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft), SmallSat.instance().getInternalQueryRepresentation()); |
559 | bodies.add(body); | 556 | bodies.add(body); |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java index f2713f45..c9dd1e58 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java | |||
@@ -3,7 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | 4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; |
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem; |
7 | import java.util.Arrays; | 7 | import java.util.Arrays; |
8 | import java.util.Collection; | 8 | import java.util.Collection; |
9 | import java.util.LinkedHashSet; | 9 | import java.util.LinkedHashSet; |
@@ -16,7 +16,6 @@ import java.util.stream.Collectors; | |||
16 | import java.util.stream.Stream; | 16 | import java.util.stream.Stream; |
17 | import org.apache.log4j.Logger; | 17 | import org.apache.log4j.Logger; |
18 | import org.eclipse.emf.ecore.EClass; | 18 | import org.eclipse.emf.ecore.EClass; |
19 | import org.eclipse.emf.ecore.EDataType; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | 19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; |
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | 20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; |
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | 21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; |
@@ -25,7 +24,6 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificat | |||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | 24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; |
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | 25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; |
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | 26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
28 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | 27 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; |
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
@@ -56,8 +54,7 @@ import satellite.DirectedCommunicationLink; | |||
56 | * pattern incompatibleSourceAndTargetBand(Link : DirectedCommunicationLink) { | 54 | * pattern incompatibleSourceAndTargetBand(Link : DirectedCommunicationLink) { |
57 | * DirectedCommunicationLink.source(Link, SourceSubsystem); | 55 | * DirectedCommunicationLink.source(Link, SourceSubsystem); |
58 | * DirectedCommunicationLink.target(Link, TargetSubsystem); | 56 | * DirectedCommunicationLink.target(Link, TargetSubsystem); |
59 | * CommSubsystem.band(SourceSubsystem, Band); | 57 | * neg find matchingCommSubsystem(SourceSubsystem, TargetSubsystem); |
60 | * neg find commSubsystemBand(TargetSubsystem, Band); | ||
61 | * } | 58 | * } |
62 | * </pre></code> | 59 | * </pre></code> |
63 | * | 60 | * |
@@ -246,8 +243,7 @@ public final class IncompatibleSourceAndTargetBand extends BaseGeneratedEMFQuery | |||
246 | * pattern incompatibleSourceAndTargetBand(Link : DirectedCommunicationLink) { | 243 | * pattern incompatibleSourceAndTargetBand(Link : DirectedCommunicationLink) { |
247 | * DirectedCommunicationLink.source(Link, SourceSubsystem); | 244 | * DirectedCommunicationLink.source(Link, SourceSubsystem); |
248 | * DirectedCommunicationLink.target(Link, TargetSubsystem); | 245 | * DirectedCommunicationLink.target(Link, TargetSubsystem); |
249 | * CommSubsystem.band(SourceSubsystem, Band); | 246 | * neg find matchingCommSubsystem(SourceSubsystem, TargetSubsystem); |
250 | * neg find commSubsystemBand(TargetSubsystem, Band); | ||
251 | * } | 247 | * } |
252 | * </pre></code> | 248 | * </pre></code> |
253 | * | 249 | * |
@@ -544,7 +540,6 @@ public final class IncompatibleSourceAndTargetBand extends BaseGeneratedEMFQuery | |||
544 | PVariable var_Link = body.getOrCreateVariableByName("Link"); | 540 | PVariable var_Link = body.getOrCreateVariableByName("Link"); |
545 | PVariable var_SourceSubsystem = body.getOrCreateVariableByName("SourceSubsystem"); | 541 | PVariable var_SourceSubsystem = body.getOrCreateVariableByName("SourceSubsystem"); |
546 | PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem"); | 542 | PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem"); |
547 | PVariable var_Band = body.getOrCreateVariableByName("Band"); | ||
548 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | 543 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); |
549 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 544 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
550 | new ExportedParameter(body, var_Link, parameter_Link) | 545 | new ExportedParameter(body, var_Link, parameter_Link) |
@@ -561,14 +556,8 @@ public final class IncompatibleSourceAndTargetBand extends BaseGeneratedEMFQuery | |||
561 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); | 556 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); |
562 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 557 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); |
563 | new Equality(body, var__virtual_1_, var_TargetSubsystem); | 558 | new Equality(body, var__virtual_1_, var_TargetSubsystem); |
564 | // CommSubsystem.band(SourceSubsystem, Band) | 559 | // neg find matchingCommSubsystem(SourceSubsystem, TargetSubsystem) |
565 | new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 560 | new NegativePatternCall(body, Tuples.flatTupleOf(var_SourceSubsystem, var_TargetSubsystem), MatchingCommSubsystem.instance().getInternalQueryRepresentation()); |
566 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
567 | new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
568 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
569 | new Equality(body, var__virtual_2_, var_Band); | ||
570 | // neg find commSubsystemBand(TargetSubsystem, Band) | ||
571 | new NegativePatternCall(body, Tuples.flatTupleOf(var_TargetSubsystem, var_Band), CommSubsystemBand.instance().getInternalQueryRepresentation()); | ||
572 | bodies.add(body); | 561 | bodies.add(body); |
573 | } | 562 | } |
574 | { | 563 | { |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetGain.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetGain.java deleted file mode 100644 index 33a4b067..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetGain.java +++ /dev/null | |||
@@ -1,582 +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.CommSubsystemGain; | ||
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.emf.ecore.EClass; | ||
19 | import org.eclipse.emf.ecore.EDataType; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
44 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
45 | import satellite.DirectedCommunicationLink; | ||
46 | |||
47 | /** | ||
48 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
49 | * | ||
50 | * <p>Original source: | ||
51 | * <code><pre> | ||
52 | * {@literal @}Constraint(severity = "error", key = {Link}, | ||
53 | * message = "Two ends of a communication link must use the same antenna gain.") | ||
54 | * pattern incompatibleSourceAndTargetGain(Link : DirectedCommunicationLink) { | ||
55 | * DirectedCommunicationLink.source(Link, SourceSubsystem); | ||
56 | * DirectedCommunicationLink.target(Link, TargetSubsystem); | ||
57 | * CommSubsystem.gain(SourceSubsystem, Gain); | ||
58 | * neg find commSubsystemGain(TargetSubsystem, Gain); | ||
59 | * } | ||
60 | * </pre></code> | ||
61 | * | ||
62 | * @see Matcher | ||
63 | * @see Match | ||
64 | * | ||
65 | */ | ||
66 | @SuppressWarnings("all") | ||
67 | public final class IncompatibleSourceAndTargetGain extends BaseGeneratedEMFQuerySpecification<IncompatibleSourceAndTargetGain.Matcher> { | ||
68 | /** | ||
69 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetGain pattern, | ||
70 | * to be used in conjunction with {@link Matcher}. | ||
71 | * | ||
72 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
73 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
74 | * usable to represent a match of the pattern in the result of a query, | ||
75 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
76 | * | ||
77 | * @see Matcher | ||
78 | * | ||
79 | */ | ||
80 | public static abstract class Match extends BasePatternMatch { | ||
81 | private DirectedCommunicationLink fLink; | ||
82 | |||
83 | private static List<String> parameterNames = makeImmutableList("Link"); | ||
84 | |||
85 | private Match(final DirectedCommunicationLink pLink) { | ||
86 | this.fLink = pLink; | ||
87 | } | ||
88 | |||
89 | @Override | ||
90 | public Object get(final String parameterName) { | ||
91 | if ("Link".equals(parameterName)) return this.fLink; | ||
92 | return null; | ||
93 | } | ||
94 | |||
95 | public DirectedCommunicationLink getLink() { | ||
96 | return this.fLink; | ||
97 | } | ||
98 | |||
99 | @Override | ||
100 | public boolean set(final String parameterName, final Object newValue) { | ||
101 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
102 | if ("Link".equals(parameterName) ) { | ||
103 | this.fLink = (DirectedCommunicationLink) newValue; | ||
104 | return true; | ||
105 | } | ||
106 | return false; | ||
107 | } | ||
108 | |||
109 | public void setLink(final DirectedCommunicationLink pLink) { | ||
110 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
111 | this.fLink = pLink; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public String patternName() { | ||
116 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetGain"; | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public List<String> parameterNames() { | ||
121 | return IncompatibleSourceAndTargetGain.Match.parameterNames; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public Object[] toArray() { | ||
126 | return new Object[]{fLink}; | ||
127 | } | ||
128 | |||
129 | @Override | ||
130 | public IncompatibleSourceAndTargetGain.Match toImmutable() { | ||
131 | return isMutable() ? newMatch(fLink) : this; | ||
132 | } | ||
133 | |||
134 | @Override | ||
135 | public String prettyPrint() { | ||
136 | StringBuilder result = new StringBuilder(); | ||
137 | result.append("\"Link\"=" + prettyPrintValue(fLink)); | ||
138 | return result.toString(); | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public int hashCode() { | ||
143 | return Objects.hash(fLink); | ||
144 | } | ||
145 | |||
146 | @Override | ||
147 | public boolean equals(final Object obj) { | ||
148 | if (this == obj) | ||
149 | return true; | ||
150 | if (obj == null) { | ||
151 | return false; | ||
152 | } | ||
153 | if ((obj instanceof IncompatibleSourceAndTargetGain.Match)) { | ||
154 | IncompatibleSourceAndTargetGain.Match other = (IncompatibleSourceAndTargetGain.Match) obj; | ||
155 | return Objects.equals(fLink, other.fLink); | ||
156 | } else { | ||
157 | // this should be infrequent | ||
158 | if (!(obj instanceof IPatternMatch)) { | ||
159 | return false; | ||
160 | } | ||
161 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
162 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
163 | } | ||
164 | } | ||
165 | |||
166 | @Override | ||
167 | public IncompatibleSourceAndTargetGain specification() { | ||
168 | return IncompatibleSourceAndTargetGain.instance(); | ||
169 | } | ||
170 | |||
171 | /** | ||
172 | * Returns an empty, mutable match. | ||
173 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
174 | * | ||
175 | * @return the empty match. | ||
176 | * | ||
177 | */ | ||
178 | public static IncompatibleSourceAndTargetGain.Match newEmptyMatch() { | ||
179 | return new Mutable(null); | ||
180 | } | ||
181 | |||
182 | /** | ||
183 | * Returns a mutable (partial) match. | ||
184 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
185 | * | ||
186 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
187 | * @return the new, mutable (partial) match object. | ||
188 | * | ||
189 | */ | ||
190 | public static IncompatibleSourceAndTargetGain.Match newMutableMatch(final DirectedCommunicationLink pLink) { | ||
191 | return new Mutable(pLink); | ||
192 | } | ||
193 | |||
194 | /** | ||
195 | * Returns a new (partial) match. | ||
196 | * This can be used e.g. to call the matcher with a partial match. | ||
197 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
198 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
199 | * @return the (partial) match object. | ||
200 | * | ||
201 | */ | ||
202 | public static IncompatibleSourceAndTargetGain.Match newMatch(final DirectedCommunicationLink pLink) { | ||
203 | return new Immutable(pLink); | ||
204 | } | ||
205 | |||
206 | private static final class Mutable extends IncompatibleSourceAndTargetGain.Match { | ||
207 | Mutable(final DirectedCommunicationLink pLink) { | ||
208 | super(pLink); | ||
209 | } | ||
210 | |||
211 | @Override | ||
212 | public boolean isMutable() { | ||
213 | return true; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | private static final class Immutable extends IncompatibleSourceAndTargetGain.Match { | ||
218 | Immutable(final DirectedCommunicationLink pLink) { | ||
219 | super(pLink); | ||
220 | } | ||
221 | |||
222 | @Override | ||
223 | public boolean isMutable() { | ||
224 | return false; | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | |||
229 | /** | ||
230 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetGain pattern, | ||
231 | * providing pattern-specific query methods. | ||
232 | * | ||
233 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
234 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
235 | * | ||
236 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
237 | * | ||
238 | * <p>Original source: | ||
239 | * <code><pre> | ||
240 | * {@literal @}Constraint(severity = "error", key = {Link}, | ||
241 | * message = "Two ends of a communication link must use the same antenna gain.") | ||
242 | * pattern incompatibleSourceAndTargetGain(Link : DirectedCommunicationLink) { | ||
243 | * DirectedCommunicationLink.source(Link, SourceSubsystem); | ||
244 | * DirectedCommunicationLink.target(Link, TargetSubsystem); | ||
245 | * CommSubsystem.gain(SourceSubsystem, Gain); | ||
246 | * neg find commSubsystemGain(TargetSubsystem, Gain); | ||
247 | * } | ||
248 | * </pre></code> | ||
249 | * | ||
250 | * @see Match | ||
251 | * @see IncompatibleSourceAndTargetGain | ||
252 | * | ||
253 | */ | ||
254 | public static class Matcher extends BaseMatcher<IncompatibleSourceAndTargetGain.Match> { | ||
255 | /** | ||
256 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
257 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
258 | * | ||
259 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
260 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
261 | * | ||
262 | */ | ||
263 | public static IncompatibleSourceAndTargetGain.Matcher on(final ViatraQueryEngine engine) { | ||
264 | // check if matcher already exists | ||
265 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
266 | if (matcher == null) { | ||
267 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
268 | } | ||
269 | return matcher; | ||
270 | } | ||
271 | |||
272 | /** | ||
273 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
274 | * @return an initialized matcher | ||
275 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
276 | * | ||
277 | */ | ||
278 | public static IncompatibleSourceAndTargetGain.Matcher create() { | ||
279 | return new Matcher(); | ||
280 | } | ||
281 | |||
282 | private static final int POSITION_LINK = 0; | ||
283 | |||
284 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(IncompatibleSourceAndTargetGain.Matcher.class); | ||
285 | |||
286 | /** | ||
287 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
288 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
289 | * | ||
290 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
291 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
292 | * | ||
293 | */ | ||
294 | private Matcher() { | ||
295 | super(querySpecification()); | ||
296 | } | ||
297 | |||
298 | /** | ||
299 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
300 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
301 | * @return matches represented as a Match object. | ||
302 | * | ||
303 | */ | ||
304 | public Collection<IncompatibleSourceAndTargetGain.Match> getAllMatches(final DirectedCommunicationLink pLink) { | ||
305 | return rawStreamAllMatches(new Object[]{pLink}).collect(Collectors.toSet()); | ||
306 | } | ||
307 | |||
308 | /** | ||
309 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
310 | * </p> | ||
311 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
312 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
313 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
314 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
315 | * @return a stream of matches represented as a Match object. | ||
316 | * | ||
317 | */ | ||
318 | public Stream<IncompatibleSourceAndTargetGain.Match> streamAllMatches(final DirectedCommunicationLink pLink) { | ||
319 | return rawStreamAllMatches(new Object[]{pLink}); | ||
320 | } | ||
321 | |||
322 | /** | ||
323 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
324 | * Neither determinism nor randomness of selection is guaranteed. | ||
325 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
326 | * @return a match represented as a Match object, or null if no match is found. | ||
327 | * | ||
328 | */ | ||
329 | public Optional<IncompatibleSourceAndTargetGain.Match> getOneArbitraryMatch(final DirectedCommunicationLink pLink) { | ||
330 | return rawGetOneArbitraryMatch(new Object[]{pLink}); | ||
331 | } | ||
332 | |||
333 | /** | ||
334 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
335 | * under any possible substitution of the unspecified parameters (if any). | ||
336 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
337 | * @return true if the input is a valid (partial) match of the pattern. | ||
338 | * | ||
339 | */ | ||
340 | public boolean hasMatch(final DirectedCommunicationLink pLink) { | ||
341 | return rawHasMatch(new Object[]{pLink}); | ||
342 | } | ||
343 | |||
344 | /** | ||
345 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
346 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
347 | * @return the number of pattern matches found. | ||
348 | * | ||
349 | */ | ||
350 | public int countMatches(final DirectedCommunicationLink pLink) { | ||
351 | return rawCountMatches(new Object[]{pLink}); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
356 | * Neither determinism nor randomness of selection is guaranteed. | ||
357 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
358 | * @param processor the action that will process the selected match. | ||
359 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
360 | * | ||
361 | */ | ||
362 | public boolean forOneArbitraryMatch(final DirectedCommunicationLink pLink, final Consumer<? super IncompatibleSourceAndTargetGain.Match> processor) { | ||
363 | return rawForOneArbitraryMatch(new Object[]{pLink}, processor); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Returns a new (partial) match. | ||
368 | * This can be used e.g. to call the matcher with a partial match. | ||
369 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
370 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
371 | * @return the (partial) match object. | ||
372 | * | ||
373 | */ | ||
374 | public IncompatibleSourceAndTargetGain.Match newMatch(final DirectedCommunicationLink pLink) { | ||
375 | return IncompatibleSourceAndTargetGain.Match.newMatch(pLink); | ||
376 | } | ||
377 | |||
378 | /** | ||
379 | * Retrieve the set of values that occur in matches for Link. | ||
380 | * @return the Set of all values or empty set if there are no matches | ||
381 | * | ||
382 | */ | ||
383 | protected Stream<DirectedCommunicationLink> rawStreamAllValuesOfLink(final Object[] parameters) { | ||
384 | return rawStreamAllValues(POSITION_LINK, parameters).map(DirectedCommunicationLink.class::cast); | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * Retrieve the set of values that occur in matches for Link. | ||
389 | * @return the Set of all values or empty set if there are no matches | ||
390 | * | ||
391 | */ | ||
392 | public Set<DirectedCommunicationLink> getAllValuesOfLink() { | ||
393 | return rawStreamAllValuesOfLink(emptyArray()).collect(Collectors.toSet()); | ||
394 | } | ||
395 | |||
396 | /** | ||
397 | * Retrieve the set of values that occur in matches for Link. | ||
398 | * @return the Set of all values or empty set if there are no matches | ||
399 | * | ||
400 | */ | ||
401 | public Stream<DirectedCommunicationLink> streamAllValuesOfLink() { | ||
402 | return rawStreamAllValuesOfLink(emptyArray()); | ||
403 | } | ||
404 | |||
405 | @Override | ||
406 | protected IncompatibleSourceAndTargetGain.Match tupleToMatch(final Tuple t) { | ||
407 | try { | ||
408 | return IncompatibleSourceAndTargetGain.Match.newMatch((DirectedCommunicationLink) t.get(POSITION_LINK)); | ||
409 | } catch(ClassCastException e) { | ||
410 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
411 | return null; | ||
412 | } | ||
413 | } | ||
414 | |||
415 | @Override | ||
416 | protected IncompatibleSourceAndTargetGain.Match arrayToMatch(final Object[] match) { | ||
417 | try { | ||
418 | return IncompatibleSourceAndTargetGain.Match.newMatch((DirectedCommunicationLink) match[POSITION_LINK]); | ||
419 | } catch(ClassCastException e) { | ||
420 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
421 | return null; | ||
422 | } | ||
423 | } | ||
424 | |||
425 | @Override | ||
426 | protected IncompatibleSourceAndTargetGain.Match arrayToMatchMutable(final Object[] match) { | ||
427 | try { | ||
428 | return IncompatibleSourceAndTargetGain.Match.newMutableMatch((DirectedCommunicationLink) match[POSITION_LINK]); | ||
429 | } catch(ClassCastException e) { | ||
430 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
431 | return null; | ||
432 | } | ||
433 | } | ||
434 | |||
435 | /** | ||
436 | * @return the singleton instance of the query specification of this pattern | ||
437 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
438 | * | ||
439 | */ | ||
440 | public static IQuerySpecification<IncompatibleSourceAndTargetGain.Matcher> querySpecification() { | ||
441 | return IncompatibleSourceAndTargetGain.instance(); | ||
442 | } | ||
443 | } | ||
444 | |||
445 | private IncompatibleSourceAndTargetGain() { | ||
446 | super(GeneratedPQuery.INSTANCE); | ||
447 | } | ||
448 | |||
449 | /** | ||
450 | * @return the singleton instance of the query specification | ||
451 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
452 | * | ||
453 | */ | ||
454 | public static IncompatibleSourceAndTargetGain instance() { | ||
455 | try{ | ||
456 | return LazyHolder.INSTANCE; | ||
457 | } catch (ExceptionInInitializerError err) { | ||
458 | throw processInitializerError(err); | ||
459 | } | ||
460 | } | ||
461 | |||
462 | @Override | ||
463 | protected IncompatibleSourceAndTargetGain.Matcher instantiate(final ViatraQueryEngine engine) { | ||
464 | return IncompatibleSourceAndTargetGain.Matcher.on(engine); | ||
465 | } | ||
466 | |||
467 | @Override | ||
468 | public IncompatibleSourceAndTargetGain.Matcher instantiate() { | ||
469 | return IncompatibleSourceAndTargetGain.Matcher.create(); | ||
470 | } | ||
471 | |||
472 | @Override | ||
473 | public IncompatibleSourceAndTargetGain.Match newEmptyMatch() { | ||
474 | return IncompatibleSourceAndTargetGain.Match.newEmptyMatch(); | ||
475 | } | ||
476 | |||
477 | @Override | ||
478 | public IncompatibleSourceAndTargetGain.Match newMatch(final Object... parameters) { | ||
479 | return IncompatibleSourceAndTargetGain.Match.newMatch((satellite.DirectedCommunicationLink) parameters[0]); | ||
480 | } | ||
481 | |||
482 | /** | ||
483 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain (visibility: PUBLIC, simpleName: IncompatibleSourceAndTargetGain, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain, 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 | ||
484 | * <b>not</b> at the class load time of the outer class, | ||
485 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain (visibility: PUBLIC, simpleName: IncompatibleSourceAndTargetGain, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
486 | * | ||
487 | * <p> This workaround is required e.g. to support recursion. | ||
488 | * | ||
489 | */ | ||
490 | private static class LazyHolder { | ||
491 | private static final IncompatibleSourceAndTargetGain INSTANCE = new IncompatibleSourceAndTargetGain(); | ||
492 | |||
493 | /** | ||
494 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
495 | * This initialization order is required to support indirect recursion. | ||
496 | * | ||
497 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
498 | * | ||
499 | */ | ||
500 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
501 | |||
502 | public static Object ensureInitialized() { | ||
503 | INSTANCE.ensureInitializedInternal(); | ||
504 | return null; | ||
505 | } | ||
506 | } | ||
507 | |||
508 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
509 | private static final IncompatibleSourceAndTargetGain.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
510 | |||
511 | private final PParameter parameter_Link = new PParameter("Link", "satellite.DirectedCommunicationLink", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "DirectedCommunicationLink")), PParameterDirection.INOUT); | ||
512 | |||
513 | private final List<PParameter> parameters = Arrays.asList(parameter_Link); | ||
514 | |||
515 | private GeneratedPQuery() { | ||
516 | super(PVisibility.PUBLIC); | ||
517 | } | ||
518 | |||
519 | @Override | ||
520 | public String getFullyQualifiedName() { | ||
521 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetGain"; | ||
522 | } | ||
523 | |||
524 | @Override | ||
525 | public List<String> getParameterNames() { | ||
526 | return Arrays.asList("Link"); | ||
527 | } | ||
528 | |||
529 | @Override | ||
530 | public List<PParameter> getParameters() { | ||
531 | return parameters; | ||
532 | } | ||
533 | |||
534 | @Override | ||
535 | public Set<PBody> doGetContainedBodies() { | ||
536 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
537 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
538 | { | ||
539 | PBody body = new PBody(this); | ||
540 | PVariable var_Link = body.getOrCreateVariableByName("Link"); | ||
541 | PVariable var_SourceSubsystem = body.getOrCreateVariableByName("SourceSubsystem"); | ||
542 | PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem"); | ||
543 | PVariable var_Gain = body.getOrCreateVariableByName("Gain"); | ||
544 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
545 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
546 | new ExportedParameter(body, var_Link, parameter_Link) | ||
547 | )); | ||
548 | // DirectedCommunicationLink.source(Link, SourceSubsystem) | ||
549 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
550 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
551 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source"))); | ||
552 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
553 | new Equality(body, var__virtual_0_, var_SourceSubsystem); | ||
554 | // DirectedCommunicationLink.target(Link, TargetSubsystem) | ||
555 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
556 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
557 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); | ||
558 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
559 | new Equality(body, var__virtual_1_, var_TargetSubsystem); | ||
560 | // CommSubsystem.gain(SourceSubsystem, Gain) | ||
561 | new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
562 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
563 | new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); | ||
564 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
565 | new Equality(body, var__virtual_2_, var_Gain); | ||
566 | // neg find commSubsystemGain(TargetSubsystem, Gain) | ||
567 | new NegativePatternCall(body, Tuples.flatTupleOf(var_TargetSubsystem, var_Gain), CommSubsystemGain.instance().getInternalQueryRepresentation()); | ||
568 | bodies.add(body); | ||
569 | } | ||
570 | { | ||
571 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
572 | annotation.addAttribute("severity", "error"); | ||
573 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
574 | new ParameterReference("Link") | ||
575 | })); | ||
576 | annotation.addAttribute("message", "Two ends of a communication link must use the same antenna gain."); | ||
577 | addAnnotation(annotation); | ||
578 | } | ||
579 | return bodies; | ||
580 | } | ||
581 | } | ||
582 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/KaAntennaGainLow.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/KaAntennaGainLow.java deleted file mode 100644 index 37c35bfe..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/KaAntennaGainLow.java +++ /dev/null | |||
@@ -1,574 +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 java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Objects; | ||
11 | import java.util.Optional; | ||
12 | import java.util.Set; | ||
13 | import java.util.function.Consumer; | ||
14 | import java.util.stream.Collectors; | ||
15 | import java.util.stream.Stream; | ||
16 | import org.apache.log4j.Logger; | ||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.emf.ecore.EDataType; | ||
19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
43 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
44 | import satellite.CommSubsystem; | ||
45 | |||
46 | /** | ||
47 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
48 | * | ||
49 | * <p>Original source: | ||
50 | * <code><pre> | ||
51 | * // Ka-band transmitters may only be combined with a medium or high gain antenna | ||
52 | * | ||
53 | * {@literal @}Constraint(severity = "error", key = {Comm}, | ||
54 | * message = "Ka-band transceiver must be combined with a medium or high gain antenna.") | ||
55 | * pattern kaAntennaGainLow(Comm : CommSubsystem) { | ||
56 | * CommSubsystem.band(Comm, TransceiverBand::Ka); | ||
57 | * CommSubsystem.gain(Comm, AntennaGain::LOW); | ||
58 | * } | ||
59 | * </pre></code> | ||
60 | * | ||
61 | * @see Matcher | ||
62 | * @see Match | ||
63 | * | ||
64 | */ | ||
65 | @SuppressWarnings("all") | ||
66 | public final class KaAntennaGainLow extends BaseGeneratedEMFQuerySpecification<KaAntennaGainLow.Matcher> { | ||
67 | /** | ||
68 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.kaAntennaGainLow pattern, | ||
69 | * to be used in conjunction with {@link Matcher}. | ||
70 | * | ||
71 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
72 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
73 | * usable to represent a match of the pattern in the result of a query, | ||
74 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
75 | * | ||
76 | * @see Matcher | ||
77 | * | ||
78 | */ | ||
79 | public static abstract class Match extends BasePatternMatch { | ||
80 | private CommSubsystem fComm; | ||
81 | |||
82 | private static List<String> parameterNames = makeImmutableList("Comm"); | ||
83 | |||
84 | private Match(final CommSubsystem pComm) { | ||
85 | this.fComm = pComm; | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public Object get(final String parameterName) { | ||
90 | if ("Comm".equals(parameterName)) return this.fComm; | ||
91 | return null; | ||
92 | } | ||
93 | |||
94 | public CommSubsystem getComm() { | ||
95 | return this.fComm; | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public boolean set(final String parameterName, final Object newValue) { | ||
100 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
101 | if ("Comm".equals(parameterName) ) { | ||
102 | this.fComm = (CommSubsystem) newValue; | ||
103 | return true; | ||
104 | } | ||
105 | return false; | ||
106 | } | ||
107 | |||
108 | public void setComm(final CommSubsystem pComm) { | ||
109 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
110 | this.fComm = pComm; | ||
111 | } | ||
112 | |||
113 | @Override | ||
114 | public String patternName() { | ||
115 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.kaAntennaGainLow"; | ||
116 | } | ||
117 | |||
118 | @Override | ||
119 | public List<String> parameterNames() { | ||
120 | return KaAntennaGainLow.Match.parameterNames; | ||
121 | } | ||
122 | |||
123 | @Override | ||
124 | public Object[] toArray() { | ||
125 | return new Object[]{fComm}; | ||
126 | } | ||
127 | |||
128 | @Override | ||
129 | public KaAntennaGainLow.Match toImmutable() { | ||
130 | return isMutable() ? newMatch(fComm) : this; | ||
131 | } | ||
132 | |||
133 | @Override | ||
134 | public String prettyPrint() { | ||
135 | StringBuilder result = new StringBuilder(); | ||
136 | result.append("\"Comm\"=" + prettyPrintValue(fComm)); | ||
137 | return result.toString(); | ||
138 | } | ||
139 | |||
140 | @Override | ||
141 | public int hashCode() { | ||
142 | return Objects.hash(fComm); | ||
143 | } | ||
144 | |||
145 | @Override | ||
146 | public boolean equals(final Object obj) { | ||
147 | if (this == obj) | ||
148 | return true; | ||
149 | if (obj == null) { | ||
150 | return false; | ||
151 | } | ||
152 | if ((obj instanceof KaAntennaGainLow.Match)) { | ||
153 | KaAntennaGainLow.Match other = (KaAntennaGainLow.Match) obj; | ||
154 | return Objects.equals(fComm, other.fComm); | ||
155 | } else { | ||
156 | // this should be infrequent | ||
157 | if (!(obj instanceof IPatternMatch)) { | ||
158 | return false; | ||
159 | } | ||
160 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
161 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | @Override | ||
166 | public KaAntennaGainLow specification() { | ||
167 | return KaAntennaGainLow.instance(); | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * Returns an empty, mutable match. | ||
172 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
173 | * | ||
174 | * @return the empty match. | ||
175 | * | ||
176 | */ | ||
177 | public static KaAntennaGainLow.Match newEmptyMatch() { | ||
178 | return new Mutable(null); | ||
179 | } | ||
180 | |||
181 | /** | ||
182 | * Returns a mutable (partial) match. | ||
183 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
184 | * | ||
185 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
186 | * @return the new, mutable (partial) match object. | ||
187 | * | ||
188 | */ | ||
189 | public static KaAntennaGainLow.Match newMutableMatch(final CommSubsystem pComm) { | ||
190 | return new Mutable(pComm); | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * Returns a new (partial) match. | ||
195 | * This can be used e.g. to call the matcher with a partial match. | ||
196 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
197 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
198 | * @return the (partial) match object. | ||
199 | * | ||
200 | */ | ||
201 | public static KaAntennaGainLow.Match newMatch(final CommSubsystem pComm) { | ||
202 | return new Immutable(pComm); | ||
203 | } | ||
204 | |||
205 | private static final class Mutable extends KaAntennaGainLow.Match { | ||
206 | Mutable(final CommSubsystem pComm) { | ||
207 | super(pComm); | ||
208 | } | ||
209 | |||
210 | @Override | ||
211 | public boolean isMutable() { | ||
212 | return true; | ||
213 | } | ||
214 | } | ||
215 | |||
216 | private static final class Immutable extends KaAntennaGainLow.Match { | ||
217 | Immutable(final CommSubsystem pComm) { | ||
218 | super(pComm); | ||
219 | } | ||
220 | |||
221 | @Override | ||
222 | public boolean isMutable() { | ||
223 | return false; | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | |||
228 | /** | ||
229 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.kaAntennaGainLow pattern, | ||
230 | * providing pattern-specific query methods. | ||
231 | * | ||
232 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
233 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
234 | * | ||
235 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
236 | * | ||
237 | * <p>Original source: | ||
238 | * <code><pre> | ||
239 | * // Ka-band transmitters may only be combined with a medium or high gain antenna | ||
240 | * | ||
241 | * {@literal @}Constraint(severity = "error", key = {Comm}, | ||
242 | * message = "Ka-band transceiver must be combined with a medium or high gain antenna.") | ||
243 | * pattern kaAntennaGainLow(Comm : CommSubsystem) { | ||
244 | * CommSubsystem.band(Comm, TransceiverBand::Ka); | ||
245 | * CommSubsystem.gain(Comm, AntennaGain::LOW); | ||
246 | * } | ||
247 | * </pre></code> | ||
248 | * | ||
249 | * @see Match | ||
250 | * @see KaAntennaGainLow | ||
251 | * | ||
252 | */ | ||
253 | public static class Matcher extends BaseMatcher<KaAntennaGainLow.Match> { | ||
254 | /** | ||
255 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
256 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
257 | * | ||
258 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
259 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
260 | * | ||
261 | */ | ||
262 | public static KaAntennaGainLow.Matcher on(final ViatraQueryEngine engine) { | ||
263 | // check if matcher already exists | ||
264 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
265 | if (matcher == null) { | ||
266 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
267 | } | ||
268 | return matcher; | ||
269 | } | ||
270 | |||
271 | /** | ||
272 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
273 | * @return an initialized matcher | ||
274 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
275 | * | ||
276 | */ | ||
277 | public static KaAntennaGainLow.Matcher create() { | ||
278 | return new Matcher(); | ||
279 | } | ||
280 | |||
281 | private static final int POSITION_COMM = 0; | ||
282 | |||
283 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(KaAntennaGainLow.Matcher.class); | ||
284 | |||
285 | /** | ||
286 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
287 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
288 | * | ||
289 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
290 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
291 | * | ||
292 | */ | ||
293 | private Matcher() { | ||
294 | super(querySpecification()); | ||
295 | } | ||
296 | |||
297 | /** | ||
298 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
299 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
300 | * @return matches represented as a Match object. | ||
301 | * | ||
302 | */ | ||
303 | public Collection<KaAntennaGainLow.Match> getAllMatches(final CommSubsystem pComm) { | ||
304 | return rawStreamAllMatches(new Object[]{pComm}).collect(Collectors.toSet()); | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
309 | * </p> | ||
310 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
311 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
312 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
313 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
314 | * @return a stream of matches represented as a Match object. | ||
315 | * | ||
316 | */ | ||
317 | public Stream<KaAntennaGainLow.Match> streamAllMatches(final CommSubsystem pComm) { | ||
318 | return rawStreamAllMatches(new Object[]{pComm}); | ||
319 | } | ||
320 | |||
321 | /** | ||
322 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
323 | * Neither determinism nor randomness of selection is guaranteed. | ||
324 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
325 | * @return a match represented as a Match object, or null if no match is found. | ||
326 | * | ||
327 | */ | ||
328 | public Optional<KaAntennaGainLow.Match> getOneArbitraryMatch(final CommSubsystem pComm) { | ||
329 | return rawGetOneArbitraryMatch(new Object[]{pComm}); | ||
330 | } | ||
331 | |||
332 | /** | ||
333 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
334 | * under any possible substitution of the unspecified parameters (if any). | ||
335 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
336 | * @return true if the input is a valid (partial) match of the pattern. | ||
337 | * | ||
338 | */ | ||
339 | public boolean hasMatch(final CommSubsystem pComm) { | ||
340 | return rawHasMatch(new Object[]{pComm}); | ||
341 | } | ||
342 | |||
343 | /** | ||
344 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
345 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
346 | * @return the number of pattern matches found. | ||
347 | * | ||
348 | */ | ||
349 | public int countMatches(final CommSubsystem pComm) { | ||
350 | return rawCountMatches(new Object[]{pComm}); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
355 | * Neither determinism nor randomness of selection is guaranteed. | ||
356 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
357 | * @param processor the action that will process the selected match. | ||
358 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
359 | * | ||
360 | */ | ||
361 | public boolean forOneArbitraryMatch(final CommSubsystem pComm, final Consumer<? super KaAntennaGainLow.Match> processor) { | ||
362 | return rawForOneArbitraryMatch(new Object[]{pComm}, processor); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * Returns a new (partial) match. | ||
367 | * This can be used e.g. to call the matcher with a partial match. | ||
368 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
369 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
370 | * @return the (partial) match object. | ||
371 | * | ||
372 | */ | ||
373 | public KaAntennaGainLow.Match newMatch(final CommSubsystem pComm) { | ||
374 | return KaAntennaGainLow.Match.newMatch(pComm); | ||
375 | } | ||
376 | |||
377 | /** | ||
378 | * Retrieve the set of values that occur in matches for Comm. | ||
379 | * @return the Set of all values or empty set if there are no matches | ||
380 | * | ||
381 | */ | ||
382 | protected Stream<CommSubsystem> rawStreamAllValuesOfComm(final Object[] parameters) { | ||
383 | return rawStreamAllValues(POSITION_COMM, parameters).map(CommSubsystem.class::cast); | ||
384 | } | ||
385 | |||
386 | /** | ||
387 | * Retrieve the set of values that occur in matches for Comm. | ||
388 | * @return the Set of all values or empty set if there are no matches | ||
389 | * | ||
390 | */ | ||
391 | public Set<CommSubsystem> getAllValuesOfComm() { | ||
392 | return rawStreamAllValuesOfComm(emptyArray()).collect(Collectors.toSet()); | ||
393 | } | ||
394 | |||
395 | /** | ||
396 | * Retrieve the set of values that occur in matches for Comm. | ||
397 | * @return the Set of all values or empty set if there are no matches | ||
398 | * | ||
399 | */ | ||
400 | public Stream<CommSubsystem> streamAllValuesOfComm() { | ||
401 | return rawStreamAllValuesOfComm(emptyArray()); | ||
402 | } | ||
403 | |||
404 | @Override | ||
405 | protected KaAntennaGainLow.Match tupleToMatch(final Tuple t) { | ||
406 | try { | ||
407 | return KaAntennaGainLow.Match.newMatch((CommSubsystem) t.get(POSITION_COMM)); | ||
408 | } catch(ClassCastException e) { | ||
409 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
410 | return null; | ||
411 | } | ||
412 | } | ||
413 | |||
414 | @Override | ||
415 | protected KaAntennaGainLow.Match arrayToMatch(final Object[] match) { | ||
416 | try { | ||
417 | return KaAntennaGainLow.Match.newMatch((CommSubsystem) match[POSITION_COMM]); | ||
418 | } catch(ClassCastException e) { | ||
419 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
420 | return null; | ||
421 | } | ||
422 | } | ||
423 | |||
424 | @Override | ||
425 | protected KaAntennaGainLow.Match arrayToMatchMutable(final Object[] match) { | ||
426 | try { | ||
427 | return KaAntennaGainLow.Match.newMutableMatch((CommSubsystem) match[POSITION_COMM]); | ||
428 | } catch(ClassCastException e) { | ||
429 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
430 | return null; | ||
431 | } | ||
432 | } | ||
433 | |||
434 | /** | ||
435 | * @return the singleton instance of the query specification of this pattern | ||
436 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
437 | * | ||
438 | */ | ||
439 | public static IQuerySpecification<KaAntennaGainLow.Matcher> querySpecification() { | ||
440 | return KaAntennaGainLow.instance(); | ||
441 | } | ||
442 | } | ||
443 | |||
444 | private KaAntennaGainLow() { | ||
445 | super(GeneratedPQuery.INSTANCE); | ||
446 | } | ||
447 | |||
448 | /** | ||
449 | * @return the singleton instance of the query specification | ||
450 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
451 | * | ||
452 | */ | ||
453 | public static KaAntennaGainLow instance() { | ||
454 | try{ | ||
455 | return LazyHolder.INSTANCE; | ||
456 | } catch (ExceptionInInitializerError err) { | ||
457 | throw processInitializerError(err); | ||
458 | } | ||
459 | } | ||
460 | |||
461 | @Override | ||
462 | protected KaAntennaGainLow.Matcher instantiate(final ViatraQueryEngine engine) { | ||
463 | return KaAntennaGainLow.Matcher.on(engine); | ||
464 | } | ||
465 | |||
466 | @Override | ||
467 | public KaAntennaGainLow.Matcher instantiate() { | ||
468 | return KaAntennaGainLow.Matcher.create(); | ||
469 | } | ||
470 | |||
471 | @Override | ||
472 | public KaAntennaGainLow.Match newEmptyMatch() { | ||
473 | return KaAntennaGainLow.Match.newEmptyMatch(); | ||
474 | } | ||
475 | |||
476 | @Override | ||
477 | public KaAntennaGainLow.Match newMatch(final Object... parameters) { | ||
478 | return KaAntennaGainLow.Match.newMatch((satellite.CommSubsystem) parameters[0]); | ||
479 | } | ||
480 | |||
481 | /** | ||
482 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow (visibility: PUBLIC, simpleName: KaAntennaGainLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow, 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 | ||
483 | * <b>not</b> at the class load time of the outer class, | ||
484 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow (visibility: PUBLIC, simpleName: KaAntennaGainLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
485 | * | ||
486 | * <p> This workaround is required e.g. to support recursion. | ||
487 | * | ||
488 | */ | ||
489 | private static class LazyHolder { | ||
490 | private static final KaAntennaGainLow INSTANCE = new KaAntennaGainLow(); | ||
491 | |||
492 | /** | ||
493 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
494 | * This initialization order is required to support indirect recursion. | ||
495 | * | ||
496 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
497 | * | ||
498 | */ | ||
499 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
500 | |||
501 | public static Object ensureInitialized() { | ||
502 | INSTANCE.ensureInitializedInternal(); | ||
503 | return null; | ||
504 | } | ||
505 | } | ||
506 | |||
507 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
508 | private static final KaAntennaGainLow.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
509 | |||
510 | private final PParameter parameter_Comm = new PParameter("Comm", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | ||
511 | |||
512 | private final List<PParameter> parameters = Arrays.asList(parameter_Comm); | ||
513 | |||
514 | private GeneratedPQuery() { | ||
515 | super(PVisibility.PUBLIC); | ||
516 | } | ||
517 | |||
518 | @Override | ||
519 | public String getFullyQualifiedName() { | ||
520 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.kaAntennaGainLow"; | ||
521 | } | ||
522 | |||
523 | @Override | ||
524 | public List<String> getParameterNames() { | ||
525 | return Arrays.asList("Comm"); | ||
526 | } | ||
527 | |||
528 | @Override | ||
529 | public List<PParameter> getParameters() { | ||
530 | return parameters; | ||
531 | } | ||
532 | |||
533 | @Override | ||
534 | public Set<PBody> doGetContainedBodies() { | ||
535 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
536 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
537 | { | ||
538 | PBody body = new PBody(this); | ||
539 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); | ||
540 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
541 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
542 | new ExportedParameter(body, var_Comm, parameter_Comm) | ||
543 | )); | ||
544 | // CommSubsystem.band(Comm, TransceiverBand::Ka) | ||
545 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
546 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance()); | ||
547 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
548 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
549 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
550 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
551 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
552 | // CommSubsystem.gain(Comm, AntennaGain::LOW) | ||
553 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
554 | new ConstantValue(body, var__virtual_2_, getEnumLiteral("http://www.example.org/satellite", "AntennaGain", "LOW").getInstance()); | ||
555 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
556 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
557 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); | ||
558 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
559 | new Equality(body, var__virtual_3_, var__virtual_2_); | ||
560 | bodies.add(body); | ||
561 | } | ||
562 | { | ||
563 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
564 | annotation.addAttribute("severity", "error"); | ||
565 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
566 | new ParameterReference("Comm") | ||
567 | })); | ||
568 | annotation.addAttribute("message", "Ka-band transceiver must be combined with a medium or high gain antenna."); | ||
569 | addAnnotation(annotation); | ||
570 | } | ||
571 | return bodies; | ||
572 | } | ||
573 | } | ||
574 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java index 31c5a70a..9025d93a 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java | |||
@@ -5,21 +5,13 @@ package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | |||
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; | 7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; |
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric; | ||
10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; | 8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; |
11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; | 9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; |
12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain; | ||
13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow; | ||
14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; | 10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; |
15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation; | 11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation; |
16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; | 12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; |
17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; | 13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; |
18 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind; | ||
19 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; | 14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; |
20 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric; | ||
21 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow; | ||
22 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium; | ||
23 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | 15 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; |
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | 16 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; |
25 | 17 | ||
@@ -37,17 +29,9 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | |||
37 | * <li>noPotentialLinkToGroundStation</li> | 29 | * <li>noPotentialLinkToGroundStation</li> |
38 | * <li>communicationLoop</li> | 30 | * <li>communicationLoop</li> |
39 | * <li>incompatibleSourceAndTargetBand</li> | 31 | * <li>incompatibleSourceAndTargetBand</li> |
40 | * <li>incompatibleSourceAndTargetGain</li> | ||
41 | * <li>uhfAntennaGainNotLow</li> | ||
42 | * <li>xAntennaGainNotMedium</li> | ||
43 | * <li>kaAntennaGainLow</li> | ||
44 | * <li>threeUCubeSatWithNonUhfCrossLink</li> | 32 | * <li>threeUCubeSatWithNonUhfCrossLink</li> |
45 | * <li>cubeSatWithKaAntenna</li> | 33 | * <li>cubeSatWithKaAntenna</li> |
46 | * <li>smallSat</li> | 34 | * <li>smallSat</li> |
47 | * <li>spacecraftOfKind</li> | ||
48 | * <li>coverageMetric</li> | ||
49 | * <li>timeMetric</li> | ||
50 | * <li>costMetric</li> | ||
51 | * </ul> | 35 | * </ul> |
52 | * | 36 | * |
53 | * @see IQueryGroup | 37 | * @see IQueryGroup |
@@ -78,17 +62,9 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { | |||
78 | querySpecifications.add(NoPotentialLinkToGroundStation.instance()); | 62 | querySpecifications.add(NoPotentialLinkToGroundStation.instance()); |
79 | querySpecifications.add(CommunicationLoop.instance()); | 63 | querySpecifications.add(CommunicationLoop.instance()); |
80 | querySpecifications.add(IncompatibleSourceAndTargetBand.instance()); | 64 | querySpecifications.add(IncompatibleSourceAndTargetBand.instance()); |
81 | querySpecifications.add(IncompatibleSourceAndTargetGain.instance()); | ||
82 | querySpecifications.add(UhfAntennaGainNotLow.instance()); | ||
83 | querySpecifications.add(XAntennaGainNotMedium.instance()); | ||
84 | querySpecifications.add(KaAntennaGainLow.instance()); | ||
85 | querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance()); | 65 | querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance()); |
86 | querySpecifications.add(CubeSatWithKaAntenna.instance()); | 66 | querySpecifications.add(CubeSatWithKaAntenna.instance()); |
87 | querySpecifications.add(SmallSat.instance()); | 67 | querySpecifications.add(SmallSat.instance()); |
88 | querySpecifications.add(SpacecraftOfKind.instance()); | ||
89 | querySpecifications.add(CoverageMetric.instance()); | ||
90 | querySpecifications.add(TimeMetric.instance()); | ||
91 | querySpecifications.add(CostMetric.instance()); | ||
92 | } | 68 | } |
93 | 69 | ||
94 | public CommunicationLinkDoesNotStartAtContainingElement getCommunicationLinkDoesNotStartAtContainingElement() { | 70 | public CommunicationLinkDoesNotStartAtContainingElement getCommunicationLinkDoesNotStartAtContainingElement() { |
@@ -139,38 +115,6 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { | |||
139 | return IncompatibleSourceAndTargetBand.Matcher.on(engine); | 115 | return IncompatibleSourceAndTargetBand.Matcher.on(engine); |
140 | } | 116 | } |
141 | 117 | ||
142 | public IncompatibleSourceAndTargetGain getIncompatibleSourceAndTargetGain() { | ||
143 | return IncompatibleSourceAndTargetGain.instance(); | ||
144 | } | ||
145 | |||
146 | public IncompatibleSourceAndTargetGain.Matcher getIncompatibleSourceAndTargetGain(final ViatraQueryEngine engine) { | ||
147 | return IncompatibleSourceAndTargetGain.Matcher.on(engine); | ||
148 | } | ||
149 | |||
150 | public UhfAntennaGainNotLow getUhfAntennaGainNotLow() { | ||
151 | return UhfAntennaGainNotLow.instance(); | ||
152 | } | ||
153 | |||
154 | public UhfAntennaGainNotLow.Matcher getUhfAntennaGainNotLow(final ViatraQueryEngine engine) { | ||
155 | return UhfAntennaGainNotLow.Matcher.on(engine); | ||
156 | } | ||
157 | |||
158 | public XAntennaGainNotMedium getXAntennaGainNotMedium() { | ||
159 | return XAntennaGainNotMedium.instance(); | ||
160 | } | ||
161 | |||
162 | public XAntennaGainNotMedium.Matcher getXAntennaGainNotMedium(final ViatraQueryEngine engine) { | ||
163 | return XAntennaGainNotMedium.Matcher.on(engine); | ||
164 | } | ||
165 | |||
166 | public KaAntennaGainLow getKaAntennaGainLow() { | ||
167 | return KaAntennaGainLow.instance(); | ||
168 | } | ||
169 | |||
170 | public KaAntennaGainLow.Matcher getKaAntennaGainLow(final ViatraQueryEngine engine) { | ||
171 | return KaAntennaGainLow.Matcher.on(engine); | ||
172 | } | ||
173 | |||
174 | public ThreeUCubeSatWithNonUhfCrossLink getThreeUCubeSatWithNonUhfCrossLink() { | 118 | public ThreeUCubeSatWithNonUhfCrossLink getThreeUCubeSatWithNonUhfCrossLink() { |
175 | return ThreeUCubeSatWithNonUhfCrossLink.instance(); | 119 | return ThreeUCubeSatWithNonUhfCrossLink.instance(); |
176 | } | 120 | } |
@@ -194,36 +138,4 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { | |||
194 | public SmallSat.Matcher getSmallSat(final ViatraQueryEngine engine) { | 138 | public SmallSat.Matcher getSmallSat(final ViatraQueryEngine engine) { |
195 | return SmallSat.Matcher.on(engine); | 139 | return SmallSat.Matcher.on(engine); |
196 | } | 140 | } |
197 | |||
198 | public SpacecraftOfKind getSpacecraftOfKind() { | ||
199 | return SpacecraftOfKind.instance(); | ||
200 | } | ||
201 | |||
202 | public SpacecraftOfKind.Matcher getSpacecraftOfKind(final ViatraQueryEngine engine) { | ||
203 | return SpacecraftOfKind.Matcher.on(engine); | ||
204 | } | ||
205 | |||
206 | public CoverageMetric getCoverageMetric() { | ||
207 | return CoverageMetric.instance(); | ||
208 | } | ||
209 | |||
210 | public CoverageMetric.Matcher getCoverageMetric(final ViatraQueryEngine engine) { | ||
211 | return CoverageMetric.Matcher.on(engine); | ||
212 | } | ||
213 | |||
214 | public TimeMetric getTimeMetric() { | ||
215 | return TimeMetric.instance(); | ||
216 | } | ||
217 | |||
218 | public TimeMetric.Matcher getTimeMetric(final ViatraQueryEngine engine) { | ||
219 | return TimeMetric.Matcher.on(engine); | ||
220 | } | ||
221 | |||
222 | public CostMetric getCostMetric() { | ||
223 | return CostMetric.instance(); | ||
224 | } | ||
225 | |||
226 | public CostMetric.Matcher getCostMetric(final ViatraQueryEngine engine) { | ||
227 | return CostMetric.Matcher.on(engine); | ||
228 | } | ||
229 | } | 141 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SpacecraftOfKind.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SpacecraftOfKind.java deleted file mode 100644 index ed0bd7dc..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SpacecraftOfKind.java +++ /dev/null | |||
@@ -1,754 +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 java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Objects; | ||
11 | import java.util.Optional; | ||
12 | import java.util.Set; | ||
13 | import java.util.function.Consumer; | ||
14 | import java.util.stream.Collectors; | ||
15 | import java.util.stream.Stream; | ||
16 | import org.apache.log4j.Logger; | ||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.emf.ecore.EDataType; | ||
19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
41 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
42 | import satellite.Spacecraft; | ||
43 | import satellite.SpacecraftKind; | ||
44 | |||
45 | /** | ||
46 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
47 | * | ||
48 | * <p>Original source: | ||
49 | * <code><pre> | ||
50 | * {@literal @}QueryBasedFeature(feature = "kind") | ||
51 | * pattern spacecraftOfKind(Spacecraft : Spacecraft, Kind : SpacecraftKind) { | ||
52 | * CubeSat3U(Spacecraft); | ||
53 | * Kind == SpacecraftKind::CubeSat3U; | ||
54 | * } or { | ||
55 | * CubeSat6U(Spacecraft); | ||
56 | * Kind == SpacecraftKind::CubeSat6U; | ||
57 | * } or { | ||
58 | * SmallSat(Spacecraft); | ||
59 | * Kind == SpacecraftKind::SmallSat; | ||
60 | * } | ||
61 | * </pre></code> | ||
62 | * | ||
63 | * @see Matcher | ||
64 | * @see Match | ||
65 | * | ||
66 | */ | ||
67 | @SuppressWarnings("all") | ||
68 | public final class SpacecraftOfKind extends BaseGeneratedEMFQuerySpecification<SpacecraftOfKind.Matcher> { | ||
69 | /** | ||
70 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind pattern, | ||
71 | * to be used in conjunction with {@link Matcher}. | ||
72 | * | ||
73 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
74 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
75 | * usable to represent a match of the pattern in the result of a query, | ||
76 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
77 | * | ||
78 | * @see Matcher | ||
79 | * | ||
80 | */ | ||
81 | public static abstract class Match extends BasePatternMatch { | ||
82 | private Spacecraft fSpacecraft; | ||
83 | |||
84 | private SpacecraftKind fKind; | ||
85 | |||
86 | private static List<String> parameterNames = makeImmutableList("Spacecraft", "Kind"); | ||
87 | |||
88 | private Match(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
89 | this.fSpacecraft = pSpacecraft; | ||
90 | this.fKind = pKind; | ||
91 | } | ||
92 | |||
93 | @Override | ||
94 | public Object get(final String parameterName) { | ||
95 | if ("Spacecraft".equals(parameterName)) return this.fSpacecraft; | ||
96 | if ("Kind".equals(parameterName)) return this.fKind; | ||
97 | return null; | ||
98 | } | ||
99 | |||
100 | public Spacecraft getSpacecraft() { | ||
101 | return this.fSpacecraft; | ||
102 | } | ||
103 | |||
104 | public SpacecraftKind getKind() { | ||
105 | return this.fKind; | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | public boolean set(final String parameterName, final Object newValue) { | ||
110 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
111 | if ("Spacecraft".equals(parameterName) ) { | ||
112 | this.fSpacecraft = (Spacecraft) newValue; | ||
113 | return true; | ||
114 | } | ||
115 | if ("Kind".equals(parameterName) ) { | ||
116 | this.fKind = (SpacecraftKind) newValue; | ||
117 | return true; | ||
118 | } | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | public void setSpacecraft(final Spacecraft pSpacecraft) { | ||
123 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
124 | this.fSpacecraft = pSpacecraft; | ||
125 | } | ||
126 | |||
127 | public void setKind(final SpacecraftKind pKind) { | ||
128 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
129 | this.fKind = pKind; | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public String patternName() { | ||
134 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind"; | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public List<String> parameterNames() { | ||
139 | return SpacecraftOfKind.Match.parameterNames; | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public Object[] toArray() { | ||
144 | return new Object[]{fSpacecraft, fKind}; | ||
145 | } | ||
146 | |||
147 | @Override | ||
148 | public SpacecraftOfKind.Match toImmutable() { | ||
149 | return isMutable() ? newMatch(fSpacecraft, fKind) : this; | ||
150 | } | ||
151 | |||
152 | @Override | ||
153 | public String prettyPrint() { | ||
154 | StringBuilder result = new StringBuilder(); | ||
155 | result.append("\"Spacecraft\"=" + prettyPrintValue(fSpacecraft) + ", "); | ||
156 | result.append("\"Kind\"=" + prettyPrintValue(fKind)); | ||
157 | return result.toString(); | ||
158 | } | ||
159 | |||
160 | @Override | ||
161 | public int hashCode() { | ||
162 | return Objects.hash(fSpacecraft, fKind); | ||
163 | } | ||
164 | |||
165 | @Override | ||
166 | public boolean equals(final Object obj) { | ||
167 | if (this == obj) | ||
168 | return true; | ||
169 | if (obj == null) { | ||
170 | return false; | ||
171 | } | ||
172 | if ((obj instanceof SpacecraftOfKind.Match)) { | ||
173 | SpacecraftOfKind.Match other = (SpacecraftOfKind.Match) obj; | ||
174 | return Objects.equals(fSpacecraft, other.fSpacecraft) && Objects.equals(fKind, other.fKind); | ||
175 | } else { | ||
176 | // this should be infrequent | ||
177 | if (!(obj instanceof IPatternMatch)) { | ||
178 | return false; | ||
179 | } | ||
180 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
181 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | @Override | ||
186 | public SpacecraftOfKind specification() { | ||
187 | return SpacecraftOfKind.instance(); | ||
188 | } | ||
189 | |||
190 | /** | ||
191 | * Returns an empty, mutable match. | ||
192 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
193 | * | ||
194 | * @return the empty match. | ||
195 | * | ||
196 | */ | ||
197 | public static SpacecraftOfKind.Match newEmptyMatch() { | ||
198 | return new Mutable(null, null); | ||
199 | } | ||
200 | |||
201 | /** | ||
202 | * Returns a mutable (partial) match. | ||
203 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
204 | * | ||
205 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
206 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
207 | * @return the new, mutable (partial) match object. | ||
208 | * | ||
209 | */ | ||
210 | public static SpacecraftOfKind.Match newMutableMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
211 | return new Mutable(pSpacecraft, pKind); | ||
212 | } | ||
213 | |||
214 | /** | ||
215 | * Returns a new (partial) match. | ||
216 | * This can be used e.g. to call the matcher with a partial match. | ||
217 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
218 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
219 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
220 | * @return the (partial) match object. | ||
221 | * | ||
222 | */ | ||
223 | public static SpacecraftOfKind.Match newMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
224 | return new Immutable(pSpacecraft, pKind); | ||
225 | } | ||
226 | |||
227 | private static final class Mutable extends SpacecraftOfKind.Match { | ||
228 | Mutable(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
229 | super(pSpacecraft, pKind); | ||
230 | } | ||
231 | |||
232 | @Override | ||
233 | public boolean isMutable() { | ||
234 | return true; | ||
235 | } | ||
236 | } | ||
237 | |||
238 | private static final class Immutable extends SpacecraftOfKind.Match { | ||
239 | Immutable(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
240 | super(pSpacecraft, pKind); | ||
241 | } | ||
242 | |||
243 | @Override | ||
244 | public boolean isMutable() { | ||
245 | return false; | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | |||
250 | /** | ||
251 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind pattern, | ||
252 | * providing pattern-specific query methods. | ||
253 | * | ||
254 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
255 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
256 | * | ||
257 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
258 | * | ||
259 | * <p>Original source: | ||
260 | * <code><pre> | ||
261 | * {@literal @}QueryBasedFeature(feature = "kind") | ||
262 | * pattern spacecraftOfKind(Spacecraft : Spacecraft, Kind : SpacecraftKind) { | ||
263 | * CubeSat3U(Spacecraft); | ||
264 | * Kind == SpacecraftKind::CubeSat3U; | ||
265 | * } or { | ||
266 | * CubeSat6U(Spacecraft); | ||
267 | * Kind == SpacecraftKind::CubeSat6U; | ||
268 | * } or { | ||
269 | * SmallSat(Spacecraft); | ||
270 | * Kind == SpacecraftKind::SmallSat; | ||
271 | * } | ||
272 | * </pre></code> | ||
273 | * | ||
274 | * @see Match | ||
275 | * @see SpacecraftOfKind | ||
276 | * | ||
277 | */ | ||
278 | public static class Matcher extends BaseMatcher<SpacecraftOfKind.Match> { | ||
279 | /** | ||
280 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
281 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
282 | * | ||
283 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
284 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
285 | * | ||
286 | */ | ||
287 | public static SpacecraftOfKind.Matcher on(final ViatraQueryEngine engine) { | ||
288 | // check if matcher already exists | ||
289 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
290 | if (matcher == null) { | ||
291 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
292 | } | ||
293 | return matcher; | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
298 | * @return an initialized matcher | ||
299 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
300 | * | ||
301 | */ | ||
302 | public static SpacecraftOfKind.Matcher create() { | ||
303 | return new Matcher(); | ||
304 | } | ||
305 | |||
306 | private static final int POSITION_SPACECRAFT = 0; | ||
307 | |||
308 | private static final int POSITION_KIND = 1; | ||
309 | |||
310 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SpacecraftOfKind.Matcher.class); | ||
311 | |||
312 | /** | ||
313 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
314 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
315 | * | ||
316 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
317 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
318 | * | ||
319 | */ | ||
320 | private Matcher() { | ||
321 | super(querySpecification()); | ||
322 | } | ||
323 | |||
324 | /** | ||
325 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
326 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
327 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
328 | * @return matches represented as a Match object. | ||
329 | * | ||
330 | */ | ||
331 | public Collection<SpacecraftOfKind.Match> getAllMatches(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
332 | return rawStreamAllMatches(new Object[]{pSpacecraft, pKind}).collect(Collectors.toSet()); | ||
333 | } | ||
334 | |||
335 | /** | ||
336 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
337 | * </p> | ||
338 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
339 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
340 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
341 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
342 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
343 | * @return a stream of matches represented as a Match object. | ||
344 | * | ||
345 | */ | ||
346 | public Stream<SpacecraftOfKind.Match> streamAllMatches(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
347 | return rawStreamAllMatches(new Object[]{pSpacecraft, pKind}); | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
352 | * Neither determinism nor randomness of selection is guaranteed. | ||
353 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
354 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
355 | * @return a match represented as a Match object, or null if no match is found. | ||
356 | * | ||
357 | */ | ||
358 | public Optional<SpacecraftOfKind.Match> getOneArbitraryMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
359 | return rawGetOneArbitraryMatch(new Object[]{pSpacecraft, pKind}); | ||
360 | } | ||
361 | |||
362 | /** | ||
363 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
364 | * under any possible substitution of the unspecified parameters (if any). | ||
365 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
366 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
367 | * @return true if the input is a valid (partial) match of the pattern. | ||
368 | * | ||
369 | */ | ||
370 | public boolean hasMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
371 | return rawHasMatch(new Object[]{pSpacecraft, pKind}); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
376 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
377 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
378 | * @return the number of pattern matches found. | ||
379 | * | ||
380 | */ | ||
381 | public int countMatches(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
382 | return rawCountMatches(new Object[]{pSpacecraft, pKind}); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
387 | * Neither determinism nor randomness of selection is guaranteed. | ||
388 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
389 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
390 | * @param processor the action that will process the selected match. | ||
391 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
392 | * | ||
393 | */ | ||
394 | public boolean forOneArbitraryMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind, final Consumer<? super SpacecraftOfKind.Match> processor) { | ||
395 | return rawForOneArbitraryMatch(new Object[]{pSpacecraft, pKind}, processor); | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * Returns a new (partial) match. | ||
400 | * This can be used e.g. to call the matcher with a partial match. | ||
401 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
402 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
403 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
404 | * @return the (partial) match object. | ||
405 | * | ||
406 | */ | ||
407 | public SpacecraftOfKind.Match newMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
408 | return SpacecraftOfKind.Match.newMatch(pSpacecraft, pKind); | ||
409 | } | ||
410 | |||
411 | /** | ||
412 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
413 | * @return the Set of all values or empty set if there are no matches | ||
414 | * | ||
415 | */ | ||
416 | protected Stream<Spacecraft> rawStreamAllValuesOfSpacecraft(final Object[] parameters) { | ||
417 | return rawStreamAllValues(POSITION_SPACECRAFT, parameters).map(Spacecraft.class::cast); | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
422 | * @return the Set of all values or empty set if there are no matches | ||
423 | * | ||
424 | */ | ||
425 | public Set<Spacecraft> getAllValuesOfSpacecraft() { | ||
426 | return rawStreamAllValuesOfSpacecraft(emptyArray()).collect(Collectors.toSet()); | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
431 | * @return the Set of all values or empty set if there are no matches | ||
432 | * | ||
433 | */ | ||
434 | public Stream<Spacecraft> streamAllValuesOfSpacecraft() { | ||
435 | return rawStreamAllValuesOfSpacecraft(emptyArray()); | ||
436 | } | ||
437 | |||
438 | /** | ||
439 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
440 | * </p> | ||
441 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
442 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
443 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
444 | * | ||
445 | * @return the Stream of all values or empty set if there are no matches | ||
446 | * | ||
447 | */ | ||
448 | public Stream<Spacecraft> streamAllValuesOfSpacecraft(final SpacecraftOfKind.Match partialMatch) { | ||
449 | return rawStreamAllValuesOfSpacecraft(partialMatch.toArray()); | ||
450 | } | ||
451 | |||
452 | /** | ||
453 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
454 | * </p> | ||
455 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
456 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
457 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
458 | * | ||
459 | * @return the Stream of all values or empty set if there are no matches | ||
460 | * | ||
461 | */ | ||
462 | public Stream<Spacecraft> streamAllValuesOfSpacecraft(final SpacecraftKind pKind) { | ||
463 | return rawStreamAllValuesOfSpacecraft(new Object[]{null, pKind}); | ||
464 | } | ||
465 | |||
466 | /** | ||
467 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
468 | * @return the Set of all values or empty set if there are no matches | ||
469 | * | ||
470 | */ | ||
471 | public Set<Spacecraft> getAllValuesOfSpacecraft(final SpacecraftOfKind.Match partialMatch) { | ||
472 | return rawStreamAllValuesOfSpacecraft(partialMatch.toArray()).collect(Collectors.toSet()); | ||
473 | } | ||
474 | |||
475 | /** | ||
476 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
477 | * @return the Set of all values or empty set if there are no matches | ||
478 | * | ||
479 | */ | ||
480 | public Set<Spacecraft> getAllValuesOfSpacecraft(final SpacecraftKind pKind) { | ||
481 | return rawStreamAllValuesOfSpacecraft(new Object[]{null, pKind}).collect(Collectors.toSet()); | ||
482 | } | ||
483 | |||
484 | /** | ||
485 | * Retrieve the set of values that occur in matches for Kind. | ||
486 | * @return the Set of all values or empty set if there are no matches | ||
487 | * | ||
488 | */ | ||
489 | protected Stream<SpacecraftKind> rawStreamAllValuesOfKind(final Object[] parameters) { | ||
490 | return rawStreamAllValues(POSITION_KIND, parameters).map(SpacecraftKind.class::cast); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * Retrieve the set of values that occur in matches for Kind. | ||
495 | * @return the Set of all values or empty set if there are no matches | ||
496 | * | ||
497 | */ | ||
498 | public Set<SpacecraftKind> getAllValuesOfKind() { | ||
499 | return rawStreamAllValuesOfKind(emptyArray()).collect(Collectors.toSet()); | ||
500 | } | ||
501 | |||
502 | /** | ||
503 | * Retrieve the set of values that occur in matches for Kind. | ||
504 | * @return the Set of all values or empty set if there are no matches | ||
505 | * | ||
506 | */ | ||
507 | public Stream<SpacecraftKind> streamAllValuesOfKind() { | ||
508 | return rawStreamAllValuesOfKind(emptyArray()); | ||
509 | } | ||
510 | |||
511 | /** | ||
512 | * Retrieve the set of values that occur in matches for Kind. | ||
513 | * </p> | ||
514 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
515 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
516 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
517 | * | ||
518 | * @return the Stream of all values or empty set if there are no matches | ||
519 | * | ||
520 | */ | ||
521 | public Stream<SpacecraftKind> streamAllValuesOfKind(final SpacecraftOfKind.Match partialMatch) { | ||
522 | return rawStreamAllValuesOfKind(partialMatch.toArray()); | ||
523 | } | ||
524 | |||
525 | /** | ||
526 | * Retrieve the set of values that occur in matches for Kind. | ||
527 | * </p> | ||
528 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
529 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
530 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
531 | * | ||
532 | * @return the Stream of all values or empty set if there are no matches | ||
533 | * | ||
534 | */ | ||
535 | public Stream<SpacecraftKind> streamAllValuesOfKind(final Spacecraft pSpacecraft) { | ||
536 | return rawStreamAllValuesOfKind(new Object[]{pSpacecraft, null}); | ||
537 | } | ||
538 | |||
539 | /** | ||
540 | * Retrieve the set of values that occur in matches for Kind. | ||
541 | * @return the Set of all values or empty set if there are no matches | ||
542 | * | ||
543 | */ | ||
544 | public Set<SpacecraftKind> getAllValuesOfKind(final SpacecraftOfKind.Match partialMatch) { | ||
545 | return rawStreamAllValuesOfKind(partialMatch.toArray()).collect(Collectors.toSet()); | ||
546 | } | ||
547 | |||
548 | /** | ||
549 | * Retrieve the set of values that occur in matches for Kind. | ||
550 | * @return the Set of all values or empty set if there are no matches | ||
551 | * | ||
552 | */ | ||
553 | public Set<SpacecraftKind> getAllValuesOfKind(final Spacecraft pSpacecraft) { | ||
554 | return rawStreamAllValuesOfKind(new Object[]{pSpacecraft, null}).collect(Collectors.toSet()); | ||
555 | } | ||
556 | |||
557 | @Override | ||
558 | protected SpacecraftOfKind.Match tupleToMatch(final Tuple t) { | ||
559 | try { | ||
560 | return SpacecraftOfKind.Match.newMatch((Spacecraft) t.get(POSITION_SPACECRAFT), (SpacecraftKind) t.get(POSITION_KIND)); | ||
561 | } catch(ClassCastException e) { | ||
562 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
563 | return null; | ||
564 | } | ||
565 | } | ||
566 | |||
567 | @Override | ||
568 | protected SpacecraftOfKind.Match arrayToMatch(final Object[] match) { | ||
569 | try { | ||
570 | return SpacecraftOfKind.Match.newMatch((Spacecraft) match[POSITION_SPACECRAFT], (SpacecraftKind) match[POSITION_KIND]); | ||
571 | } catch(ClassCastException e) { | ||
572 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
573 | return null; | ||
574 | } | ||
575 | } | ||
576 | |||
577 | @Override | ||
578 | protected SpacecraftOfKind.Match arrayToMatchMutable(final Object[] match) { | ||
579 | try { | ||
580 | return SpacecraftOfKind.Match.newMutableMatch((Spacecraft) match[POSITION_SPACECRAFT], (SpacecraftKind) match[POSITION_KIND]); | ||
581 | } catch(ClassCastException e) { | ||
582 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
583 | return null; | ||
584 | } | ||
585 | } | ||
586 | |||
587 | /** | ||
588 | * @return the singleton instance of the query specification of this pattern | ||
589 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
590 | * | ||
591 | */ | ||
592 | public static IQuerySpecification<SpacecraftOfKind.Matcher> querySpecification() { | ||
593 | return SpacecraftOfKind.instance(); | ||
594 | } | ||
595 | } | ||
596 | |||
597 | private SpacecraftOfKind() { | ||
598 | super(GeneratedPQuery.INSTANCE); | ||
599 | } | ||
600 | |||
601 | /** | ||
602 | * @return the singleton instance of the query specification | ||
603 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
604 | * | ||
605 | */ | ||
606 | public static SpacecraftOfKind instance() { | ||
607 | try{ | ||
608 | return LazyHolder.INSTANCE; | ||
609 | } catch (ExceptionInInitializerError err) { | ||
610 | throw processInitializerError(err); | ||
611 | } | ||
612 | } | ||
613 | |||
614 | @Override | ||
615 | protected SpacecraftOfKind.Matcher instantiate(final ViatraQueryEngine engine) { | ||
616 | return SpacecraftOfKind.Matcher.on(engine); | ||
617 | } | ||
618 | |||
619 | @Override | ||
620 | public SpacecraftOfKind.Matcher instantiate() { | ||
621 | return SpacecraftOfKind.Matcher.create(); | ||
622 | } | ||
623 | |||
624 | @Override | ||
625 | public SpacecraftOfKind.Match newEmptyMatch() { | ||
626 | return SpacecraftOfKind.Match.newEmptyMatch(); | ||
627 | } | ||
628 | |||
629 | @Override | ||
630 | public SpacecraftOfKind.Match newMatch(final Object... parameters) { | ||
631 | return SpacecraftOfKind.Match.newMatch((satellite.Spacecraft) parameters[0], (satellite.SpacecraftKind) parameters[1]); | ||
632 | } | ||
633 | |||
634 | /** | ||
635 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind (visibility: PUBLIC, simpleName: SpacecraftOfKind, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind, 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 | ||
636 | * <b>not</b> at the class load time of the outer class, | ||
637 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind (visibility: PUBLIC, simpleName: SpacecraftOfKind, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
638 | * | ||
639 | * <p> This workaround is required e.g. to support recursion. | ||
640 | * | ||
641 | */ | ||
642 | private static class LazyHolder { | ||
643 | private static final SpacecraftOfKind INSTANCE = new SpacecraftOfKind(); | ||
644 | |||
645 | /** | ||
646 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
647 | * This initialization order is required to support indirect recursion. | ||
648 | * | ||
649 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
650 | * | ||
651 | */ | ||
652 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
653 | |||
654 | public static Object ensureInitialized() { | ||
655 | INSTANCE.ensureInitializedInternal(); | ||
656 | return null; | ||
657 | } | ||
658 | } | ||
659 | |||
660 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
661 | private static final SpacecraftOfKind.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
662 | |||
663 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
664 | |||
665 | private final PParameter parameter_Kind = new PParameter("Kind", "satellite.SpacecraftKind", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "SpacecraftKind")), PParameterDirection.INOUT); | ||
666 | |||
667 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Kind); | ||
668 | |||
669 | private GeneratedPQuery() { | ||
670 | super(PVisibility.PUBLIC); | ||
671 | } | ||
672 | |||
673 | @Override | ||
674 | public String getFullyQualifiedName() { | ||
675 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind"; | ||
676 | } | ||
677 | |||
678 | @Override | ||
679 | public List<String> getParameterNames() { | ||
680 | return Arrays.asList("Spacecraft","Kind"); | ||
681 | } | ||
682 | |||
683 | @Override | ||
684 | public List<PParameter> getParameters() { | ||
685 | return parameters; | ||
686 | } | ||
687 | |||
688 | @Override | ||
689 | public Set<PBody> doGetContainedBodies() { | ||
690 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
691 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
692 | { | ||
693 | PBody body = new PBody(this); | ||
694 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
695 | PVariable var_Kind = body.getOrCreateVariableByName("Kind"); | ||
696 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
697 | new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
698 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
699 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
700 | new ExportedParameter(body, var_Kind, parameter_Kind) | ||
701 | )); | ||
702 | // CubeSat3U(Spacecraft) | ||
703 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); | ||
704 | // Kind == SpacecraftKind::CubeSat3U | ||
705 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
706 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat3U").getInstance()); | ||
707 | new Equality(body, var_Kind, var__virtual_0_); | ||
708 | bodies.add(body); | ||
709 | } | ||
710 | { | ||
711 | PBody body = new PBody(this); | ||
712 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
713 | PVariable var_Kind = body.getOrCreateVariableByName("Kind"); | ||
714 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
715 | new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
716 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
717 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
718 | new ExportedParameter(body, var_Kind, parameter_Kind) | ||
719 | )); | ||
720 | // CubeSat6U(Spacecraft) | ||
721 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat6U"))); | ||
722 | // Kind == SpacecraftKind::CubeSat6U | ||
723 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
724 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat6U").getInstance()); | ||
725 | new Equality(body, var_Kind, var__virtual_0_); | ||
726 | bodies.add(body); | ||
727 | } | ||
728 | { | ||
729 | PBody body = new PBody(this); | ||
730 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
731 | PVariable var_Kind = body.getOrCreateVariableByName("Kind"); | ||
732 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
733 | new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
734 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
735 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
736 | new ExportedParameter(body, var_Kind, parameter_Kind) | ||
737 | )); | ||
738 | // SmallSat(Spacecraft) | ||
739 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat"))); | ||
740 | // Kind == SpacecraftKind::SmallSat | ||
741 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
742 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "SmallSat").getInstance()); | ||
743 | new Equality(body, var_Kind, var__virtual_0_); | ||
744 | bodies.add(body); | ||
745 | } | ||
746 | { | ||
747 | PAnnotation annotation = new PAnnotation("QueryBasedFeature"); | ||
748 | annotation.addAttribute("feature", "kind"); | ||
749 | addAnnotation(annotation); | ||
750 | } | ||
751 | return bodies; | ||
752 | } | ||
753 | } | ||
754 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/TimeMetric.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/TimeMetric.java deleted file mode 100644 index 45d4cc35..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/TimeMetric.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.MissionTime; | ||
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 | * // Time | ||
47 | * | ||
48 | * pattern timeMetric(Time : java Double) { | ||
49 | * Time == sum find missionTime(_, #_); | ||
50 | * } | ||
51 | * </pre></code> | ||
52 | * | ||
53 | * @see Matcher | ||
54 | * @see Match | ||
55 | * | ||
56 | */ | ||
57 | @SuppressWarnings("all") | ||
58 | public final class TimeMetric extends BaseGeneratedEMFQuerySpecification<TimeMetric.Matcher> { | ||
59 | /** | ||
60 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric 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 fTime; | ||
73 | |||
74 | private static List<String> parameterNames = makeImmutableList("Time"); | ||
75 | |||
76 | private Match(final Double pTime) { | ||
77 | this.fTime = pTime; | ||
78 | } | ||
79 | |||
80 | @Override | ||
81 | public Object get(final String parameterName) { | ||
82 | if ("Time".equals(parameterName)) return this.fTime; | ||
83 | return null; | ||
84 | } | ||
85 | |||
86 | public Double getTime() { | ||
87 | return this.fTime; | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public boolean set(final String parameterName, final Object newValue) { | ||
92 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
93 | if ("Time".equals(parameterName) ) { | ||
94 | this.fTime = (Double) newValue; | ||
95 | return true; | ||
96 | } | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | public void setTime(final Double pTime) { | ||
101 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
102 | this.fTime = pTime; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String patternName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> parameterNames() { | ||
112 | return TimeMetric.Match.parameterNames; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Object[] toArray() { | ||
117 | return new Object[]{fTime}; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public TimeMetric.Match toImmutable() { | ||
122 | return isMutable() ? newMatch(fTime) : this; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public String prettyPrint() { | ||
127 | StringBuilder result = new StringBuilder(); | ||
128 | result.append("\"Time\"=" + prettyPrintValue(fTime)); | ||
129 | return result.toString(); | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public int hashCode() { | ||
134 | return Objects.hash(fTime); | ||
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 TimeMetric.Match)) { | ||
145 | TimeMetric.Match other = (TimeMetric.Match) obj; | ||
146 | return Objects.equals(fTime, other.fTime); | ||
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 TimeMetric specification() { | ||
159 | return TimeMetric.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 TimeMetric.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 pTime the fixed value of pattern parameter Time, or null if not bound. | ||
178 | * @return the new, mutable (partial) match object. | ||
179 | * | ||
180 | */ | ||
181 | public static TimeMetric.Match newMutableMatch(final Double pTime) { | ||
182 | return new Mutable(pTime); | ||
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 pTime the fixed value of pattern parameter Time, or null if not bound. | ||
190 | * @return the (partial) match object. | ||
191 | * | ||
192 | */ | ||
193 | public static TimeMetric.Match newMatch(final Double pTime) { | ||
194 | return new Immutable(pTime); | ||
195 | } | ||
196 | |||
197 | private static final class Mutable extends TimeMetric.Match { | ||
198 | Mutable(final Double pTime) { | ||
199 | super(pTime); | ||
200 | } | ||
201 | |||
202 | @Override | ||
203 | public boolean isMutable() { | ||
204 | return true; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | private static final class Immutable extends TimeMetric.Match { | ||
209 | Immutable(final Double pTime) { | ||
210 | super(pTime); | ||
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.timeMetric 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 | * // Time | ||
232 | * | ||
233 | * pattern timeMetric(Time : java Double) { | ||
234 | * Time == sum find missionTime(_, #_); | ||
235 | * } | ||
236 | * </pre></code> | ||
237 | * | ||
238 | * @see Match | ||
239 | * @see TimeMetric | ||
240 | * | ||
241 | */ | ||
242 | public static class Matcher extends BaseMatcher<TimeMetric.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 TimeMetric.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 TimeMetric.Matcher create() { | ||
267 | return new Matcher(); | ||
268 | } | ||
269 | |||
270 | private static final int POSITION_TIME = 0; | ||
271 | |||
272 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TimeMetric.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 pTime the fixed value of pattern parameter Time, or null if not bound. | ||
289 | * @return matches represented as a Match object. | ||
290 | * | ||
291 | */ | ||
292 | public Collection<TimeMetric.Match> getAllMatches(final Double pTime) { | ||
293 | return rawStreamAllMatches(new Object[]{pTime}).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 pTime the fixed value of pattern parameter Time, or null if not bound. | ||
303 | * @return a stream of matches represented as a Match object. | ||
304 | * | ||
305 | */ | ||
306 | public Stream<TimeMetric.Match> streamAllMatches(final Double pTime) { | ||
307 | return rawStreamAllMatches(new Object[]{pTime}); | ||
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 pTime the fixed value of pattern parameter Time, 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<TimeMetric.Match> getOneArbitraryMatch(final Double pTime) { | ||
318 | return rawGetOneArbitraryMatch(new Object[]{pTime}); | ||
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 pTime the fixed value of pattern parameter Time, 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 pTime) { | ||
329 | return rawHasMatch(new Object[]{pTime}); | ||
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 pTime the fixed value of pattern parameter Time, or null if not bound. | ||
335 | * @return the number of pattern matches found. | ||
336 | * | ||
337 | */ | ||
338 | public int countMatches(final Double pTime) { | ||
339 | return rawCountMatches(new Object[]{pTime}); | ||
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 pTime the fixed value of pattern parameter Time, 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 pTime, final Consumer<? super TimeMetric.Match> processor) { | ||
351 | return rawForOneArbitraryMatch(new Object[]{pTime}, 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 pTime the fixed value of pattern parameter Time, or null if not bound. | ||
359 | * @return the (partial) match object. | ||
360 | * | ||
361 | */ | ||
362 | public TimeMetric.Match newMatch(final Double pTime) { | ||
363 | return TimeMetric.Match.newMatch(pTime); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Retrieve the set of values that occur in matches for Time. | ||
368 | * @return the Set of all values or empty set if there are no matches | ||
369 | * | ||
370 | */ | ||
371 | protected Stream<Double> rawStreamAllValuesOfTime(final Object[] parameters) { | ||
372 | return rawStreamAllValues(POSITION_TIME, parameters).map(Double.class::cast); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * Retrieve the set of values that occur in matches for Time. | ||
377 | * @return the Set of all values or empty set if there are no matches | ||
378 | * | ||
379 | */ | ||
380 | public Set<Double> getAllValuesOfTime() { | ||
381 | return rawStreamAllValuesOfTime(emptyArray()).collect(Collectors.toSet()); | ||
382 | } | ||
383 | |||
384 | /** | ||
385 | * Retrieve the set of values that occur in matches for Time. | ||
386 | * @return the Set of all values or empty set if there are no matches | ||
387 | * | ||
388 | */ | ||
389 | public Stream<Double> streamAllValuesOfTime() { | ||
390 | return rawStreamAllValuesOfTime(emptyArray()); | ||
391 | } | ||
392 | |||
393 | @Override | ||
394 | protected TimeMetric.Match tupleToMatch(final Tuple t) { | ||
395 | try { | ||
396 | return TimeMetric.Match.newMatch((Double) t.get(POSITION_TIME)); | ||
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 TimeMetric.Match arrayToMatch(final Object[] match) { | ||
405 | try { | ||
406 | return TimeMetric.Match.newMatch((Double) match[POSITION_TIME]); | ||
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 TimeMetric.Match arrayToMatchMutable(final Object[] match) { | ||
415 | try { | ||
416 | return TimeMetric.Match.newMutableMatch((Double) match[POSITION_TIME]); | ||
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<TimeMetric.Matcher> querySpecification() { | ||
429 | return TimeMetric.instance(); | ||
430 | } | ||
431 | } | ||
432 | |||
433 | private TimeMetric() { | ||
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 TimeMetric instance() { | ||
443 | try{ | ||
444 | return LazyHolder.INSTANCE; | ||
445 | } catch (ExceptionInInitializerError err) { | ||
446 | throw processInitializerError(err); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | @Override | ||
451 | protected TimeMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
452 | return TimeMetric.Matcher.on(engine); | ||
453 | } | ||
454 | |||
455 | @Override | ||
456 | public TimeMetric.Matcher instantiate() { | ||
457 | return TimeMetric.Matcher.create(); | ||
458 | } | ||
459 | |||
460 | @Override | ||
461 | public TimeMetric.Match newEmptyMatch() { | ||
462 | return TimeMetric.Match.newEmptyMatch(); | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | public TimeMetric.Match newMatch(final Object... parameters) { | ||
467 | return TimeMetric.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.TimeMetric (visibility: PUBLIC, simpleName: TimeMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric, 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.TimeMetric (visibility: PUBLIC, simpleName: TimeMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric, 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 TimeMetric INSTANCE = new TimeMetric(); | ||
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 TimeMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
498 | |||
499 | private final PParameter parameter_Time = new PParameter("Time", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
500 | |||
501 | private final List<PParameter> parameters = Arrays.asList(parameter_Time); | ||
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.timeMetric"; | ||
510 | } | ||
511 | |||
512 | @Override | ||
513 | public List<String> getParameterNames() { | ||
514 | return Arrays.asList("Time"); | ||
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_Time = body.getOrCreateVariableByName("Time"); | ||
529 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
530 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
531 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Time), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
532 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
533 | new ExportedParameter(body, var_Time, parameter_Time) | ||
534 | )); | ||
535 | // Time == sum find missionTime(_, #_) | ||
536 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
537 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), MissionTime.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
538 | new Equality(body, var_Time, var__virtual_0_); | ||
539 | bodies.add(body); | ||
540 | } | ||
541 | return bodies; | ||
542 | } | ||
543 | } | ||
544 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/UhfAntennaGainNotLow.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/UhfAntennaGainNotLow.java deleted file mode 100644 index 99e472ea..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/UhfAntennaGainNotLow.java +++ /dev/null | |||
@@ -1,576 +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.CommSubsystemGainLow; | ||
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.emf.ecore.EClass; | ||
19 | import org.eclipse.emf.ecore.EDataType; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
44 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
45 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
46 | import satellite.CommSubsystem; | ||
47 | |||
48 | /** | ||
49 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
50 | * | ||
51 | * <p>Original source: | ||
52 | * <code><pre> | ||
53 | * // UHF-band transmitters may only be combined with a low gain antenna | ||
54 | * | ||
55 | * {@literal @}Constraint(severity = "error", key = {Comm}, | ||
56 | * message = "UHF transceiver must be combined with a low gain antenna.") | ||
57 | * pattern uhfAntennaGainNotLow(Comm : CommSubsystem) { | ||
58 | * CommSubsystem.band(Comm, TransceiverBand::UHF); | ||
59 | * // VIATRA will fail to infer a type constraint for the virtual variable introduced | ||
60 | * // when an enum literal appears in a negative pattern call, so we use a helper pattern | ||
61 | * // instead of neg find commSubsystemGain(Comm, AntennaGain::LOW); | ||
62 | * neg find commSubsystemGainLow(Comm); | ||
63 | * } | ||
64 | * </pre></code> | ||
65 | * | ||
66 | * @see Matcher | ||
67 | * @see Match | ||
68 | * | ||
69 | */ | ||
70 | @SuppressWarnings("all") | ||
71 | public final class UhfAntennaGainNotLow extends BaseGeneratedEMFQuerySpecification<UhfAntennaGainNotLow.Matcher> { | ||
72 | /** | ||
73 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.uhfAntennaGainNotLow pattern, | ||
74 | * to be used in conjunction with {@link Matcher}. | ||
75 | * | ||
76 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
77 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
78 | * usable to represent a match of the pattern in the result of a query, | ||
79 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
80 | * | ||
81 | * @see Matcher | ||
82 | * | ||
83 | */ | ||
84 | public static abstract class Match extends BasePatternMatch { | ||
85 | private CommSubsystem fComm; | ||
86 | |||
87 | private static List<String> parameterNames = makeImmutableList("Comm"); | ||
88 | |||
89 | private Match(final CommSubsystem pComm) { | ||
90 | this.fComm = pComm; | ||
91 | } | ||
92 | |||
93 | @Override | ||
94 | public Object get(final String parameterName) { | ||
95 | if ("Comm".equals(parameterName)) return this.fComm; | ||
96 | return null; | ||
97 | } | ||
98 | |||
99 | public CommSubsystem getComm() { | ||
100 | return this.fComm; | ||
101 | } | ||
102 | |||
103 | @Override | ||
104 | public boolean set(final String parameterName, final Object newValue) { | ||
105 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
106 | if ("Comm".equals(parameterName) ) { | ||
107 | this.fComm = (CommSubsystem) newValue; | ||
108 | return true; | ||
109 | } | ||
110 | return false; | ||
111 | } | ||
112 | |||
113 | public void setComm(final CommSubsystem pComm) { | ||
114 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
115 | this.fComm = pComm; | ||
116 | } | ||
117 | |||
118 | @Override | ||
119 | public String patternName() { | ||
120 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.uhfAntennaGainNotLow"; | ||
121 | } | ||
122 | |||
123 | @Override | ||
124 | public List<String> parameterNames() { | ||
125 | return UhfAntennaGainNotLow.Match.parameterNames; | ||
126 | } | ||
127 | |||
128 | @Override | ||
129 | public Object[] toArray() { | ||
130 | return new Object[]{fComm}; | ||
131 | } | ||
132 | |||
133 | @Override | ||
134 | public UhfAntennaGainNotLow.Match toImmutable() { | ||
135 | return isMutable() ? newMatch(fComm) : this; | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public String prettyPrint() { | ||
140 | StringBuilder result = new StringBuilder(); | ||
141 | result.append("\"Comm\"=" + prettyPrintValue(fComm)); | ||
142 | return result.toString(); | ||
143 | } | ||
144 | |||
145 | @Override | ||
146 | public int hashCode() { | ||
147 | return Objects.hash(fComm); | ||
148 | } | ||
149 | |||
150 | @Override | ||
151 | public boolean equals(final Object obj) { | ||
152 | if (this == obj) | ||
153 | return true; | ||
154 | if (obj == null) { | ||
155 | return false; | ||
156 | } | ||
157 | if ((obj instanceof UhfAntennaGainNotLow.Match)) { | ||
158 | UhfAntennaGainNotLow.Match other = (UhfAntennaGainNotLow.Match) obj; | ||
159 | return Objects.equals(fComm, other.fComm); | ||
160 | } else { | ||
161 | // this should be infrequent | ||
162 | if (!(obj instanceof IPatternMatch)) { | ||
163 | return false; | ||
164 | } | ||
165 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
166 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
167 | } | ||
168 | } | ||
169 | |||
170 | @Override | ||
171 | public UhfAntennaGainNotLow specification() { | ||
172 | return UhfAntennaGainNotLow.instance(); | ||
173 | } | ||
174 | |||
175 | /** | ||
176 | * Returns an empty, mutable match. | ||
177 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
178 | * | ||
179 | * @return the empty match. | ||
180 | * | ||
181 | */ | ||
182 | public static UhfAntennaGainNotLow.Match newEmptyMatch() { | ||
183 | return new Mutable(null); | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * Returns a mutable (partial) match. | ||
188 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
189 | * | ||
190 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
191 | * @return the new, mutable (partial) match object. | ||
192 | * | ||
193 | */ | ||
194 | public static UhfAntennaGainNotLow.Match newMutableMatch(final CommSubsystem pComm) { | ||
195 | return new Mutable(pComm); | ||
196 | } | ||
197 | |||
198 | /** | ||
199 | * Returns a new (partial) match. | ||
200 | * This can be used e.g. to call the matcher with a partial match. | ||
201 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
202 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
203 | * @return the (partial) match object. | ||
204 | * | ||
205 | */ | ||
206 | public static UhfAntennaGainNotLow.Match newMatch(final CommSubsystem pComm) { | ||
207 | return new Immutable(pComm); | ||
208 | } | ||
209 | |||
210 | private static final class Mutable extends UhfAntennaGainNotLow.Match { | ||
211 | Mutable(final CommSubsystem pComm) { | ||
212 | super(pComm); | ||
213 | } | ||
214 | |||
215 | @Override | ||
216 | public boolean isMutable() { | ||
217 | return true; | ||
218 | } | ||
219 | } | ||
220 | |||
221 | private static final class Immutable extends UhfAntennaGainNotLow.Match { | ||
222 | Immutable(final CommSubsystem pComm) { | ||
223 | super(pComm); | ||
224 | } | ||
225 | |||
226 | @Override | ||
227 | public boolean isMutable() { | ||
228 | return false; | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | |||
233 | /** | ||
234 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.uhfAntennaGainNotLow pattern, | ||
235 | * providing pattern-specific query methods. | ||
236 | * | ||
237 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
238 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
239 | * | ||
240 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
241 | * | ||
242 | * <p>Original source: | ||
243 | * <code><pre> | ||
244 | * // UHF-band transmitters may only be combined with a low gain antenna | ||
245 | * | ||
246 | * {@literal @}Constraint(severity = "error", key = {Comm}, | ||
247 | * message = "UHF transceiver must be combined with a low gain antenna.") | ||
248 | * pattern uhfAntennaGainNotLow(Comm : CommSubsystem) { | ||
249 | * CommSubsystem.band(Comm, TransceiverBand::UHF); | ||
250 | * // VIATRA will fail to infer a type constraint for the virtual variable introduced | ||
251 | * // when an enum literal appears in a negative pattern call, so we use a helper pattern | ||
252 | * // instead of neg find commSubsystemGain(Comm, AntennaGain::LOW); | ||
253 | * neg find commSubsystemGainLow(Comm); | ||
254 | * } | ||
255 | * </pre></code> | ||
256 | * | ||
257 | * @see Match | ||
258 | * @see UhfAntennaGainNotLow | ||
259 | * | ||
260 | */ | ||
261 | public static class Matcher extends BaseMatcher<UhfAntennaGainNotLow.Match> { | ||
262 | /** | ||
263 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
264 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
265 | * | ||
266 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
267 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
268 | * | ||
269 | */ | ||
270 | public static UhfAntennaGainNotLow.Matcher on(final ViatraQueryEngine engine) { | ||
271 | // check if matcher already exists | ||
272 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
273 | if (matcher == null) { | ||
274 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
275 | } | ||
276 | return matcher; | ||
277 | } | ||
278 | |||
279 | /** | ||
280 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
281 | * @return an initialized matcher | ||
282 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
283 | * | ||
284 | */ | ||
285 | public static UhfAntennaGainNotLow.Matcher create() { | ||
286 | return new Matcher(); | ||
287 | } | ||
288 | |||
289 | private static final int POSITION_COMM = 0; | ||
290 | |||
291 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(UhfAntennaGainNotLow.Matcher.class); | ||
292 | |||
293 | /** | ||
294 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
295 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
296 | * | ||
297 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
298 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
299 | * | ||
300 | */ | ||
301 | private Matcher() { | ||
302 | super(querySpecification()); | ||
303 | } | ||
304 | |||
305 | /** | ||
306 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
307 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
308 | * @return matches represented as a Match object. | ||
309 | * | ||
310 | */ | ||
311 | public Collection<UhfAntennaGainNotLow.Match> getAllMatches(final CommSubsystem pComm) { | ||
312 | return rawStreamAllMatches(new Object[]{pComm}).collect(Collectors.toSet()); | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
317 | * </p> | ||
318 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
319 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
320 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
321 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
322 | * @return a stream of matches represented as a Match object. | ||
323 | * | ||
324 | */ | ||
325 | public Stream<UhfAntennaGainNotLow.Match> streamAllMatches(final CommSubsystem pComm) { | ||
326 | return rawStreamAllMatches(new Object[]{pComm}); | ||
327 | } | ||
328 | |||
329 | /** | ||
330 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
331 | * Neither determinism nor randomness of selection is guaranteed. | ||
332 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
333 | * @return a match represented as a Match object, or null if no match is found. | ||
334 | * | ||
335 | */ | ||
336 | public Optional<UhfAntennaGainNotLow.Match> getOneArbitraryMatch(final CommSubsystem pComm) { | ||
337 | return rawGetOneArbitraryMatch(new Object[]{pComm}); | ||
338 | } | ||
339 | |||
340 | /** | ||
341 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
342 | * under any possible substitution of the unspecified parameters (if any). | ||
343 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
344 | * @return true if the input is a valid (partial) match of the pattern. | ||
345 | * | ||
346 | */ | ||
347 | public boolean hasMatch(final CommSubsystem pComm) { | ||
348 | return rawHasMatch(new Object[]{pComm}); | ||
349 | } | ||
350 | |||
351 | /** | ||
352 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
353 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
354 | * @return the number of pattern matches found. | ||
355 | * | ||
356 | */ | ||
357 | public int countMatches(final CommSubsystem pComm) { | ||
358 | return rawCountMatches(new Object[]{pComm}); | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
363 | * Neither determinism nor randomness of selection is guaranteed. | ||
364 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
365 | * @param processor the action that will process the selected match. | ||
366 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
367 | * | ||
368 | */ | ||
369 | public boolean forOneArbitraryMatch(final CommSubsystem pComm, final Consumer<? super UhfAntennaGainNotLow.Match> processor) { | ||
370 | return rawForOneArbitraryMatch(new Object[]{pComm}, processor); | ||
371 | } | ||
372 | |||
373 | /** | ||
374 | * Returns a new (partial) match. | ||
375 | * This can be used e.g. to call the matcher with a partial match. | ||
376 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
377 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
378 | * @return the (partial) match object. | ||
379 | * | ||
380 | */ | ||
381 | public UhfAntennaGainNotLow.Match newMatch(final CommSubsystem pComm) { | ||
382 | return UhfAntennaGainNotLow.Match.newMatch(pComm); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * Retrieve the set of values that occur in matches for Comm. | ||
387 | * @return the Set of all values or empty set if there are no matches | ||
388 | * | ||
389 | */ | ||
390 | protected Stream<CommSubsystem> rawStreamAllValuesOfComm(final Object[] parameters) { | ||
391 | return rawStreamAllValues(POSITION_COMM, parameters).map(CommSubsystem.class::cast); | ||
392 | } | ||
393 | |||
394 | /** | ||
395 | * Retrieve the set of values that occur in matches for Comm. | ||
396 | * @return the Set of all values or empty set if there are no matches | ||
397 | * | ||
398 | */ | ||
399 | public Set<CommSubsystem> getAllValuesOfComm() { | ||
400 | return rawStreamAllValuesOfComm(emptyArray()).collect(Collectors.toSet()); | ||
401 | } | ||
402 | |||
403 | /** | ||
404 | * Retrieve the set of values that occur in matches for Comm. | ||
405 | * @return the Set of all values or empty set if there are no matches | ||
406 | * | ||
407 | */ | ||
408 | public Stream<CommSubsystem> streamAllValuesOfComm() { | ||
409 | return rawStreamAllValuesOfComm(emptyArray()); | ||
410 | } | ||
411 | |||
412 | @Override | ||
413 | protected UhfAntennaGainNotLow.Match tupleToMatch(final Tuple t) { | ||
414 | try { | ||
415 | return UhfAntennaGainNotLow.Match.newMatch((CommSubsystem) t.get(POSITION_COMM)); | ||
416 | } catch(ClassCastException e) { | ||
417 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
418 | return null; | ||
419 | } | ||
420 | } | ||
421 | |||
422 | @Override | ||
423 | protected UhfAntennaGainNotLow.Match arrayToMatch(final Object[] match) { | ||
424 | try { | ||
425 | return UhfAntennaGainNotLow.Match.newMatch((CommSubsystem) match[POSITION_COMM]); | ||
426 | } catch(ClassCastException e) { | ||
427 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
428 | return null; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | @Override | ||
433 | protected UhfAntennaGainNotLow.Match arrayToMatchMutable(final Object[] match) { | ||
434 | try { | ||
435 | return UhfAntennaGainNotLow.Match.newMutableMatch((CommSubsystem) match[POSITION_COMM]); | ||
436 | } catch(ClassCastException e) { | ||
437 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
438 | return null; | ||
439 | } | ||
440 | } | ||
441 | |||
442 | /** | ||
443 | * @return the singleton instance of the query specification of this pattern | ||
444 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
445 | * | ||
446 | */ | ||
447 | public static IQuerySpecification<UhfAntennaGainNotLow.Matcher> querySpecification() { | ||
448 | return UhfAntennaGainNotLow.instance(); | ||
449 | } | ||
450 | } | ||
451 | |||
452 | private UhfAntennaGainNotLow() { | ||
453 | super(GeneratedPQuery.INSTANCE); | ||
454 | } | ||
455 | |||
456 | /** | ||
457 | * @return the singleton instance of the query specification | ||
458 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
459 | * | ||
460 | */ | ||
461 | public static UhfAntennaGainNotLow instance() { | ||
462 | try{ | ||
463 | return LazyHolder.INSTANCE; | ||
464 | } catch (ExceptionInInitializerError err) { | ||
465 | throw processInitializerError(err); | ||
466 | } | ||
467 | } | ||
468 | |||
469 | @Override | ||
470 | protected UhfAntennaGainNotLow.Matcher instantiate(final ViatraQueryEngine engine) { | ||
471 | return UhfAntennaGainNotLow.Matcher.on(engine); | ||
472 | } | ||
473 | |||
474 | @Override | ||
475 | public UhfAntennaGainNotLow.Matcher instantiate() { | ||
476 | return UhfAntennaGainNotLow.Matcher.create(); | ||
477 | } | ||
478 | |||
479 | @Override | ||
480 | public UhfAntennaGainNotLow.Match newEmptyMatch() { | ||
481 | return UhfAntennaGainNotLow.Match.newEmptyMatch(); | ||
482 | } | ||
483 | |||
484 | @Override | ||
485 | public UhfAntennaGainNotLow.Match newMatch(final Object... parameters) { | ||
486 | return UhfAntennaGainNotLow.Match.newMatch((satellite.CommSubsystem) parameters[0]); | ||
487 | } | ||
488 | |||
489 | /** | ||
490 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow (visibility: PUBLIC, simpleName: UhfAntennaGainNotLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow, 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 | ||
491 | * <b>not</b> at the class load time of the outer class, | ||
492 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow (visibility: PUBLIC, simpleName: UhfAntennaGainNotLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
493 | * | ||
494 | * <p> This workaround is required e.g. to support recursion. | ||
495 | * | ||
496 | */ | ||
497 | private static class LazyHolder { | ||
498 | private static final UhfAntennaGainNotLow INSTANCE = new UhfAntennaGainNotLow(); | ||
499 | |||
500 | /** | ||
501 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
502 | * This initialization order is required to support indirect recursion. | ||
503 | * | ||
504 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
505 | * | ||
506 | */ | ||
507 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
508 | |||
509 | public static Object ensureInitialized() { | ||
510 | INSTANCE.ensureInitializedInternal(); | ||
511 | return null; | ||
512 | } | ||
513 | } | ||
514 | |||
515 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
516 | private static final UhfAntennaGainNotLow.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
517 | |||
518 | private final PParameter parameter_Comm = new PParameter("Comm", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | ||
519 | |||
520 | private final List<PParameter> parameters = Arrays.asList(parameter_Comm); | ||
521 | |||
522 | private GeneratedPQuery() { | ||
523 | super(PVisibility.PUBLIC); | ||
524 | } | ||
525 | |||
526 | @Override | ||
527 | public String getFullyQualifiedName() { | ||
528 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.uhfAntennaGainNotLow"; | ||
529 | } | ||
530 | |||
531 | @Override | ||
532 | public List<String> getParameterNames() { | ||
533 | return Arrays.asList("Comm"); | ||
534 | } | ||
535 | |||
536 | @Override | ||
537 | public List<PParameter> getParameters() { | ||
538 | return parameters; | ||
539 | } | ||
540 | |||
541 | @Override | ||
542 | public Set<PBody> doGetContainedBodies() { | ||
543 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
544 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
545 | { | ||
546 | PBody body = new PBody(this); | ||
547 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); | ||
548 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
549 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
550 | new ExportedParameter(body, var_Comm, parameter_Comm) | ||
551 | )); | ||
552 | // CommSubsystem.band(Comm, TransceiverBand::UHF) | ||
553 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
554 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance()); | ||
555 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
556 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
557 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
558 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
559 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
560 | // // VIATRA will fail to infer a type constraint for the virtual variable introduced // when an enum literal appears in a negative pattern call, so we use a helper pattern // instead of neg find commSubsystemGain(Comm, AntennaGain::LOW); neg find commSubsystemGainLow(Comm) | ||
561 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Comm), CommSubsystemGainLow.instance().getInternalQueryRepresentation()); | ||
562 | bodies.add(body); | ||
563 | } | ||
564 | { | ||
565 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
566 | annotation.addAttribute("severity", "error"); | ||
567 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
568 | new ParameterReference("Comm") | ||
569 | })); | ||
570 | annotation.addAttribute("message", "UHF transceiver must be combined with a low gain antenna."); | ||
571 | addAnnotation(annotation); | ||
572 | } | ||
573 | return bodies; | ||
574 | } | ||
575 | } | ||
576 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/XAntennaGainNotMedium.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/XAntennaGainNotMedium.java deleted file mode 100644 index b50962c5..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/XAntennaGainNotMedium.java +++ /dev/null | |||
@@ -1,570 +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.CommSubsystemGainMedium; | ||
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.emf.ecore.EClass; | ||
19 | import org.eclipse.emf.ecore.EDataType; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
44 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
45 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
46 | import satellite.CommSubsystem; | ||
47 | |||
48 | /** | ||
49 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
50 | * | ||
51 | * <p>Original source: | ||
52 | * <code><pre> | ||
53 | * // X-band transmitters may only be combined with a medium gain antenna | ||
54 | * | ||
55 | * {@literal @}Constraint(severity = "error", key = {Comm}, | ||
56 | * message = "X-band transceiver must be combined with a medium gain antenna.") | ||
57 | * pattern xAntennaGainNotMedium(Comm : CommSubsystem) { | ||
58 | * CommSubsystem.band(Comm, TransceiverBand::X); | ||
59 | * neg find commSubsystemGainMedium(Comm); | ||
60 | * } | ||
61 | * </pre></code> | ||
62 | * | ||
63 | * @see Matcher | ||
64 | * @see Match | ||
65 | * | ||
66 | */ | ||
67 | @SuppressWarnings("all") | ||
68 | public final class XAntennaGainNotMedium extends BaseGeneratedEMFQuerySpecification<XAntennaGainNotMedium.Matcher> { | ||
69 | /** | ||
70 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.xAntennaGainNotMedium pattern, | ||
71 | * to be used in conjunction with {@link Matcher}. | ||
72 | * | ||
73 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
74 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
75 | * usable to represent a match of the pattern in the result of a query, | ||
76 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
77 | * | ||
78 | * @see Matcher | ||
79 | * | ||
80 | */ | ||
81 | public static abstract class Match extends BasePatternMatch { | ||
82 | private CommSubsystem fComm; | ||
83 | |||
84 | private static List<String> parameterNames = makeImmutableList("Comm"); | ||
85 | |||
86 | private Match(final CommSubsystem pComm) { | ||
87 | this.fComm = pComm; | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public Object get(final String parameterName) { | ||
92 | if ("Comm".equals(parameterName)) return this.fComm; | ||
93 | return null; | ||
94 | } | ||
95 | |||
96 | public CommSubsystem getComm() { | ||
97 | return this.fComm; | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public boolean set(final String parameterName, final Object newValue) { | ||
102 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
103 | if ("Comm".equals(parameterName) ) { | ||
104 | this.fComm = (CommSubsystem) newValue; | ||
105 | return true; | ||
106 | } | ||
107 | return false; | ||
108 | } | ||
109 | |||
110 | public void setComm(final CommSubsystem pComm) { | ||
111 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
112 | this.fComm = pComm; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public String patternName() { | ||
117 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.xAntennaGainNotMedium"; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<String> parameterNames() { | ||
122 | return XAntennaGainNotMedium.Match.parameterNames; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Object[] toArray() { | ||
127 | return new Object[]{fComm}; | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public XAntennaGainNotMedium.Match toImmutable() { | ||
132 | return isMutable() ? newMatch(fComm) : this; | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public String prettyPrint() { | ||
137 | StringBuilder result = new StringBuilder(); | ||
138 | result.append("\"Comm\"=" + prettyPrintValue(fComm)); | ||
139 | return result.toString(); | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public int hashCode() { | ||
144 | return Objects.hash(fComm); | ||
145 | } | ||
146 | |||
147 | @Override | ||
148 | public boolean equals(final Object obj) { | ||
149 | if (this == obj) | ||
150 | return true; | ||
151 | if (obj == null) { | ||
152 | return false; | ||
153 | } | ||
154 | if ((obj instanceof XAntennaGainNotMedium.Match)) { | ||
155 | XAntennaGainNotMedium.Match other = (XAntennaGainNotMedium.Match) obj; | ||
156 | return Objects.equals(fComm, other.fComm); | ||
157 | } else { | ||
158 | // this should be infrequent | ||
159 | if (!(obj instanceof IPatternMatch)) { | ||
160 | return false; | ||
161 | } | ||
162 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
163 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
164 | } | ||
165 | } | ||
166 | |||
167 | @Override | ||
168 | public XAntennaGainNotMedium specification() { | ||
169 | return XAntennaGainNotMedium.instance(); | ||
170 | } | ||
171 | |||
172 | /** | ||
173 | * Returns an empty, mutable match. | ||
174 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
175 | * | ||
176 | * @return the empty match. | ||
177 | * | ||
178 | */ | ||
179 | public static XAntennaGainNotMedium.Match newEmptyMatch() { | ||
180 | return new Mutable(null); | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * Returns a mutable (partial) match. | ||
185 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
186 | * | ||
187 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
188 | * @return the new, mutable (partial) match object. | ||
189 | * | ||
190 | */ | ||
191 | public static XAntennaGainNotMedium.Match newMutableMatch(final CommSubsystem pComm) { | ||
192 | return new Mutable(pComm); | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * Returns a new (partial) match. | ||
197 | * This can be used e.g. to call the matcher with a partial match. | ||
198 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
199 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
200 | * @return the (partial) match object. | ||
201 | * | ||
202 | */ | ||
203 | public static XAntennaGainNotMedium.Match newMatch(final CommSubsystem pComm) { | ||
204 | return new Immutable(pComm); | ||
205 | } | ||
206 | |||
207 | private static final class Mutable extends XAntennaGainNotMedium.Match { | ||
208 | Mutable(final CommSubsystem pComm) { | ||
209 | super(pComm); | ||
210 | } | ||
211 | |||
212 | @Override | ||
213 | public boolean isMutable() { | ||
214 | return true; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | private static final class Immutable extends XAntennaGainNotMedium.Match { | ||
219 | Immutable(final CommSubsystem pComm) { | ||
220 | super(pComm); | ||
221 | } | ||
222 | |||
223 | @Override | ||
224 | public boolean isMutable() { | ||
225 | return false; | ||
226 | } | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /** | ||
231 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.xAntennaGainNotMedium pattern, | ||
232 | * providing pattern-specific query methods. | ||
233 | * | ||
234 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
235 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
236 | * | ||
237 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
238 | * | ||
239 | * <p>Original source: | ||
240 | * <code><pre> | ||
241 | * // X-band transmitters may only be combined with a medium gain antenna | ||
242 | * | ||
243 | * {@literal @}Constraint(severity = "error", key = {Comm}, | ||
244 | * message = "X-band transceiver must be combined with a medium gain antenna.") | ||
245 | * pattern xAntennaGainNotMedium(Comm : CommSubsystem) { | ||
246 | * CommSubsystem.band(Comm, TransceiverBand::X); | ||
247 | * neg find commSubsystemGainMedium(Comm); | ||
248 | * } | ||
249 | * </pre></code> | ||
250 | * | ||
251 | * @see Match | ||
252 | * @see XAntennaGainNotMedium | ||
253 | * | ||
254 | */ | ||
255 | public static class Matcher extends BaseMatcher<XAntennaGainNotMedium.Match> { | ||
256 | /** | ||
257 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
258 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
259 | * | ||
260 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
261 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
262 | * | ||
263 | */ | ||
264 | public static XAntennaGainNotMedium.Matcher on(final ViatraQueryEngine engine) { | ||
265 | // check if matcher already exists | ||
266 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
267 | if (matcher == null) { | ||
268 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
269 | } | ||
270 | return matcher; | ||
271 | } | ||
272 | |||
273 | /** | ||
274 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
275 | * @return an initialized matcher | ||
276 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
277 | * | ||
278 | */ | ||
279 | public static XAntennaGainNotMedium.Matcher create() { | ||
280 | return new Matcher(); | ||
281 | } | ||
282 | |||
283 | private static final int POSITION_COMM = 0; | ||
284 | |||
285 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(XAntennaGainNotMedium.Matcher.class); | ||
286 | |||
287 | /** | ||
288 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
289 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
290 | * | ||
291 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
292 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
293 | * | ||
294 | */ | ||
295 | private Matcher() { | ||
296 | super(querySpecification()); | ||
297 | } | ||
298 | |||
299 | /** | ||
300 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
301 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
302 | * @return matches represented as a Match object. | ||
303 | * | ||
304 | */ | ||
305 | public Collection<XAntennaGainNotMedium.Match> getAllMatches(final CommSubsystem pComm) { | ||
306 | return rawStreamAllMatches(new Object[]{pComm}).collect(Collectors.toSet()); | ||
307 | } | ||
308 | |||
309 | /** | ||
310 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
311 | * </p> | ||
312 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
313 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
314 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
315 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
316 | * @return a stream of matches represented as a Match object. | ||
317 | * | ||
318 | */ | ||
319 | public Stream<XAntennaGainNotMedium.Match> streamAllMatches(final CommSubsystem pComm) { | ||
320 | return rawStreamAllMatches(new Object[]{pComm}); | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
325 | * Neither determinism nor randomness of selection is guaranteed. | ||
326 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
327 | * @return a match represented as a Match object, or null if no match is found. | ||
328 | * | ||
329 | */ | ||
330 | public Optional<XAntennaGainNotMedium.Match> getOneArbitraryMatch(final CommSubsystem pComm) { | ||
331 | return rawGetOneArbitraryMatch(new Object[]{pComm}); | ||
332 | } | ||
333 | |||
334 | /** | ||
335 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
336 | * under any possible substitution of the unspecified parameters (if any). | ||
337 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
338 | * @return true if the input is a valid (partial) match of the pattern. | ||
339 | * | ||
340 | */ | ||
341 | public boolean hasMatch(final CommSubsystem pComm) { | ||
342 | return rawHasMatch(new Object[]{pComm}); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
347 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
348 | * @return the number of pattern matches found. | ||
349 | * | ||
350 | */ | ||
351 | public int countMatches(final CommSubsystem pComm) { | ||
352 | return rawCountMatches(new Object[]{pComm}); | ||
353 | } | ||
354 | |||
355 | /** | ||
356 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
357 | * Neither determinism nor randomness of selection is guaranteed. | ||
358 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
359 | * @param processor the action that will process the selected match. | ||
360 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
361 | * | ||
362 | */ | ||
363 | public boolean forOneArbitraryMatch(final CommSubsystem pComm, final Consumer<? super XAntennaGainNotMedium.Match> processor) { | ||
364 | return rawForOneArbitraryMatch(new Object[]{pComm}, processor); | ||
365 | } | ||
366 | |||
367 | /** | ||
368 | * Returns a new (partial) match. | ||
369 | * This can be used e.g. to call the matcher with a partial match. | ||
370 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
371 | * @param pComm the fixed value of pattern parameter Comm, or null if not bound. | ||
372 | * @return the (partial) match object. | ||
373 | * | ||
374 | */ | ||
375 | public XAntennaGainNotMedium.Match newMatch(final CommSubsystem pComm) { | ||
376 | return XAntennaGainNotMedium.Match.newMatch(pComm); | ||
377 | } | ||
378 | |||
379 | /** | ||
380 | * Retrieve the set of values that occur in matches for Comm. | ||
381 | * @return the Set of all values or empty set if there are no matches | ||
382 | * | ||
383 | */ | ||
384 | protected Stream<CommSubsystem> rawStreamAllValuesOfComm(final Object[] parameters) { | ||
385 | return rawStreamAllValues(POSITION_COMM, parameters).map(CommSubsystem.class::cast); | ||
386 | } | ||
387 | |||
388 | /** | ||
389 | * Retrieve the set of values that occur in matches for Comm. | ||
390 | * @return the Set of all values or empty set if there are no matches | ||
391 | * | ||
392 | */ | ||
393 | public Set<CommSubsystem> getAllValuesOfComm() { | ||
394 | return rawStreamAllValuesOfComm(emptyArray()).collect(Collectors.toSet()); | ||
395 | } | ||
396 | |||
397 | /** | ||
398 | * Retrieve the set of values that occur in matches for Comm. | ||
399 | * @return the Set of all values or empty set if there are no matches | ||
400 | * | ||
401 | */ | ||
402 | public Stream<CommSubsystem> streamAllValuesOfComm() { | ||
403 | return rawStreamAllValuesOfComm(emptyArray()); | ||
404 | } | ||
405 | |||
406 | @Override | ||
407 | protected XAntennaGainNotMedium.Match tupleToMatch(final Tuple t) { | ||
408 | try { | ||
409 | return XAntennaGainNotMedium.Match.newMatch((CommSubsystem) t.get(POSITION_COMM)); | ||
410 | } catch(ClassCastException e) { | ||
411 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
412 | return null; | ||
413 | } | ||
414 | } | ||
415 | |||
416 | @Override | ||
417 | protected XAntennaGainNotMedium.Match arrayToMatch(final Object[] match) { | ||
418 | try { | ||
419 | return XAntennaGainNotMedium.Match.newMatch((CommSubsystem) match[POSITION_COMM]); | ||
420 | } catch(ClassCastException e) { | ||
421 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
422 | return null; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | @Override | ||
427 | protected XAntennaGainNotMedium.Match arrayToMatchMutable(final Object[] match) { | ||
428 | try { | ||
429 | return XAntennaGainNotMedium.Match.newMutableMatch((CommSubsystem) match[POSITION_COMM]); | ||
430 | } catch(ClassCastException e) { | ||
431 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
432 | return null; | ||
433 | } | ||
434 | } | ||
435 | |||
436 | /** | ||
437 | * @return the singleton instance of the query specification of this pattern | ||
438 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
439 | * | ||
440 | */ | ||
441 | public static IQuerySpecification<XAntennaGainNotMedium.Matcher> querySpecification() { | ||
442 | return XAntennaGainNotMedium.instance(); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | private XAntennaGainNotMedium() { | ||
447 | super(GeneratedPQuery.INSTANCE); | ||
448 | } | ||
449 | |||
450 | /** | ||
451 | * @return the singleton instance of the query specification | ||
452 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
453 | * | ||
454 | */ | ||
455 | public static XAntennaGainNotMedium instance() { | ||
456 | try{ | ||
457 | return LazyHolder.INSTANCE; | ||
458 | } catch (ExceptionInInitializerError err) { | ||
459 | throw processInitializerError(err); | ||
460 | } | ||
461 | } | ||
462 | |||
463 | @Override | ||
464 | protected XAntennaGainNotMedium.Matcher instantiate(final ViatraQueryEngine engine) { | ||
465 | return XAntennaGainNotMedium.Matcher.on(engine); | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | public XAntennaGainNotMedium.Matcher instantiate() { | ||
470 | return XAntennaGainNotMedium.Matcher.create(); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public XAntennaGainNotMedium.Match newEmptyMatch() { | ||
475 | return XAntennaGainNotMedium.Match.newEmptyMatch(); | ||
476 | } | ||
477 | |||
478 | @Override | ||
479 | public XAntennaGainNotMedium.Match newMatch(final Object... parameters) { | ||
480 | return XAntennaGainNotMedium.Match.newMatch((satellite.CommSubsystem) parameters[0]); | ||
481 | } | ||
482 | |||
483 | /** | ||
484 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium (visibility: PUBLIC, simpleName: XAntennaGainNotMedium, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium, 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 | ||
485 | * <b>not</b> at the class load time of the outer class, | ||
486 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium (visibility: PUBLIC, simpleName: XAntennaGainNotMedium, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
487 | * | ||
488 | * <p> This workaround is required e.g. to support recursion. | ||
489 | * | ||
490 | */ | ||
491 | private static class LazyHolder { | ||
492 | private static final XAntennaGainNotMedium INSTANCE = new XAntennaGainNotMedium(); | ||
493 | |||
494 | /** | ||
495 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
496 | * This initialization order is required to support indirect recursion. | ||
497 | * | ||
498 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
499 | * | ||
500 | */ | ||
501 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
502 | |||
503 | public static Object ensureInitialized() { | ||
504 | INSTANCE.ensureInitializedInternal(); | ||
505 | return null; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
510 | private static final XAntennaGainNotMedium.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
511 | |||
512 | private final PParameter parameter_Comm = new PParameter("Comm", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | ||
513 | |||
514 | private final List<PParameter> parameters = Arrays.asList(parameter_Comm); | ||
515 | |||
516 | private GeneratedPQuery() { | ||
517 | super(PVisibility.PUBLIC); | ||
518 | } | ||
519 | |||
520 | @Override | ||
521 | public String getFullyQualifiedName() { | ||
522 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.xAntennaGainNotMedium"; | ||
523 | } | ||
524 | |||
525 | @Override | ||
526 | public List<String> getParameterNames() { | ||
527 | return Arrays.asList("Comm"); | ||
528 | } | ||
529 | |||
530 | @Override | ||
531 | public List<PParameter> getParameters() { | ||
532 | return parameters; | ||
533 | } | ||
534 | |||
535 | @Override | ||
536 | public Set<PBody> doGetContainedBodies() { | ||
537 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
538 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
539 | { | ||
540 | PBody body = new PBody(this); | ||
541 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); | ||
542 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
543 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
544 | new ExportedParameter(body, var_Comm, parameter_Comm) | ||
545 | )); | ||
546 | // CommSubsystem.band(Comm, TransceiverBand::X) | ||
547 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
548 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "X").getInstance()); | ||
549 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
550 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
551 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
552 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
553 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
554 | // neg find commSubsystemGainMedium(Comm) | ||
555 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Comm), CommSubsystemGainMedium.instance().getInternalQueryRepresentation()); | ||
556 | bodies.add(body); | ||
557 | } | ||
558 | { | ||
559 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
560 | annotation.addAttribute("severity", "error"); | ||
561 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
562 | new ParameterReference("Comm") | ||
563 | })); | ||
564 | annotation.addAttribute("message", "X-band transceiver must be combined with a medium gain antenna."); | ||
565 | addAnnotation(annotation); | ||
566 | } | ||
567 | return bodies; | ||
568 | } | ||
569 | } | ||
570 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.CubeSat6U.java._trace b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.CubeSat6U.java._trace new file mode 100644 index 00000000..d0140d1a --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.CubeSat6U.java._trace | |||
Binary files differ | |||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.MatchingCommSubsystem.java._trace b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.MatchingCommSubsystem.java._trace new file mode 100644 index 00000000..7cab430c --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.MatchingCommSubsystem.java._trace | |||
Binary files differ | |||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore index 4c8bcc9e..ea4a15d7 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore | |||
@@ -36,3 +36,31 @@ | |||
36 | /.CubeSat3U.java._trace | 36 | /.CubeSat3U.java._trace |
37 | /.LinkAllowed.java._trace | 37 | /.LinkAllowed.java._trace |
38 | /.IndirectLinkAllowed.java._trace | 38 | /.IndirectLinkAllowed.java._trace |
39 | /AdditionalCommSubsystemCost.java | ||
40 | /AtLeastTwoInterferometryPayloads.java | ||
41 | /BasePrice.java | ||
42 | /CommSubsystemBand.java | ||
43 | /CommSubsystemBandUhf.java | ||
44 | /CommSubsystemGain.java | ||
45 | /CommSubsystemGainLow.java | ||
46 | /CommSubsystemGainMedium.java | ||
47 | /CubeSat3U.java | ||
48 | /DirectCommunicationLink.java | ||
49 | /GroundStationNetwork.java | ||
50 | /IncomingData.java | ||
51 | /IndirectCommunicationLink.java | ||
52 | /IndirectLinkAllowed.java | ||
53 | /InterferometryPayloadCost.java | ||
54 | /LinkAllowed.java | ||
55 | /MatchingAntenna.java | ||
56 | /MissionCost.java | ||
57 | /MissionCoverage.java | ||
58 | /MissionTime.java | ||
59 | /SatelliteQueriesAll.java | ||
60 | /ScienceData.java | ||
61 | /SpacecraftCost.java | ||
62 | /SpacecraftUplink.java | ||
63 | /SpacecraftWithInterferometryPayload.java | ||
64 | /SpacecraftWithTwoCommSubsystems.java | ||
65 | /TransmitRate.java | ||
66 | /TransmitTime.java | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AdditionalCommSubsystemCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AdditionalCommSubsystemCost.java deleted file mode 100644 index 293fdbe0..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AdditionalCommSubsystemCost.java +++ /dev/null | |||
@@ -1,173 +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.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
30 | |||
31 | /** | ||
32 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
33 | * | ||
34 | * <p>Original source: | ||
35 | * <code><pre> | ||
36 | * private pattern additionalCommSubsystemCost(Spacecraft : Spacecraft, Cost : java Double) { | ||
37 | * find spacecraftWithTwoCommSubsystems(Spacecraft); | ||
38 | * Cost == 100000.0; | ||
39 | * } or { | ||
40 | * neg find spacecraftWithTwoCommSubsystems(Spacecraft); | ||
41 | * Cost == 0.0; | ||
42 | * } | ||
43 | * </pre></code> | ||
44 | * | ||
45 | * @see GenericPatternMatcher | ||
46 | * @see GenericPatternMatch | ||
47 | * | ||
48 | */ | ||
49 | @SuppressWarnings("all") | ||
50 | public final class AdditionalCommSubsystemCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
51 | private AdditionalCommSubsystemCost() { | ||
52 | super(GeneratedPQuery.INSTANCE); | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * @return the singleton instance of the query specification | ||
57 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
58 | * | ||
59 | */ | ||
60 | public static AdditionalCommSubsystemCost instance() { | ||
61 | try{ | ||
62 | return LazyHolder.INSTANCE; | ||
63 | } catch (ExceptionInInitializerError err) { | ||
64 | throw processInitializerError(err); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost (visibility: PUBLIC, simpleName: AdditionalCommSubsystemCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
70 | * <b>not</b> at the class load time of the outer class, | ||
71 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost (visibility: PUBLIC, simpleName: AdditionalCommSubsystemCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
72 | * | ||
73 | * <p> This workaround is required e.g. to support recursion. | ||
74 | * | ||
75 | */ | ||
76 | private static class LazyHolder { | ||
77 | private static final AdditionalCommSubsystemCost INSTANCE = new AdditionalCommSubsystemCost(); | ||
78 | |||
79 | /** | ||
80 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
81 | * This initialization order is required to support indirect recursion. | ||
82 | * | ||
83 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
84 | * | ||
85 | */ | ||
86 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
87 | |||
88 | public static Object ensureInitialized() { | ||
89 | INSTANCE.ensureInitializedInternal(); | ||
90 | return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
95 | private static final AdditionalCommSubsystemCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
96 | |||
97 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
100 | |||
101 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Cost); | ||
102 | |||
103 | private GeneratedPQuery() { | ||
104 | super(PVisibility.PRIVATE); | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public String getFullyQualifiedName() { | ||
109 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.additionalCommSubsystemCost"; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public List<String> getParameterNames() { | ||
114 | return Arrays.asList("Spacecraft","Cost"); | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public List<PParameter> getParameters() { | ||
119 | return parameters; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public Set<PBody> doGetContainedBodies() { | ||
124 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
125 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
126 | { | ||
127 | PBody body = new PBody(this); | ||
128 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
129 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
131 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
132 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
133 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
134 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
135 | )); | ||
136 | // find spacecraftWithTwoCommSubsystems(Spacecraft) | ||
137 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft), SpacecraftWithTwoCommSubsystems.instance().getInternalQueryRepresentation()); | ||
138 | // Cost == 100000.0 | ||
139 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
140 | new ConstantValue(body, var__virtual_0_, 100000.0); | ||
141 | new Equality(body, var_Cost, var__virtual_0_); | ||
142 | bodies.add(body); | ||
143 | } | ||
144 | { | ||
145 | PBody body = new PBody(this); | ||
146 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
147 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
149 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
150 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
151 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
152 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
153 | )); | ||
154 | // neg find spacecraftWithTwoCommSubsystems(Spacecraft) | ||
155 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft), SpacecraftWithTwoCommSubsystems.instance().getInternalQueryRepresentation()); | ||
156 | // Cost == 0.0 | ||
157 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
158 | new ConstantValue(body, var__virtual_0_, 0.0); | ||
159 | new Equality(body, var_Cost, var__virtual_0_); | ||
160 | bodies.add(body); | ||
161 | } | ||
162 | return bodies; | ||
163 | } | ||
164 | } | ||
165 | |||
166 | private static double evaluateExpression_1_1() { | ||
167 | return 100000.0; | ||
168 | } | ||
169 | |||
170 | private static double evaluateExpression_2_1() { | ||
171 | return 0.0; | ||
172 | } | ||
173 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/BasePrice.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/BasePrice.java deleted file mode 100644 index 833148f9..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/BasePrice.java +++ /dev/null | |||
@@ -1,195 +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.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
14 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern basePrice(Spacecraft : Spacecraft, BasePrice : java Double) { | ||
34 | * CubeSat3U(Spacecraft); | ||
35 | * BasePrice == 250000.0; | ||
36 | * } or { | ||
37 | * CubeSat6U(Spacecraft); | ||
38 | * BasePrice == 750000.0; | ||
39 | * } or { | ||
40 | * SmallSat(Spacecraft); | ||
41 | * BasePrice == 3000000.0; | ||
42 | * } | ||
43 | * </pre></code> | ||
44 | * | ||
45 | * @see GenericPatternMatcher | ||
46 | * @see GenericPatternMatch | ||
47 | * | ||
48 | */ | ||
49 | @SuppressWarnings("all") | ||
50 | public final class BasePrice extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
51 | private BasePrice() { | ||
52 | super(GeneratedPQuery.INSTANCE); | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * @return the singleton instance of the query specification | ||
57 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
58 | * | ||
59 | */ | ||
60 | public static BasePrice instance() { | ||
61 | try{ | ||
62 | return LazyHolder.INSTANCE; | ||
63 | } catch (ExceptionInInitializerError err) { | ||
64 | throw processInitializerError(err); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice (visibility: PUBLIC, simpleName: BasePrice, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
70 | * <b>not</b> at the class load time of the outer class, | ||
71 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice (visibility: PUBLIC, simpleName: BasePrice, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
72 | * | ||
73 | * <p> This workaround is required e.g. to support recursion. | ||
74 | * | ||
75 | */ | ||
76 | private static class LazyHolder { | ||
77 | private static final BasePrice INSTANCE = new BasePrice(); | ||
78 | |||
79 | /** | ||
80 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
81 | * This initialization order is required to support indirect recursion. | ||
82 | * | ||
83 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
84 | * | ||
85 | */ | ||
86 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
87 | |||
88 | public static Object ensureInitialized() { | ||
89 | INSTANCE.ensureInitializedInternal(); | ||
90 | return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
95 | private static final BasePrice.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
96 | |||
97 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final PParameter parameter_BasePrice = new PParameter("BasePrice", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
100 | |||
101 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_BasePrice); | ||
102 | |||
103 | private GeneratedPQuery() { | ||
104 | super(PVisibility.PRIVATE); | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public String getFullyQualifiedName() { | ||
109 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.basePrice"; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public List<String> getParameterNames() { | ||
114 | return Arrays.asList("Spacecraft","BasePrice"); | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public List<PParameter> getParameters() { | ||
119 | return parameters; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public Set<PBody> doGetContainedBodies() { | ||
124 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
125 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
126 | { | ||
127 | PBody body = new PBody(this); | ||
128 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
129 | PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
131 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_BasePrice), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
132 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
133 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
134 | new ExportedParameter(body, var_BasePrice, parameter_BasePrice) | ||
135 | )); | ||
136 | // CubeSat3U(Spacecraft) | ||
137 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); | ||
138 | // BasePrice == 250000.0 | ||
139 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
140 | new ConstantValue(body, var__virtual_0_, 250000.0); | ||
141 | new Equality(body, var_BasePrice, var__virtual_0_); | ||
142 | bodies.add(body); | ||
143 | } | ||
144 | { | ||
145 | PBody body = new PBody(this); | ||
146 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
147 | PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
149 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_BasePrice), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
150 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
151 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
152 | new ExportedParameter(body, var_BasePrice, parameter_BasePrice) | ||
153 | )); | ||
154 | // CubeSat6U(Spacecraft) | ||
155 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat6U"))); | ||
156 | // BasePrice == 750000.0 | ||
157 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
158 | new ConstantValue(body, var__virtual_0_, 750000.0); | ||
159 | new Equality(body, var_BasePrice, var__virtual_0_); | ||
160 | bodies.add(body); | ||
161 | } | ||
162 | { | ||
163 | PBody body = new PBody(this); | ||
164 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
165 | PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); | ||
166 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
167 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_BasePrice), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
168 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
169 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
170 | new ExportedParameter(body, var_BasePrice, parameter_BasePrice) | ||
171 | )); | ||
172 | // SmallSat(Spacecraft) | ||
173 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat"))); | ||
174 | // BasePrice == 3000000.0 | ||
175 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
176 | new ConstantValue(body, var__virtual_0_, 3000000.0); | ||
177 | new Equality(body, var_BasePrice, var__virtual_0_); | ||
178 | bodies.add(body); | ||
179 | } | ||
180 | return bodies; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | private static double evaluateExpression_1_1() { | ||
185 | return 250000.0; | ||
186 | } | ||
187 | |||
188 | private static double evaluateExpression_2_1() { | ||
189 | return 750000.0; | ||
190 | } | ||
191 | |||
192 | private static double evaluateExpression_3_1() { | ||
193 | return 3000000.0; | ||
194 | } | ||
195 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBand.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBand.java deleted file mode 100644 index 609e0b93..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBand.java +++ /dev/null | |||
@@ -1,140 +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.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern commSubsystemBand(Comm : CommSubsystem, Band : TransceiverBand) { | ||
34 | * CommSubsystem.band(Comm, Band); | ||
35 | * } | ||
36 | * </pre></code> | ||
37 | * | ||
38 | * @see GenericPatternMatcher | ||
39 | * @see GenericPatternMatch | ||
40 | * | ||
41 | */ | ||
42 | @SuppressWarnings("all") | ||
43 | public final class CommSubsystemBand extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
44 | private CommSubsystemBand() { | ||
45 | super(GeneratedPQuery.INSTANCE); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @return the singleton instance of the query specification | ||
50 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
51 | * | ||
52 | */ | ||
53 | public static CommSubsystemBand instance() { | ||
54 | try{ | ||
55 | return LazyHolder.INSTANCE; | ||
56 | } catch (ExceptionInInitializerError err) { | ||
57 | throw processInitializerError(err); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand (visibility: PUBLIC, simpleName: CommSubsystemBand, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
63 | * <b>not</b> at the class load time of the outer class, | ||
64 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand (visibility: PUBLIC, simpleName: CommSubsystemBand, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
65 | * | ||
66 | * <p> This workaround is required e.g. to support recursion. | ||
67 | * | ||
68 | */ | ||
69 | private static class LazyHolder { | ||
70 | private static final CommSubsystemBand INSTANCE = new CommSubsystemBand(); | ||
71 | |||
72 | /** | ||
73 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
74 | * This initialization order is required to support indirect recursion. | ||
75 | * | ||
76 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
77 | * | ||
78 | */ | ||
79 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
80 | |||
81 | public static Object ensureInitialized() { | ||
82 | INSTANCE.ensureInitializedInternal(); | ||
83 | return null; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
88 | private static final CommSubsystemBand.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
89 | |||
90 | private final PParameter parameter_Comm = new PParameter("Comm", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | ||
91 | |||
92 | private final PParameter parameter_Band = new PParameter("Band", "satellite.TransceiverBand", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "TransceiverBand")), PParameterDirection.INOUT); | ||
93 | |||
94 | private final List<PParameter> parameters = Arrays.asList(parameter_Comm, parameter_Band); | ||
95 | |||
96 | private GeneratedPQuery() { | ||
97 | super(PVisibility.PRIVATE); | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public String getFullyQualifiedName() { | ||
102 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.commSubsystemBand"; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public List<String> getParameterNames() { | ||
107 | return Arrays.asList("Comm","Band"); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<PParameter> getParameters() { | ||
112 | return parameters; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Set<PBody> doGetContainedBodies() { | ||
117 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
118 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
119 | { | ||
120 | PBody body = new PBody(this); | ||
121 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); | ||
122 | PVariable var_Band = body.getOrCreateVariableByName("Band"); | ||
123 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
124 | new TypeConstraint(body, Tuples.flatTupleOf(var_Band), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
125 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
126 | new ExportedParameter(body, var_Comm, parameter_Comm), | ||
127 | new ExportedParameter(body, var_Band, parameter_Band) | ||
128 | )); | ||
129 | // CommSubsystem.band(Comm, Band) | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
131 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
134 | new Equality(body, var__virtual_0_, var_Band); | ||
135 | bodies.add(body); | ||
136 | } | ||
137 | return bodies; | ||
138 | } | ||
139 | } | ||
140 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBandUhf.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBandUhf.java index bc25ea59..6acd73c3 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBandUhf.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBandUhf.java | |||
@@ -8,18 +8,13 @@ import java.util.LinkedHashSet; | |||
8 | import java.util.List; | 8 | import java.util.List; |
9 | import java.util.Set; | 9 | import java.util.Set; |
10 | import org.eclipse.emf.ecore.EClass; | 10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | 11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; |
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | 12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; |
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | 13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 14 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 15 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | 16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; |
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 17 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 19 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 20 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
@@ -31,8 +26,8 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
31 | * | 26 | * |
32 | * <p>Original source: | 27 | * <p>Original source: |
33 | * <code><pre> | 28 | * <code><pre> |
34 | * private pattern commSubsystemBandUhf(Comm : CommSubsystem) { | 29 | * private pattern commSubsystemBandUhf(Comm : UHFCommSubsystem) { |
35 | * CommSubsystem.band(Comm, TransceiverBand::UHF); | 30 | * UHFCommSubsystem(Comm); |
36 | * } | 31 | * } |
37 | * </pre></code> | 32 | * </pre></code> |
38 | * | 33 | * |
@@ -88,7 +83,7 @@ public final class CommSubsystemBandUhf extends BaseGeneratedEMFQuerySpecificati | |||
88 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | 83 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { |
89 | private static final CommSubsystemBandUhf.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | 84 | private static final CommSubsystemBandUhf.GeneratedPQuery INSTANCE = new GeneratedPQuery(); |
90 | 85 | ||
91 | private final PParameter parameter_Comm = new PParameter("Comm", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | 86 | private final PParameter parameter_Comm = new PParameter("Comm", "satellite.UHFCommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "UHFCommSubsystem")), PParameterDirection.INOUT); |
92 | 87 | ||
93 | private final List<PParameter> parameters = Arrays.asList(parameter_Comm); | 88 | private final List<PParameter> parameters = Arrays.asList(parameter_Comm); |
94 | 89 | ||
@@ -118,18 +113,12 @@ public final class CommSubsystemBandUhf extends BaseGeneratedEMFQuerySpecificati | |||
118 | { | 113 | { |
119 | PBody body = new PBody(this); | 114 | PBody body = new PBody(this); |
120 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); | 115 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); |
121 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 116 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "UHFCommSubsystem"))); |
122 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 117 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
123 | new ExportedParameter(body, var_Comm, parameter_Comm) | 118 | new ExportedParameter(body, var_Comm, parameter_Comm) |
124 | )); | 119 | )); |
125 | // CommSubsystem.band(Comm, TransceiverBand::UHF) | 120 | // UHFCommSubsystem(Comm) |
126 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | 121 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "UHFCommSubsystem"))); |
127 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance()); | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
129 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
132 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
133 | bodies.add(body); | 122 | bodies.add(body); |
134 | } | 123 | } |
135 | return bodies; | 124 | return bodies; |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGain.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGain.java deleted file mode 100644 index 69793a96..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGain.java +++ /dev/null | |||
@@ -1,140 +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.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern commSubsystemGain(Comm : CommSubsystem, Gain : AntennaGain) { | ||
34 | * CommSubsystem.gain(Comm, Gain); | ||
35 | * } | ||
36 | * </pre></code> | ||
37 | * | ||
38 | * @see GenericPatternMatcher | ||
39 | * @see GenericPatternMatch | ||
40 | * | ||
41 | */ | ||
42 | @SuppressWarnings("all") | ||
43 | public final class CommSubsystemGain extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
44 | private CommSubsystemGain() { | ||
45 | super(GeneratedPQuery.INSTANCE); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @return the singleton instance of the query specification | ||
50 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
51 | * | ||
52 | */ | ||
53 | public static CommSubsystemGain instance() { | ||
54 | try{ | ||
55 | return LazyHolder.INSTANCE; | ||
56 | } catch (ExceptionInInitializerError err) { | ||
57 | throw processInitializerError(err); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain (visibility: PUBLIC, simpleName: CommSubsystemGain, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
63 | * <b>not</b> at the class load time of the outer class, | ||
64 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain (visibility: PUBLIC, simpleName: CommSubsystemGain, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
65 | * | ||
66 | * <p> This workaround is required e.g. to support recursion. | ||
67 | * | ||
68 | */ | ||
69 | private static class LazyHolder { | ||
70 | private static final CommSubsystemGain INSTANCE = new CommSubsystemGain(); | ||
71 | |||
72 | /** | ||
73 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
74 | * This initialization order is required to support indirect recursion. | ||
75 | * | ||
76 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
77 | * | ||
78 | */ | ||
79 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
80 | |||
81 | public static Object ensureInitialized() { | ||
82 | INSTANCE.ensureInitializedInternal(); | ||
83 | return null; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
88 | private static final CommSubsystemGain.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
89 | |||
90 | private final PParameter parameter_Comm = new PParameter("Comm", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | ||
91 | |||
92 | private final PParameter parameter_Gain = new PParameter("Gain", "satellite.AntennaGain", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "AntennaGain")), PParameterDirection.INOUT); | ||
93 | |||
94 | private final List<PParameter> parameters = Arrays.asList(parameter_Comm, parameter_Gain); | ||
95 | |||
96 | private GeneratedPQuery() { | ||
97 | super(PVisibility.PRIVATE); | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public String getFullyQualifiedName() { | ||
102 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.commSubsystemGain"; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public List<String> getParameterNames() { | ||
107 | return Arrays.asList("Comm","Gain"); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<PParameter> getParameters() { | ||
112 | return parameters; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Set<PBody> doGetContainedBodies() { | ||
117 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
118 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
119 | { | ||
120 | PBody body = new PBody(this); | ||
121 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); | ||
122 | PVariable var_Gain = body.getOrCreateVariableByName("Gain"); | ||
123 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
124 | new TypeConstraint(body, Tuples.flatTupleOf(var_Gain), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
125 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
126 | new ExportedParameter(body, var_Comm, parameter_Comm), | ||
127 | new ExportedParameter(body, var_Gain, parameter_Gain) | ||
128 | )); | ||
129 | // CommSubsystem.gain(Comm, Gain) | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
131 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
134 | new Equality(body, var__virtual_0_, var_Gain); | ||
135 | bodies.add(body); | ||
136 | } | ||
137 | return bodies; | ||
138 | } | ||
139 | } | ||
140 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainMedium.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainMedium.java deleted file mode 100644 index 82b77bbc..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainMedium.java +++ /dev/null | |||
@@ -1,138 +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.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
28 | |||
29 | /** | ||
30 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
31 | * | ||
32 | * <p>Original source: | ||
33 | * <code><pre> | ||
34 | * private pattern commSubsystemGainMedium(Comm : CommSubsystem) { | ||
35 | * CommSubsystem.gain(Comm, AntennaGain::MEDIUM); | ||
36 | * } | ||
37 | * </pre></code> | ||
38 | * | ||
39 | * @see GenericPatternMatcher | ||
40 | * @see GenericPatternMatch | ||
41 | * | ||
42 | */ | ||
43 | @SuppressWarnings("all") | ||
44 | public final class CommSubsystemGainMedium extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
45 | private CommSubsystemGainMedium() { | ||
46 | super(GeneratedPQuery.INSTANCE); | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * @return the singleton instance of the query specification | ||
51 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
52 | * | ||
53 | */ | ||
54 | public static CommSubsystemGainMedium instance() { | ||
55 | try{ | ||
56 | return LazyHolder.INSTANCE; | ||
57 | } catch (ExceptionInInitializerError err) { | ||
58 | throw processInitializerError(err); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium (visibility: PUBLIC, simpleName: CommSubsystemGainMedium, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
64 | * <b>not</b> at the class load time of the outer class, | ||
65 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium (visibility: PUBLIC, simpleName: CommSubsystemGainMedium, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
66 | * | ||
67 | * <p> This workaround is required e.g. to support recursion. | ||
68 | * | ||
69 | */ | ||
70 | private static class LazyHolder { | ||
71 | private static final CommSubsystemGainMedium INSTANCE = new CommSubsystemGainMedium(); | ||
72 | |||
73 | /** | ||
74 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
75 | * This initialization order is required to support indirect recursion. | ||
76 | * | ||
77 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
78 | * | ||
79 | */ | ||
80 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
81 | |||
82 | public static Object ensureInitialized() { | ||
83 | INSTANCE.ensureInitializedInternal(); | ||
84 | return null; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
89 | private static final CommSubsystemGainMedium.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
90 | |||
91 | private final PParameter parameter_Comm = new PParameter("Comm", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | ||
92 | |||
93 | private final List<PParameter> parameters = Arrays.asList(parameter_Comm); | ||
94 | |||
95 | private GeneratedPQuery() { | ||
96 | super(PVisibility.PRIVATE); | ||
97 | } | ||
98 | |||
99 | @Override | ||
100 | public String getFullyQualifiedName() { | ||
101 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.commSubsystemGainMedium"; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public List<String> getParameterNames() { | ||
106 | return Arrays.asList("Comm"); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public List<PParameter> getParameters() { | ||
111 | return parameters; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public Set<PBody> doGetContainedBodies() { | ||
116 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
117 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
118 | { | ||
119 | PBody body = new PBody(this); | ||
120 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); | ||
121 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
122 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
123 | new ExportedParameter(body, var_Comm, parameter_Comm) | ||
124 | )); | ||
125 | // CommSubsystem.gain(Comm, AntennaGain::MEDIUM) | ||
126 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
127 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "AntennaGain", "MEDIUM").getInstance()); | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
129 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
132 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
133 | bodies.add(body); | ||
134 | } | ||
135 | return bodies; | ||
136 | } | ||
137 | } | ||
138 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainLow.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CubeSat6U.java index fd24f163..e4526a02 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainLow.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CubeSat6U.java | |||
@@ -8,18 +8,13 @@ import java.util.LinkedHashSet; | |||
8 | import java.util.List; | 8 | import java.util.List; |
9 | import java.util.Set; | 9 | import java.util.Set; |
10 | import org.eclipse.emf.ecore.EClass; | 10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | 11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; |
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | 12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; |
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | 13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 14 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 15 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | 16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; |
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 17 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 19 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 20 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
@@ -31,8 +26,8 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
31 | * | 26 | * |
32 | * <p>Original source: | 27 | * <p>Original source: |
33 | * <code><pre> | 28 | * <code><pre> |
34 | * private pattern commSubsystemGainLow(Comm : CommSubsystem) { | 29 | * private pattern cubeSat6U(Sat : CubeSat6U) { |
35 | * CommSubsystem.gain(Comm, AntennaGain::LOW); | 30 | * CubeSat6U(Sat); |
36 | * } | 31 | * } |
37 | * </pre></code> | 32 | * </pre></code> |
38 | * | 33 | * |
@@ -41,8 +36,8 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
41 | * | 36 | * |
42 | */ | 37 | */ |
43 | @SuppressWarnings("all") | 38 | @SuppressWarnings("all") |
44 | public final class CommSubsystemGainLow extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | 39 | public final class CubeSat6U extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { |
45 | private CommSubsystemGainLow() { | 40 | private CubeSat6U() { |
46 | super(GeneratedPQuery.INSTANCE); | 41 | super(GeneratedPQuery.INSTANCE); |
47 | } | 42 | } |
48 | 43 | ||
@@ -51,7 +46,7 @@ public final class CommSubsystemGainLow extends BaseGeneratedEMFQuerySpecificati | |||
51 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | 46 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded |
52 | * | 47 | * |
53 | */ | 48 | */ |
54 | public static CommSubsystemGainLow instance() { | 49 | public static CubeSat6U instance() { |
55 | try{ | 50 | try{ |
56 | return LazyHolder.INSTANCE; | 51 | return LazyHolder.INSTANCE; |
57 | } catch (ExceptionInInitializerError err) { | 52 | } catch (ExceptionInInitializerError err) { |
@@ -60,15 +55,15 @@ public final class CommSubsystemGainLow extends BaseGeneratedEMFQuerySpecificati | |||
60 | } | 55 | } |
61 | 56 | ||
62 | /** | 57 | /** |
63 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow (visibility: PUBLIC, simpleName: CommSubsystemGainLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | 58 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat6U (visibility: PUBLIC, simpleName: CubeSat6U, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat6U, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created |
64 | * <b>not</b> at the class load time of the outer class, | 59 | * <b>not</b> at the class load time of the outer class, |
65 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow (visibility: PUBLIC, simpleName: CommSubsystemGainLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | 60 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat6U (visibility: PUBLIC, simpleName: CubeSat6U, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat6U, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. |
66 | * | 61 | * |
67 | * <p> This workaround is required e.g. to support recursion. | 62 | * <p> This workaround is required e.g. to support recursion. |
68 | * | 63 | * |
69 | */ | 64 | */ |
70 | private static class LazyHolder { | 65 | private static class LazyHolder { |
71 | private static final CommSubsystemGainLow INSTANCE = new CommSubsystemGainLow(); | 66 | private static final CubeSat6U INSTANCE = new CubeSat6U(); |
72 | 67 | ||
73 | /** | 68 | /** |
74 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | 69 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. |
@@ -86,11 +81,11 @@ public final class CommSubsystemGainLow extends BaseGeneratedEMFQuerySpecificati | |||
86 | } | 81 | } |
87 | 82 | ||
88 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | 83 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { |
89 | private static final CommSubsystemGainLow.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | 84 | private static final CubeSat6U.GeneratedPQuery INSTANCE = new GeneratedPQuery(); |
90 | 85 | ||
91 | private final PParameter parameter_Comm = new PParameter("Comm", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | 86 | private final PParameter parameter_Sat = new PParameter("Sat", "satellite.CubeSat6U", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CubeSat6U")), PParameterDirection.INOUT); |
92 | 87 | ||
93 | private final List<PParameter> parameters = Arrays.asList(parameter_Comm); | 88 | private final List<PParameter> parameters = Arrays.asList(parameter_Sat); |
94 | 89 | ||
95 | private GeneratedPQuery() { | 90 | private GeneratedPQuery() { |
96 | super(PVisibility.PRIVATE); | 91 | super(PVisibility.PRIVATE); |
@@ -98,12 +93,12 @@ public final class CommSubsystemGainLow extends BaseGeneratedEMFQuerySpecificati | |||
98 | 93 | ||
99 | @Override | 94 | @Override |
100 | public String getFullyQualifiedName() { | 95 | public String getFullyQualifiedName() { |
101 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.commSubsystemGainLow"; | 96 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.cubeSat6U"; |
102 | } | 97 | } |
103 | 98 | ||
104 | @Override | 99 | @Override |
105 | public List<String> getParameterNames() { | 100 | public List<String> getParameterNames() { |
106 | return Arrays.asList("Comm"); | 101 | return Arrays.asList("Sat"); |
107 | } | 102 | } |
108 | 103 | ||
109 | @Override | 104 | @Override |
@@ -117,19 +112,13 @@ public final class CommSubsystemGainLow extends BaseGeneratedEMFQuerySpecificati | |||
117 | Set<PBody> bodies = new LinkedHashSet<>(); | 112 | Set<PBody> bodies = new LinkedHashSet<>(); |
118 | { | 113 | { |
119 | PBody body = new PBody(this); | 114 | PBody body = new PBody(this); |
120 | PVariable var_Comm = body.getOrCreateVariableByName("Comm"); | 115 | PVariable var_Sat = body.getOrCreateVariableByName("Sat"); |
121 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 116 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat6U"))); |
122 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 117 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
123 | new ExportedParameter(body, var_Comm, parameter_Comm) | 118 | new ExportedParameter(body, var_Sat, parameter_Sat) |
124 | )); | 119 | )); |
125 | // CommSubsystem.gain(Comm, AntennaGain::LOW) | 120 | // CubeSat6U(Sat) |
126 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | 121 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat6U"))); |
127 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "AntennaGain", "LOW").getInstance()); | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
129 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
132 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
133 | bodies.add(body); | 122 | bodies.add(body); |
134 | } | 123 | } |
135 | return bodies; | 124 | return bodies; |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IncomingData.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IncomingData.java deleted file mode 100644 index 4d18f028..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IncomingData.java +++ /dev/null | |||
@@ -1,145 +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.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Set; | ||
12 | import org.eclipse.emf.ecore.EClass; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
28 | |||
29 | /** | ||
30 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
31 | * | ||
32 | * <p>Original source: | ||
33 | * <code><pre> | ||
34 | * private pattern incomingData(Spacecraft : Spacecraft, Source : Spacecraft, Data : java Double) { | ||
35 | * find indirectCommunicationLink(Source, Spacecraft); | ||
36 | * find scienceData(Source, Data); | ||
37 | * } | ||
38 | * </pre></code> | ||
39 | * | ||
40 | * @see GenericPatternMatcher | ||
41 | * @see GenericPatternMatch | ||
42 | * | ||
43 | */ | ||
44 | @SuppressWarnings("all") | ||
45 | public final class IncomingData extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
46 | private IncomingData() { | ||
47 | super(GeneratedPQuery.INSTANCE); | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * @return the singleton instance of the query specification | ||
52 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
53 | * | ||
54 | */ | ||
55 | public static IncomingData instance() { | ||
56 | try{ | ||
57 | return LazyHolder.INSTANCE; | ||
58 | } catch (ExceptionInInitializerError err) { | ||
59 | throw processInitializerError(err); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | /** | ||
64 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData (visibility: PUBLIC, simpleName: IncomingData, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
65 | * <b>not</b> at the class load time of the outer class, | ||
66 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData (visibility: PUBLIC, simpleName: IncomingData, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
67 | * | ||
68 | * <p> This workaround is required e.g. to support recursion. | ||
69 | * | ||
70 | */ | ||
71 | private static class LazyHolder { | ||
72 | private static final IncomingData INSTANCE = new IncomingData(); | ||
73 | |||
74 | /** | ||
75 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
76 | * This initialization order is required to support indirect recursion. | ||
77 | * | ||
78 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
79 | * | ||
80 | */ | ||
81 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
82 | |||
83 | public static Object ensureInitialized() { | ||
84 | INSTANCE.ensureInitializedInternal(); | ||
85 | return null; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
90 | private static final IncomingData.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
91 | |||
92 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
93 | |||
94 | private final PParameter parameter_Source = new PParameter("Source", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
95 | |||
96 | private final PParameter parameter_Data = new PParameter("Data", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
97 | |||
98 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Source, parameter_Data); | ||
99 | |||
100 | private GeneratedPQuery() { | ||
101 | super(PVisibility.PRIVATE); | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public String getFullyQualifiedName() { | ||
106 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incomingData"; | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public List<String> getParameterNames() { | ||
111 | return Arrays.asList("Spacecraft","Source","Data"); | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public List<PParameter> getParameters() { | ||
116 | return parameters; | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public Set<PBody> doGetContainedBodies() { | ||
121 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
122 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
123 | { | ||
124 | PBody body = new PBody(this); | ||
125 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
126 | PVariable var_Source = body.getOrCreateVariableByName("Source"); | ||
127 | PVariable var_Data = body.getOrCreateVariableByName("Data"); | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
129 | new TypeConstraint(body, Tuples.flatTupleOf(var_Source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
130 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Data), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
131 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
132 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
133 | new ExportedParameter(body, var_Source, parameter_Source), | ||
134 | new ExportedParameter(body, var_Data, parameter_Data) | ||
135 | )); | ||
136 | // find indirectCommunicationLink(Source, Spacecraft) | ||
137 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Source, var_Spacecraft), IndirectCommunicationLink.instance().getInternalQueryRepresentation()); | ||
138 | // find scienceData(Source, Data) | ||
139 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Source, var_Data), ScienceData.instance().getInternalQueryRepresentation()); | ||
140 | bodies.add(body); | ||
141 | } | ||
142 | return bodies; | ||
143 | } | ||
144 | } | ||
145 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java deleted file mode 100644 index 535f32d9..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java +++ /dev/null | |||
@@ -1,175 +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.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
30 | |||
31 | /** | ||
32 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
33 | * | ||
34 | * <p>Original source: | ||
35 | * <code><pre> | ||
36 | * private pattern interferometryPayloadCost(Spacecraft : Spacecraft, Cost : java Double) { | ||
37 | * find spacecraftWithInterferometryPayload(_, Spacecraft); | ||
38 | * Cost == 50000.0; | ||
39 | * } or { | ||
40 | * neg find spacecraftWithInterferometryPayload(_, Spacecraft); | ||
41 | * Cost == 0.0; | ||
42 | * } | ||
43 | * </pre></code> | ||
44 | * | ||
45 | * @see GenericPatternMatcher | ||
46 | * @see GenericPatternMatch | ||
47 | * | ||
48 | */ | ||
49 | @SuppressWarnings("all") | ||
50 | public final class InterferometryPayloadCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
51 | private InterferometryPayloadCost() { | ||
52 | super(GeneratedPQuery.INSTANCE); | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * @return the singleton instance of the query specification | ||
57 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
58 | * | ||
59 | */ | ||
60 | public static InterferometryPayloadCost instance() { | ||
61 | try{ | ||
62 | return LazyHolder.INSTANCE; | ||
63 | } catch (ExceptionInInitializerError err) { | ||
64 | throw processInitializerError(err); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost (visibility: PUBLIC, simpleName: InterferometryPayloadCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
70 | * <b>not</b> at the class load time of the outer class, | ||
71 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost (visibility: PUBLIC, simpleName: InterferometryPayloadCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
72 | * | ||
73 | * <p> This workaround is required e.g. to support recursion. | ||
74 | * | ||
75 | */ | ||
76 | private static class LazyHolder { | ||
77 | private static final InterferometryPayloadCost INSTANCE = new InterferometryPayloadCost(); | ||
78 | |||
79 | /** | ||
80 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
81 | * This initialization order is required to support indirect recursion. | ||
82 | * | ||
83 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
84 | * | ||
85 | */ | ||
86 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
87 | |||
88 | public static Object ensureInitialized() { | ||
89 | INSTANCE.ensureInitializedInternal(); | ||
90 | return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
95 | private static final InterferometryPayloadCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
96 | |||
97 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
100 | |||
101 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Cost); | ||
102 | |||
103 | private GeneratedPQuery() { | ||
104 | super(PVisibility.PRIVATE); | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public String getFullyQualifiedName() { | ||
109 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.interferometryPayloadCost"; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public List<String> getParameterNames() { | ||
114 | return Arrays.asList("Spacecraft","Cost"); | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public List<PParameter> getParameters() { | ||
119 | return parameters; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public Set<PBody> doGetContainedBodies() { | ||
124 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
125 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
126 | { | ||
127 | PBody body = new PBody(this); | ||
128 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
129 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
130 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
132 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
133 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
134 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
135 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
136 | )); | ||
137 | // find spacecraftWithInterferometryPayload(_, Spacecraft) | ||
138 | new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_Spacecraft), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation()); | ||
139 | // Cost == 50000.0 | ||
140 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
141 | new ConstantValue(body, var__virtual_0_, 50000.0); | ||
142 | new Equality(body, var_Cost, var__virtual_0_); | ||
143 | bodies.add(body); | ||
144 | } | ||
145 | { | ||
146 | PBody body = new PBody(this); | ||
147 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
148 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
149 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
150 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
151 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
152 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
153 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
154 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
155 | )); | ||
156 | // neg find spacecraftWithInterferometryPayload(_, Spacecraft) | ||
157 | new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var_Spacecraft), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation()); | ||
158 | // Cost == 0.0 | ||
159 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
160 | new ConstantValue(body, var__virtual_0_, 0.0); | ||
161 | new Equality(body, var_Cost, var__virtual_0_); | ||
162 | bodies.add(body); | ||
163 | } | ||
164 | return bodies; | ||
165 | } | ||
166 | } | ||
167 | |||
168 | private static double evaluateExpression_1_1() { | ||
169 | return 50000.0; | ||
170 | } | ||
171 | |||
172 | private static double evaluateExpression_2_1() { | ||
173 | return 0.0; | ||
174 | } | ||
175 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/LinkAllowed.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/LinkAllowed.java index 7118d657..c3f6bb82 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/LinkAllowed.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/LinkAllowed.java | |||
@@ -18,7 +18,6 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | |||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | 18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; |
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | 20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; |
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; |
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
@@ -32,13 +31,13 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
32 | * <p>Original source: | 31 | * <p>Original source: |
33 | * <code><pre> | 32 | * <code><pre> |
34 | * private pattern linkAllowed(From : Spacecraft, To : CommunicatingElement) { | 33 | * private pattern linkAllowed(From : Spacecraft, To : CommunicatingElement) { |
35 | * find matchingAntenna(From, To, _); | 34 | * find matchingAntenna(From, To); |
36 | * neg find cubeSat3U(From); | 35 | * neg find cubeSat3U(From); |
37 | * } or { | 36 | * } or { |
38 | * find matchingAntenna(From, To, TransceiverBand::UHF); | 37 | * find matchingAntenna(From, To); |
39 | * CubeSat3U(From); | 38 | * CubeSat3U(From); |
40 | * } or { | 39 | * } or { |
41 | * find matchingAntenna(From, To, _); | 40 | * find matchingAntenna(From, To); |
42 | * CubeSat3U(From); | 41 | * CubeSat3U(From); |
43 | * GroundStationNetwork(To); | 42 | * GroundStationNetwork(To); |
44 | * } | 43 | * } |
@@ -129,15 +128,14 @@ public final class LinkAllowed extends BaseGeneratedEMFQuerySpecificationWithGen | |||
129 | PBody body = new PBody(this); | 128 | PBody body = new PBody(this); |
130 | PVariable var_From = body.getOrCreateVariableByName("From"); | 129 | PVariable var_From = body.getOrCreateVariableByName("From"); |
131 | PVariable var_To = body.getOrCreateVariableByName("To"); | 130 | PVariable var_To = body.getOrCreateVariableByName("To"); |
132 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | 131 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); |
134 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | 132 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
135 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 133 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
136 | new ExportedParameter(body, var_From, parameter_From), | 134 | new ExportedParameter(body, var_From, parameter_From), |
137 | new ExportedParameter(body, var_To, parameter_To) | 135 | new ExportedParameter(body, var_To, parameter_To) |
138 | )); | 136 | )); |
139 | // find matchingAntenna(From, To, _) | 137 | // find matchingAntenna(From, To) |
140 | new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To, var___0_), MatchingAntenna.instance().getInternalQueryRepresentation()); | 138 | new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To), MatchingAntenna.instance().getInternalQueryRepresentation()); |
141 | // neg find cubeSat3U(From) | 139 | // neg find cubeSat3U(From) |
142 | new NegativePatternCall(body, Tuples.flatTupleOf(var_From), CubeSat3U.instance().getInternalQueryRepresentation()); | 140 | new NegativePatternCall(body, Tuples.flatTupleOf(var_From), CubeSat3U.instance().getInternalQueryRepresentation()); |
143 | bodies.add(body); | 141 | bodies.add(body); |
@@ -152,10 +150,8 @@ public final class LinkAllowed extends BaseGeneratedEMFQuerySpecificationWithGen | |||
152 | new ExportedParameter(body, var_From, parameter_From), | 150 | new ExportedParameter(body, var_From, parameter_From), |
153 | new ExportedParameter(body, var_To, parameter_To) | 151 | new ExportedParameter(body, var_To, parameter_To) |
154 | )); | 152 | )); |
155 | // find matchingAntenna(From, To, TransceiverBand::UHF) | 153 | // find matchingAntenna(From, To) |
156 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | 154 | new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To), MatchingAntenna.instance().getInternalQueryRepresentation()); |
157 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance()); | ||
158 | new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To, var__virtual_0_), MatchingAntenna.instance().getInternalQueryRepresentation()); | ||
159 | // CubeSat3U(From) | 155 | // CubeSat3U(From) |
160 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); | 156 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); |
161 | bodies.add(body); | 157 | bodies.add(body); |
@@ -164,15 +160,14 @@ public final class LinkAllowed extends BaseGeneratedEMFQuerySpecificationWithGen | |||
164 | PBody body = new PBody(this); | 160 | PBody body = new PBody(this); |
165 | PVariable var_From = body.getOrCreateVariableByName("From"); | 161 | PVariable var_From = body.getOrCreateVariableByName("From"); |
166 | PVariable var_To = body.getOrCreateVariableByName("To"); | 162 | PVariable var_To = body.getOrCreateVariableByName("To"); |
167 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
168 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | 163 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); |
169 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | 164 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
170 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 165 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
171 | new ExportedParameter(body, var_From, parameter_From), | 166 | new ExportedParameter(body, var_From, parameter_From), |
172 | new ExportedParameter(body, var_To, parameter_To) | 167 | new ExportedParameter(body, var_To, parameter_To) |
173 | )); | 168 | )); |
174 | // find matchingAntenna(From, To, _) | 169 | // find matchingAntenna(From, To) |
175 | new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To, var___0_), MatchingAntenna.instance().getInternalQueryRepresentation()); | 170 | new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To), MatchingAntenna.instance().getInternalQueryRepresentation()); |
176 | // CubeSat3U(From) | 171 | // CubeSat3U(From) |
177 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); | 172 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); |
178 | // GroundStationNetwork(To) | 173 | // GroundStationNetwork(To) |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingAntenna.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingAntenna.java index 3a52ad1d..6ee10814 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingAntenna.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingAntenna.java | |||
@@ -3,22 +3,22 @@ | |||
3 | */ | 3 | */ |
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; | 4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; |
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem; | ||
6 | import java.util.Arrays; | 7 | import java.util.Arrays; |
7 | import java.util.LinkedHashSet; | 8 | import java.util.LinkedHashSet; |
8 | import java.util.List; | 9 | import java.util.List; |
9 | import java.util.Set; | 10 | import java.util.Set; |
10 | import org.eclipse.emf.ecore.EClass; | 11 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | 12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; |
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | 13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; |
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | 14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | 15 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; |
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 16 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | 18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; |
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | 19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; |
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
@@ -30,11 +30,10 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
30 | * | 30 | * |
31 | * <p>Original source: | 31 | * <p>Original source: |
32 | * <code><pre> | 32 | * <code><pre> |
33 | * private pattern matchingAntenna(From : Spacecraft, To : CommunicatingElement, Band : TransceiverBand) { | 33 | * private pattern matchingAntenna(From : Spacecraft, To : CommunicatingElement) { |
34 | * CommunicatingElement.commSubsystem.band(From, Band); | 34 | * CommunicatingElement.commSubsystem(From, FromSys); |
35 | * CommunicatingElement.commSubsystem.band(To, Band); | 35 | * CommunicatingElement.commSubsystem(To, ToSys); |
36 | * CommunicatingElement.commSubsystem.gain(From, Gain); | 36 | * find matchingCommSubsystem(FromSys, ToSys); |
37 | * CommunicatingElement.commSubsystem.gain(To, Gain); | ||
38 | * } | 37 | * } |
39 | * </pre></code> | 38 | * </pre></code> |
40 | * | 39 | * |
@@ -94,9 +93,7 @@ public final class MatchingAntenna extends BaseGeneratedEMFQuerySpecificationWit | |||
94 | 93 | ||
95 | private final PParameter parameter_To = new PParameter("To", "satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT); | 94 | private final PParameter parameter_To = new PParameter("To", "satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT); |
96 | 95 | ||
97 | private final PParameter parameter_Band = new PParameter("Band", "satellite.TransceiverBand", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "TransceiverBand")), PParameterDirection.INOUT); | 96 | private final List<PParameter> parameters = Arrays.asList(parameter_From, parameter_To); |
98 | |||
99 | private final List<PParameter> parameters = Arrays.asList(parameter_From, parameter_To, parameter_Band); | ||
100 | 97 | ||
101 | private GeneratedPQuery() { | 98 | private GeneratedPQuery() { |
102 | super(PVisibility.PRIVATE); | 99 | super(PVisibility.PRIVATE); |
@@ -109,7 +106,7 @@ public final class MatchingAntenna extends BaseGeneratedEMFQuerySpecificationWit | |||
109 | 106 | ||
110 | @Override | 107 | @Override |
111 | public List<String> getParameterNames() { | 108 | public List<String> getParameterNames() { |
112 | return Arrays.asList("From","To","Band"); | 109 | return Arrays.asList("From","To"); |
113 | } | 110 | } |
114 | 111 | ||
115 | @Override | 112 | @Override |
@@ -125,52 +122,28 @@ public final class MatchingAntenna extends BaseGeneratedEMFQuerySpecificationWit | |||
125 | PBody body = new PBody(this); | 122 | PBody body = new PBody(this); |
126 | PVariable var_From = body.getOrCreateVariableByName("From"); | 123 | PVariable var_From = body.getOrCreateVariableByName("From"); |
127 | PVariable var_To = body.getOrCreateVariableByName("To"); | 124 | PVariable var_To = body.getOrCreateVariableByName("To"); |
128 | PVariable var_Band = body.getOrCreateVariableByName("Band"); | 125 | PVariable var_FromSys = body.getOrCreateVariableByName("FromSys"); |
129 | PVariable var_Gain = body.getOrCreateVariableByName("Gain"); | 126 | PVariable var_ToSys = body.getOrCreateVariableByName("ToSys"); |
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | 127 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); |
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | 128 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Band), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
133 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 129 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
134 | new ExportedParameter(body, var_From, parameter_From), | 130 | new ExportedParameter(body, var_From, parameter_From), |
135 | new ExportedParameter(body, var_To, parameter_To), | 131 | new ExportedParameter(body, var_To, parameter_To) |
136 | new ExportedParameter(body, var_Band, parameter_Band) | ||
137 | )); | 132 | )); |
138 | // CommunicatingElement.commSubsystem.band(From, Band) | 133 | // CommunicatingElement.commSubsystem(From, FromSys) |
139 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | 134 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
140 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | 135 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); |
141 | new TypeConstraint(body, Tuples.flatTupleOf(var_From, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | 136 | new TypeConstraint(body, Tuples.flatTupleOf(var_From, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); |
142 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 137 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); |
143 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | 138 | new Equality(body, var__virtual_0_, var_FromSys); |
144 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | 139 | // CommunicatingElement.commSubsystem(To, ToSys) |
145 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
146 | new Equality(body, var__virtual_1_, var_Band); | ||
147 | // CommunicatingElement.commSubsystem.band(To, Band) | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | 140 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
149 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | 141 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); |
150 | new TypeConstraint(body, Tuples.flatTupleOf(var_To, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | 142 | new TypeConstraint(body, Tuples.flatTupleOf(var_To, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); |
151 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 143 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); |
152 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | 144 | new Equality(body, var__virtual_1_, var_ToSys); |
153 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | 145 | // find matchingCommSubsystem(FromSys, ToSys) |
154 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | 146 | new PositivePatternCall(body, Tuples.flatTupleOf(var_FromSys, var_ToSys), MatchingCommSubsystem.instance().getInternalQueryRepresentation()); |
155 | new Equality(body, var__virtual_3_, var_Band); | ||
156 | // CommunicatingElement.commSubsystem.gain(From, Gain) | ||
157 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
158 | PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); | ||
159 | new TypeConstraint(body, Tuples.flatTupleOf(var_From, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
160 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
161 | PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); | ||
162 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); | ||
163 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
164 | new Equality(body, var__virtual_5_, var_Gain); | ||
165 | // CommunicatingElement.commSubsystem.gain(To, Gain) | ||
166 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
167 | PVariable var__virtual_6_ = body.getOrCreateVariableByName(".virtual{6}"); | ||
168 | new TypeConstraint(body, Tuples.flatTupleOf(var_To, var__virtual_6_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
169 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
170 | PVariable var__virtual_7_ = body.getOrCreateVariableByName(".virtual{7}"); | ||
171 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_, var__virtual_7_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); | ||
172 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_7_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
173 | new Equality(body, var__virtual_7_, var_Gain); | ||
174 | bodies.add(body); | 147 | bodies.add(body); |
175 | } | 148 | } |
176 | return bodies; | 149 | return bodies; |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingCommSubsystem.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingCommSubsystem.java new file mode 100644 index 00000000..24726d21 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingCommSubsystem.java | |||
@@ -0,0 +1,173 @@ | |||
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.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
14 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
23 | |||
24 | /** | ||
25 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
26 | * | ||
27 | * <p>Original source: | ||
28 | * <code><pre> | ||
29 | * private pattern matchingCommSubsystem(From : CommSubsystem, To : CommSubsystem) { | ||
30 | * UHFCommSubsystem(From); | ||
31 | * UHFCommSubsystem(To); | ||
32 | * } or { | ||
33 | * XCommSubsystem(From); | ||
34 | * XCommSubsystem(To); | ||
35 | * } or { | ||
36 | * KaCommSubsystem(From); | ||
37 | * KaCommSubsystem(To); | ||
38 | * } | ||
39 | * </pre></code> | ||
40 | * | ||
41 | * @see GenericPatternMatcher | ||
42 | * @see GenericPatternMatch | ||
43 | * | ||
44 | */ | ||
45 | @SuppressWarnings("all") | ||
46 | public final class MatchingCommSubsystem extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
47 | private MatchingCommSubsystem() { | ||
48 | super(GeneratedPQuery.INSTANCE); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @return the singleton instance of the query specification | ||
53 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
54 | * | ||
55 | */ | ||
56 | public static MatchingCommSubsystem instance() { | ||
57 | try{ | ||
58 | return LazyHolder.INSTANCE; | ||
59 | } catch (ExceptionInInitializerError err) { | ||
60 | throw processInitializerError(err); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem (visibility: PUBLIC, simpleName: MatchingCommSubsystem, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
66 | * <b>not</b> at the class load time of the outer class, | ||
67 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem (visibility: PUBLIC, simpleName: MatchingCommSubsystem, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
68 | * | ||
69 | * <p> This workaround is required e.g. to support recursion. | ||
70 | * | ||
71 | */ | ||
72 | private static class LazyHolder { | ||
73 | private static final MatchingCommSubsystem INSTANCE = new MatchingCommSubsystem(); | ||
74 | |||
75 | /** | ||
76 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
77 | * This initialization order is required to support indirect recursion. | ||
78 | * | ||
79 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
80 | * | ||
81 | */ | ||
82 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
83 | |||
84 | public static Object ensureInitialized() { | ||
85 | INSTANCE.ensureInitializedInternal(); | ||
86 | return null; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
91 | private static final MatchingCommSubsystem.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
92 | |||
93 | private final PParameter parameter_From = new PParameter("From", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | ||
94 | |||
95 | private final PParameter parameter_To = new PParameter("To", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT); | ||
96 | |||
97 | private final List<PParameter> parameters = Arrays.asList(parameter_From, parameter_To); | ||
98 | |||
99 | private GeneratedPQuery() { | ||
100 | super(PVisibility.PRIVATE); | ||
101 | } | ||
102 | |||
103 | @Override | ||
104 | public String getFullyQualifiedName() { | ||
105 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.matchingCommSubsystem"; | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | public List<String> getParameterNames() { | ||
110 | return Arrays.asList("From","To"); | ||
111 | } | ||
112 | |||
113 | @Override | ||
114 | public List<PParameter> getParameters() { | ||
115 | return parameters; | ||
116 | } | ||
117 | |||
118 | @Override | ||
119 | public Set<PBody> doGetContainedBodies() { | ||
120 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
121 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
122 | { | ||
123 | PBody body = new PBody(this); | ||
124 | PVariable var_From = body.getOrCreateVariableByName("From"); | ||
125 | PVariable var_To = body.getOrCreateVariableByName("To"); | ||
126 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
127 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
128 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
129 | new ExportedParameter(body, var_From, parameter_From), | ||
130 | new ExportedParameter(body, var_To, parameter_To) | ||
131 | )); | ||
132 | // UHFCommSubsystem(From) | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "UHFCommSubsystem"))); | ||
134 | // UHFCommSubsystem(To) | ||
135 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "UHFCommSubsystem"))); | ||
136 | bodies.add(body); | ||
137 | } | ||
138 | { | ||
139 | PBody body = new PBody(this); | ||
140 | PVariable var_From = body.getOrCreateVariableByName("From"); | ||
141 | PVariable var_To = body.getOrCreateVariableByName("To"); | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
143 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
144 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
145 | new ExportedParameter(body, var_From, parameter_From), | ||
146 | new ExportedParameter(body, var_To, parameter_To) | ||
147 | )); | ||
148 | // XCommSubsystem(From) | ||
149 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "XCommSubsystem"))); | ||
150 | // XCommSubsystem(To) | ||
151 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "XCommSubsystem"))); | ||
152 | bodies.add(body); | ||
153 | } | ||
154 | { | ||
155 | PBody body = new PBody(this); | ||
156 | PVariable var_From = body.getOrCreateVariableByName("From"); | ||
157 | PVariable var_To = body.getOrCreateVariableByName("To"); | ||
158 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
159 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
160 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
161 | new ExportedParameter(body, var_From, parameter_From), | ||
162 | new ExportedParameter(body, var_To, parameter_To) | ||
163 | )); | ||
164 | // KaCommSubsystem(From) | ||
165 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "KaCommSubsystem"))); | ||
166 | // KaCommSubsystem(To) | ||
167 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "KaCommSubsystem"))); | ||
168 | bodies.add(body); | ||
169 | } | ||
170 | return bodies; | ||
171 | } | ||
172 | } | ||
173 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCost.java deleted file mode 100644 index c3389e11..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCost.java +++ /dev/null | |||
@@ -1,183 +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.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
35 | |||
36 | /** | ||
37 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
38 | * | ||
39 | * <p>Original source: | ||
40 | * <code><pre> | ||
41 | * private pattern missionCost(Mission : InterferometryMission, Cost : java Double) { | ||
42 | * InterferometryMission.observationTime(Mission, ObservationTime); | ||
43 | * SpacecraftCost == sum find spacecraftCost(Mission, _, #_); | ||
44 | * Cost == eval(SpacecraftCost + 100000.0 ObservationTime); | ||
45 | * } | ||
46 | * </pre></code> | ||
47 | * | ||
48 | * @see GenericPatternMatcher | ||
49 | * @see GenericPatternMatch | ||
50 | * | ||
51 | */ | ||
52 | @SuppressWarnings("all") | ||
53 | public final class MissionCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
54 | private MissionCost() { | ||
55 | super(GeneratedPQuery.INSTANCE); | ||
56 | } | ||
57 | |||
58 | /** | ||
59 | * @return the singleton instance of the query specification | ||
60 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
61 | * | ||
62 | */ | ||
63 | public static MissionCost instance() { | ||
64 | try{ | ||
65 | return LazyHolder.INSTANCE; | ||
66 | } catch (ExceptionInInitializerError err) { | ||
67 | throw processInitializerError(err); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost (visibility: PUBLIC, simpleName: MissionCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
73 | * <b>not</b> at the class load time of the outer class, | ||
74 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost (visibility: PUBLIC, simpleName: MissionCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
75 | * | ||
76 | * <p> This workaround is required e.g. to support recursion. | ||
77 | * | ||
78 | */ | ||
79 | private static class LazyHolder { | ||
80 | private static final MissionCost INSTANCE = new MissionCost(); | ||
81 | |||
82 | /** | ||
83 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
84 | * This initialization order is required to support indirect recursion. | ||
85 | * | ||
86 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
87 | * | ||
88 | */ | ||
89 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
90 | |||
91 | public static Object ensureInitialized() { | ||
92 | INSTANCE.ensureInitializedInternal(); | ||
93 | return null; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
98 | private static final MissionCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
99 | |||
100 | private final PParameter parameter_Mission = new PParameter("Mission", "satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
101 | |||
102 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
103 | |||
104 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Cost); | ||
105 | |||
106 | private GeneratedPQuery() { | ||
107 | super(PVisibility.PRIVATE); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public String getFullyQualifiedName() { | ||
112 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.missionCost"; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<String> getParameterNames() { | ||
117 | return Arrays.asList("Mission","Cost"); | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<PParameter> getParameters() { | ||
122 | return parameters; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Set<PBody> doGetContainedBodies() { | ||
127 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
128 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
129 | { | ||
130 | PBody body = new PBody(this); | ||
131 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
132 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
133 | PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); | ||
134 | PVariable var_SpacecraftCost = body.getOrCreateVariableByName("SpacecraftCost"); | ||
135 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
136 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
137 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
138 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
139 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
140 | new ExportedParameter(body, var_Mission, parameter_Mission), | ||
141 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
142 | )); | ||
143 | // InterferometryMission.observationTime(Mission, ObservationTime) | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
145 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); | ||
147 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); | ||
148 | new Equality(body, var__virtual_0_, var_ObservationTime); | ||
149 | // SpacecraftCost == sum find spacecraftCost(Mission, _, #_) | ||
150 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
151 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var_Mission, var___0_, var___1_), SpacecraftCost.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); | ||
152 | new Equality(body, var_SpacecraftCost, var__virtual_1_); | ||
153 | // Cost == eval(SpacecraftCost + 100000.0 * ObservationTime) | ||
154 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
155 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
156 | |||
157 | @Override | ||
158 | public String getShortDescription() { | ||
159 | return "Expression evaluation from pattern missionCost"; | ||
160 | } | ||
161 | |||
162 | @Override | ||
163 | public Iterable<String> getInputParameterNames() { | ||
164 | return Arrays.asList("ObservationTime", "SpacecraftCost");} | ||
165 | |||
166 | @Override | ||
167 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
168 | Float ObservationTime = (Float) provider.getValue("ObservationTime"); | ||
169 | Double SpacecraftCost = (Double) provider.getValue("SpacecraftCost"); | ||
170 | return evaluateExpression_1_1(ObservationTime, SpacecraftCost); | ||
171 | } | ||
172 | }, var__virtual_2_ ); | ||
173 | new Equality(body, var_Cost, var__virtual_2_); | ||
174 | bodies.add(body); | ||
175 | } | ||
176 | return bodies; | ||
177 | } | ||
178 | } | ||
179 | |||
180 | private static double evaluateExpression_1_1(final Float ObservationTime, final Double SpacecraftCost) { | ||
181 | return ((SpacecraftCost).doubleValue() + (100000.0 * (ObservationTime).floatValue())); | ||
182 | } | ||
183 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCoverage.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCoverage.java deleted file mode 100644 index 639d82ef..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCoverage.java +++ /dev/null | |||
@@ -1,183 +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.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
34 | |||
35 | /** | ||
36 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
37 | * | ||
38 | * <p>Original source: | ||
39 | * <code><pre> | ||
40 | * private pattern missionCoverage(Mission : InterferometryMission, Coverage : java Double) { | ||
41 | * InterferometryMission.observationTime(Mission, ObservationTime); | ||
42 | * ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _); | ||
43 | * Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9 (1.0 / ObservationTime)) + 0.05 ObservationTime / 3); | ||
44 | * } | ||
45 | * </pre></code> | ||
46 | * | ||
47 | * @see GenericPatternMatcher | ||
48 | * @see GenericPatternMatch | ||
49 | * | ||
50 | */ | ||
51 | @SuppressWarnings("all") | ||
52 | public final class MissionCoverage extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
53 | private MissionCoverage() { | ||
54 | super(GeneratedPQuery.INSTANCE); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * @return the singleton instance of the query specification | ||
59 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
60 | * | ||
61 | */ | ||
62 | public static MissionCoverage instance() { | ||
63 | try{ | ||
64 | return LazyHolder.INSTANCE; | ||
65 | } catch (ExceptionInInitializerError err) { | ||
66 | throw processInitializerError(err); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage (visibility: PUBLIC, simpleName: MissionCoverage, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
72 | * <b>not</b> at the class load time of the outer class, | ||
73 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage (visibility: PUBLIC, simpleName: MissionCoverage, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
74 | * | ||
75 | * <p> This workaround is required e.g. to support recursion. | ||
76 | * | ||
77 | */ | ||
78 | private static class LazyHolder { | ||
79 | private static final MissionCoverage INSTANCE = new MissionCoverage(); | ||
80 | |||
81 | /** | ||
82 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
83 | * This initialization order is required to support indirect recursion. | ||
84 | * | ||
85 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
86 | * | ||
87 | */ | ||
88 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
89 | |||
90 | public static Object ensureInitialized() { | ||
91 | INSTANCE.ensureInitializedInternal(); | ||
92 | return null; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
97 | private static final MissionCoverage.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
98 | |||
99 | private final PParameter parameter_Mission = new PParameter("Mission", "satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
100 | |||
101 | private final PParameter parameter_Coverage = new PParameter("Coverage", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
102 | |||
103 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Coverage); | ||
104 | |||
105 | private GeneratedPQuery() { | ||
106 | super(PVisibility.PRIVATE); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public String getFullyQualifiedName() { | ||
111 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.missionCoverage"; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public List<String> getParameterNames() { | ||
116 | return Arrays.asList("Mission","Coverage"); | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public List<PParameter> getParameters() { | ||
121 | return parameters; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public Set<PBody> doGetContainedBodies() { | ||
126 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
127 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
128 | { | ||
129 | PBody body = new PBody(this); | ||
130 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
131 | PVariable var_Coverage = body.getOrCreateVariableByName("Coverage"); | ||
132 | PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); | ||
133 | PVariable var_ObserverCount = body.getOrCreateVariableByName("ObserverCount"); | ||
134 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
135 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
136 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Coverage), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
137 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
138 | new ExportedParameter(body, var_Mission, parameter_Mission), | ||
139 | new ExportedParameter(body, var_Coverage, parameter_Coverage) | ||
140 | )); | ||
141 | // InterferometryMission.observationTime(Mission, ObservationTime) | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
143 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); | ||
146 | new Equality(body, var__virtual_0_, var_ObservationTime); | ||
147 | // ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _) | ||
148 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
149 | new PatternMatchCounter(body, Tuples.flatTupleOf(var_Mission, var___0_), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation(), var__virtual_1_); | ||
150 | new Equality(body, var_ObserverCount, var__virtual_1_); | ||
151 | // Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9 * (1.0 / ObservationTime)) + 0.05 * ObservationTime / 3) | ||
152 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
153 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
154 | |||
155 | @Override | ||
156 | public String getShortDescription() { | ||
157 | return "Expression evaluation from pattern missionCoverage"; | ||
158 | } | ||
159 | |||
160 | @Override | ||
161 | public Iterable<String> getInputParameterNames() { | ||
162 | return Arrays.asList("ObservationTime", "ObserverCount");} | ||
163 | |||
164 | @Override | ||
165 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
166 | Float ObservationTime = (Float) provider.getValue("ObservationTime"); | ||
167 | Integer ObserverCount = (Integer) provider.getValue("ObserverCount"); | ||
168 | return evaluateExpression_1_1(ObservationTime, ObserverCount); | ||
169 | } | ||
170 | }, var__virtual_2_ ); | ||
171 | new Equality(body, var_Coverage, var__virtual_2_); | ||
172 | bodies.add(body); | ||
173 | } | ||
174 | return bodies; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | private static double evaluateExpression_1_1(final Float ObservationTime, final Integer ObserverCount) { | ||
179 | double _pow = Math.pow((1 - (2.0 / (ObserverCount).intValue())), (1 + (9 * (1.0 / (ObservationTime).floatValue())))); | ||
180 | double _plus = (_pow + ((0.05 * (ObservationTime).floatValue()) / 3)); | ||
181 | return _plus; | ||
182 | } | ||
183 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionTime.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionTime.java deleted file mode 100644 index 5e610441..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionTime.java +++ /dev/null | |||
@@ -1,183 +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.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
35 | |||
36 | /** | ||
37 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
38 | * | ||
39 | * <p>Original source: | ||
40 | * <code><pre> | ||
41 | * private pattern missionTime(Mission : InterferometryMission, Time : java Double) { | ||
42 | * InterferometryMission.observationTime(Mission, ObservationTime); | ||
43 | * TrasmitTime == sum find transmitTime(Mission, _, #_); | ||
44 | * Time == eval(TrasmitTime + 60.0 ObservationTime); | ||
45 | * } | ||
46 | * </pre></code> | ||
47 | * | ||
48 | * @see GenericPatternMatcher | ||
49 | * @see GenericPatternMatch | ||
50 | * | ||
51 | */ | ||
52 | @SuppressWarnings("all") | ||
53 | public final class MissionTime extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
54 | private MissionTime() { | ||
55 | super(GeneratedPQuery.INSTANCE); | ||
56 | } | ||
57 | |||
58 | /** | ||
59 | * @return the singleton instance of the query specification | ||
60 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
61 | * | ||
62 | */ | ||
63 | public static MissionTime instance() { | ||
64 | try{ | ||
65 | return LazyHolder.INSTANCE; | ||
66 | } catch (ExceptionInInitializerError err) { | ||
67 | throw processInitializerError(err); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime (visibility: PUBLIC, simpleName: MissionTime, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
73 | * <b>not</b> at the class load time of the outer class, | ||
74 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime (visibility: PUBLIC, simpleName: MissionTime, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
75 | * | ||
76 | * <p> This workaround is required e.g. to support recursion. | ||
77 | * | ||
78 | */ | ||
79 | private static class LazyHolder { | ||
80 | private static final MissionTime INSTANCE = new MissionTime(); | ||
81 | |||
82 | /** | ||
83 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
84 | * This initialization order is required to support indirect recursion. | ||
85 | * | ||
86 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
87 | * | ||
88 | */ | ||
89 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
90 | |||
91 | public static Object ensureInitialized() { | ||
92 | INSTANCE.ensureInitializedInternal(); | ||
93 | return null; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
98 | private static final MissionTime.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
99 | |||
100 | private final PParameter parameter_Mission = new PParameter("Mission", "satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
101 | |||
102 | private final PParameter parameter_Time = new PParameter("Time", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
103 | |||
104 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Time); | ||
105 | |||
106 | private GeneratedPQuery() { | ||
107 | super(PVisibility.PRIVATE); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public String getFullyQualifiedName() { | ||
112 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.missionTime"; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<String> getParameterNames() { | ||
117 | return Arrays.asList("Mission","Time"); | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<PParameter> getParameters() { | ||
122 | return parameters; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Set<PBody> doGetContainedBodies() { | ||
127 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
128 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
129 | { | ||
130 | PBody body = new PBody(this); | ||
131 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
132 | PVariable var_Time = body.getOrCreateVariableByName("Time"); | ||
133 | PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); | ||
134 | PVariable var_TrasmitTime = body.getOrCreateVariableByName("TrasmitTime"); | ||
135 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
136 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
137 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
138 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Time), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
139 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
140 | new ExportedParameter(body, var_Mission, parameter_Mission), | ||
141 | new ExportedParameter(body, var_Time, parameter_Time) | ||
142 | )); | ||
143 | // InterferometryMission.observationTime(Mission, ObservationTime) | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
145 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); | ||
147 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); | ||
148 | new Equality(body, var__virtual_0_, var_ObservationTime); | ||
149 | // TrasmitTime == sum find transmitTime(Mission, _, #_) | ||
150 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
151 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var_Mission, var___0_, var___1_), TransmitTime.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); | ||
152 | new Equality(body, var_TrasmitTime, var__virtual_1_); | ||
153 | // Time == eval(TrasmitTime + 60.0 * ObservationTime) | ||
154 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
155 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
156 | |||
157 | @Override | ||
158 | public String getShortDescription() { | ||
159 | return "Expression evaluation from pattern missionTime"; | ||
160 | } | ||
161 | |||
162 | @Override | ||
163 | public Iterable<String> getInputParameterNames() { | ||
164 | return Arrays.asList("ObservationTime", "TrasmitTime");} | ||
165 | |||
166 | @Override | ||
167 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
168 | Float ObservationTime = (Float) provider.getValue("ObservationTime"); | ||
169 | Double TrasmitTime = (Double) provider.getValue("TrasmitTime"); | ||
170 | return evaluateExpression_1_1(ObservationTime, TrasmitTime); | ||
171 | } | ||
172 | }, var__virtual_2_ ); | ||
173 | new Equality(body, var_Time, var__virtual_2_); | ||
174 | bodies.add(body); | ||
175 | } | ||
176 | return bodies; | ||
177 | } | ||
178 | } | ||
179 | |||
180 | private static double evaluateExpression_1_1(final Float ObservationTime, final Double TrasmitTime) { | ||
181 | return ((TrasmitTime).doubleValue() + (60.0 * (ObservationTime).floatValue())); | ||
182 | } | ||
183 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java index e474ddf1..66ea8361 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java | |||
@@ -5,48 +5,25 @@ package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; | |||
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; | 7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; |
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric; | ||
10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; | 8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; |
11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; | 9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; |
12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain; | ||
13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow; | ||
14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; | 10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; |
15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation; | 11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation; |
16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; | 12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; |
17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; | 13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; |
18 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind; | ||
19 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; | 14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; |
20 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric; | ||
21 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow; | ||
22 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium; | ||
23 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost; | ||
24 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads; | 15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads; |
25 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice; | ||
26 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand; | ||
27 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; | 16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; |
28 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain; | ||
29 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow; | ||
30 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium; | ||
31 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U; | 17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U; |
18 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat6U; | ||
32 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink; | 19 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink; |
33 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; | 20 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; |
34 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData; | ||
35 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; | 21 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; |
36 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed; | 22 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed; |
37 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost; | ||
38 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed; | 23 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed; |
39 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna; | 24 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna; |
40 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost; | 25 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem; |
41 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage; | ||
42 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime; | ||
43 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; | ||
44 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost; | ||
45 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink; | ||
46 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; | 26 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; |
47 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems; | ||
48 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate; | ||
49 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime; | ||
50 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | 27 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; |
51 | 28 | ||
52 | /** | 29 | /** |
@@ -64,41 +41,18 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | |||
64 | * <li>indirectLinkAllowed</li> | 41 | * <li>indirectLinkAllowed</li> |
65 | * <li>linkAllowed</li> | 42 | * <li>linkAllowed</li> |
66 | * <li>matchingAntenna</li> | 43 | * <li>matchingAntenna</li> |
44 | * <li>matchingCommSubsystem</li> | ||
67 | * <li>cubeSat3U</li> | 45 | * <li>cubeSat3U</li> |
46 | * <li>cubeSat6U</li> | ||
68 | * <li>communicationLoop</li> | 47 | * <li>communicationLoop</li> |
69 | * <li>indirectCommunicationLink</li> | 48 | * <li>indirectCommunicationLink</li> |
70 | * <li>directCommunicationLink</li> | 49 | * <li>directCommunicationLink</li> |
71 | * <li>incompatibleSourceAndTargetBand</li> | 50 | * <li>incompatibleSourceAndTargetBand</li> |
72 | * <li>commSubsystemBand</li> | ||
73 | * <li>incompatibleSourceAndTargetGain</li> | ||
74 | * <li>commSubsystemGain</li> | ||
75 | * <li>uhfAntennaGainNotLow</li> | ||
76 | * <li>commSubsystemGainLow</li> | ||
77 | * <li>xAntennaGainNotMedium</li> | ||
78 | * <li>commSubsystemGainMedium</li> | ||
79 | * <li>kaAntennaGainLow</li> | ||
80 | * <li>threeUCubeSatWithNonUhfCrossLink</li> | 51 | * <li>threeUCubeSatWithNonUhfCrossLink</li> |
81 | * <li>commSubsystemBandUhf</li> | 52 | * <li>commSubsystemBandUhf</li> |
82 | * <li>groundStationNetwork</li> | 53 | * <li>groundStationNetwork</li> |
83 | * <li>cubeSatWithKaAntenna</li> | 54 | * <li>cubeSatWithKaAntenna</li> |
84 | * <li>smallSat</li> | 55 | * <li>smallSat</li> |
85 | * <li>spacecraftOfKind</li> | ||
86 | * <li>coverageMetric</li> | ||
87 | * <li>missionCoverage</li> | ||
88 | * <li>timeMetric</li> | ||
89 | * <li>missionTime</li> | ||
90 | * <li>transmitTime</li> | ||
91 | * <li>incomingData</li> | ||
92 | * <li>scienceData</li> | ||
93 | * <li>transmitRate</li> | ||
94 | * <li>spacecraftUplink</li> | ||
95 | * <li>costMetric</li> | ||
96 | * <li>missionCost</li> | ||
97 | * <li>spacecraftCost</li> | ||
98 | * <li>basePrice</li> | ||
99 | * <li>interferometryPayloadCost</li> | ||
100 | * <li>additionalCommSubsystemCost</li> | ||
101 | * <li>spacecraftWithTwoCommSubsystems</li> | ||
102 | * </ul> | 56 | * </ul> |
103 | * | 57 | * |
104 | * @see IQueryGroup | 58 | * @see IQueryGroup |
@@ -132,40 +86,17 @@ public final class SatelliteQueriesAll extends BaseGeneratedPatternGroup { | |||
132 | querySpecifications.add(IndirectLinkAllowed.instance()); | 86 | querySpecifications.add(IndirectLinkAllowed.instance()); |
133 | querySpecifications.add(LinkAllowed.instance()); | 87 | querySpecifications.add(LinkAllowed.instance()); |
134 | querySpecifications.add(MatchingAntenna.instance()); | 88 | querySpecifications.add(MatchingAntenna.instance()); |
89 | querySpecifications.add(MatchingCommSubsystem.instance()); | ||
135 | querySpecifications.add(CubeSat3U.instance()); | 90 | querySpecifications.add(CubeSat3U.instance()); |
91 | querySpecifications.add(CubeSat6U.instance()); | ||
136 | querySpecifications.add(CommunicationLoop.instance()); | 92 | querySpecifications.add(CommunicationLoop.instance()); |
137 | querySpecifications.add(IndirectCommunicationLink.instance()); | 93 | querySpecifications.add(IndirectCommunicationLink.instance()); |
138 | querySpecifications.add(DirectCommunicationLink.instance()); | 94 | querySpecifications.add(DirectCommunicationLink.instance()); |
139 | querySpecifications.add(IncompatibleSourceAndTargetBand.instance()); | 95 | querySpecifications.add(IncompatibleSourceAndTargetBand.instance()); |
140 | querySpecifications.add(CommSubsystemBand.instance()); | ||
141 | querySpecifications.add(IncompatibleSourceAndTargetGain.instance()); | ||
142 | querySpecifications.add(CommSubsystemGain.instance()); | ||
143 | querySpecifications.add(UhfAntennaGainNotLow.instance()); | ||
144 | querySpecifications.add(CommSubsystemGainLow.instance()); | ||
145 | querySpecifications.add(XAntennaGainNotMedium.instance()); | ||
146 | querySpecifications.add(CommSubsystemGainMedium.instance()); | ||
147 | querySpecifications.add(KaAntennaGainLow.instance()); | ||
148 | querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance()); | 96 | querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance()); |
149 | querySpecifications.add(CommSubsystemBandUhf.instance()); | 97 | querySpecifications.add(CommSubsystemBandUhf.instance()); |
150 | querySpecifications.add(GroundStationNetwork.instance()); | 98 | querySpecifications.add(GroundStationNetwork.instance()); |
151 | querySpecifications.add(CubeSatWithKaAntenna.instance()); | 99 | querySpecifications.add(CubeSatWithKaAntenna.instance()); |
152 | querySpecifications.add(SmallSat.instance()); | 100 | querySpecifications.add(SmallSat.instance()); |
153 | querySpecifications.add(SpacecraftOfKind.instance()); | ||
154 | querySpecifications.add(CoverageMetric.instance()); | ||
155 | querySpecifications.add(MissionCoverage.instance()); | ||
156 | querySpecifications.add(TimeMetric.instance()); | ||
157 | querySpecifications.add(MissionTime.instance()); | ||
158 | querySpecifications.add(TransmitTime.instance()); | ||
159 | querySpecifications.add(IncomingData.instance()); | ||
160 | querySpecifications.add(ScienceData.instance()); | ||
161 | querySpecifications.add(TransmitRate.instance()); | ||
162 | querySpecifications.add(SpacecraftUplink.instance()); | ||
163 | querySpecifications.add(CostMetric.instance()); | ||
164 | querySpecifications.add(MissionCost.instance()); | ||
165 | querySpecifications.add(SpacecraftCost.instance()); | ||
166 | querySpecifications.add(BasePrice.instance()); | ||
167 | querySpecifications.add(InterferometryPayloadCost.instance()); | ||
168 | querySpecifications.add(AdditionalCommSubsystemCost.instance()); | ||
169 | querySpecifications.add(SpacecraftWithTwoCommSubsystems.instance()); | ||
170 | } | 101 | } |
171 | } | 102 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/ScienceData.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/ScienceData.java deleted file mode 100644 index bb262a0b..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/ScienceData.java +++ /dev/null | |||
@@ -1,179 +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.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
32 | |||
33 | /** | ||
34 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
35 | * | ||
36 | * <p>Original source: | ||
37 | * <code><pre> | ||
38 | * private pattern scienceData(Spacecraft : Spacecraft, Data : java Double) { | ||
39 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
40 | * InterferometryMission.observationTime(Mission, ObservationTime); | ||
41 | * Data == eval(12.0 ObservationTime); | ||
42 | * } | ||
43 | * </pre></code> | ||
44 | * | ||
45 | * @see GenericPatternMatcher | ||
46 | * @see GenericPatternMatch | ||
47 | * | ||
48 | */ | ||
49 | @SuppressWarnings("all") | ||
50 | public final class ScienceData extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
51 | private ScienceData() { | ||
52 | super(GeneratedPQuery.INSTANCE); | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * @return the singleton instance of the query specification | ||
57 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
58 | * | ||
59 | */ | ||
60 | public static ScienceData instance() { | ||
61 | try{ | ||
62 | return LazyHolder.INSTANCE; | ||
63 | } catch (ExceptionInInitializerError err) { | ||
64 | throw processInitializerError(err); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData (visibility: PUBLIC, simpleName: ScienceData, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
70 | * <b>not</b> at the class load time of the outer class, | ||
71 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData (visibility: PUBLIC, simpleName: ScienceData, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
72 | * | ||
73 | * <p> This workaround is required e.g. to support recursion. | ||
74 | * | ||
75 | */ | ||
76 | private static class LazyHolder { | ||
77 | private static final ScienceData INSTANCE = new ScienceData(); | ||
78 | |||
79 | /** | ||
80 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
81 | * This initialization order is required to support indirect recursion. | ||
82 | * | ||
83 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
84 | * | ||
85 | */ | ||
86 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
87 | |||
88 | public static Object ensureInitialized() { | ||
89 | INSTANCE.ensureInitializedInternal(); | ||
90 | return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
95 | private static final ScienceData.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
96 | |||
97 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final PParameter parameter_Data = new PParameter("Data", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
100 | |||
101 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Data); | ||
102 | |||
103 | private GeneratedPQuery() { | ||
104 | super(PVisibility.PRIVATE); | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public String getFullyQualifiedName() { | ||
109 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.scienceData"; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public List<String> getParameterNames() { | ||
114 | return Arrays.asList("Spacecraft","Data"); | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public List<PParameter> getParameters() { | ||
119 | return parameters; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public Set<PBody> doGetContainedBodies() { | ||
124 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
125 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
126 | { | ||
127 | PBody body = new PBody(this); | ||
128 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
129 | PVariable var_Data = body.getOrCreateVariableByName("Data"); | ||
130 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
131 | PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
133 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Data), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
134 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
135 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
136 | new ExportedParameter(body, var_Data, parameter_Data) | ||
137 | )); | ||
138 | // ConstellationMission.spacecraft(Mission, Spacecraft) | ||
139 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
140 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
141 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
143 | new Equality(body, var__virtual_0_, var_Spacecraft); | ||
144 | // InterferometryMission.observationTime(Mission, ObservationTime) | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
146 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
147 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); | ||
149 | new Equality(body, var__virtual_1_, var_ObservationTime); | ||
150 | // Data == eval(12.0 * ObservationTime) | ||
151 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
152 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
153 | |||
154 | @Override | ||
155 | public String getShortDescription() { | ||
156 | return "Expression evaluation from pattern scienceData"; | ||
157 | } | ||
158 | |||
159 | @Override | ||
160 | public Iterable<String> getInputParameterNames() { | ||
161 | return Arrays.asList("ObservationTime");} | ||
162 | |||
163 | @Override | ||
164 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
165 | Float ObservationTime = (Float) provider.getValue("ObservationTime"); | ||
166 | return evaluateExpression_1_1(ObservationTime); | ||
167 | } | ||
168 | }, var__virtual_2_ ); | ||
169 | new Equality(body, var_Data, var__virtual_2_); | ||
170 | bodies.add(body); | ||
171 | } | ||
172 | return bodies; | ||
173 | } | ||
174 | } | ||
175 | |||
176 | private static double evaluateExpression_1_1(final Float ObservationTime) { | ||
177 | return (12.0 * (ObservationTime).floatValue()); | ||
178 | } | ||
179 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftCost.java deleted file mode 100644 index ca71cdd8..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftCost.java +++ /dev/null | |||
@@ -1,209 +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.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost; | ||
10 | import java.util.Arrays; | ||
11 | import java.util.LinkedHashSet; | ||
12 | import java.util.List; | ||
13 | import java.util.Set; | ||
14 | import org.eclipse.emf.ecore.EClass; | ||
15 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
16 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
36 | |||
37 | /** | ||
38 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
39 | * | ||
40 | * <p>Original source: | ||
41 | * <code><pre> | ||
42 | * private pattern spacecraftCost(Mission : InterferometryMission, Spacecraft : Spacecraft, Cost : java Double) { | ||
43 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
44 | * find spacecraftOfKind(Spacecraft, Kind); | ||
45 | * KindCount == count find spacecraftOfKind(_, Kind); | ||
46 | * find basePrice(Spacecraft, BasePrice); | ||
47 | * find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost); | ||
48 | * find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost); | ||
49 | * Cost == eval(BasePrice Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost); | ||
50 | * } | ||
51 | * </pre></code> | ||
52 | * | ||
53 | * @see GenericPatternMatcher | ||
54 | * @see GenericPatternMatch | ||
55 | * | ||
56 | */ | ||
57 | @SuppressWarnings("all") | ||
58 | public final class SpacecraftCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
59 | private SpacecraftCost() { | ||
60 | super(GeneratedPQuery.INSTANCE); | ||
61 | } | ||
62 | |||
63 | /** | ||
64 | * @return the singleton instance of the query specification | ||
65 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
66 | * | ||
67 | */ | ||
68 | public static SpacecraftCost instance() { | ||
69 | try{ | ||
70 | return LazyHolder.INSTANCE; | ||
71 | } catch (ExceptionInInitializerError err) { | ||
72 | throw processInitializerError(err); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost (visibility: PUBLIC, simpleName: SpacecraftCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
78 | * <b>not</b> at the class load time of the outer class, | ||
79 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost (visibility: PUBLIC, simpleName: SpacecraftCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
80 | * | ||
81 | * <p> This workaround is required e.g. to support recursion. | ||
82 | * | ||
83 | */ | ||
84 | private static class LazyHolder { | ||
85 | private static final SpacecraftCost INSTANCE = new SpacecraftCost(); | ||
86 | |||
87 | /** | ||
88 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
89 | * This initialization order is required to support indirect recursion. | ||
90 | * | ||
91 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
92 | * | ||
93 | */ | ||
94 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
95 | |||
96 | public static Object ensureInitialized() { | ||
97 | INSTANCE.ensureInitializedInternal(); | ||
98 | return null; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
103 | private static final SpacecraftCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
104 | |||
105 | private final PParameter parameter_Mission = new PParameter("Mission", "satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
106 | |||
107 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
108 | |||
109 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
110 | |||
111 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Spacecraft, parameter_Cost); | ||
112 | |||
113 | private GeneratedPQuery() { | ||
114 | super(PVisibility.PRIVATE); | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public String getFullyQualifiedName() { | ||
119 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftCost"; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public List<String> getParameterNames() { | ||
124 | return Arrays.asList("Mission","Spacecraft","Cost"); | ||
125 | } | ||
126 | |||
127 | @Override | ||
128 | public List<PParameter> getParameters() { | ||
129 | return parameters; | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public Set<PBody> doGetContainedBodies() { | ||
134 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
135 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
136 | { | ||
137 | PBody body = new PBody(this); | ||
138 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
139 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
140 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
141 | PVariable var_Kind = body.getOrCreateVariableByName("Kind"); | ||
142 | PVariable var_KindCount = body.getOrCreateVariableByName("KindCount"); | ||
143 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
144 | PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); | ||
145 | PVariable var_InterferometryPayloadCost = body.getOrCreateVariableByName("InterferometryPayloadCost"); | ||
146 | PVariable var_AdditionalCommSubsystemCost = body.getOrCreateVariableByName("AdditionalCommSubsystemCost"); | ||
147 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
149 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
150 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
151 | new ExportedParameter(body, var_Mission, parameter_Mission), | ||
152 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
153 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
154 | )); | ||
155 | // ConstellationMission.spacecraft(Mission, Spacecraft) | ||
156 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
157 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
158 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); | ||
159 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
160 | new Equality(body, var__virtual_0_, var_Spacecraft); | ||
161 | // find spacecraftOfKind(Spacecraft, Kind) | ||
162 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_Kind), SpacecraftOfKind.instance().getInternalQueryRepresentation()); | ||
163 | // KindCount == count find spacecraftOfKind(_, Kind) | ||
164 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
165 | new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_, var_Kind), SpacecraftOfKind.instance().getInternalQueryRepresentation(), var__virtual_1_); | ||
166 | new Equality(body, var_KindCount, var__virtual_1_); | ||
167 | // find basePrice(Spacecraft, BasePrice) | ||
168 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_BasePrice), BasePrice.instance().getInternalQueryRepresentation()); | ||
169 | // find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost) | ||
170 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_InterferometryPayloadCost), InterferometryPayloadCost.instance().getInternalQueryRepresentation()); | ||
171 | // find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost) | ||
172 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_AdditionalCommSubsystemCost), AdditionalCommSubsystemCost.instance().getInternalQueryRepresentation()); | ||
173 | // Cost == eval(BasePrice * Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost) | ||
174 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
175 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
176 | |||
177 | @Override | ||
178 | public String getShortDescription() { | ||
179 | return "Expression evaluation from pattern spacecraftCost"; | ||
180 | } | ||
181 | |||
182 | @Override | ||
183 | public Iterable<String> getInputParameterNames() { | ||
184 | return Arrays.asList("AdditionalCommSubsystemCost", "BasePrice", "InterferometryPayloadCost", "KindCount");} | ||
185 | |||
186 | @Override | ||
187 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
188 | Double AdditionalCommSubsystemCost = (Double) provider.getValue("AdditionalCommSubsystemCost"); | ||
189 | Double BasePrice = (Double) provider.getValue("BasePrice"); | ||
190 | Double InterferometryPayloadCost = (Double) provider.getValue("InterferometryPayloadCost"); | ||
191 | Integer KindCount = (Integer) provider.getValue("KindCount"); | ||
192 | return evaluateExpression_1_1(AdditionalCommSubsystemCost, BasePrice, InterferometryPayloadCost, KindCount); | ||
193 | } | ||
194 | }, var__virtual_2_ ); | ||
195 | new Equality(body, var_Cost, var__virtual_2_); | ||
196 | bodies.add(body); | ||
197 | } | ||
198 | return bodies; | ||
199 | } | ||
200 | } | ||
201 | |||
202 | private static double evaluateExpression_1_1(final Double AdditionalCommSubsystemCost, final Double BasePrice, final Double InterferometryPayloadCost, final Integer KindCount) { | ||
203 | double _pow = Math.pow((KindCount).intValue(), (-0.25)); | ||
204 | double _multiply = ((BasePrice).doubleValue() * _pow); | ||
205 | double _plus = (_multiply + (InterferometryPayloadCost).doubleValue()); | ||
206 | double _plus_1 = (_plus + (AdditionalCommSubsystemCost).doubleValue()); | ||
207 | return _plus_1; | ||
208 | } | ||
209 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftUplink.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftUplink.java deleted file mode 100644 index 8ecc1717..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftUplink.java +++ /dev/null | |||
@@ -1,171 +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.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern spacecraftUplink(Spacecraft : Spacecraft, Band : TransceiverBand, Target : CommunicatingElement) { | ||
34 | * CommunicatingElement.communicationLink(Spacecraft, Link); | ||
35 | * DirectedCommunicationLink.source.band(Link, Band); | ||
36 | * DirectedCommunicationLink.target(Link, TargetSubsystem); | ||
37 | * CommunicatingElement.commSubsystem(Target, TargetSubsystem); | ||
38 | * } | ||
39 | * </pre></code> | ||
40 | * | ||
41 | * @see GenericPatternMatcher | ||
42 | * @see GenericPatternMatch | ||
43 | * | ||
44 | */ | ||
45 | @SuppressWarnings("all") | ||
46 | public final class SpacecraftUplink extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
47 | private SpacecraftUplink() { | ||
48 | super(GeneratedPQuery.INSTANCE); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @return the singleton instance of the query specification | ||
53 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
54 | * | ||
55 | */ | ||
56 | public static SpacecraftUplink instance() { | ||
57 | try{ | ||
58 | return LazyHolder.INSTANCE; | ||
59 | } catch (ExceptionInInitializerError err) { | ||
60 | throw processInitializerError(err); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink (visibility: PUBLIC, simpleName: SpacecraftUplink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
66 | * <b>not</b> at the class load time of the outer class, | ||
67 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink (visibility: PUBLIC, simpleName: SpacecraftUplink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
68 | * | ||
69 | * <p> This workaround is required e.g. to support recursion. | ||
70 | * | ||
71 | */ | ||
72 | private static class LazyHolder { | ||
73 | private static final SpacecraftUplink INSTANCE = new SpacecraftUplink(); | ||
74 | |||
75 | /** | ||
76 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
77 | * This initialization order is required to support indirect recursion. | ||
78 | * | ||
79 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
80 | * | ||
81 | */ | ||
82 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
83 | |||
84 | public static Object ensureInitialized() { | ||
85 | INSTANCE.ensureInitializedInternal(); | ||
86 | return null; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
91 | private static final SpacecraftUplink.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
92 | |||
93 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
94 | |||
95 | private final PParameter parameter_Band = new PParameter("Band", "satellite.TransceiverBand", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "TransceiverBand")), PParameterDirection.INOUT); | ||
96 | |||
97 | private final PParameter parameter_Target = new PParameter("Target", "satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Band, parameter_Target); | ||
100 | |||
101 | private GeneratedPQuery() { | ||
102 | super(PVisibility.PRIVATE); | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String getFullyQualifiedName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftUplink"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> getParameterNames() { | ||
112 | return Arrays.asList("Spacecraft","Band","Target"); | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<PParameter> getParameters() { | ||
117 | return parameters; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public Set<PBody> doGetContainedBodies() { | ||
122 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
123 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
124 | { | ||
125 | PBody body = new PBody(this); | ||
126 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
127 | PVariable var_Band = body.getOrCreateVariableByName("Band"); | ||
128 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
129 | PVariable var_Link = body.getOrCreateVariableByName("Link"); | ||
130 | PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem"); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Band), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
134 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
135 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
136 | new ExportedParameter(body, var_Band, parameter_Band), | ||
137 | new ExportedParameter(body, var_Target, parameter_Target) | ||
138 | )); | ||
139 | // CommunicatingElement.communicationLink(Spacecraft, Link) | ||
140 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
141 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "communicationLink"))); | ||
143 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
144 | new Equality(body, var__virtual_0_, var_Link); | ||
145 | // DirectedCommunicationLink.source.band(Link, Band) | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
147 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source"))); | ||
149 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
150 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
151 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
152 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
153 | new Equality(body, var__virtual_2_, var_Band); | ||
154 | // DirectedCommunicationLink.target(Link, TargetSubsystem) | ||
155 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
156 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
157 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); | ||
158 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
159 | new Equality(body, var__virtual_3_, var_TargetSubsystem); | ||
160 | // CommunicatingElement.commSubsystem(Target, TargetSubsystem) | ||
161 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
162 | PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); | ||
163 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
164 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
165 | new Equality(body, var__virtual_4_, var_TargetSubsystem); | ||
166 | bodies.add(body); | ||
167 | } | ||
168 | return bodies; | ||
169 | } | ||
170 | } | ||
171 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithTwoCommSubsystems.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithTwoCommSubsystems.java deleted file mode 100644 index a91f7b92..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithTwoCommSubsystems.java +++ /dev/null | |||
@@ -1,146 +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.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
26 | |||
27 | /** | ||
28 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
29 | * | ||
30 | * <p>Original source: | ||
31 | * <code><pre> | ||
32 | * private pattern spacecraftWithTwoCommSubsystems(Spacecraft : Spacecraft) { | ||
33 | * Spacecraft.commSubsystem(Spacecraft, Subsystem1); | ||
34 | * Spacecraft.commSubsystem(Spacecraft, Subsystem2); | ||
35 | * Subsystem1 != Subsystem2; | ||
36 | * } | ||
37 | * </pre></code> | ||
38 | * | ||
39 | * @see GenericPatternMatcher | ||
40 | * @see GenericPatternMatch | ||
41 | * | ||
42 | */ | ||
43 | @SuppressWarnings("all") | ||
44 | public final class SpacecraftWithTwoCommSubsystems extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
45 | private SpacecraftWithTwoCommSubsystems() { | ||
46 | super(GeneratedPQuery.INSTANCE); | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * @return the singleton instance of the query specification | ||
51 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
52 | * | ||
53 | */ | ||
54 | public static SpacecraftWithTwoCommSubsystems instance() { | ||
55 | try{ | ||
56 | return LazyHolder.INSTANCE; | ||
57 | } catch (ExceptionInInitializerError err) { | ||
58 | throw processInitializerError(err); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems (visibility: PUBLIC, simpleName: SpacecraftWithTwoCommSubsystems, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
64 | * <b>not</b> at the class load time of the outer class, | ||
65 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems (visibility: PUBLIC, simpleName: SpacecraftWithTwoCommSubsystems, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
66 | * | ||
67 | * <p> This workaround is required e.g. to support recursion. | ||
68 | * | ||
69 | */ | ||
70 | private static class LazyHolder { | ||
71 | private static final SpacecraftWithTwoCommSubsystems INSTANCE = new SpacecraftWithTwoCommSubsystems(); | ||
72 | |||
73 | /** | ||
74 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
75 | * This initialization order is required to support indirect recursion. | ||
76 | * | ||
77 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
78 | * | ||
79 | */ | ||
80 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
81 | |||
82 | public static Object ensureInitialized() { | ||
83 | INSTANCE.ensureInitializedInternal(); | ||
84 | return null; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
89 | private static final SpacecraftWithTwoCommSubsystems.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
90 | |||
91 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
92 | |||
93 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft); | ||
94 | |||
95 | private GeneratedPQuery() { | ||
96 | super(PVisibility.PRIVATE); | ||
97 | } | ||
98 | |||
99 | @Override | ||
100 | public String getFullyQualifiedName() { | ||
101 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftWithTwoCommSubsystems"; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public List<String> getParameterNames() { | ||
106 | return Arrays.asList("Spacecraft"); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public List<PParameter> getParameters() { | ||
111 | return parameters; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public Set<PBody> doGetContainedBodies() { | ||
116 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
117 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
118 | { | ||
119 | PBody body = new PBody(this); | ||
120 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
121 | PVariable var_Subsystem1 = body.getOrCreateVariableByName("Subsystem1"); | ||
122 | PVariable var_Subsystem2 = body.getOrCreateVariableByName("Subsystem2"); | ||
123 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
124 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
125 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft) | ||
126 | )); | ||
127 | // Spacecraft.commSubsystem(Spacecraft, Subsystem1) | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
129 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
132 | new Equality(body, var__virtual_0_, var_Subsystem1); | ||
133 | // Spacecraft.commSubsystem(Spacecraft, Subsystem2) | ||
134 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
135 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
136 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
137 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
138 | new Equality(body, var__virtual_1_, var_Subsystem2); | ||
139 | // Subsystem1 != Subsystem2 | ||
140 | new Inequality(body, var_Subsystem1, var_Subsystem2); | ||
141 | bodies.add(body); | ||
142 | } | ||
143 | return bodies; | ||
144 | } | ||
145 | } | ||
146 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitRate.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitRate.java deleted file mode 100644 index 174e076a..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitRate.java +++ /dev/null | |||
@@ -1,277 +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.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
29 | |||
30 | /** | ||
31 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
32 | * | ||
33 | * <p>Original source: | ||
34 | * <code><pre> | ||
35 | * private pattern transmitRate(Spacecraft : Spacecraft, TransmitRate : java Double) { | ||
36 | * find spacecraftUplink(Spacecraft, TransceiverBand::UHF, Target); | ||
37 | * Spacecraft(Target); | ||
38 | * TransmitRate == 5.0; | ||
39 | * } or { | ||
40 | * find spacecraftUplink(Spacecraft, TransceiverBand::X, Target); | ||
41 | * Spacecraft(Target); | ||
42 | * TransmitRate == 1.6; | ||
43 | * } or { | ||
44 | * find spacecraftUplink(Spacecraft, TransceiverBand::X, Target); | ||
45 | * GroundStationNetwork(Target); | ||
46 | * TransmitRate == 0.7; | ||
47 | * } or { | ||
48 | * find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target); | ||
49 | * Spacecraft(Target); | ||
50 | * TransmitRate == 220.0; | ||
51 | * } or { | ||
52 | * find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target); | ||
53 | * GroundStationNetwork(Target); | ||
54 | * TransmitRate == 80.0; | ||
55 | * } | ||
56 | * </pre></code> | ||
57 | * | ||
58 | * @see GenericPatternMatcher | ||
59 | * @see GenericPatternMatch | ||
60 | * | ||
61 | */ | ||
62 | @SuppressWarnings("all") | ||
63 | public final class TransmitRate extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
64 | private TransmitRate() { | ||
65 | super(GeneratedPQuery.INSTANCE); | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * @return the singleton instance of the query specification | ||
70 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
71 | * | ||
72 | */ | ||
73 | public static TransmitRate instance() { | ||
74 | try{ | ||
75 | return LazyHolder.INSTANCE; | ||
76 | } catch (ExceptionInInitializerError err) { | ||
77 | throw processInitializerError(err); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | /** | ||
82 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate (visibility: PUBLIC, simpleName: TransmitRate, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
83 | * <b>not</b> at the class load time of the outer class, | ||
84 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate (visibility: PUBLIC, simpleName: TransmitRate, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
85 | * | ||
86 | * <p> This workaround is required e.g. to support recursion. | ||
87 | * | ||
88 | */ | ||
89 | private static class LazyHolder { | ||
90 | private static final TransmitRate INSTANCE = new TransmitRate(); | ||
91 | |||
92 | /** | ||
93 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
94 | * This initialization order is required to support indirect recursion. | ||
95 | * | ||
96 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
97 | * | ||
98 | */ | ||
99 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
100 | |||
101 | public static Object ensureInitialized() { | ||
102 | INSTANCE.ensureInitializedInternal(); | ||
103 | return null; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
108 | private static final TransmitRate.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
109 | |||
110 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
111 | |||
112 | private final PParameter parameter_TransmitRate = new PParameter("TransmitRate", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
113 | |||
114 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_TransmitRate); | ||
115 | |||
116 | private GeneratedPQuery() { | ||
117 | super(PVisibility.PRIVATE); | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public String getFullyQualifiedName() { | ||
122 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.transmitRate"; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public List<String> getParameterNames() { | ||
127 | return Arrays.asList("Spacecraft","TransmitRate"); | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public List<PParameter> getParameters() { | ||
132 | return parameters; | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public Set<PBody> doGetContainedBodies() { | ||
137 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
138 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
139 | { | ||
140 | PBody body = new PBody(this); | ||
141 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
142 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
143 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
145 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
146 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
147 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
148 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
149 | )); | ||
150 | // find spacecraftUplink(Spacecraft, TransceiverBand::UHF, Target) | ||
151 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
152 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance()); | ||
153 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
154 | // Spacecraft(Target) | ||
155 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
156 | // TransmitRate == 5.0 | ||
157 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
158 | new ConstantValue(body, var__virtual_1_, 5.0); | ||
159 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
160 | bodies.add(body); | ||
161 | } | ||
162 | { | ||
163 | PBody body = new PBody(this); | ||
164 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
165 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
166 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
167 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
168 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
169 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
170 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
171 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
172 | )); | ||
173 | // find spacecraftUplink(Spacecraft, TransceiverBand::X, Target) | ||
174 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
175 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "X").getInstance()); | ||
176 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
177 | // Spacecraft(Target) | ||
178 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
179 | // TransmitRate == 1.6 | ||
180 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
181 | new ConstantValue(body, var__virtual_1_, 1.6); | ||
182 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
183 | bodies.add(body); | ||
184 | } | ||
185 | { | ||
186 | PBody body = new PBody(this); | ||
187 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
188 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
189 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
190 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
191 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
192 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
193 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
194 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
195 | )); | ||
196 | // find spacecraftUplink(Spacecraft, TransceiverBand::X, Target) | ||
197 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
198 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "X").getInstance()); | ||
199 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
200 | // GroundStationNetwork(Target) | ||
201 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); | ||
202 | // TransmitRate == 0.7 | ||
203 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
204 | new ConstantValue(body, var__virtual_1_, 0.7); | ||
205 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
206 | bodies.add(body); | ||
207 | } | ||
208 | { | ||
209 | PBody body = new PBody(this); | ||
210 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
211 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
212 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
213 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
214 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
215 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
216 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
217 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
218 | )); | ||
219 | // find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target) | ||
220 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
221 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance()); | ||
222 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
223 | // Spacecraft(Target) | ||
224 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
225 | // TransmitRate == 220.0 | ||
226 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
227 | new ConstantValue(body, var__virtual_1_, 220.0); | ||
228 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
229 | bodies.add(body); | ||
230 | } | ||
231 | { | ||
232 | PBody body = new PBody(this); | ||
233 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
234 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
235 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
236 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
237 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
238 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
239 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
240 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
241 | )); | ||
242 | // find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target) | ||
243 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
244 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance()); | ||
245 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
246 | // GroundStationNetwork(Target) | ||
247 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); | ||
248 | // TransmitRate == 80.0 | ||
249 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
250 | new ConstantValue(body, var__virtual_1_, 80.0); | ||
251 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
252 | bodies.add(body); | ||
253 | } | ||
254 | return bodies; | ||
255 | } | ||
256 | } | ||
257 | |||
258 | private static double evaluateExpression_1_1() { | ||
259 | return 5.0; | ||
260 | } | ||
261 | |||
262 | private static double evaluateExpression_2_1() { | ||
263 | return 1.6; | ||
264 | } | ||
265 | |||
266 | private static double evaluateExpression_3_1() { | ||
267 | return 0.7; | ||
268 | } | ||
269 | |||
270 | private static double evaluateExpression_4_1() { | ||
271 | return 220.0; | ||
272 | } | ||
273 | |||
274 | private static double evaluateExpression_5_1() { | ||
275 | return 80.0; | ||
276 | } | ||
277 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitTime.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitTime.java deleted file mode 100644 index a64c750a..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitTime.java +++ /dev/null | |||
@@ -1,200 +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.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate; | ||
9 | import java.util.Arrays; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Set; | ||
13 | import org.eclipse.emf.ecore.EClass; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
15 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
36 | import org.eclipse.xtext.xbase.lib.DoubleExtensions; | ||
37 | |||
38 | /** | ||
39 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
40 | * | ||
41 | * <p>Original source: | ||
42 | * <code><pre> | ||
43 | * private pattern transmitTime(Mission : InterferometryMission, Spacecraft : Spacecraft, TransmitTime : java Double) { | ||
44 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
45 | * find scienceData(Spacecraft, ScienceData); | ||
46 | * IncomingData == sum find incomingData(Spacecraft, _, #_); | ||
47 | * find transmitRate(Spacecraft, TransmitRate); | ||
48 | * TransmitTime == eval((ScienceData + IncomingData) / (7.5 TransmitRate)); | ||
49 | * } | ||
50 | * </pre></code> | ||
51 | * | ||
52 | * @see GenericPatternMatcher | ||
53 | * @see GenericPatternMatch | ||
54 | * | ||
55 | */ | ||
56 | @SuppressWarnings("all") | ||
57 | public final class TransmitTime extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
58 | private TransmitTime() { | ||
59 | super(GeneratedPQuery.INSTANCE); | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * @return the singleton instance of the query specification | ||
64 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
65 | * | ||
66 | */ | ||
67 | public static TransmitTime instance() { | ||
68 | try{ | ||
69 | return LazyHolder.INSTANCE; | ||
70 | } catch (ExceptionInInitializerError err) { | ||
71 | throw processInitializerError(err); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime (visibility: PUBLIC, simpleName: TransmitTime, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
77 | * <b>not</b> at the class load time of the outer class, | ||
78 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime (visibility: PUBLIC, simpleName: TransmitTime, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
79 | * | ||
80 | * <p> This workaround is required e.g. to support recursion. | ||
81 | * | ||
82 | */ | ||
83 | private static class LazyHolder { | ||
84 | private static final TransmitTime INSTANCE = new TransmitTime(); | ||
85 | |||
86 | /** | ||
87 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
88 | * This initialization order is required to support indirect recursion. | ||
89 | * | ||
90 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
91 | * | ||
92 | */ | ||
93 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
94 | |||
95 | public static Object ensureInitialized() { | ||
96 | INSTANCE.ensureInitializedInternal(); | ||
97 | return null; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
102 | private static final TransmitTime.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
103 | |||
104 | private final PParameter parameter_Mission = new PParameter("Mission", "satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
105 | |||
106 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
107 | |||
108 | private final PParameter parameter_TransmitTime = new PParameter("TransmitTime", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
109 | |||
110 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Spacecraft, parameter_TransmitTime); | ||
111 | |||
112 | private GeneratedPQuery() { | ||
113 | super(PVisibility.PRIVATE); | ||
114 | } | ||
115 | |||
116 | @Override | ||
117 | public String getFullyQualifiedName() { | ||
118 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.transmitTime"; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public List<String> getParameterNames() { | ||
123 | return Arrays.asList("Mission","Spacecraft","TransmitTime"); | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public List<PParameter> getParameters() { | ||
128 | return parameters; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public Set<PBody> doGetContainedBodies() { | ||
133 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
134 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
135 | { | ||
136 | PBody body = new PBody(this); | ||
137 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
138 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
139 | PVariable var_TransmitTime = body.getOrCreateVariableByName("TransmitTime"); | ||
140 | PVariable var_ScienceData = body.getOrCreateVariableByName("ScienceData"); | ||
141 | PVariable var_IncomingData = body.getOrCreateVariableByName("IncomingData"); | ||
142 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
143 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
144 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
147 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitTime), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
148 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
149 | new ExportedParameter(body, var_Mission, parameter_Mission), | ||
150 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
151 | new ExportedParameter(body, var_TransmitTime, parameter_TransmitTime) | ||
152 | )); | ||
153 | // ConstellationMission.spacecraft(Mission, Spacecraft) | ||
154 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
155 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
156 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); | ||
157 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
158 | new Equality(body, var__virtual_0_, var_Spacecraft); | ||
159 | // find scienceData(Spacecraft, ScienceData) | ||
160 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_ScienceData), ScienceData.instance().getInternalQueryRepresentation()); | ||
161 | // IncomingData == sum find incomingData(Spacecraft, _, #_) | ||
162 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
163 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var_Spacecraft, var___0_, var___1_), IncomingData.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); | ||
164 | new Equality(body, var_IncomingData, var__virtual_1_); | ||
165 | // find transmitRate(Spacecraft, TransmitRate) | ||
166 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_TransmitRate), TransmitRate.instance().getInternalQueryRepresentation()); | ||
167 | // TransmitTime == eval((ScienceData + IncomingData) / (7.5 * TransmitRate)) | ||
168 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
169 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
170 | |||
171 | @Override | ||
172 | public String getShortDescription() { | ||
173 | return "Expression evaluation from pattern transmitTime"; | ||
174 | } | ||
175 | |||
176 | @Override | ||
177 | public Iterable<String> getInputParameterNames() { | ||
178 | return Arrays.asList("IncomingData", "ScienceData", "TransmitRate");} | ||
179 | |||
180 | @Override | ||
181 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
182 | Double IncomingData = (Double) provider.getValue("IncomingData"); | ||
183 | Double ScienceData = (Double) provider.getValue("ScienceData"); | ||
184 | Double TransmitRate = (Double) provider.getValue("TransmitRate"); | ||
185 | return evaluateExpression_1_1(IncomingData, ScienceData, TransmitRate); | ||
186 | } | ||
187 | }, var__virtual_2_ ); | ||
188 | new Equality(body, var_TransmitTime, var__virtual_2_); | ||
189 | bodies.add(body); | ||
190 | } | ||
191 | return bodies; | ||
192 | } | ||
193 | } | ||
194 | |||
195 | private static double evaluateExpression_1_1(final Double IncomingData, final Double ScienceData, final Double TransmitRate) { | ||
196 | double _plus = DoubleExtensions.operator_plus(ScienceData, IncomingData); | ||
197 | double _divide = (_plus / (7.5 * (TransmitRate).doubleValue())); | ||
198 | return _divide; | ||
199 | } | ||
200 | } | ||