diff options
author | 2019-05-06 18:42:22 -0400 | |
---|---|---|
committer | 2019-05-06 18:42:22 -0400 | |
commit | 09b1255f11ee17828da706f682e33f50316887fe (patch) | |
tree | f3783961c521b73201a9d079be78feb26e8a285c /Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java | |
parent | Merge remote-tracking branch 'origin/master' into kris (diff) | |
download | VIATRA-Generator-09b1255f11ee17828da706f682e33f50316887fe.tar.gz VIATRA-Generator-09b1255f11ee17828da706f682e33f50316887fe.tar.zst VIATRA-Generator-09b1255f11ee17828da706f682e33f50316887fe.zip |
Trying to implement spacecraft case study
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java | 571 |
1 files changed, 571 insertions, 0 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java new file mode 100644 index 00000000..1e8f8502 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java | |||
@@ -0,0 +1,571 @@ | |||
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.IndirectLinkAllowed; | ||
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 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, | ||
51 | * message = "Spacecraft has no potential communication path to the ground station.") | ||
52 | * pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { | ||
53 | * ConstellationMission.groundStationNetwork(Mission, GroundStation); | ||
54 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
55 | * neg find indirectLinkAllowed(Spacecraft, GroundStation); | ||
56 | * } | ||
57 | * </pre></code> | ||
58 | * | ||
59 | * @see Matcher | ||
60 | * @see Match | ||
61 | * | ||
62 | */ | ||
63 | @SuppressWarnings("all") | ||
64 | public final class NoPotentialLinkToGroundStation extends BaseGeneratedEMFQuerySpecification<NoPotentialLinkToGroundStation.Matcher> { | ||
65 | /** | ||
66 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation pattern, | ||
67 | * to be used in conjunction with {@link Matcher}. | ||
68 | * | ||
69 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
70 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
71 | * usable to represent a match of the pattern in the result of a query, | ||
72 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
73 | * | ||
74 | * @see Matcher | ||
75 | * | ||
76 | */ | ||
77 | public static abstract class Match extends BasePatternMatch { | ||
78 | private Spacecraft fSpacecraft; | ||
79 | |||
80 | private static List<String> parameterNames = makeImmutableList("Spacecraft"); | ||
81 | |||
82 | private Match(final Spacecraft pSpacecraft) { | ||
83 | this.fSpacecraft = pSpacecraft; | ||
84 | } | ||
85 | |||
86 | @Override | ||
87 | public Object get(final String parameterName) { | ||
88 | if ("Spacecraft".equals(parameterName)) return this.fSpacecraft; | ||
89 | return null; | ||
90 | } | ||
91 | |||
92 | public Spacecraft getSpacecraft() { | ||
93 | return this.fSpacecraft; | ||
94 | } | ||
95 | |||
96 | @Override | ||
97 | public boolean set(final String parameterName, final Object newValue) { | ||
98 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
99 | if ("Spacecraft".equals(parameterName) ) { | ||
100 | this.fSpacecraft = (Spacecraft) newValue; | ||
101 | return true; | ||
102 | } | ||
103 | return false; | ||
104 | } | ||
105 | |||
106 | public void setSpacecraft(final Spacecraft pSpacecraft) { | ||
107 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
108 | this.fSpacecraft = pSpacecraft; | ||
109 | } | ||
110 | |||
111 | @Override | ||
112 | public String patternName() { | ||
113 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation"; | ||
114 | } | ||
115 | |||
116 | @Override | ||
117 | public List<String> parameterNames() { | ||
118 | return NoPotentialLinkToGroundStation.Match.parameterNames; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public Object[] toArray() { | ||
123 | return new Object[]{fSpacecraft}; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public NoPotentialLinkToGroundStation.Match toImmutable() { | ||
128 | return isMutable() ? newMatch(fSpacecraft) : this; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public String prettyPrint() { | ||
133 | StringBuilder result = new StringBuilder(); | ||
134 | result.append("\"Spacecraft\"=" + prettyPrintValue(fSpacecraft)); | ||
135 | return result.toString(); | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public int hashCode() { | ||
140 | return Objects.hash(fSpacecraft); | ||
141 | } | ||
142 | |||
143 | @Override | ||
144 | public boolean equals(final Object obj) { | ||
145 | if (this == obj) | ||
146 | return true; | ||
147 | if (obj == null) { | ||
148 | return false; | ||
149 | } | ||
150 | if ((obj instanceof NoPotentialLinkToGroundStation.Match)) { | ||
151 | NoPotentialLinkToGroundStation.Match other = (NoPotentialLinkToGroundStation.Match) obj; | ||
152 | return Objects.equals(fSpacecraft, other.fSpacecraft); | ||
153 | } else { | ||
154 | // this should be infrequent | ||
155 | if (!(obj instanceof IPatternMatch)) { | ||
156 | return false; | ||
157 | } | ||
158 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
159 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | @Override | ||
164 | public NoPotentialLinkToGroundStation specification() { | ||
165 | return NoPotentialLinkToGroundStation.instance(); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * Returns an empty, mutable match. | ||
170 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
171 | * | ||
172 | * @return the empty match. | ||
173 | * | ||
174 | */ | ||
175 | public static NoPotentialLinkToGroundStation.Match newEmptyMatch() { | ||
176 | return new Mutable(null); | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * Returns a mutable (partial) match. | ||
181 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
182 | * | ||
183 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
184 | * @return the new, mutable (partial) match object. | ||
185 | * | ||
186 | */ | ||
187 | public static NoPotentialLinkToGroundStation.Match newMutableMatch(final Spacecraft pSpacecraft) { | ||
188 | return new Mutable(pSpacecraft); | ||
189 | } | ||
190 | |||
191 | /** | ||
192 | * Returns a new (partial) match. | ||
193 | * This can be used e.g. to call the matcher with a partial match. | ||
194 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
195 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
196 | * @return the (partial) match object. | ||
197 | * | ||
198 | */ | ||
199 | public static NoPotentialLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) { | ||
200 | return new Immutable(pSpacecraft); | ||
201 | } | ||
202 | |||
203 | private static final class Mutable extends NoPotentialLinkToGroundStation.Match { | ||
204 | Mutable(final Spacecraft pSpacecraft) { | ||
205 | super(pSpacecraft); | ||
206 | } | ||
207 | |||
208 | @Override | ||
209 | public boolean isMutable() { | ||
210 | return true; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | private static final class Immutable extends NoPotentialLinkToGroundStation.Match { | ||
215 | Immutable(final Spacecraft pSpacecraft) { | ||
216 | super(pSpacecraft); | ||
217 | } | ||
218 | |||
219 | @Override | ||
220 | public boolean isMutable() { | ||
221 | return false; | ||
222 | } | ||
223 | } | ||
224 | } | ||
225 | |||
226 | /** | ||
227 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation pattern, | ||
228 | * providing pattern-specific query methods. | ||
229 | * | ||
230 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
231 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
232 | * | ||
233 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
234 | * | ||
235 | * <p>Original source: | ||
236 | * <code><pre> | ||
237 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, | ||
238 | * message = "Spacecraft has no potential communication path to the ground station.") | ||
239 | * pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { | ||
240 | * ConstellationMission.groundStationNetwork(Mission, GroundStation); | ||
241 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
242 | * neg find indirectLinkAllowed(Spacecraft, GroundStation); | ||
243 | * } | ||
244 | * </pre></code> | ||
245 | * | ||
246 | * @see Match | ||
247 | * @see NoPotentialLinkToGroundStation | ||
248 | * | ||
249 | */ | ||
250 | public static class Matcher extends BaseMatcher<NoPotentialLinkToGroundStation.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 NoPotentialLinkToGroundStation.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 NoPotentialLinkToGroundStation.Matcher create() { | ||
275 | return new Matcher(); | ||
276 | } | ||
277 | |||
278 | private static final int POSITION_SPACECRAFT = 0; | ||
279 | |||
280 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NoPotentialLinkToGroundStation.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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
297 | * @return matches represented as a Match object. | ||
298 | * | ||
299 | */ | ||
300 | public Collection<NoPotentialLinkToGroundStation.Match> getAllMatches(final Spacecraft pSpacecraft) { | ||
301 | return rawStreamAllMatches(new Object[]{pSpacecraft}).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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
311 | * @return a stream of matches represented as a Match object. | ||
312 | * | ||
313 | */ | ||
314 | public Stream<NoPotentialLinkToGroundStation.Match> streamAllMatches(final Spacecraft pSpacecraft) { | ||
315 | return rawStreamAllMatches(new Object[]{pSpacecraft}); | ||
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 pSpacecraft the fixed value of pattern parameter Spacecraft, 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<NoPotentialLinkToGroundStation.Match> getOneArbitraryMatch(final Spacecraft pSpacecraft) { | ||
326 | return rawGetOneArbitraryMatch(new Object[]{pSpacecraft}); | ||
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 pSpacecraft the fixed value of pattern parameter Spacecraft, 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 Spacecraft pSpacecraft) { | ||
337 | return rawHasMatch(new Object[]{pSpacecraft}); | ||
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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
343 | * @return the number of pattern matches found. | ||
344 | * | ||
345 | */ | ||
346 | public int countMatches(final Spacecraft pSpacecraft) { | ||
347 | return rawCountMatches(new Object[]{pSpacecraft}); | ||
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 pSpacecraft the fixed value of pattern parameter Spacecraft, 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 Spacecraft pSpacecraft, final Consumer<? super NoPotentialLinkToGroundStation.Match> processor) { | ||
359 | return rawForOneArbitraryMatch(new Object[]{pSpacecraft}, 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 pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
367 | * @return the (partial) match object. | ||
368 | * | ||
369 | */ | ||
370 | public NoPotentialLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) { | ||
371 | return NoPotentialLinkToGroundStation.Match.newMatch(pSpacecraft); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
376 | * @return the Set of all values or empty set if there are no matches | ||
377 | * | ||
378 | */ | ||
379 | protected Stream<Spacecraft> rawStreamAllValuesOfSpacecraft(final Object[] parameters) { | ||
380 | return rawStreamAllValues(POSITION_SPACECRAFT, parameters).map(Spacecraft.class::cast); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
385 | * @return the Set of all values or empty set if there are no matches | ||
386 | * | ||
387 | */ | ||
388 | public Set<Spacecraft> getAllValuesOfSpacecraft() { | ||
389 | return rawStreamAllValuesOfSpacecraft(emptyArray()).collect(Collectors.toSet()); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
394 | * @return the Set of all values or empty set if there are no matches | ||
395 | * | ||
396 | */ | ||
397 | public Stream<Spacecraft> streamAllValuesOfSpacecraft() { | ||
398 | return rawStreamAllValuesOfSpacecraft(emptyArray()); | ||
399 | } | ||
400 | |||
401 | @Override | ||
402 | protected NoPotentialLinkToGroundStation.Match tupleToMatch(final Tuple t) { | ||
403 | try { | ||
404 | return NoPotentialLinkToGroundStation.Match.newMatch((Spacecraft) t.get(POSITION_SPACECRAFT)); | ||
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 NoPotentialLinkToGroundStation.Match arrayToMatch(final Object[] match) { | ||
413 | try { | ||
414 | return NoPotentialLinkToGroundStation.Match.newMatch((Spacecraft) match[POSITION_SPACECRAFT]); | ||
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 NoPotentialLinkToGroundStation.Match arrayToMatchMutable(final Object[] match) { | ||
423 | try { | ||
424 | return NoPotentialLinkToGroundStation.Match.newMutableMatch((Spacecraft) match[POSITION_SPACECRAFT]); | ||
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<NoPotentialLinkToGroundStation.Matcher> querySpecification() { | ||
437 | return NoPotentialLinkToGroundStation.instance(); | ||
438 | } | ||
439 | } | ||
440 | |||
441 | private NoPotentialLinkToGroundStation() { | ||
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 NoPotentialLinkToGroundStation instance() { | ||
451 | try{ | ||
452 | return LazyHolder.INSTANCE; | ||
453 | } catch (ExceptionInInitializerError err) { | ||
454 | throw processInitializerError(err); | ||
455 | } | ||
456 | } | ||
457 | |||
458 | @Override | ||
459 | protected NoPotentialLinkToGroundStation.Matcher instantiate(final ViatraQueryEngine engine) { | ||
460 | return NoPotentialLinkToGroundStation.Matcher.on(engine); | ||
461 | } | ||
462 | |||
463 | @Override | ||
464 | public NoPotentialLinkToGroundStation.Matcher instantiate() { | ||
465 | return NoPotentialLinkToGroundStation.Matcher.create(); | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | public NoPotentialLinkToGroundStation.Match newEmptyMatch() { | ||
470 | return NoPotentialLinkToGroundStation.Match.newEmptyMatch(); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public NoPotentialLinkToGroundStation.Match newMatch(final Object... parameters) { | ||
475 | return NoPotentialLinkToGroundStation.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0]); | ||
476 | } | ||
477 | |||
478 | /** | ||
479 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation (visibility: PUBLIC, simpleName: NoPotentialLinkToGroundStation, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation, 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.NoPotentialLinkToGroundStation (visibility: PUBLIC, simpleName: NoPotentialLinkToGroundStation, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation, 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 NoPotentialLinkToGroundStation INSTANCE = new NoPotentialLinkToGroundStation(); | ||
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 NoPotentialLinkToGroundStation.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
506 | |||
507 | 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); | ||
508 | |||
509 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft); | ||
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.noPotentialLinkToGroundStation"; | ||
518 | } | ||
519 | |||
520 | @Override | ||
521 | public List<String> getParameterNames() { | ||
522 | return Arrays.asList("Spacecraft"); | ||
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_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
537 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
538 | PVariable var_GroundStation = body.getOrCreateVariableByName("GroundStation"); | ||
539 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
540 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
541 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft) | ||
542 | )); | ||
543 | // ConstellationMission.groundStationNetwork(Mission, GroundStation) | ||
544 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
545 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
546 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "groundStationNetwork"))); | ||
547 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); | ||
548 | new Equality(body, var__virtual_0_, var_GroundStation); | ||
549 | // ConstellationMission.spacecraft(Mission, Spacecraft) | ||
550 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
551 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
552 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); | ||
553 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
554 | new Equality(body, var__virtual_1_, var_Spacecraft); | ||
555 | // neg find indirectLinkAllowed(Spacecraft, GroundStation) | ||
556 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_GroundStation), IndirectLinkAllowed.instance().getInternalQueryRepresentation()); | ||
557 | bodies.add(body); | ||
558 | } | ||
559 | { | ||
560 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
561 | annotation.addAttribute("severity", "error"); | ||
562 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
563 | new ParameterReference("Spacecraft") | ||
564 | })); | ||
565 | annotation.addAttribute("message", "Spacecraft has no potential communication path to the ground station."); | ||
566 | addAnnotation(annotation); | ||
567 | } | ||
568 | return bodies; | ||
569 | } | ||
570 | } | ||
571 | } | ||