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