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