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