diff options
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java | 579 |
1 files changed, 579 insertions, 0 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java new file mode 100644 index 00000000..dde3c20f --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java | |||
@@ -0,0 +1,579 @@ | |||
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.DirectedCommunicationLink; | ||
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.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.EStructuralFeatureInstancesKey; | ||
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.annotations.ParameterReference; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
42 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
43 | |||
44 | /** | ||
45 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
46 | * | ||
47 | * <p>Original source: | ||
48 | * <code><pre> | ||
49 | * {@literal @}Constraint(severity = "error", key = {Link}, | ||
50 | * message = "Communication links must start from the containing element.") | ||
51 | * pattern communicationLinkDoesNotStartAtContainingElement(Link : DirectedCommunicationLink) { | ||
52 | * CommunicatingElement.communicationLink(Element, Link); | ||
53 | * DirectedCommunicationLink.source(Link, SourceComm); | ||
54 | * CommunicatingElement.commSubsystem(SourceElement, SourceComm); | ||
55 | * Element != SourceElement; | ||
56 | * } | ||
57 | * </pre></code> | ||
58 | * | ||
59 | * @see Matcher | ||
60 | * @see Match | ||
61 | * | ||
62 | */ | ||
63 | @SuppressWarnings("all") | ||
64 | public final class CommunicationLinkDoesNotStartAtContainingElement extends BaseGeneratedEMFQuerySpecification<CommunicationLinkDoesNotStartAtContainingElement.Matcher> { | ||
65 | /** | ||
66 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLinkDoesNotStartAtContainingElement 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 DirectedCommunicationLink fLink; | ||
79 | |||
80 | private static List<String> parameterNames = makeImmutableList("Link"); | ||
81 | |||
82 | private Match(final DirectedCommunicationLink pLink) { | ||
83 | this.fLink = pLink; | ||
84 | } | ||
85 | |||
86 | @Override | ||
87 | public Object get(final String parameterName) { | ||
88 | if ("Link".equals(parameterName)) return this.fLink; | ||
89 | return null; | ||
90 | } | ||
91 | |||
92 | public DirectedCommunicationLink getLink() { | ||
93 | return this.fLink; | ||
94 | } | ||
95 | |||
96 | @Override | ||
97 | public boolean set(final String parameterName, final Object newValue) { | ||
98 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
99 | if ("Link".equals(parameterName) ) { | ||
100 | this.fLink = (DirectedCommunicationLink) newValue; | ||
101 | return true; | ||
102 | } | ||
103 | return false; | ||
104 | } | ||
105 | |||
106 | public void setLink(final DirectedCommunicationLink pLink) { | ||
107 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
108 | this.fLink = pLink; | ||
109 | } | ||
110 | |||
111 | @Override | ||
112 | public String patternName() { | ||
113 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLinkDoesNotStartAtContainingElement"; | ||
114 | } | ||
115 | |||
116 | @Override | ||
117 | public List<String> parameterNames() { | ||
118 | return CommunicationLinkDoesNotStartAtContainingElement.Match.parameterNames; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public Object[] toArray() { | ||
123 | return new Object[]{fLink}; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public CommunicationLinkDoesNotStartAtContainingElement.Match toImmutable() { | ||
128 | return isMutable() ? newMatch(fLink) : this; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public String prettyPrint() { | ||
133 | StringBuilder result = new StringBuilder(); | ||
134 | result.append("\"Link\"=" + prettyPrintValue(fLink)); | ||
135 | return result.toString(); | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public int hashCode() { | ||
140 | return Objects.hash(fLink); | ||
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 CommunicationLinkDoesNotStartAtContainingElement.Match)) { | ||
151 | CommunicationLinkDoesNotStartAtContainingElement.Match other = (CommunicationLinkDoesNotStartAtContainingElement.Match) obj; | ||
152 | return Objects.equals(fLink, other.fLink); | ||
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 CommunicationLinkDoesNotStartAtContainingElement specification() { | ||
165 | return CommunicationLinkDoesNotStartAtContainingElement.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 CommunicationLinkDoesNotStartAtContainingElement.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 pLink the fixed value of pattern parameter Link, or null if not bound. | ||
184 | * @return the new, mutable (partial) match object. | ||
185 | * | ||
186 | */ | ||
187 | public static CommunicationLinkDoesNotStartAtContainingElement.Match newMutableMatch(final DirectedCommunicationLink pLink) { | ||
188 | return new Mutable(pLink); | ||
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 pLink the fixed value of pattern parameter Link, or null if not bound. | ||
196 | * @return the (partial) match object. | ||
197 | * | ||
198 | */ | ||
199 | public static CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final DirectedCommunicationLink pLink) { | ||
200 | return new Immutable(pLink); | ||
201 | } | ||
202 | |||
203 | private static final class Mutable extends CommunicationLinkDoesNotStartAtContainingElement.Match { | ||
204 | Mutable(final DirectedCommunicationLink pLink) { | ||
205 | super(pLink); | ||
206 | } | ||
207 | |||
208 | @Override | ||
209 | public boolean isMutable() { | ||
210 | return true; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | private static final class Immutable extends CommunicationLinkDoesNotStartAtContainingElement.Match { | ||
215 | Immutable(final DirectedCommunicationLink pLink) { | ||
216 | super(pLink); | ||
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.communicationLinkDoesNotStartAtContainingElement 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 = {Link}, | ||
238 | * message = "Communication links must start from the containing element.") | ||
239 | * pattern communicationLinkDoesNotStartAtContainingElement(Link : DirectedCommunicationLink) { | ||
240 | * CommunicatingElement.communicationLink(Element, Link); | ||
241 | * DirectedCommunicationLink.source(Link, SourceComm); | ||
242 | * CommunicatingElement.commSubsystem(SourceElement, SourceComm); | ||
243 | * Element != SourceElement; | ||
244 | * } | ||
245 | * </pre></code> | ||
246 | * | ||
247 | * @see Match | ||
248 | * @see CommunicationLinkDoesNotStartAtContainingElement | ||
249 | * | ||
250 | */ | ||
251 | public static class Matcher extends BaseMatcher<CommunicationLinkDoesNotStartAtContainingElement.Match> { | ||
252 | /** | ||
253 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
254 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
255 | * | ||
256 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
257 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
258 | * | ||
259 | */ | ||
260 | public static CommunicationLinkDoesNotStartAtContainingElement.Matcher on(final ViatraQueryEngine engine) { | ||
261 | // check if matcher already exists | ||
262 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
263 | if (matcher == null) { | ||
264 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
265 | } | ||
266 | return matcher; | ||
267 | } | ||
268 | |||
269 | /** | ||
270 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
271 | * @return an initialized matcher | ||
272 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
273 | * | ||
274 | */ | ||
275 | public static CommunicationLinkDoesNotStartAtContainingElement.Matcher create() { | ||
276 | return new Matcher(); | ||
277 | } | ||
278 | |||
279 | private static final int POSITION_LINK = 0; | ||
280 | |||
281 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CommunicationLinkDoesNotStartAtContainingElement.Matcher.class); | ||
282 | |||
283 | /** | ||
284 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
285 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
286 | * | ||
287 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
288 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
289 | * | ||
290 | */ | ||
291 | private Matcher() { | ||
292 | super(querySpecification()); | ||
293 | } | ||
294 | |||
295 | /** | ||
296 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
297 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
298 | * @return matches represented as a Match object. | ||
299 | * | ||
300 | */ | ||
301 | public Collection<CommunicationLinkDoesNotStartAtContainingElement.Match> getAllMatches(final DirectedCommunicationLink pLink) { | ||
302 | return rawStreamAllMatches(new Object[]{pLink}).collect(Collectors.toSet()); | ||
303 | } | ||
304 | |||
305 | /** | ||
306 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
307 | * </p> | ||
308 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
309 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
310 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
311 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
312 | * @return a stream of matches represented as a Match object. | ||
313 | * | ||
314 | */ | ||
315 | public Stream<CommunicationLinkDoesNotStartAtContainingElement.Match> streamAllMatches(final DirectedCommunicationLink pLink) { | ||
316 | return rawStreamAllMatches(new Object[]{pLink}); | ||
317 | } | ||
318 | |||
319 | /** | ||
320 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
321 | * Neither determinism nor randomness of selection is guaranteed. | ||
322 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
323 | * @return a match represented as a Match object, or null if no match is found. | ||
324 | * | ||
325 | */ | ||
326 | public Optional<CommunicationLinkDoesNotStartAtContainingElement.Match> getOneArbitraryMatch(final DirectedCommunicationLink pLink) { | ||
327 | return rawGetOneArbitraryMatch(new Object[]{pLink}); | ||
328 | } | ||
329 | |||
330 | /** | ||
331 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
332 | * under any possible substitution of the unspecified parameters (if any). | ||
333 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
334 | * @return true if the input is a valid (partial) match of the pattern. | ||
335 | * | ||
336 | */ | ||
337 | public boolean hasMatch(final DirectedCommunicationLink pLink) { | ||
338 | return rawHasMatch(new Object[]{pLink}); | ||
339 | } | ||
340 | |||
341 | /** | ||
342 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
343 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
344 | * @return the number of pattern matches found. | ||
345 | * | ||
346 | */ | ||
347 | public int countMatches(final DirectedCommunicationLink pLink) { | ||
348 | return rawCountMatches(new Object[]{pLink}); | ||
349 | } | ||
350 | |||
351 | /** | ||
352 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
353 | * Neither determinism nor randomness of selection is guaranteed. | ||
354 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
355 | * @param processor the action that will process the selected match. | ||
356 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
357 | * | ||
358 | */ | ||
359 | public boolean forOneArbitraryMatch(final DirectedCommunicationLink pLink, final Consumer<? super CommunicationLinkDoesNotStartAtContainingElement.Match> processor) { | ||
360 | return rawForOneArbitraryMatch(new Object[]{pLink}, processor); | ||
361 | } | ||
362 | |||
363 | /** | ||
364 | * Returns a new (partial) match. | ||
365 | * This can be used e.g. to call the matcher with a partial match. | ||
366 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
367 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | ||
368 | * @return the (partial) match object. | ||
369 | * | ||
370 | */ | ||
371 | public CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final DirectedCommunicationLink pLink) { | ||
372 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch(pLink); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * Retrieve the set of values that occur in matches for Link. | ||
377 | * @return the Set of all values or empty set if there are no matches | ||
378 | * | ||
379 | */ | ||
380 | protected Stream<DirectedCommunicationLink> rawStreamAllValuesOfLink(final Object[] parameters) { | ||
381 | return rawStreamAllValues(POSITION_LINK, parameters).map(DirectedCommunicationLink.class::cast); | ||
382 | } | ||
383 | |||
384 | /** | ||
385 | * Retrieve the set of values that occur in matches for Link. | ||
386 | * @return the Set of all values or empty set if there are no matches | ||
387 | * | ||
388 | */ | ||
389 | public Set<DirectedCommunicationLink> getAllValuesOfLink() { | ||
390 | return rawStreamAllValuesOfLink(emptyArray()).collect(Collectors.toSet()); | ||
391 | } | ||
392 | |||
393 | /** | ||
394 | * Retrieve the set of values that occur in matches for Link. | ||
395 | * @return the Set of all values or empty set if there are no matches | ||
396 | * | ||
397 | */ | ||
398 | public Stream<DirectedCommunicationLink> streamAllValuesOfLink() { | ||
399 | return rawStreamAllValuesOfLink(emptyArray()); | ||
400 | } | ||
401 | |||
402 | @Override | ||
403 | protected CommunicationLinkDoesNotStartAtContainingElement.Match tupleToMatch(final Tuple t) { | ||
404 | try { | ||
405 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((DirectedCommunicationLink) t.get(POSITION_LINK)); | ||
406 | } catch(ClassCastException e) { | ||
407 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
408 | return null; | ||
409 | } | ||
410 | } | ||
411 | |||
412 | @Override | ||
413 | protected CommunicationLinkDoesNotStartAtContainingElement.Match arrayToMatch(final Object[] match) { | ||
414 | try { | ||
415 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((DirectedCommunicationLink) match[POSITION_LINK]); | ||
416 | } catch(ClassCastException e) { | ||
417 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
418 | return null; | ||
419 | } | ||
420 | } | ||
421 | |||
422 | @Override | ||
423 | protected CommunicationLinkDoesNotStartAtContainingElement.Match arrayToMatchMutable(final Object[] match) { | ||
424 | try { | ||
425 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMutableMatch((DirectedCommunicationLink) match[POSITION_LINK]); | ||
426 | } catch(ClassCastException e) { | ||
427 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
428 | return null; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | /** | ||
433 | * @return the singleton instance of the query specification of this pattern | ||
434 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
435 | * | ||
436 | */ | ||
437 | public static IQuerySpecification<CommunicationLinkDoesNotStartAtContainingElement.Matcher> querySpecification() { | ||
438 | return CommunicationLinkDoesNotStartAtContainingElement.instance(); | ||
439 | } | ||
440 | } | ||
441 | |||
442 | private CommunicationLinkDoesNotStartAtContainingElement() { | ||
443 | super(GeneratedPQuery.INSTANCE); | ||
444 | } | ||
445 | |||
446 | /** | ||
447 | * @return the singleton instance of the query specification | ||
448 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
449 | * | ||
450 | */ | ||
451 | public static CommunicationLinkDoesNotStartAtContainingElement instance() { | ||
452 | try{ | ||
453 | return LazyHolder.INSTANCE; | ||
454 | } catch (ExceptionInInitializerError err) { | ||
455 | throw processInitializerError(err); | ||
456 | } | ||
457 | } | ||
458 | |||
459 | @Override | ||
460 | protected CommunicationLinkDoesNotStartAtContainingElement.Matcher instantiate(final ViatraQueryEngine engine) { | ||
461 | return CommunicationLinkDoesNotStartAtContainingElement.Matcher.on(engine); | ||
462 | } | ||
463 | |||
464 | @Override | ||
465 | public CommunicationLinkDoesNotStartAtContainingElement.Matcher instantiate() { | ||
466 | return CommunicationLinkDoesNotStartAtContainingElement.Matcher.create(); | ||
467 | } | ||
468 | |||
469 | @Override | ||
470 | public CommunicationLinkDoesNotStartAtContainingElement.Match newEmptyMatch() { | ||
471 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newEmptyMatch(); | ||
472 | } | ||
473 | |||
474 | @Override | ||
475 | public CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final Object... parameters) { | ||
476 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink) parameters[0]); | ||
477 | } | ||
478 | |||
479 | /** | ||
480 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement (visibility: PUBLIC, simpleName: CommunicationLinkDoesNotStartAtContainingElement, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement, 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 | ||
481 | * <b>not</b> at the class load time of the outer class, | ||
482 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement (visibility: PUBLIC, simpleName: CommunicationLinkDoesNotStartAtContainingElement, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
483 | * | ||
484 | * <p> This workaround is required e.g. to support recursion. | ||
485 | * | ||
486 | */ | ||
487 | private static class LazyHolder { | ||
488 | private static final CommunicationLinkDoesNotStartAtContainingElement INSTANCE = new CommunicationLinkDoesNotStartAtContainingElement(); | ||
489 | |||
490 | /** | ||
491 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
492 | * This initialization order is required to support indirect recursion. | ||
493 | * | ||
494 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
495 | * | ||
496 | */ | ||
497 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
498 | |||
499 | public static Object ensureInitialized() { | ||
500 | INSTANCE.ensureInitializedInternal(); | ||
501 | return null; | ||
502 | } | ||
503 | } | ||
504 | |||
505 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
506 | private static final CommunicationLinkDoesNotStartAtContainingElement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
507 | |||
508 | private final PParameter parameter_Link = new PParameter("Link", "hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "DirectedCommunicationLink")), PParameterDirection.INOUT); | ||
509 | |||
510 | private final List<PParameter> parameters = Arrays.asList(parameter_Link); | ||
511 | |||
512 | private GeneratedPQuery() { | ||
513 | super(PVisibility.PUBLIC); | ||
514 | } | ||
515 | |||
516 | @Override | ||
517 | public String getFullyQualifiedName() { | ||
518 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLinkDoesNotStartAtContainingElement"; | ||
519 | } | ||
520 | |||
521 | @Override | ||
522 | public List<String> getParameterNames() { | ||
523 | return Arrays.asList("Link"); | ||
524 | } | ||
525 | |||
526 | @Override | ||
527 | public List<PParameter> getParameters() { | ||
528 | return parameters; | ||
529 | } | ||
530 | |||
531 | @Override | ||
532 | public Set<PBody> doGetContainedBodies() { | ||
533 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
534 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
535 | { | ||
536 | PBody body = new PBody(this); | ||
537 | PVariable var_Link = body.getOrCreateVariableByName("Link"); | ||
538 | PVariable var_Element = body.getOrCreateVariableByName("Element"); | ||
539 | PVariable var_SourceComm = body.getOrCreateVariableByName("SourceComm"); | ||
540 | PVariable var_SourceElement = body.getOrCreateVariableByName("SourceElement"); | ||
541 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
542 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
543 | new ExportedParameter(body, var_Link, parameter_Link) | ||
544 | )); | ||
545 | // CommunicatingElement.communicationLink(Element, Link) | ||
546 | new TypeConstraint(body, Tuples.flatTupleOf(var_Element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
547 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
548 | new TypeConstraint(body, Tuples.flatTupleOf(var_Element, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "communicationLink"))); | ||
549 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
550 | new Equality(body, var__virtual_0_, var_Link); | ||
551 | // DirectedCommunicationLink.source(Link, SourceComm) | ||
552 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
553 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
554 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source"))); | ||
555 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
556 | new Equality(body, var__virtual_1_, var_SourceComm); | ||
557 | // CommunicatingElement.commSubsystem(SourceElement, SourceComm) | ||
558 | new TypeConstraint(body, Tuples.flatTupleOf(var_SourceElement), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
559 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
560 | new TypeConstraint(body, Tuples.flatTupleOf(var_SourceElement, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
561 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
562 | new Equality(body, var__virtual_2_, var_SourceComm); | ||
563 | // Element != SourceElement | ||
564 | new Inequality(body, var_Element, var_SourceElement); | ||
565 | bodies.add(body); | ||
566 | } | ||
567 | { | ||
568 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
569 | annotation.addAttribute("severity", "error"); | ||
570 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
571 | new ParameterReference("Link") | ||
572 | })); | ||
573 | annotation.addAttribute("message", "Communication links must start from the containing element."); | ||
574 | addAnnotation(annotation); | ||
575 | } | ||
576 | return bodies; | ||
577 | } | ||
578 | } | ||
579 | } | ||