aboutsummaryrefslogtreecommitdiffstats
path: root/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java
diff options
context:
space:
mode:
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java')
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java566
1 files changed, 0 insertions, 566 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java
deleted file mode 100644
index af53fc9f..00000000
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java
+++ /dev/null
@@ -1,566 +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 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
41import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
42import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
43import satellite.CommSubsystem;
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 * // Source and target communication systems must be compatible.
51 *
52 * {@literal @}Constraint(severity = "error", key = {SourceSubsystem},
53 * message = "Two ends of a communication link must use the same band.")
54 * pattern incompatibleSourceAndTargetBand(SourceSubsystem : CommSubsystem) {
55 * CommSubsystem.target(SourceSubsystem, TargetSubsystem);
56 * neg find matchingCommSubsystem(SourceSubsystem, TargetSubsystem);
57 * }
58 * </pre></code>
59 *
60 * @see Matcher
61 * @see Match
62 *
63 */
64@SuppressWarnings("all")
65public final class IncompatibleSourceAndTargetBand extends BaseGeneratedEMFQuerySpecification<IncompatibleSourceAndTargetBand.Matcher> {
66 /**
67 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand pattern,
68 * to be used in conjunction with {@link Matcher}.
69 *
70 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
71 * Each instance is a (possibly partial) substitution of pattern parameters,
72 * usable to represent a match of the pattern in the result of a query,
73 * or to specify the bound (fixed) input parameters when issuing a query.
74 *
75 * @see Matcher
76 *
77 */
78 public static abstract class Match extends BasePatternMatch {
79 private CommSubsystem fSourceSubsystem;
80
81 private static List<String> parameterNames = makeImmutableList("SourceSubsystem");
82
83 private Match(final CommSubsystem pSourceSubsystem) {
84 this.fSourceSubsystem = pSourceSubsystem;
85 }
86
87 @Override
88 public Object get(final String parameterName) {
89 if ("SourceSubsystem".equals(parameterName)) return this.fSourceSubsystem;
90 return null;
91 }
92
93 public CommSubsystem getSourceSubsystem() {
94 return this.fSourceSubsystem;
95 }
96
97 @Override
98 public boolean set(final String parameterName, final Object newValue) {
99 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
100 if ("SourceSubsystem".equals(parameterName) ) {
101 this.fSourceSubsystem = (CommSubsystem) newValue;
102 return true;
103 }
104 return false;
105 }
106
107 public void setSourceSubsystem(final CommSubsystem pSourceSubsystem) {
108 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
109 this.fSourceSubsystem = pSourceSubsystem;
110 }
111
112 @Override
113 public String patternName() {
114 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand";
115 }
116
117 @Override
118 public List<String> parameterNames() {
119 return IncompatibleSourceAndTargetBand.Match.parameterNames;
120 }
121
122 @Override
123 public Object[] toArray() {
124 return new Object[]{fSourceSubsystem};
125 }
126
127 @Override
128 public IncompatibleSourceAndTargetBand.Match toImmutable() {
129 return isMutable() ? newMatch(fSourceSubsystem) : this;
130 }
131
132 @Override
133 public String prettyPrint() {
134 StringBuilder result = new StringBuilder();
135 result.append("\"SourceSubsystem\"=" + prettyPrintValue(fSourceSubsystem));
136 return result.toString();
137 }
138
139 @Override
140 public int hashCode() {
141 return Objects.hash(fSourceSubsystem);
142 }
143
144 @Override
145 public boolean equals(final Object obj) {
146 if (this == obj)
147 return true;
148 if (obj == null) {
149 return false;
150 }
151 if ((obj instanceof IncompatibleSourceAndTargetBand.Match)) {
152 IncompatibleSourceAndTargetBand.Match other = (IncompatibleSourceAndTargetBand.Match) obj;
153 return Objects.equals(fSourceSubsystem, other.fSourceSubsystem);
154 } else {
155 // this should be infrequent
156 if (!(obj instanceof IPatternMatch)) {
157 return false;
158 }
159 IPatternMatch otherSig = (IPatternMatch) obj;
160 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
161 }
162 }
163
164 @Override
165 public IncompatibleSourceAndTargetBand specification() {
166 return IncompatibleSourceAndTargetBand.instance();
167 }
168
169 /**
170 * Returns an empty, mutable match.
171 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
172 *
173 * @return the empty match.
174 *
175 */
176 public static IncompatibleSourceAndTargetBand.Match newEmptyMatch() {
177 return new Mutable(null);
178 }
179
180 /**
181 * Returns a mutable (partial) match.
182 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
183 *
184 * @param pSourceSubsystem the fixed value of pattern parameter SourceSubsystem, or null if not bound.
185 * @return the new, mutable (partial) match object.
186 *
187 */
188 public static IncompatibleSourceAndTargetBand.Match newMutableMatch(final CommSubsystem pSourceSubsystem) {
189 return new Mutable(pSourceSubsystem);
190 }
191
192 /**
193 * Returns a new (partial) match.
194 * This can be used e.g. to call the matcher with a partial match.
195 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
196 * @param pSourceSubsystem the fixed value of pattern parameter SourceSubsystem, or null if not bound.
197 * @return the (partial) match object.
198 *
199 */
200 public static IncompatibleSourceAndTargetBand.Match newMatch(final CommSubsystem pSourceSubsystem) {
201 return new Immutable(pSourceSubsystem);
202 }
203
204 private static final class Mutable extends IncompatibleSourceAndTargetBand.Match {
205 Mutable(final CommSubsystem pSourceSubsystem) {
206 super(pSourceSubsystem);
207 }
208
209 @Override
210 public boolean isMutable() {
211 return true;
212 }
213 }
214
215 private static final class Immutable extends IncompatibleSourceAndTargetBand.Match {
216 Immutable(final CommSubsystem pSourceSubsystem) {
217 super(pSourceSubsystem);
218 }
219
220 @Override
221 public boolean isMutable() {
222 return false;
223 }
224 }
225 }
226
227 /**
228 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand pattern,
229 * providing pattern-specific query methods.
230 *
231 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
232 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
233 *
234 * <p>Matches of the pattern will be represented as {@link Match}.
235 *
236 * <p>Original source:
237 * <code><pre>
238 * // Source and target communication systems must be compatible.
239 *
240 * {@literal @}Constraint(severity = "error", key = {SourceSubsystem},
241 * message = "Two ends of a communication link must use the same band.")
242 * pattern incompatibleSourceAndTargetBand(SourceSubsystem : CommSubsystem) {
243 * CommSubsystem.target(SourceSubsystem, TargetSubsystem);
244 * neg find matchingCommSubsystem(SourceSubsystem, TargetSubsystem);
245 * }
246 * </pre></code>
247 *
248 * @see Match
249 * @see IncompatibleSourceAndTargetBand
250 *
251 */
252 public static class Matcher extends BaseMatcher<IncompatibleSourceAndTargetBand.Match> {
253 /**
254 * Initializes the pattern matcher within an existing VIATRA Query engine.
255 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
256 *
257 * @param engine the existing VIATRA Query engine in which this matcher will be created.
258 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
259 *
260 */
261 public static IncompatibleSourceAndTargetBand.Matcher on(final ViatraQueryEngine engine) {
262 // check if matcher already exists
263 Matcher matcher = engine.getExistingMatcher(querySpecification());
264 if (matcher == null) {
265 matcher = (Matcher)engine.getMatcher(querySpecification());
266 }
267 return matcher;
268 }
269
270 /**
271 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
272 * @return an initialized matcher
273 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
274 *
275 */
276 public static IncompatibleSourceAndTargetBand.Matcher create() {
277 return new Matcher();
278 }
279
280 private static final int POSITION_SOURCESUBSYSTEM = 0;
281
282 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(IncompatibleSourceAndTargetBand.Matcher.class);
283
284 /**
285 * Initializes the pattern matcher within an existing VIATRA Query engine.
286 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
287 *
288 * @param engine the existing VIATRA Query engine in which this matcher will be created.
289 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
290 *
291 */
292 private Matcher() {
293 super(querySpecification());
294 }
295
296 /**
297 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
298 * @param pSourceSubsystem the fixed value of pattern parameter SourceSubsystem, or null if not bound.
299 * @return matches represented as a Match object.
300 *
301 */
302 public Collection<IncompatibleSourceAndTargetBand.Match> getAllMatches(final CommSubsystem pSourceSubsystem) {
303 return rawStreamAllMatches(new Object[]{pSourceSubsystem}).collect(Collectors.toSet());
304 }
305
306 /**
307 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
308 * </p>
309 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
310 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
311 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
312 * @param pSourceSubsystem the fixed value of pattern parameter SourceSubsystem, or null if not bound.
313 * @return a stream of matches represented as a Match object.
314 *
315 */
316 public Stream<IncompatibleSourceAndTargetBand.Match> streamAllMatches(final CommSubsystem pSourceSubsystem) {
317 return rawStreamAllMatches(new Object[]{pSourceSubsystem});
318 }
319
320 /**
321 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
322 * Neither determinism nor randomness of selection is guaranteed.
323 * @param pSourceSubsystem the fixed value of pattern parameter SourceSubsystem, or null if not bound.
324 * @return a match represented as a Match object, or null if no match is found.
325 *
326 */
327 public Optional<IncompatibleSourceAndTargetBand.Match> getOneArbitraryMatch(final CommSubsystem pSourceSubsystem) {
328 return rawGetOneArbitraryMatch(new Object[]{pSourceSubsystem});
329 }
330
331 /**
332 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
333 * under any possible substitution of the unspecified parameters (if any).
334 * @param pSourceSubsystem the fixed value of pattern parameter SourceSubsystem, or null if not bound.
335 * @return true if the input is a valid (partial) match of the pattern.
336 *
337 */
338 public boolean hasMatch(final CommSubsystem pSourceSubsystem) {
339 return rawHasMatch(new Object[]{pSourceSubsystem});
340 }
341
342 /**
343 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
344 * @param pSourceSubsystem the fixed value of pattern parameter SourceSubsystem, or null if not bound.
345 * @return the number of pattern matches found.
346 *
347 */
348 public int countMatches(final CommSubsystem pSourceSubsystem) {
349 return rawCountMatches(new Object[]{pSourceSubsystem});
350 }
351
352 /**
353 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
354 * Neither determinism nor randomness of selection is guaranteed.
355 * @param pSourceSubsystem the fixed value of pattern parameter SourceSubsystem, or null if not bound.
356 * @param processor the action that will process the selected match.
357 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
358 *
359 */
360 public boolean forOneArbitraryMatch(final CommSubsystem pSourceSubsystem, final Consumer<? super IncompatibleSourceAndTargetBand.Match> processor) {
361 return rawForOneArbitraryMatch(new Object[]{pSourceSubsystem}, processor);
362 }
363
364 /**
365 * Returns a new (partial) match.
366 * This can be used e.g. to call the matcher with a partial match.
367 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
368 * @param pSourceSubsystem the fixed value of pattern parameter SourceSubsystem, or null if not bound.
369 * @return the (partial) match object.
370 *
371 */
372 public IncompatibleSourceAndTargetBand.Match newMatch(final CommSubsystem pSourceSubsystem) {
373 return IncompatibleSourceAndTargetBand.Match.newMatch(pSourceSubsystem);
374 }
375
376 /**
377 * Retrieve the set of values that occur in matches for SourceSubsystem.
378 * @return the Set of all values or empty set if there are no matches
379 *
380 */
381 protected Stream<CommSubsystem> rawStreamAllValuesOfSourceSubsystem(final Object[] parameters) {
382 return rawStreamAllValues(POSITION_SOURCESUBSYSTEM, parameters).map(CommSubsystem.class::cast);
383 }
384
385 /**
386 * Retrieve the set of values that occur in matches for SourceSubsystem.
387 * @return the Set of all values or empty set if there are no matches
388 *
389 */
390 public Set<CommSubsystem> getAllValuesOfSourceSubsystem() {
391 return rawStreamAllValuesOfSourceSubsystem(emptyArray()).collect(Collectors.toSet());
392 }
393
394 /**
395 * Retrieve the set of values that occur in matches for SourceSubsystem.
396 * @return the Set of all values or empty set if there are no matches
397 *
398 */
399 public Stream<CommSubsystem> streamAllValuesOfSourceSubsystem() {
400 return rawStreamAllValuesOfSourceSubsystem(emptyArray());
401 }
402
403 @Override
404 protected IncompatibleSourceAndTargetBand.Match tupleToMatch(final Tuple t) {
405 try {
406 return IncompatibleSourceAndTargetBand.Match.newMatch((CommSubsystem) t.get(POSITION_SOURCESUBSYSTEM));
407 } catch(ClassCastException e) {
408 LOGGER.error("Element(s) in tuple not properly typed!",e);
409 return null;
410 }
411 }
412
413 @Override
414 protected IncompatibleSourceAndTargetBand.Match arrayToMatch(final Object[] match) {
415 try {
416 return IncompatibleSourceAndTargetBand.Match.newMatch((CommSubsystem) match[POSITION_SOURCESUBSYSTEM]);
417 } catch(ClassCastException e) {
418 LOGGER.error("Element(s) in array not properly typed!",e);
419 return null;
420 }
421 }
422
423 @Override
424 protected IncompatibleSourceAndTargetBand.Match arrayToMatchMutable(final Object[] match) {
425 try {
426 return IncompatibleSourceAndTargetBand.Match.newMutableMatch((CommSubsystem) match[POSITION_SOURCESUBSYSTEM]);
427 } catch(ClassCastException e) {
428 LOGGER.error("Element(s) in array not properly typed!",e);
429 return null;
430 }
431 }
432
433 /**
434 * @return the singleton instance of the query specification of this pattern
435 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
436 *
437 */
438 public static IQuerySpecification<IncompatibleSourceAndTargetBand.Matcher> querySpecification() {
439 return IncompatibleSourceAndTargetBand.instance();
440 }
441 }
442
443 private IncompatibleSourceAndTargetBand() {
444 super(GeneratedPQuery.INSTANCE);
445 }
446
447 /**
448 * @return the singleton instance of the query specification
449 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
450 *
451 */
452 public static IncompatibleSourceAndTargetBand instance() {
453 try{
454 return LazyHolder.INSTANCE;
455 } catch (ExceptionInInitializerError err) {
456 throw processInitializerError(err);
457 }
458 }
459
460 @Override
461 protected IncompatibleSourceAndTargetBand.Matcher instantiate(final ViatraQueryEngine engine) {
462 return IncompatibleSourceAndTargetBand.Matcher.on(engine);
463 }
464
465 @Override
466 public IncompatibleSourceAndTargetBand.Matcher instantiate() {
467 return IncompatibleSourceAndTargetBand.Matcher.create();
468 }
469
470 @Override
471 public IncompatibleSourceAndTargetBand.Match newEmptyMatch() {
472 return IncompatibleSourceAndTargetBand.Match.newEmptyMatch();
473 }
474
475 @Override
476 public IncompatibleSourceAndTargetBand.Match newMatch(final Object... parameters) {
477 return IncompatibleSourceAndTargetBand.Match.newMatch((satellite.CommSubsystem) parameters[0]);
478 }
479
480 /**
481 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand (visibility: PUBLIC, simpleName: IncompatibleSourceAndTargetBand, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand, 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
482 * <b>not</b> at the class load time of the outer class,
483 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand (visibility: PUBLIC, simpleName: IncompatibleSourceAndTargetBand, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
484 *
485 * <p> This workaround is required e.g. to support recursion.
486 *
487 */
488 private static class LazyHolder {
489 private static final IncompatibleSourceAndTargetBand INSTANCE = new IncompatibleSourceAndTargetBand();
490
491 /**
492 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
493 * This initialization order is required to support indirect recursion.
494 *
495 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
496 *
497 */
498 private static final Object STATIC_INITIALIZER = ensureInitialized();
499
500 public static Object ensureInitialized() {
501 INSTANCE.ensureInitializedInternal();
502 return null;
503 }
504 }
505
506 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
507 private static final IncompatibleSourceAndTargetBand.GeneratedPQuery INSTANCE = new GeneratedPQuery();
508
509 private final PParameter parameter_SourceSubsystem = new PParameter("SourceSubsystem", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
510
511 private final List<PParameter> parameters = Arrays.asList(parameter_SourceSubsystem);
512
513 private GeneratedPQuery() {
514 super(PVisibility.PUBLIC);
515 }
516
517 @Override
518 public String getFullyQualifiedName() {
519 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand";
520 }
521
522 @Override
523 public List<String> getParameterNames() {
524 return Arrays.asList("SourceSubsystem");
525 }
526
527 @Override
528 public List<PParameter> getParameters() {
529 return parameters;
530 }
531
532 @Override
533 public Set<PBody> doGetContainedBodies() {
534 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
535 Set<PBody> bodies = new LinkedHashSet<>();
536 {
537 PBody body = new PBody(this);
538 PVariable var_SourceSubsystem = body.getOrCreateVariableByName("SourceSubsystem");
539 PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem");
540 new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
541 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
542 new ExportedParameter(body, var_SourceSubsystem, parameter_SourceSubsystem)
543 ));
544 // CommSubsystem.target(SourceSubsystem, TargetSubsystem)
545 new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
546 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
547 new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "target")));
548 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
549 new Equality(body, var__virtual_0_, var_TargetSubsystem);
550 // neg find matchingCommSubsystem(SourceSubsystem, TargetSubsystem)
551 new NegativePatternCall(body, Tuples.flatTupleOf(var_SourceSubsystem, var_TargetSubsystem), MatchingCommSubsystem.instance().getInternalQueryRepresentation());
552 bodies.add(body);
553 }
554 {
555 PAnnotation annotation = new PAnnotation("Constraint");
556 annotation.addAttribute("severity", "error");
557 annotation.addAttribute("key", Arrays.asList(new Object[] {
558 new ParameterReference("SourceSubsystem")
559 }));
560 annotation.addAttribute("message", "Two ends of a communication link must use the same band.");
561 addAnnotation(annotation);
562 }
563 return bodies;
564 }
565 }
566}