-
Notifications
You must be signed in to change notification settings - Fork 85
/
_FunctionPkg__ownedFunctions.java
209 lines (194 loc) · 12.2 KB
/
_FunctionPkg__ownedFunctions.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/**
*
* Copyright (c) 2006, 2020 THALES DMS FRANCE.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales - initial API and implementation
*
*/
package org.polarsys.capella.viatra.core.data.fa.surrogate.internal;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
/**
* A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
*
* <p>Original source:
* <code><pre>
* private pattern _FunctionPkg__ownedFunctions(pkg : FunctionPkg, af : AbstractFunction) {
* OperationalActivityPkg.ownedOperationalActivities(pkg, af);
* } or {
* SystemFunctionPkg.ownedSystemFunctions(pkg, af);
* } or {
* LogicalFunctionPkg.ownedLogicalFunctions(pkg, af);
* } or {
* PhysicalFunctionPkg.ownedPhysicalFunctions(pkg, af);
* }
* </pre></code>
*
* @see GenericPatternMatcher
* @see GenericPatternMatch
*
*/
@SuppressWarnings("all")
public final class _FunctionPkg__ownedFunctions extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
private _FunctionPkg__ownedFunctions() {
super(GeneratedPQuery.INSTANCE);
}
/**
* @return the singleton instance of the query specification
* @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
*
*/
public static _FunctionPkg__ownedFunctions instance() {
try{
return LazyHolder.INSTANCE;
} catch (ExceptionInInitializerError err) {
throw processInitializerError(err);
}
}
/**
* Inner class allowing the singleton instance of {@link _FunctionPkg__ownedFunctions} to be created
* <b>not</b> at the class load time of the outer class,
* but rather at the first call to {@link _FunctionPkg__ownedFunctions#instance()}.
*
* <p> This workaround is required e.g. to support recursion.
*
*/
private static class LazyHolder {
private static final _FunctionPkg__ownedFunctions INSTANCE = new _FunctionPkg__ownedFunctions();
/**
* Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
* This initialization order is required to support indirect recursion.
*
* <p> The static initializer is defined using a helper field to work around limitations of the code generator.
*
*/
private static final Object STATIC_INITIALIZER = ensureInitialized();
public static Object ensureInitialized() {
INSTANCE.ensureInitializedInternal();
return null;
}
}
private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
private static final _FunctionPkg__ownedFunctions.GeneratedPQuery INSTANCE = new GeneratedPQuery();
private final PParameter parameter_pkg = new PParameter("pkg", "org.polarsys.capella.core.data.fa.FunctionPkg", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.polarsys.org/capella/core/fa/7.0.0", "FunctionPkg")), PParameterDirection.INOUT);
private final PParameter parameter_af = new PParameter("af", "org.polarsys.capella.core.data.fa.AbstractFunction", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.polarsys.org/capella/core/fa/7.0.0", "AbstractFunction")), PParameterDirection.INOUT);
private final List<PParameter> parameters = Arrays.asList(parameter_pkg, parameter_af);
private GeneratedPQuery() {
super(PVisibility.PRIVATE);
}
@Override
public String getFullyQualifiedName() {
return "org.polarsys.capella.viatra.core.data.fa.surrogate._FunctionPkg__ownedFunctions";
}
@Override
public List<String> getParameterNames() {
return Arrays.asList("pkg","af");
}
@Override
public List<PParameter> getParameters() {
return parameters;
}
@Override
public Set<PBody> doGetContainedBodies() {
setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
Set<PBody> bodies = new LinkedHashSet<>();
{
PBody body = new PBody(this);
PVariable var_pkg = body.getOrCreateVariableByName("pkg");
PVariable var_af = body.getOrCreateVariableByName("af");
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/fa/7.0.0", "FunctionPkg")));
new TypeConstraint(body, Tuples.flatTupleOf(var_af), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/fa/7.0.0", "AbstractFunction")));
body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
new ExportedParameter(body, var_pkg, parameter_pkg),
new ExportedParameter(body, var_af, parameter_af)
));
// OperationalActivityPkg.ownedOperationalActivities(pkg, af)
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/oa/7.0.0", "OperationalActivityPkg")));
PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.polarsys.org/capella/core/oa/7.0.0", "OperationalActivityPkg", "ownedOperationalActivities")));
new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/oa/7.0.0", "OperationalActivity")));
new Equality(body, var__virtual_0_, var_af);
bodies.add(body);
}
{
PBody body = new PBody(this);
PVariable var_pkg = body.getOrCreateVariableByName("pkg");
PVariable var_af = body.getOrCreateVariableByName("af");
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/fa/7.0.0", "FunctionPkg")));
new TypeConstraint(body, Tuples.flatTupleOf(var_af), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/fa/7.0.0", "AbstractFunction")));
body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
new ExportedParameter(body, var_pkg, parameter_pkg),
new ExportedParameter(body, var_af, parameter_af)
));
// SystemFunctionPkg.ownedSystemFunctions(pkg, af)
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/ctx/7.0.0", "SystemFunctionPkg")));
PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.polarsys.org/capella/core/ctx/7.0.0", "SystemFunctionPkg", "ownedSystemFunctions")));
new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/ctx/7.0.0", "SystemFunction")));
new Equality(body, var__virtual_0_, var_af);
bodies.add(body);
}
{
PBody body = new PBody(this);
PVariable var_pkg = body.getOrCreateVariableByName("pkg");
PVariable var_af = body.getOrCreateVariableByName("af");
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/fa/7.0.0", "FunctionPkg")));
new TypeConstraint(body, Tuples.flatTupleOf(var_af), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/fa/7.0.0", "AbstractFunction")));
body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
new ExportedParameter(body, var_pkg, parameter_pkg),
new ExportedParameter(body, var_af, parameter_af)
));
// LogicalFunctionPkg.ownedLogicalFunctions(pkg, af)
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/la/7.0.0", "LogicalFunctionPkg")));
PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.polarsys.org/capella/core/la/7.0.0", "LogicalFunctionPkg", "ownedLogicalFunctions")));
new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/la/7.0.0", "LogicalFunction")));
new Equality(body, var__virtual_0_, var_af);
bodies.add(body);
}
{
PBody body = new PBody(this);
PVariable var_pkg = body.getOrCreateVariableByName("pkg");
PVariable var_af = body.getOrCreateVariableByName("af");
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/fa/7.0.0", "FunctionPkg")));
new TypeConstraint(body, Tuples.flatTupleOf(var_af), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/fa/7.0.0", "AbstractFunction")));
body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
new ExportedParameter(body, var_pkg, parameter_pkg),
new ExportedParameter(body, var_af, parameter_af)
));
// PhysicalFunctionPkg.ownedPhysicalFunctions(pkg, af)
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/pa/7.0.0", "PhysicalFunctionPkg")));
PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
new TypeConstraint(body, Tuples.flatTupleOf(var_pkg, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.polarsys.org/capella/core/pa/7.0.0", "PhysicalFunctionPkg", "ownedPhysicalFunctions")));
new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.polarsys.org/capella/core/pa/7.0.0", "PhysicalFunction")));
new Equality(body, var__virtual_0_, var_af);
bodies.add(body);
}
return bodies;
}
}
}