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