diff options
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/UhfAntennaGainNotLow.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/UhfAntennaGainNotLow.java | 576 |
1 files changed, 0 insertions, 576 deletions
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 | } | ||