diff options
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoLinkToGroundStation.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoLinkToGroundStation.java | 575 |
1 files changed, 575 insertions, 0 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoLinkToGroundStation.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoLinkToGroundStation.java new file mode 100644 index 00000000..598f3a6b --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoLinkToGroundStation.java | |||
@@ -0,0 +1,575 @@ | |||
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.Spacecraft; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.Collection; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | import java.util.Optional; | ||
14 | import java.util.Set; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collectors; | ||
17 | import java.util.stream.Stream; | ||
18 | import org.apache.log4j.Logger; | ||
19 | import org.eclipse.emf.ecore.EClass; | ||
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.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.basicdeferred.NegativePatternCall; | ||
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 | |||
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 | * // All spacecraft must have some communication path to the ground station | ||
51 | * | ||
52 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, | ||
53 | * message = "Spacecraft has no communication path to the ground station.") | ||
54 | * pattern noLinkToGroundStation(Spacecraft : Spacecraft) { | ||
55 | * ConstellationMission.groundStationNetwork(Mission, GroundStation); | ||
56 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
57 | * neg find indirectCommunicationLink(Spacecraft, GroundStation); | ||
58 | * } | ||
59 | * </pre></code> | ||
60 | * | ||
61 | * @see Matcher | ||
62 | * @see Match | ||
63 | * | ||
64 | */ | ||
65 | @SuppressWarnings("all") | ||
66 | public final class NoLinkToGroundStation extends BaseGeneratedEMFQuerySpecification<NoLinkToGroundStation.Matcher> { | ||
67 | /** | ||
68 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noLinkToGroundStation 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 Spacecraft fSpacecraft; | ||
81 | |||
82 | private static List<String> parameterNames = makeImmutableList("Spacecraft"); | ||
83 | |||
84 | private Match(final Spacecraft pSpacecraft) { | ||
85 | this.fSpacecraft = pSpacecraft; | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public Object get(final String parameterName) { | ||
90 | if ("Spacecraft".equals(parameterName)) return this.fSpacecraft; | ||
91 | return null; | ||
92 | } | ||
93 | |||
94 | public Spacecraft getSpacecraft() { | ||
95 | return this.fSpacecraft; | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public boolean set(final String parameterName, final Object newValue) { | ||
100 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
101 | if ("Spacecraft".equals(parameterName) ) { | ||
102 | this.fSpacecraft = (Spacecraft) newValue; | ||
103 | return true; | ||
104 | } | ||
105 | return false; | ||
106 | } | ||
107 | |||
108 | public void setSpacecraft(final Spacecraft pSpacecraft) { | ||
109 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
110 | this.fSpacecraft = pSpacecraft; | ||
111 | } | ||
112 | |||
113 | @Override | ||
114 | public String patternName() { | ||
115 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noLinkToGroundStation"; | ||
116 | } | ||
117 | |||
118 | @Override | ||
119 | public List<String> parameterNames() { | ||
120 | return NoLinkToGroundStation.Match.parameterNames; | ||
121 | } | ||
122 | |||
123 | @Override | ||
124 | public Object[] toArray() { | ||
125 | return new Object[]{fSpacecraft}; | ||
126 | } | ||
127 | |||
128 | @Override | ||
129 | public NoLinkToGroundStation.Match toImmutable() { | ||
130 | return isMutable() ? newMatch(fSpacecraft) : this; | ||
131 | } | ||
132 | |||
133 | @Override | ||
134 | public String prettyPrint() { | ||
135 | StringBuilder result = new StringBuilder(); | ||
136 | result.append("\"Spacecraft\"=" + prettyPrintValue(fSpacecraft)); | ||
137 | return result.toString(); | ||
138 | } | ||
139 | |||
140 | @Override | ||
141 | public int hashCode() { | ||
142 | return Objects.hash(fSpacecraft); | ||
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 NoLinkToGroundStation.Match)) { | ||
153 | NoLinkToGroundStation.Match other = (NoLinkToGroundStation.Match) obj; | ||
154 | return Objects.equals(fSpacecraft, other.fSpacecraft); | ||
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 NoLinkToGroundStation specification() { | ||
167 | return NoLinkToGroundStation.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 NoLinkToGroundStation.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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
186 | * @return the new, mutable (partial) match object. | ||
187 | * | ||
188 | */ | ||
189 | public static NoLinkToGroundStation.Match newMutableMatch(final Spacecraft pSpacecraft) { | ||
190 | return new Mutable(pSpacecraft); | ||
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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
198 | * @return the (partial) match object. | ||
199 | * | ||
200 | */ | ||
201 | public static NoLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) { | ||
202 | return new Immutable(pSpacecraft); | ||
203 | } | ||
204 | |||
205 | private static final class Mutable extends NoLinkToGroundStation.Match { | ||
206 | Mutable(final Spacecraft pSpacecraft) { | ||
207 | super(pSpacecraft); | ||
208 | } | ||
209 | |||
210 | @Override | ||
211 | public boolean isMutable() { | ||
212 | return true; | ||
213 | } | ||
214 | } | ||
215 | |||
216 | private static final class Immutable extends NoLinkToGroundStation.Match { | ||
217 | Immutable(final Spacecraft pSpacecraft) { | ||
218 | super(pSpacecraft); | ||
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.noLinkToGroundStation 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 | * // All spacecraft must have some communication path to the ground station | ||
240 | * | ||
241 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, | ||
242 | * message = "Spacecraft has no communication path to the ground station.") | ||
243 | * pattern noLinkToGroundStation(Spacecraft : Spacecraft) { | ||
244 | * ConstellationMission.groundStationNetwork(Mission, GroundStation); | ||
245 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
246 | * neg find indirectCommunicationLink(Spacecraft, GroundStation); | ||
247 | * } | ||
248 | * </pre></code> | ||
249 | * | ||
250 | * @see Match | ||
251 | * @see NoLinkToGroundStation | ||
252 | * | ||
253 | */ | ||
254 | public static class Matcher extends BaseMatcher<NoLinkToGroundStation.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 NoLinkToGroundStation.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 NoLinkToGroundStation.Matcher create() { | ||
279 | return new Matcher(); | ||
280 | } | ||
281 | |||
282 | private static final int POSITION_SPACECRAFT = 0; | ||
283 | |||
284 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NoLinkToGroundStation.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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
301 | * @return matches represented as a Match object. | ||
302 | * | ||
303 | */ | ||
304 | public Collection<NoLinkToGroundStation.Match> getAllMatches(final Spacecraft pSpacecraft) { | ||
305 | return rawStreamAllMatches(new Object[]{pSpacecraft}).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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
315 | * @return a stream of matches represented as a Match object. | ||
316 | * | ||
317 | */ | ||
318 | public Stream<NoLinkToGroundStation.Match> streamAllMatches(final Spacecraft pSpacecraft) { | ||
319 | return rawStreamAllMatches(new Object[]{pSpacecraft}); | ||
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 pSpacecraft the fixed value of pattern parameter Spacecraft, 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<NoLinkToGroundStation.Match> getOneArbitraryMatch(final Spacecraft pSpacecraft) { | ||
330 | return rawGetOneArbitraryMatch(new Object[]{pSpacecraft}); | ||
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 pSpacecraft the fixed value of pattern parameter Spacecraft, 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 Spacecraft pSpacecraft) { | ||
341 | return rawHasMatch(new Object[]{pSpacecraft}); | ||
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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
347 | * @return the number of pattern matches found. | ||
348 | * | ||
349 | */ | ||
350 | public int countMatches(final Spacecraft pSpacecraft) { | ||
351 | return rawCountMatches(new Object[]{pSpacecraft}); | ||
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 pSpacecraft the fixed value of pattern parameter Spacecraft, 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 Spacecraft pSpacecraft, final Consumer<? super NoLinkToGroundStation.Match> processor) { | ||
363 | return rawForOneArbitraryMatch(new Object[]{pSpacecraft}, 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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
371 | * @return the (partial) match object. | ||
372 | * | ||
373 | */ | ||
374 | public NoLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) { | ||
375 | return NoLinkToGroundStation.Match.newMatch(pSpacecraft); | ||
376 | } | ||
377 | |||
378 | /** | ||
379 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
380 | * @return the Set of all values or empty set if there are no matches | ||
381 | * | ||
382 | */ | ||
383 | protected Stream<Spacecraft> rawStreamAllValuesOfSpacecraft(final Object[] parameters) { | ||
384 | return rawStreamAllValues(POSITION_SPACECRAFT, parameters).map(Spacecraft.class::cast); | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
389 | * @return the Set of all values or empty set if there are no matches | ||
390 | * | ||
391 | */ | ||
392 | public Set<Spacecraft> getAllValuesOfSpacecraft() { | ||
393 | return rawStreamAllValuesOfSpacecraft(emptyArray()).collect(Collectors.toSet()); | ||
394 | } | ||
395 | |||
396 | /** | ||
397 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
398 | * @return the Set of all values or empty set if there are no matches | ||
399 | * | ||
400 | */ | ||
401 | public Stream<Spacecraft> streamAllValuesOfSpacecraft() { | ||
402 | return rawStreamAllValuesOfSpacecraft(emptyArray()); | ||
403 | } | ||
404 | |||
405 | @Override | ||
406 | protected NoLinkToGroundStation.Match tupleToMatch(final Tuple t) { | ||
407 | try { | ||
408 | return NoLinkToGroundStation.Match.newMatch((Spacecraft) t.get(POSITION_SPACECRAFT)); | ||
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 NoLinkToGroundStation.Match arrayToMatch(final Object[] match) { | ||
417 | try { | ||
418 | return NoLinkToGroundStation.Match.newMatch((Spacecraft) match[POSITION_SPACECRAFT]); | ||
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 NoLinkToGroundStation.Match arrayToMatchMutable(final Object[] match) { | ||
427 | try { | ||
428 | return NoLinkToGroundStation.Match.newMutableMatch((Spacecraft) match[POSITION_SPACECRAFT]); | ||
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<NoLinkToGroundStation.Matcher> querySpecification() { | ||
441 | return NoLinkToGroundStation.instance(); | ||
442 | } | ||
443 | } | ||
444 | |||
445 | private NoLinkToGroundStation() { | ||
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 NoLinkToGroundStation instance() { | ||
455 | try{ | ||
456 | return LazyHolder.INSTANCE; | ||
457 | } catch (ExceptionInInitializerError err) { | ||
458 | throw processInitializerError(err); | ||
459 | } | ||
460 | } | ||
461 | |||
462 | @Override | ||
463 | protected NoLinkToGroundStation.Matcher instantiate(final ViatraQueryEngine engine) { | ||
464 | return NoLinkToGroundStation.Matcher.on(engine); | ||
465 | } | ||
466 | |||
467 | @Override | ||
468 | public NoLinkToGroundStation.Matcher instantiate() { | ||
469 | return NoLinkToGroundStation.Matcher.create(); | ||
470 | } | ||
471 | |||
472 | @Override | ||
473 | public NoLinkToGroundStation.Match newEmptyMatch() { | ||
474 | return NoLinkToGroundStation.Match.newEmptyMatch(); | ||
475 | } | ||
476 | |||
477 | @Override | ||
478 | public NoLinkToGroundStation.Match newMatch(final Object... parameters) { | ||
479 | return NoLinkToGroundStation.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0]); | ||
480 | } | ||
481 | |||
482 | /** | ||
483 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation (visibility: PUBLIC, simpleName: NoLinkToGroundStation, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation, 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.NoLinkToGroundStation (visibility: PUBLIC, simpleName: NoLinkToGroundStation, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation, 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 NoLinkToGroundStation INSTANCE = new NoLinkToGroundStation(); | ||
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 NoLinkToGroundStation.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
510 | |||
511 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
512 | |||
513 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft); | ||
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.noLinkToGroundStation"; | ||
522 | } | ||
523 | |||
524 | @Override | ||
525 | public List<String> getParameterNames() { | ||
526 | return Arrays.asList("Spacecraft"); | ||
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_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
541 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
542 | PVariable var_GroundStation = body.getOrCreateVariableByName("GroundStation"); | ||
543 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
544 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
545 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft) | ||
546 | )); | ||
547 | // ConstellationMission.groundStationNetwork(Mission, GroundStation) | ||
548 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
549 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
550 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "groundStationNetwork"))); | ||
551 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); | ||
552 | new Equality(body, var__virtual_0_, var_GroundStation); | ||
553 | // ConstellationMission.spacecraft(Mission, Spacecraft) | ||
554 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
555 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
556 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); | ||
557 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
558 | new Equality(body, var__virtual_1_, var_Spacecraft); | ||
559 | // neg find indirectCommunicationLink(Spacecraft, GroundStation) | ||
560 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_GroundStation), IndirectCommunicationLink.instance().getInternalQueryRepresentation()); | ||
561 | bodies.add(body); | ||
562 | } | ||
563 | { | ||
564 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
565 | annotation.addAttribute("severity", "error"); | ||
566 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
567 | new ParameterReference("Spacecraft") | ||
568 | })); | ||
569 | annotation.addAttribute("message", "Spacecraft has no communication path to the ground station."); | ||
570 | addAnnotation(annotation); | ||
571 | } | ||
572 | return bodies; | ||
573 | } | ||
574 | } | ||
575 | } | ||