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