diff options
author | Kristóf Marussy <kris7topher@gmail.com> | 2019-06-09 14:45:02 -0400 |
---|---|---|
committer | Kristóf Marussy <kris7topher@gmail.com> | 2019-06-09 14:45:02 -0400 |
commit | 555987a459702674da350fa1fd5f76ffe14cd7c0 (patch) | |
tree | c64f2af9d655eb94b1a13d8c22f67bbf34435e0f /Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java | |
parent | Trying to simplify Satellite case study (diff) | |
download | VIATRA-Generator-555987a459702674da350fa1fd5f76ffe14cd7c0.tar.gz VIATRA-Generator-555987a459702674da350fa1fd5f76ffe14cd7c0.tar.zst VIATRA-Generator-555987a459702674da350fa1fd5f76ffe14cd7c0.zip |
Simplify satellite metamodel further
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 | 199 |
1 files changed, 91 insertions, 108 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 index 8d27a262..a23cb415 100644 --- 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 | |||
@@ -3,6 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | 4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; |
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmittingCommSubsystem; | ||
6 | import java.util.Arrays; | 7 | import java.util.Arrays; |
7 | import java.util.Collection; | 8 | import java.util.Collection; |
8 | import java.util.LinkedHashSet; | 9 | import java.util.LinkedHashSet; |
@@ -23,15 +24,14 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificat | |||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | 24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; |
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | 25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; |
25 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | 26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
26 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 27 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | 29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; |
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | 30 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; |
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | 31 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; |
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; | 33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; |
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
@@ -39,20 +39,19 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | |||
39 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | 39 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; |
40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | 40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; |
41 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | 41 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; |
42 | import satellite.DirectedCommunicationLink; | 42 | import satellite.CommunicatingElement; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | 45 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. |
46 | * | 46 | * |
47 | * <p>Original source: | 47 | * <p>Original source: |
48 | * <code><pre> | 48 | * <code><pre> |
49 | * {@literal @}Constraint(severity = "error", key = {Link}, | 49 | * {@literal @}Constraint(severity = "error", key = {Element}, |
50 | * message = "Communication links must start from the containing element.") | 50 | * message = "A communicating element may not have two transmitting communication subsystems..") |
51 | * pattern communicationLinkDoesNotStartAtContainingElement(Link : DirectedCommunicationLink) { | 51 | * pattern communicationLinkDoesNotStartAtContainingElement(Element : CommunicatingElement) { |
52 | * CommunicatingElement.communicationLink(Element, Link); | 52 | * find transmittingCommSubsystem(Element, Comm1); |
53 | * DirectedCommunicationLink.source(Link, SourceComm); | 53 | * find transmittingCommSubsystem(Element, Comm2); |
54 | * CommunicatingElement.commSubsystem(SourceElement, SourceComm); | 54 | * Comm1 != Comm2; |
55 | * Element != SourceElement; | ||
56 | * } | 55 | * } |
57 | * </pre></code> | 56 | * </pre></code> |
58 | * | 57 | * |
@@ -75,37 +74,37 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
75 | * | 74 | * |
76 | */ | 75 | */ |
77 | public static abstract class Match extends BasePatternMatch { | 76 | public static abstract class Match extends BasePatternMatch { |
78 | private DirectedCommunicationLink fLink; | 77 | private CommunicatingElement fElement; |
79 | 78 | ||
80 | private static List<String> parameterNames = makeImmutableList("Link"); | 79 | private static List<String> parameterNames = makeImmutableList("Element"); |
81 | 80 | ||
82 | private Match(final DirectedCommunicationLink pLink) { | 81 | private Match(final CommunicatingElement pElement) { |
83 | this.fLink = pLink; | 82 | this.fElement = pElement; |
84 | } | 83 | } |
85 | 84 | ||
86 | @Override | 85 | @Override |
87 | public Object get(final String parameterName) { | 86 | public Object get(final String parameterName) { |
88 | if ("Link".equals(parameterName)) return this.fLink; | 87 | if ("Element".equals(parameterName)) return this.fElement; |
89 | return null; | 88 | return null; |
90 | } | 89 | } |
91 | 90 | ||
92 | public DirectedCommunicationLink getLink() { | 91 | public CommunicatingElement getElement() { |
93 | return this.fLink; | 92 | return this.fElement; |
94 | } | 93 | } |
95 | 94 | ||
96 | @Override | 95 | @Override |
97 | public boolean set(final String parameterName, final Object newValue) { | 96 | public boolean set(final String parameterName, final Object newValue) { |
98 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 97 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
99 | if ("Link".equals(parameterName) ) { | 98 | if ("Element".equals(parameterName) ) { |
100 | this.fLink = (DirectedCommunicationLink) newValue; | 99 | this.fElement = (CommunicatingElement) newValue; |
101 | return true; | 100 | return true; |
102 | } | 101 | } |
103 | return false; | 102 | return false; |
104 | } | 103 | } |
105 | 104 | ||
106 | public void setLink(final DirectedCommunicationLink pLink) { | 105 | public void setElement(final CommunicatingElement pElement) { |
107 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 106 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
108 | this.fLink = pLink; | 107 | this.fElement = pElement; |
109 | } | 108 | } |
110 | 109 | ||
111 | @Override | 110 | @Override |
@@ -120,24 +119,24 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
120 | 119 | ||
121 | @Override | 120 | @Override |
122 | public Object[] toArray() { | 121 | public Object[] toArray() { |
123 | return new Object[]{fLink}; | 122 | return new Object[]{fElement}; |
124 | } | 123 | } |
125 | 124 | ||
126 | @Override | 125 | @Override |
127 | public CommunicationLinkDoesNotStartAtContainingElement.Match toImmutable() { | 126 | public CommunicationLinkDoesNotStartAtContainingElement.Match toImmutable() { |
128 | return isMutable() ? newMatch(fLink) : this; | 127 | return isMutable() ? newMatch(fElement) : this; |
129 | } | 128 | } |
130 | 129 | ||
131 | @Override | 130 | @Override |
132 | public String prettyPrint() { | 131 | public String prettyPrint() { |
133 | StringBuilder result = new StringBuilder(); | 132 | StringBuilder result = new StringBuilder(); |
134 | result.append("\"Link\"=" + prettyPrintValue(fLink)); | 133 | result.append("\"Element\"=" + prettyPrintValue(fElement)); |
135 | return result.toString(); | 134 | return result.toString(); |
136 | } | 135 | } |
137 | 136 | ||
138 | @Override | 137 | @Override |
139 | public int hashCode() { | 138 | public int hashCode() { |
140 | return Objects.hash(fLink); | 139 | return Objects.hash(fElement); |
141 | } | 140 | } |
142 | 141 | ||
143 | @Override | 142 | @Override |
@@ -149,7 +148,7 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
149 | } | 148 | } |
150 | if ((obj instanceof CommunicationLinkDoesNotStartAtContainingElement.Match)) { | 149 | if ((obj instanceof CommunicationLinkDoesNotStartAtContainingElement.Match)) { |
151 | CommunicationLinkDoesNotStartAtContainingElement.Match other = (CommunicationLinkDoesNotStartAtContainingElement.Match) obj; | 150 | CommunicationLinkDoesNotStartAtContainingElement.Match other = (CommunicationLinkDoesNotStartAtContainingElement.Match) obj; |
152 | return Objects.equals(fLink, other.fLink); | 151 | return Objects.equals(fElement, other.fElement); |
153 | } else { | 152 | } else { |
154 | // this should be infrequent | 153 | // this should be infrequent |
155 | if (!(obj instanceof IPatternMatch)) { | 154 | if (!(obj instanceof IPatternMatch)) { |
@@ -180,29 +179,29 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
180 | * Returns a mutable (partial) match. | 179 | * Returns a mutable (partial) match. |
181 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | 180 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. |
182 | * | 181 | * |
183 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | 182 | * @param pElement the fixed value of pattern parameter Element, or null if not bound. |
184 | * @return the new, mutable (partial) match object. | 183 | * @return the new, mutable (partial) match object. |
185 | * | 184 | * |
186 | */ | 185 | */ |
187 | public static CommunicationLinkDoesNotStartAtContainingElement.Match newMutableMatch(final DirectedCommunicationLink pLink) { | 186 | public static CommunicationLinkDoesNotStartAtContainingElement.Match newMutableMatch(final CommunicatingElement pElement) { |
188 | return new Mutable(pLink); | 187 | return new Mutable(pElement); |
189 | } | 188 | } |
190 | 189 | ||
191 | /** | 190 | /** |
192 | * Returns a new (partial) match. | 191 | * Returns a new (partial) match. |
193 | * This can be used e.g. to call the matcher with a partial match. | 192 | * 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. | 193 | * <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. | 194 | * @param pElement the fixed value of pattern parameter Element, or null if not bound. |
196 | * @return the (partial) match object. | 195 | * @return the (partial) match object. |
197 | * | 196 | * |
198 | */ | 197 | */ |
199 | public static CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final DirectedCommunicationLink pLink) { | 198 | public static CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final CommunicatingElement pElement) { |
200 | return new Immutable(pLink); | 199 | return new Immutable(pElement); |
201 | } | 200 | } |
202 | 201 | ||
203 | private static final class Mutable extends CommunicationLinkDoesNotStartAtContainingElement.Match { | 202 | private static final class Mutable extends CommunicationLinkDoesNotStartAtContainingElement.Match { |
204 | Mutable(final DirectedCommunicationLink pLink) { | 203 | Mutable(final CommunicatingElement pElement) { |
205 | super(pLink); | 204 | super(pElement); |
206 | } | 205 | } |
207 | 206 | ||
208 | @Override | 207 | @Override |
@@ -212,8 +211,8 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
212 | } | 211 | } |
213 | 212 | ||
214 | private static final class Immutable extends CommunicationLinkDoesNotStartAtContainingElement.Match { | 213 | private static final class Immutable extends CommunicationLinkDoesNotStartAtContainingElement.Match { |
215 | Immutable(final DirectedCommunicationLink pLink) { | 214 | Immutable(final CommunicatingElement pElement) { |
216 | super(pLink); | 215 | super(pElement); |
217 | } | 216 | } |
218 | 217 | ||
219 | @Override | 218 | @Override |
@@ -234,13 +233,12 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
234 | * | 233 | * |
235 | * <p>Original source: | 234 | * <p>Original source: |
236 | * <code><pre> | 235 | * <code><pre> |
237 | * {@literal @}Constraint(severity = "error", key = {Link}, | 236 | * {@literal @}Constraint(severity = "error", key = {Element}, |
238 | * message = "Communication links must start from the containing element.") | 237 | * message = "A communicating element may not have two transmitting communication subsystems..") |
239 | * pattern communicationLinkDoesNotStartAtContainingElement(Link : DirectedCommunicationLink) { | 238 | * pattern communicationLinkDoesNotStartAtContainingElement(Element : CommunicatingElement) { |
240 | * CommunicatingElement.communicationLink(Element, Link); | 239 | * find transmittingCommSubsystem(Element, Comm1); |
241 | * DirectedCommunicationLink.source(Link, SourceComm); | 240 | * find transmittingCommSubsystem(Element, Comm2); |
242 | * CommunicatingElement.commSubsystem(SourceElement, SourceComm); | 241 | * Comm1 != Comm2; |
243 | * Element != SourceElement; | ||
244 | * } | 242 | * } |
245 | * </pre></code> | 243 | * </pre></code> |
246 | * | 244 | * |
@@ -276,7 +274,7 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
276 | return new Matcher(); | 274 | return new Matcher(); |
277 | } | 275 | } |
278 | 276 | ||
279 | private static final int POSITION_LINK = 0; | 277 | private static final int POSITION_ELEMENT = 0; |
280 | 278 | ||
281 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CommunicationLinkDoesNotStartAtContainingElement.Matcher.class); | 279 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CommunicationLinkDoesNotStartAtContainingElement.Matcher.class); |
282 | 280 | ||
@@ -294,12 +292,12 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
294 | 292 | ||
295 | /** | 293 | /** |
296 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | 294 | * 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. | 295 | * @param pElement the fixed value of pattern parameter Element, or null if not bound. |
298 | * @return matches represented as a Match object. | 296 | * @return matches represented as a Match object. |
299 | * | 297 | * |
300 | */ | 298 | */ |
301 | public Collection<CommunicationLinkDoesNotStartAtContainingElement.Match> getAllMatches(final DirectedCommunicationLink pLink) { | 299 | public Collection<CommunicationLinkDoesNotStartAtContainingElement.Match> getAllMatches(final CommunicatingElement pElement) { |
302 | return rawStreamAllMatches(new Object[]{pLink}).collect(Collectors.toSet()); | 300 | return rawStreamAllMatches(new Object[]{pElement}).collect(Collectors.toSet()); |
303 | } | 301 | } |
304 | 302 | ||
305 | /** | 303 | /** |
@@ -308,101 +306,101 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
308 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | 306 | * <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>. | 307 | * 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. | 308 | * 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. | 309 | * @param pElement the fixed value of pattern parameter Element, or null if not bound. |
312 | * @return a stream of matches represented as a Match object. | 310 | * @return a stream of matches represented as a Match object. |
313 | * | 311 | * |
314 | */ | 312 | */ |
315 | public Stream<CommunicationLinkDoesNotStartAtContainingElement.Match> streamAllMatches(final DirectedCommunicationLink pLink) { | 313 | public Stream<CommunicationLinkDoesNotStartAtContainingElement.Match> streamAllMatches(final CommunicatingElement pElement) { |
316 | return rawStreamAllMatches(new Object[]{pLink}); | 314 | return rawStreamAllMatches(new Object[]{pElement}); |
317 | } | 315 | } |
318 | 316 | ||
319 | /** | 317 | /** |
320 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | 318 | * 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. | 319 | * Neither determinism nor randomness of selection is guaranteed. |
322 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | 320 | * @param pElement the fixed value of pattern parameter Element, or null if not bound. |
323 | * @return a match represented as a Match object, or null if no match is found. | 321 | * @return a match represented as a Match object, or null if no match is found. |
324 | * | 322 | * |
325 | */ | 323 | */ |
326 | public Optional<CommunicationLinkDoesNotStartAtContainingElement.Match> getOneArbitraryMatch(final DirectedCommunicationLink pLink) { | 324 | public Optional<CommunicationLinkDoesNotStartAtContainingElement.Match> getOneArbitraryMatch(final CommunicatingElement pElement) { |
327 | return rawGetOneArbitraryMatch(new Object[]{pLink}); | 325 | return rawGetOneArbitraryMatch(new Object[]{pElement}); |
328 | } | 326 | } |
329 | 327 | ||
330 | /** | 328 | /** |
331 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | 329 | * 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). | 330 | * 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. | 331 | * @param pElement the fixed value of pattern parameter Element, or null if not bound. |
334 | * @return true if the input is a valid (partial) match of the pattern. | 332 | * @return true if the input is a valid (partial) match of the pattern. |
335 | * | 333 | * |
336 | */ | 334 | */ |
337 | public boolean hasMatch(final DirectedCommunicationLink pLink) { | 335 | public boolean hasMatch(final CommunicatingElement pElement) { |
338 | return rawHasMatch(new Object[]{pLink}); | 336 | return rawHasMatch(new Object[]{pElement}); |
339 | } | 337 | } |
340 | 338 | ||
341 | /** | 339 | /** |
342 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | 340 | * 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. | 341 | * @param pElement the fixed value of pattern parameter Element, or null if not bound. |
344 | * @return the number of pattern matches found. | 342 | * @return the number of pattern matches found. |
345 | * | 343 | * |
346 | */ | 344 | */ |
347 | public int countMatches(final DirectedCommunicationLink pLink) { | 345 | public int countMatches(final CommunicatingElement pElement) { |
348 | return rawCountMatches(new Object[]{pLink}); | 346 | return rawCountMatches(new Object[]{pElement}); |
349 | } | 347 | } |
350 | 348 | ||
351 | /** | 349 | /** |
352 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | 350 | * 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. | 351 | * Neither determinism nor randomness of selection is guaranteed. |
354 | * @param pLink the fixed value of pattern parameter Link, or null if not bound. | 352 | * @param pElement the fixed value of pattern parameter Element, or null if not bound. |
355 | * @param processor the action that will process the selected match. | 353 | * @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 | 354 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked |
357 | * | 355 | * |
358 | */ | 356 | */ |
359 | public boolean forOneArbitraryMatch(final DirectedCommunicationLink pLink, final Consumer<? super CommunicationLinkDoesNotStartAtContainingElement.Match> processor) { | 357 | public boolean forOneArbitraryMatch(final CommunicatingElement pElement, final Consumer<? super CommunicationLinkDoesNotStartAtContainingElement.Match> processor) { |
360 | return rawForOneArbitraryMatch(new Object[]{pLink}, processor); | 358 | return rawForOneArbitraryMatch(new Object[]{pElement}, processor); |
361 | } | 359 | } |
362 | 360 | ||
363 | /** | 361 | /** |
364 | * Returns a new (partial) match. | 362 | * Returns a new (partial) match. |
365 | * This can be used e.g. to call the matcher with a partial match. | 363 | * 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. | 364 | * <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. | 365 | * @param pElement the fixed value of pattern parameter Element, or null if not bound. |
368 | * @return the (partial) match object. | 366 | * @return the (partial) match object. |
369 | * | 367 | * |
370 | */ | 368 | */ |
371 | public CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final DirectedCommunicationLink pLink) { | 369 | public CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final CommunicatingElement pElement) { |
372 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch(pLink); | 370 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch(pElement); |
373 | } | 371 | } |
374 | 372 | ||
375 | /** | 373 | /** |
376 | * Retrieve the set of values that occur in matches for Link. | 374 | * Retrieve the set of values that occur in matches for Element. |
377 | * @return the Set of all values or empty set if there are no matches | 375 | * @return the Set of all values or empty set if there are no matches |
378 | * | 376 | * |
379 | */ | 377 | */ |
380 | protected Stream<DirectedCommunicationLink> rawStreamAllValuesOfLink(final Object[] parameters) { | 378 | protected Stream<CommunicatingElement> rawStreamAllValuesOfElement(final Object[] parameters) { |
381 | return rawStreamAllValues(POSITION_LINK, parameters).map(DirectedCommunicationLink.class::cast); | 379 | return rawStreamAllValues(POSITION_ELEMENT, parameters).map(CommunicatingElement.class::cast); |
382 | } | 380 | } |
383 | 381 | ||
384 | /** | 382 | /** |
385 | * Retrieve the set of values that occur in matches for Link. | 383 | * Retrieve the set of values that occur in matches for Element. |
386 | * @return the Set of all values or empty set if there are no matches | 384 | * @return the Set of all values or empty set if there are no matches |
387 | * | 385 | * |
388 | */ | 386 | */ |
389 | public Set<DirectedCommunicationLink> getAllValuesOfLink() { | 387 | public Set<CommunicatingElement> getAllValuesOfElement() { |
390 | return rawStreamAllValuesOfLink(emptyArray()).collect(Collectors.toSet()); | 388 | return rawStreamAllValuesOfElement(emptyArray()).collect(Collectors.toSet()); |
391 | } | 389 | } |
392 | 390 | ||
393 | /** | 391 | /** |
394 | * Retrieve the set of values that occur in matches for Link. | 392 | * Retrieve the set of values that occur in matches for Element. |
395 | * @return the Set of all values or empty set if there are no matches | 393 | * @return the Set of all values or empty set if there are no matches |
396 | * | 394 | * |
397 | */ | 395 | */ |
398 | public Stream<DirectedCommunicationLink> streamAllValuesOfLink() { | 396 | public Stream<CommunicatingElement> streamAllValuesOfElement() { |
399 | return rawStreamAllValuesOfLink(emptyArray()); | 397 | return rawStreamAllValuesOfElement(emptyArray()); |
400 | } | 398 | } |
401 | 399 | ||
402 | @Override | 400 | @Override |
403 | protected CommunicationLinkDoesNotStartAtContainingElement.Match tupleToMatch(final Tuple t) { | 401 | protected CommunicationLinkDoesNotStartAtContainingElement.Match tupleToMatch(final Tuple t) { |
404 | try { | 402 | try { |
405 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((DirectedCommunicationLink) t.get(POSITION_LINK)); | 403 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((CommunicatingElement) t.get(POSITION_ELEMENT)); |
406 | } catch(ClassCastException e) { | 404 | } catch(ClassCastException e) { |
407 | LOGGER.error("Element(s) in tuple not properly typed!",e); | 405 | LOGGER.error("Element(s) in tuple not properly typed!",e); |
408 | return null; | 406 | return null; |
@@ -412,7 +410,7 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
412 | @Override | 410 | @Override |
413 | protected CommunicationLinkDoesNotStartAtContainingElement.Match arrayToMatch(final Object[] match) { | 411 | protected CommunicationLinkDoesNotStartAtContainingElement.Match arrayToMatch(final Object[] match) { |
414 | try { | 412 | try { |
415 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((DirectedCommunicationLink) match[POSITION_LINK]); | 413 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((CommunicatingElement) match[POSITION_ELEMENT]); |
416 | } catch(ClassCastException e) { | 414 | } catch(ClassCastException e) { |
417 | LOGGER.error("Element(s) in array not properly typed!",e); | 415 | LOGGER.error("Element(s) in array not properly typed!",e); |
418 | return null; | 416 | return null; |
@@ -422,7 +420,7 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
422 | @Override | 420 | @Override |
423 | protected CommunicationLinkDoesNotStartAtContainingElement.Match arrayToMatchMutable(final Object[] match) { | 421 | protected CommunicationLinkDoesNotStartAtContainingElement.Match arrayToMatchMutable(final Object[] match) { |
424 | try { | 422 | try { |
425 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMutableMatch((DirectedCommunicationLink) match[POSITION_LINK]); | 423 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMutableMatch((CommunicatingElement) match[POSITION_ELEMENT]); |
426 | } catch(ClassCastException e) { | 424 | } catch(ClassCastException e) { |
427 | LOGGER.error("Element(s) in array not properly typed!",e); | 425 | LOGGER.error("Element(s) in array not properly typed!",e); |
428 | return null; | 426 | return null; |
@@ -473,7 +471,7 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
473 | 471 | ||
474 | @Override | 472 | @Override |
475 | public CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final Object... parameters) { | 473 | public CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final Object... parameters) { |
476 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((satellite.DirectedCommunicationLink) parameters[0]); | 474 | return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((satellite.CommunicatingElement) parameters[0]); |
477 | } | 475 | } |
478 | 476 | ||
479 | /** | 477 | /** |
@@ -505,9 +503,9 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
505 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | 503 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { |
506 | private static final CommunicationLinkDoesNotStartAtContainingElement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | 504 | private static final CommunicationLinkDoesNotStartAtContainingElement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); |
507 | 505 | ||
508 | private final PParameter parameter_Link = new PParameter("Link", "satellite.DirectedCommunicationLink", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "DirectedCommunicationLink")), PParameterDirection.INOUT); | 506 | private final PParameter parameter_Element = new PParameter("Element", "satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT); |
509 | 507 | ||
510 | private final List<PParameter> parameters = Arrays.asList(parameter_Link); | 508 | private final List<PParameter> parameters = Arrays.asList(parameter_Element); |
511 | 509 | ||
512 | private GeneratedPQuery() { | 510 | private GeneratedPQuery() { |
513 | super(PVisibility.PUBLIC); | 511 | super(PVisibility.PUBLIC); |
@@ -520,7 +518,7 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
520 | 518 | ||
521 | @Override | 519 | @Override |
522 | public List<String> getParameterNames() { | 520 | public List<String> getParameterNames() { |
523 | return Arrays.asList("Link"); | 521 | return Arrays.asList("Element"); |
524 | } | 522 | } |
525 | 523 | ||
526 | @Override | 524 | @Override |
@@ -534,43 +532,28 @@ public final class CommunicationLinkDoesNotStartAtContainingElement extends Base | |||
534 | Set<PBody> bodies = new LinkedHashSet<>(); | 532 | Set<PBody> bodies = new LinkedHashSet<>(); |
535 | { | 533 | { |
536 | PBody body = new PBody(this); | 534 | PBody body = new PBody(this); |
537 | PVariable var_Link = body.getOrCreateVariableByName("Link"); | ||
538 | PVariable var_Element = body.getOrCreateVariableByName("Element"); | 535 | PVariable var_Element = body.getOrCreateVariableByName("Element"); |
539 | PVariable var_SourceComm = body.getOrCreateVariableByName("SourceComm"); | 536 | PVariable var_Comm1 = body.getOrCreateVariableByName("Comm1"); |
540 | PVariable var_SourceElement = body.getOrCreateVariableByName("SourceElement"); | 537 | PVariable var_Comm2 = body.getOrCreateVariableByName("Comm2"); |
541 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | 538 | new TypeConstraint(body, Tuples.flatTupleOf(var_Element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
542 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 539 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
543 | new ExportedParameter(body, var_Link, parameter_Link) | 540 | new ExportedParameter(body, var_Element, parameter_Element) |
544 | )); | 541 | )); |
545 | // CommunicatingElement.communicationLink(Element, Link) | 542 | // find transmittingCommSubsystem(Element, Comm1) |
546 | new TypeConstraint(body, Tuples.flatTupleOf(var_Element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | 543 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Element, var_Comm1), TransmittingCommSubsystem.instance().getInternalQueryRepresentation()); |
547 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | 544 | // find transmittingCommSubsystem(Element, Comm2) |
548 | new TypeConstraint(body, Tuples.flatTupleOf(var_Element, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "communicationLink"))); | 545 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Element, var_Comm2), TransmittingCommSubsystem.instance().getInternalQueryRepresentation()); |
549 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | 546 | // Comm1 != Comm2 |
550 | new Equality(body, var__virtual_0_, var_Link); | 547 | new Inequality(body, var_Comm1, var_Comm2); |
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); | 548 | bodies.add(body); |
566 | } | 549 | } |
567 | { | 550 | { |
568 | PAnnotation annotation = new PAnnotation("Constraint"); | 551 | PAnnotation annotation = new PAnnotation("Constraint"); |
569 | annotation.addAttribute("severity", "error"); | 552 | annotation.addAttribute("severity", "error"); |
570 | annotation.addAttribute("key", Arrays.asList(new Object[] { | 553 | annotation.addAttribute("key", Arrays.asList(new Object[] { |
571 | new ParameterReference("Link") | 554 | new ParameterReference("Element") |
572 | })); | 555 | })); |
573 | annotation.addAttribute("message", "Communication links must start from the containing element."); | 556 | annotation.addAttribute("message", "A communicating element may not have two transmitting communication subsystems.."); |
574 | addAnnotation(annotation); | 557 | addAnnotation(annotation); |
575 | } | 558 | } |
576 | return bodies; | 559 | return bodies; |