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