diff options
author | 2019-05-15 13:46:38 -0400 | |
---|---|---|
committer | 2019-05-15 13:46:38 -0400 | |
commit | e904f9d4b1d2d15ab4ec6d72ee881f4c7de34eef (patch) | |
tree | 42cb23ff8839308345c0859cdf99469c930af03b /Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java | |
parent | Merge remote-tracking branch 'origin/master' into kris (diff) | |
download | VIATRA-Generator-e904f9d4b1d2d15ab4ec6d72ee881f4c7de34eef.tar.gz VIATRA-Generator-e904f9d4b1d2d15ab4ec6d72ee881f4c7de34eef.tar.zst VIATRA-Generator-e904f9d4b1d2d15ab4ec6d72ee881f4c7de34eef.zip |
Formalize CPS case study for optimization
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java new file mode 100644 index 00000000..535f32d9 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java | |||
@@ -0,0 +1,175 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
30 | |||
31 | /** | ||
32 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
33 | * | ||
34 | * <p>Original source: | ||
35 | * <code><pre> | ||
36 | * private pattern interferometryPayloadCost(Spacecraft : Spacecraft, Cost : java Double) { | ||
37 | * find spacecraftWithInterferometryPayload(_, Spacecraft); | ||
38 | * Cost == 50000.0; | ||
39 | * } or { | ||
40 | * neg find spacecraftWithInterferometryPayload(_, Spacecraft); | ||
41 | * Cost == 0.0; | ||
42 | * } | ||
43 | * </pre></code> | ||
44 | * | ||
45 | * @see GenericPatternMatcher | ||
46 | * @see GenericPatternMatch | ||
47 | * | ||
48 | */ | ||
49 | @SuppressWarnings("all") | ||
50 | public final class InterferometryPayloadCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
51 | private InterferometryPayloadCost() { | ||
52 | super(GeneratedPQuery.INSTANCE); | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * @return the singleton instance of the query specification | ||
57 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
58 | * | ||
59 | */ | ||
60 | public static InterferometryPayloadCost instance() { | ||
61 | try{ | ||
62 | return LazyHolder.INSTANCE; | ||
63 | } catch (ExceptionInInitializerError err) { | ||
64 | throw processInitializerError(err); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost (visibility: PUBLIC, simpleName: InterferometryPayloadCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
70 | * <b>not</b> at the class load time of the outer class, | ||
71 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost (visibility: PUBLIC, simpleName: InterferometryPayloadCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
72 | * | ||
73 | * <p> This workaround is required e.g. to support recursion. | ||
74 | * | ||
75 | */ | ||
76 | private static class LazyHolder { | ||
77 | private static final InterferometryPayloadCost INSTANCE = new InterferometryPayloadCost(); | ||
78 | |||
79 | /** | ||
80 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
81 | * This initialization order is required to support indirect recursion. | ||
82 | * | ||
83 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
84 | * | ||
85 | */ | ||
86 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
87 | |||
88 | public static Object ensureInitialized() { | ||
89 | INSTANCE.ensureInitializedInternal(); | ||
90 | return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
95 | private static final InterferometryPayloadCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
96 | |||
97 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
100 | |||
101 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Cost); | ||
102 | |||
103 | private GeneratedPQuery() { | ||
104 | super(PVisibility.PRIVATE); | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public String getFullyQualifiedName() { | ||
109 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.interferometryPayloadCost"; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public List<String> getParameterNames() { | ||
114 | return Arrays.asList("Spacecraft","Cost"); | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public List<PParameter> getParameters() { | ||
119 | return parameters; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public Set<PBody> doGetContainedBodies() { | ||
124 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
125 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
126 | { | ||
127 | PBody body = new PBody(this); | ||
128 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
129 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
130 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
132 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
133 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
134 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
135 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
136 | )); | ||
137 | // find spacecraftWithInterferometryPayload(_, Spacecraft) | ||
138 | new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_Spacecraft), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation()); | ||
139 | // Cost == 50000.0 | ||
140 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
141 | new ConstantValue(body, var__virtual_0_, 50000.0); | ||
142 | new Equality(body, var_Cost, var__virtual_0_); | ||
143 | bodies.add(body); | ||
144 | } | ||
145 | { | ||
146 | PBody body = new PBody(this); | ||
147 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
148 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
149 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
150 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
151 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
152 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
153 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
154 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
155 | )); | ||
156 | // neg find spacecraftWithInterferometryPayload(_, Spacecraft) | ||
157 | new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var_Spacecraft), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation()); | ||
158 | // Cost == 0.0 | ||
159 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
160 | new ConstantValue(body, var__virtual_0_, 0.0); | ||
161 | new Equality(body, var_Cost, var__virtual_0_); | ||
162 | bodies.add(body); | ||
163 | } | ||
164 | return bodies; | ||
165 | } | ||
166 | } | ||
167 | |||
168 | private static double evaluateExpression_1_1() { | ||
169 | return 50000.0; | ||
170 | } | ||
171 | |||
172 | private static double evaluateExpression_2_1() { | ||
173 | return 0.0; | ||
174 | } | ||
175 | } | ||