diff options
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner')
30 files changed, 1529 insertions, 3441 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/metrics/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/metrics/.gitignore deleted file mode 100644 index 3e7cd5e2..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/metrics/.gitignore +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | /.CoverageMetric.java._trace | ||
2 | /.SatelliteMetrics.java._trace | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/metrics/internal/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/metrics/internal/.gitignore deleted file mode 100644 index d3195cfc..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/metrics/internal/.gitignore +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | /.MissionCoverage.java._trace | ||
2 | /.SatelliteMetricsAll.java._trace | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore index 5f0d5b4b..6f361334 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore | |||
@@ -20,3 +20,6 @@ | |||
20 | /.TimeMetric.java._trace | 20 | /.TimeMetric.java._trace |
21 | /.CostMetric.java._trace | 21 | /.CostMetric.java._trace |
22 | /.SpacecraftCost.java._trace | 22 | /.SpacecraftCost.java._trace |
23 | /.SpacecraftOfKind.java._trace | ||
24 | /.NoPotentialLinkToGroundStation.java._trace | ||
25 | /.SmallSat.java._trace | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java index c15563ff..ba69943a 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java | |||
@@ -4,7 +4,7 @@ | |||
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | 4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; |
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat; | 7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; |
8 | import java.util.Arrays; | 8 | import java.util.Arrays; |
9 | import java.util.Collection; | 9 | import java.util.Collection; |
10 | import java.util.LinkedHashSet; | 10 | import java.util.LinkedHashSet; |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CoverageMetric.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java index 23b02ce4..1e8f8502 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CoverageMetric.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java | |||
@@ -3,7 +3,8 @@ | |||
3 | */ | 3 | */ |
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | 4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; |
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed; | ||
7 | import java.util.Arrays; | 8 | import java.util.Arrays; |
8 | import java.util.Collection; | 9 | import java.util.Collection; |
9 | import java.util.LinkedHashSet; | 10 | import java.util.LinkedHashSet; |
@@ -15,6 +16,7 @@ import java.util.function.Consumer; | |||
15 | import java.util.stream.Collectors; | 16 | import java.util.stream.Collectors; |
16 | import java.util.stream.Stream; | 17 | import java.util.stream.Stream; |
17 | import org.apache.log4j.Logger; | 18 | import org.apache.log4j.Logger; |
19 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | 20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; |
19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | 21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; |
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | 22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; |
@@ -22,15 +24,17 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | |||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | 24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; |
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | 25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; |
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | 26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; |
25 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | 27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
28 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 29 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
27 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | 31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; |
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | 32 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; |
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | 34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; |
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | 36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; |
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | 40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; |
@@ -43,14 +47,12 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | |||
43 | * | 47 | * |
44 | * <p>Original source: | 48 | * <p>Original source: |
45 | * <code><pre> | 49 | * <code><pre> |
46 | * // | 50 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, |
47 | * // Metrics | 51 | * message = "Spacecraft has no potential communication path to the ground station.") |
48 | * // | 52 | * pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { |
49 | * | 53 | * ConstellationMission.groundStationNetwork(Mission, GroundStation); |
50 | * // Coverage | 54 | * ConstellationMission.spacecraft(Mission, Spacecraft); |
51 | * | 55 | * neg find indirectLinkAllowed(Spacecraft, GroundStation); |
52 | * pattern coverageMetric(Coverage : java Double) { | ||
53 | * Coverage == sum find missionCoverage(_, #_); | ||
54 | * } | 56 | * } |
55 | * </pre></code> | 57 | * </pre></code> |
56 | * | 58 | * |
@@ -59,9 +61,9 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | |||
59 | * | 61 | * |
60 | */ | 62 | */ |
61 | @SuppressWarnings("all") | 63 | @SuppressWarnings("all") |
62 | public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<CoverageMetric.Matcher> { | 64 | public final class NoPotentialLinkToGroundStation extends BaseGeneratedEMFQuerySpecification<NoPotentialLinkToGroundStation.Matcher> { |
63 | /** | 65 | /** |
64 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric pattern, | 66 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation pattern, |
65 | * to be used in conjunction with {@link Matcher}. | 67 | * to be used in conjunction with {@link Matcher}. |
66 | * | 68 | * |
67 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | 69 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. |
@@ -73,69 +75,69 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
73 | * | 75 | * |
74 | */ | 76 | */ |
75 | public static abstract class Match extends BasePatternMatch { | 77 | public static abstract class Match extends BasePatternMatch { |
76 | private Double fCoverage; | 78 | private Spacecraft fSpacecraft; |
77 | 79 | ||
78 | private static List<String> parameterNames = makeImmutableList("Coverage"); | 80 | private static List<String> parameterNames = makeImmutableList("Spacecraft"); |
79 | 81 | ||
80 | private Match(final Double pCoverage) { | 82 | private Match(final Spacecraft pSpacecraft) { |
81 | this.fCoverage = pCoverage; | 83 | this.fSpacecraft = pSpacecraft; |
82 | } | 84 | } |
83 | 85 | ||
84 | @Override | 86 | @Override |
85 | public Object get(final String parameterName) { | 87 | public Object get(final String parameterName) { |
86 | if ("Coverage".equals(parameterName)) return this.fCoverage; | 88 | if ("Spacecraft".equals(parameterName)) return this.fSpacecraft; |
87 | return null; | 89 | return null; |
88 | } | 90 | } |
89 | 91 | ||
90 | public Double getCoverage() { | 92 | public Spacecraft getSpacecraft() { |
91 | return this.fCoverage; | 93 | return this.fSpacecraft; |
92 | } | 94 | } |
93 | 95 | ||
94 | @Override | 96 | @Override |
95 | public boolean set(final String parameterName, final Object newValue) { | 97 | public boolean set(final String parameterName, final Object newValue) { |
96 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 98 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
97 | if ("Coverage".equals(parameterName) ) { | 99 | if ("Spacecraft".equals(parameterName) ) { |
98 | this.fCoverage = (Double) newValue; | 100 | this.fSpacecraft = (Spacecraft) newValue; |
99 | return true; | 101 | return true; |
100 | } | 102 | } |
101 | return false; | 103 | return false; |
102 | } | 104 | } |
103 | 105 | ||
104 | public void setCoverage(final Double pCoverage) { | 106 | public void setSpacecraft(final Spacecraft pSpacecraft) { |
105 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 107 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
106 | this.fCoverage = pCoverage; | 108 | this.fSpacecraft = pSpacecraft; |
107 | } | 109 | } |
108 | 110 | ||
109 | @Override | 111 | @Override |
110 | public String patternName() { | 112 | public String patternName() { |
111 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric"; | 113 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation"; |
112 | } | 114 | } |
113 | 115 | ||
114 | @Override | 116 | @Override |
115 | public List<String> parameterNames() { | 117 | public List<String> parameterNames() { |
116 | return CoverageMetric.Match.parameterNames; | 118 | return NoPotentialLinkToGroundStation.Match.parameterNames; |
117 | } | 119 | } |
118 | 120 | ||
119 | @Override | 121 | @Override |
120 | public Object[] toArray() { | 122 | public Object[] toArray() { |
121 | return new Object[]{fCoverage}; | 123 | return new Object[]{fSpacecraft}; |
122 | } | 124 | } |
123 | 125 | ||
124 | @Override | 126 | @Override |
125 | public CoverageMetric.Match toImmutable() { | 127 | public NoPotentialLinkToGroundStation.Match toImmutable() { |
126 | return isMutable() ? newMatch(fCoverage) : this; | 128 | return isMutable() ? newMatch(fSpacecraft) : this; |
127 | } | 129 | } |
128 | 130 | ||
129 | @Override | 131 | @Override |
130 | public String prettyPrint() { | 132 | public String prettyPrint() { |
131 | StringBuilder result = new StringBuilder(); | 133 | StringBuilder result = new StringBuilder(); |
132 | result.append("\"Coverage\"=" + prettyPrintValue(fCoverage)); | 134 | result.append("\"Spacecraft\"=" + prettyPrintValue(fSpacecraft)); |
133 | return result.toString(); | 135 | return result.toString(); |
134 | } | 136 | } |
135 | 137 | ||
136 | @Override | 138 | @Override |
137 | public int hashCode() { | 139 | public int hashCode() { |
138 | return Objects.hash(fCoverage); | 140 | return Objects.hash(fSpacecraft); |
139 | } | 141 | } |
140 | 142 | ||
141 | @Override | 143 | @Override |
@@ -145,9 +147,9 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
145 | if (obj == null) { | 147 | if (obj == null) { |
146 | return false; | 148 | return false; |
147 | } | 149 | } |
148 | if ((obj instanceof CoverageMetric.Match)) { | 150 | if ((obj instanceof NoPotentialLinkToGroundStation.Match)) { |
149 | CoverageMetric.Match other = (CoverageMetric.Match) obj; | 151 | NoPotentialLinkToGroundStation.Match other = (NoPotentialLinkToGroundStation.Match) obj; |
150 | return Objects.equals(fCoverage, other.fCoverage); | 152 | return Objects.equals(fSpacecraft, other.fSpacecraft); |
151 | } else { | 153 | } else { |
152 | // this should be infrequent | 154 | // this should be infrequent |
153 | if (!(obj instanceof IPatternMatch)) { | 155 | if (!(obj instanceof IPatternMatch)) { |
@@ -159,8 +161,8 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
159 | } | 161 | } |
160 | 162 | ||
161 | @Override | 163 | @Override |
162 | public CoverageMetric specification() { | 164 | public NoPotentialLinkToGroundStation specification() { |
163 | return CoverageMetric.instance(); | 165 | return NoPotentialLinkToGroundStation.instance(); |
164 | } | 166 | } |
165 | 167 | ||
166 | /** | 168 | /** |
@@ -170,7 +172,7 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
170 | * @return the empty match. | 172 | * @return the empty match. |
171 | * | 173 | * |
172 | */ | 174 | */ |
173 | public static CoverageMetric.Match newEmptyMatch() { | 175 | public static NoPotentialLinkToGroundStation.Match newEmptyMatch() { |
174 | return new Mutable(null); | 176 | return new Mutable(null); |
175 | } | 177 | } |
176 | 178 | ||
@@ -178,29 +180,29 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
178 | * Returns a mutable (partial) match. | 180 | * Returns a mutable (partial) match. |
179 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | 181 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. |
180 | * | 182 | * |
181 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | 183 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. |
182 | * @return the new, mutable (partial) match object. | 184 | * @return the new, mutable (partial) match object. |
183 | * | 185 | * |
184 | */ | 186 | */ |
185 | public static CoverageMetric.Match newMutableMatch(final Double pCoverage) { | 187 | public static NoPotentialLinkToGroundStation.Match newMutableMatch(final Spacecraft pSpacecraft) { |
186 | return new Mutable(pCoverage); | 188 | return new Mutable(pSpacecraft); |
187 | } | 189 | } |
188 | 190 | ||
189 | /** | 191 | /** |
190 | * Returns a new (partial) match. | 192 | * Returns a new (partial) match. |
191 | * This can be used e.g. to call the matcher with a partial match. | 193 | * This can be used e.g. to call the matcher with a partial match. |
192 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | 194 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. |
193 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | 195 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. |
194 | * @return the (partial) match object. | 196 | * @return the (partial) match object. |
195 | * | 197 | * |
196 | */ | 198 | */ |
197 | public static CoverageMetric.Match newMatch(final Double pCoverage) { | 199 | public static NoPotentialLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) { |
198 | return new Immutable(pCoverage); | 200 | return new Immutable(pSpacecraft); |
199 | } | 201 | } |
200 | 202 | ||
201 | private static final class Mutable extends CoverageMetric.Match { | 203 | private static final class Mutable extends NoPotentialLinkToGroundStation.Match { |
202 | Mutable(final Double pCoverage) { | 204 | Mutable(final Spacecraft pSpacecraft) { |
203 | super(pCoverage); | 205 | super(pSpacecraft); |
204 | } | 206 | } |
205 | 207 | ||
206 | @Override | 208 | @Override |
@@ -209,9 +211,9 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
209 | } | 211 | } |
210 | } | 212 | } |
211 | 213 | ||
212 | private static final class Immutable extends CoverageMetric.Match { | 214 | private static final class Immutable extends NoPotentialLinkToGroundStation.Match { |
213 | Immutable(final Double pCoverage) { | 215 | Immutable(final Spacecraft pSpacecraft) { |
214 | super(pCoverage); | 216 | super(pSpacecraft); |
215 | } | 217 | } |
216 | 218 | ||
217 | @Override | 219 | @Override |
@@ -222,7 +224,7 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
222 | } | 224 | } |
223 | 225 | ||
224 | /** | 226 | /** |
225 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric pattern, | 227 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation pattern, |
226 | * providing pattern-specific query methods. | 228 | * providing pattern-specific query methods. |
227 | * | 229 | * |
228 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | 230 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, |
@@ -232,22 +234,20 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
232 | * | 234 | * |
233 | * <p>Original source: | 235 | * <p>Original source: |
234 | * <code><pre> | 236 | * <code><pre> |
235 | * // | 237 | * {@literal @}Constraint(severity = "error", key = {Spacecraft}, |
236 | * // Metrics | 238 | * message = "Spacecraft has no potential communication path to the ground station.") |
237 | * // | 239 | * pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { |
238 | * | 240 | * ConstellationMission.groundStationNetwork(Mission, GroundStation); |
239 | * // Coverage | 241 | * ConstellationMission.spacecraft(Mission, Spacecraft); |
240 | * | 242 | * neg find indirectLinkAllowed(Spacecraft, GroundStation); |
241 | * pattern coverageMetric(Coverage : java Double) { | ||
242 | * Coverage == sum find missionCoverage(_, #_); | ||
243 | * } | 243 | * } |
244 | * </pre></code> | 244 | * </pre></code> |
245 | * | 245 | * |
246 | * @see Match | 246 | * @see Match |
247 | * @see CoverageMetric | 247 | * @see NoPotentialLinkToGroundStation |
248 | * | 248 | * |
249 | */ | 249 | */ |
250 | public static class Matcher extends BaseMatcher<CoverageMetric.Match> { | 250 | public static class Matcher extends BaseMatcher<NoPotentialLinkToGroundStation.Match> { |
251 | /** | 251 | /** |
252 | * Initializes the pattern matcher within an existing VIATRA Query engine. | 252 | * Initializes the pattern matcher within an existing VIATRA Query engine. |
253 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | 253 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. |
@@ -256,7 +256,7 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
256 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | 256 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation |
257 | * | 257 | * |
258 | */ | 258 | */ |
259 | public static CoverageMetric.Matcher on(final ViatraQueryEngine engine) { | 259 | public static NoPotentialLinkToGroundStation.Matcher on(final ViatraQueryEngine engine) { |
260 | // check if matcher already exists | 260 | // check if matcher already exists |
261 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | 261 | Matcher matcher = engine.getExistingMatcher(querySpecification()); |
262 | if (matcher == null) { | 262 | if (matcher == null) { |
@@ -271,13 +271,13 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
271 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | 271 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. |
272 | * | 272 | * |
273 | */ | 273 | */ |
274 | public static CoverageMetric.Matcher create() { | 274 | public static NoPotentialLinkToGroundStation.Matcher create() { |
275 | return new Matcher(); | 275 | return new Matcher(); |
276 | } | 276 | } |
277 | 277 | ||
278 | private static final int POSITION_COVERAGE = 0; | 278 | private static final int POSITION_SPACECRAFT = 0; |
279 | 279 | ||
280 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CoverageMetric.Matcher.class); | 280 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NoPotentialLinkToGroundStation.Matcher.class); |
281 | 281 | ||
282 | /** | 282 | /** |
283 | * Initializes the pattern matcher within an existing VIATRA Query engine. | 283 | * Initializes the pattern matcher within an existing VIATRA Query engine. |
@@ -293,12 +293,12 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
293 | 293 | ||
294 | /** | 294 | /** |
295 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | 295 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. |
296 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | 296 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. |
297 | * @return matches represented as a Match object. | 297 | * @return matches represented as a Match object. |
298 | * | 298 | * |
299 | */ | 299 | */ |
300 | public Collection<CoverageMetric.Match> getAllMatches(final Double pCoverage) { | 300 | public Collection<NoPotentialLinkToGroundStation.Match> getAllMatches(final Spacecraft pSpacecraft) { |
301 | return rawStreamAllMatches(new Object[]{pCoverage}).collect(Collectors.toSet()); | 301 | return rawStreamAllMatches(new Object[]{pSpacecraft}).collect(Collectors.toSet()); |
302 | } | 302 | } |
303 | 303 | ||
304 | /** | 304 | /** |
@@ -307,101 +307,101 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
307 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | 307 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. |
308 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | 308 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. |
309 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | 309 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. |
310 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | 310 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. |
311 | * @return a stream of matches represented as a Match object. | 311 | * @return a stream of matches represented as a Match object. |
312 | * | 312 | * |
313 | */ | 313 | */ |
314 | public Stream<CoverageMetric.Match> streamAllMatches(final Double pCoverage) { | 314 | public Stream<NoPotentialLinkToGroundStation.Match> streamAllMatches(final Spacecraft pSpacecraft) { |
315 | return rawStreamAllMatches(new Object[]{pCoverage}); | 315 | return rawStreamAllMatches(new Object[]{pSpacecraft}); |
316 | } | 316 | } |
317 | 317 | ||
318 | /** | 318 | /** |
319 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | 319 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. |
320 | * Neither determinism nor randomness of selection is guaranteed. | 320 | * Neither determinism nor randomness of selection is guaranteed. |
321 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | 321 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. |
322 | * @return a match represented as a Match object, or null if no match is found. | 322 | * @return a match represented as a Match object, or null if no match is found. |
323 | * | 323 | * |
324 | */ | 324 | */ |
325 | public Optional<CoverageMetric.Match> getOneArbitraryMatch(final Double pCoverage) { | 325 | public Optional<NoPotentialLinkToGroundStation.Match> getOneArbitraryMatch(final Spacecraft pSpacecraft) { |
326 | return rawGetOneArbitraryMatch(new Object[]{pCoverage}); | 326 | return rawGetOneArbitraryMatch(new Object[]{pSpacecraft}); |
327 | } | 327 | } |
328 | 328 | ||
329 | /** | 329 | /** |
330 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | 330 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, |
331 | * under any possible substitution of the unspecified parameters (if any). | 331 | * under any possible substitution of the unspecified parameters (if any). |
332 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | 332 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. |
333 | * @return true if the input is a valid (partial) match of the pattern. | 333 | * @return true if the input is a valid (partial) match of the pattern. |
334 | * | 334 | * |
335 | */ | 335 | */ |
336 | public boolean hasMatch(final Double pCoverage) { | 336 | public boolean hasMatch(final Spacecraft pSpacecraft) { |
337 | return rawHasMatch(new Object[]{pCoverage}); | 337 | return rawHasMatch(new Object[]{pSpacecraft}); |
338 | } | 338 | } |
339 | 339 | ||
340 | /** | 340 | /** |
341 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | 341 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. |
342 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | 342 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. |
343 | * @return the number of pattern matches found. | 343 | * @return the number of pattern matches found. |
344 | * | 344 | * |
345 | */ | 345 | */ |
346 | public int countMatches(final Double pCoverage) { | 346 | public int countMatches(final Spacecraft pSpacecraft) { |
347 | return rawCountMatches(new Object[]{pCoverage}); | 347 | return rawCountMatches(new Object[]{pSpacecraft}); |
348 | } | 348 | } |
349 | 349 | ||
350 | /** | 350 | /** |
351 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | 351 | * Executes the given processor on 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 pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | 353 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. |
354 | * @param processor the action that will process the selected match. | 354 | * @param processor the action that will process the selected match. |
355 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | 355 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked |
356 | * | 356 | * |
357 | */ | 357 | */ |
358 | public boolean forOneArbitraryMatch(final Double pCoverage, final Consumer<? super CoverageMetric.Match> processor) { | 358 | public boolean forOneArbitraryMatch(final Spacecraft pSpacecraft, final Consumer<? super NoPotentialLinkToGroundStation.Match> processor) { |
359 | return rawForOneArbitraryMatch(new Object[]{pCoverage}, processor); | 359 | return rawForOneArbitraryMatch(new Object[]{pSpacecraft}, processor); |
360 | } | 360 | } |
361 | 361 | ||
362 | /** | 362 | /** |
363 | * Returns a new (partial) match. | 363 | * Returns a new (partial) match. |
364 | * This can be used e.g. to call the matcher with a partial match. | 364 | * This can be used e.g. to call the matcher with a partial match. |
365 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | 365 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. |
366 | * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. | 366 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. |
367 | * @return the (partial) match object. | 367 | * @return the (partial) match object. |
368 | * | 368 | * |
369 | */ | 369 | */ |
370 | public CoverageMetric.Match newMatch(final Double pCoverage) { | 370 | public NoPotentialLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) { |
371 | return CoverageMetric.Match.newMatch(pCoverage); | 371 | return NoPotentialLinkToGroundStation.Match.newMatch(pSpacecraft); |
372 | } | 372 | } |
373 | 373 | ||
374 | /** | 374 | /** |
375 | * Retrieve the set of values that occur in matches for Coverage. | 375 | * Retrieve the set of values that occur in matches for Spacecraft. |
376 | * @return the Set of all values or empty set if there are no matches | 376 | * @return the Set of all values or empty set if there are no matches |
377 | * | 377 | * |
378 | */ | 378 | */ |
379 | protected Stream<Double> rawStreamAllValuesOfCoverage(final Object[] parameters) { | 379 | protected Stream<Spacecraft> rawStreamAllValuesOfSpacecraft(final Object[] parameters) { |
380 | return rawStreamAllValues(POSITION_COVERAGE, parameters).map(Double.class::cast); | 380 | return rawStreamAllValues(POSITION_SPACECRAFT, parameters).map(Spacecraft.class::cast); |
381 | } | 381 | } |
382 | 382 | ||
383 | /** | 383 | /** |
384 | * Retrieve the set of values that occur in matches for Coverage. | 384 | * Retrieve the set of values that occur in matches for Spacecraft. |
385 | * @return the Set of all values or empty set if there are no matches | 385 | * @return the Set of all values or empty set if there are no matches |
386 | * | 386 | * |
387 | */ | 387 | */ |
388 | public Set<Double> getAllValuesOfCoverage() { | 388 | public Set<Spacecraft> getAllValuesOfSpacecraft() { |
389 | return rawStreamAllValuesOfCoverage(emptyArray()).collect(Collectors.toSet()); | 389 | return rawStreamAllValuesOfSpacecraft(emptyArray()).collect(Collectors.toSet()); |
390 | } | 390 | } |
391 | 391 | ||
392 | /** | 392 | /** |
393 | * Retrieve the set of values that occur in matches for Coverage. | 393 | * Retrieve the set of values that occur in matches for Spacecraft. |
394 | * @return the Set of all values or empty set if there are no matches | 394 | * @return the Set of all values or empty set if there are no matches |
395 | * | 395 | * |
396 | */ | 396 | */ |
397 | public Stream<Double> streamAllValuesOfCoverage() { | 397 | public Stream<Spacecraft> streamAllValuesOfSpacecraft() { |
398 | return rawStreamAllValuesOfCoverage(emptyArray()); | 398 | return rawStreamAllValuesOfSpacecraft(emptyArray()); |
399 | } | 399 | } |
400 | 400 | ||
401 | @Override | 401 | @Override |
402 | protected CoverageMetric.Match tupleToMatch(final Tuple t) { | 402 | protected NoPotentialLinkToGroundStation.Match tupleToMatch(final Tuple t) { |
403 | try { | 403 | try { |
404 | return CoverageMetric.Match.newMatch((Double) t.get(POSITION_COVERAGE)); | 404 | return NoPotentialLinkToGroundStation.Match.newMatch((Spacecraft) t.get(POSITION_SPACECRAFT)); |
405 | } catch(ClassCastException e) { | 405 | } catch(ClassCastException e) { |
406 | LOGGER.error("Element(s) in tuple not properly typed!",e); | 406 | LOGGER.error("Element(s) in tuple not properly typed!",e); |
407 | return null; | 407 | return null; |
@@ -409,9 +409,9 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
409 | } | 409 | } |
410 | 410 | ||
411 | @Override | 411 | @Override |
412 | protected CoverageMetric.Match arrayToMatch(final Object[] match) { | 412 | protected NoPotentialLinkToGroundStation.Match arrayToMatch(final Object[] match) { |
413 | try { | 413 | try { |
414 | return CoverageMetric.Match.newMatch((Double) match[POSITION_COVERAGE]); | 414 | return NoPotentialLinkToGroundStation.Match.newMatch((Spacecraft) match[POSITION_SPACECRAFT]); |
415 | } catch(ClassCastException e) { | 415 | } catch(ClassCastException e) { |
416 | LOGGER.error("Element(s) in array not properly typed!",e); | 416 | LOGGER.error("Element(s) in array not properly typed!",e); |
417 | return null; | 417 | return null; |
@@ -419,9 +419,9 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
419 | } | 419 | } |
420 | 420 | ||
421 | @Override | 421 | @Override |
422 | protected CoverageMetric.Match arrayToMatchMutable(final Object[] match) { | 422 | protected NoPotentialLinkToGroundStation.Match arrayToMatchMutable(final Object[] match) { |
423 | try { | 423 | try { |
424 | return CoverageMetric.Match.newMutableMatch((Double) match[POSITION_COVERAGE]); | 424 | return NoPotentialLinkToGroundStation.Match.newMutableMatch((Spacecraft) match[POSITION_SPACECRAFT]); |
425 | } catch(ClassCastException e) { | 425 | } catch(ClassCastException e) { |
426 | LOGGER.error("Element(s) in array not properly typed!",e); | 426 | LOGGER.error("Element(s) in array not properly typed!",e); |
427 | return null; | 427 | return null; |
@@ -433,12 +433,12 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
433 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | 433 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded |
434 | * | 434 | * |
435 | */ | 435 | */ |
436 | public static IQuerySpecification<CoverageMetric.Matcher> querySpecification() { | 436 | public static IQuerySpecification<NoPotentialLinkToGroundStation.Matcher> querySpecification() { |
437 | return CoverageMetric.instance(); | 437 | return NoPotentialLinkToGroundStation.instance(); |
438 | } | 438 | } |
439 | } | 439 | } |
440 | 440 | ||
441 | private CoverageMetric() { | 441 | private NoPotentialLinkToGroundStation() { |
442 | super(GeneratedPQuery.INSTANCE); | 442 | super(GeneratedPQuery.INSTANCE); |
443 | } | 443 | } |
444 | 444 | ||
@@ -447,7 +447,7 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
447 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | 447 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded |
448 | * | 448 | * |
449 | */ | 449 | */ |
450 | public static CoverageMetric instance() { | 450 | public static NoPotentialLinkToGroundStation instance() { |
451 | try{ | 451 | try{ |
452 | return LazyHolder.INSTANCE; | 452 | return LazyHolder.INSTANCE; |
453 | } catch (ExceptionInInitializerError err) { | 453 | } catch (ExceptionInInitializerError err) { |
@@ -456,35 +456,35 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
456 | } | 456 | } |
457 | 457 | ||
458 | @Override | 458 | @Override |
459 | protected CoverageMetric.Matcher instantiate(final ViatraQueryEngine engine) { | 459 | protected NoPotentialLinkToGroundStation.Matcher instantiate(final ViatraQueryEngine engine) { |
460 | return CoverageMetric.Matcher.on(engine); | 460 | return NoPotentialLinkToGroundStation.Matcher.on(engine); |
461 | } | 461 | } |
462 | 462 | ||
463 | @Override | 463 | @Override |
464 | public CoverageMetric.Matcher instantiate() { | 464 | public NoPotentialLinkToGroundStation.Matcher instantiate() { |
465 | return CoverageMetric.Matcher.create(); | 465 | return NoPotentialLinkToGroundStation.Matcher.create(); |
466 | } | 466 | } |
467 | 467 | ||
468 | @Override | 468 | @Override |
469 | public CoverageMetric.Match newEmptyMatch() { | 469 | public NoPotentialLinkToGroundStation.Match newEmptyMatch() { |
470 | return CoverageMetric.Match.newEmptyMatch(); | 470 | return NoPotentialLinkToGroundStation.Match.newEmptyMatch(); |
471 | } | 471 | } |
472 | 472 | ||
473 | @Override | 473 | @Override |
474 | public CoverageMetric.Match newMatch(final Object... parameters) { | 474 | public NoPotentialLinkToGroundStation.Match newMatch(final Object... parameters) { |
475 | return CoverageMetric.Match.newMatch((java.lang.Double) parameters[0]); | 475 | return NoPotentialLinkToGroundStation.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0]); |
476 | } | 476 | } |
477 | 477 | ||
478 | /** | 478 | /** |
479 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric (visibility: PUBLIC, simpleName: CoverageMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | 479 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation (visibility: PUBLIC, simpleName: NoPotentialLinkToGroundStation, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created |
480 | * <b>not</b> at the class load time of the outer class, | 480 | * <b>not</b> at the class load time of the outer class, |
481 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric (visibility: PUBLIC, simpleName: CoverageMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | 481 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation (visibility: PUBLIC, simpleName: NoPotentialLinkToGroundStation, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. |
482 | * | 482 | * |
483 | * <p> This workaround is required e.g. to support recursion. | 483 | * <p> This workaround is required e.g. to support recursion. |
484 | * | 484 | * |
485 | */ | 485 | */ |
486 | private static class LazyHolder { | 486 | private static class LazyHolder { |
487 | private static final CoverageMetric INSTANCE = new CoverageMetric(); | 487 | private static final NoPotentialLinkToGroundStation INSTANCE = new NoPotentialLinkToGroundStation(); |
488 | 488 | ||
489 | /** | 489 | /** |
490 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | 490 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. |
@@ -502,11 +502,11 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
502 | } | 502 | } |
503 | 503 | ||
504 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | 504 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { |
505 | private static final CoverageMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | 505 | private static final NoPotentialLinkToGroundStation.GeneratedPQuery INSTANCE = new GeneratedPQuery(); |
506 | 506 | ||
507 | private final PParameter parameter_Coverage = new PParameter("Coverage", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | 507 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); |
508 | 508 | ||
509 | private final List<PParameter> parameters = Arrays.asList(parameter_Coverage); | 509 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft); |
510 | 510 | ||
511 | private GeneratedPQuery() { | 511 | private GeneratedPQuery() { |
512 | super(PVisibility.PUBLIC); | 512 | super(PVisibility.PUBLIC); |
@@ -514,12 +514,12 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
514 | 514 | ||
515 | @Override | 515 | @Override |
516 | public String getFullyQualifiedName() { | 516 | public String getFullyQualifiedName() { |
517 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric"; | 517 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation"; |
518 | } | 518 | } |
519 | 519 | ||
520 | @Override | 520 | @Override |
521 | public List<String> getParameterNames() { | 521 | public List<String> getParameterNames() { |
522 | return Arrays.asList("Coverage"); | 522 | return Arrays.asList("Spacecraft"); |
523 | } | 523 | } |
524 | 524 | ||
525 | @Override | 525 | @Override |
@@ -533,19 +533,38 @@ public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification<Cov | |||
533 | Set<PBody> bodies = new LinkedHashSet<>(); | 533 | Set<PBody> bodies = new LinkedHashSet<>(); |
534 | { | 534 | { |
535 | PBody body = new PBody(this); | 535 | PBody body = new PBody(this); |
536 | PVariable var_Coverage = body.getOrCreateVariableByName("Coverage"); | 536 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); |
537 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | 537 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); |
538 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | 538 | PVariable var_GroundStation = body.getOrCreateVariableByName("GroundStation"); |
539 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Coverage), new JavaTransitiveInstancesKey(java.lang.Double.class)); | 539 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); |
540 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 540 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
541 | new ExportedParameter(body, var_Coverage, parameter_Coverage) | 541 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft) |
542 | )); | 542 | )); |
543 | // Coverage == sum find missionCoverage(_, #_) | 543 | // ConstellationMission.groundStationNetwork(Mission, GroundStation) |
544 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
544 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | 545 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); |
545 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), MissionCoverage.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | 546 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "groundStationNetwork"))); |
546 | new Equality(body, var_Coverage, var__virtual_0_); | 547 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); |
548 | new Equality(body, var__virtual_0_, var_GroundStation); | ||
549 | // ConstellationMission.spacecraft(Mission, Spacecraft) | ||
550 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
551 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
552 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); | ||
553 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
554 | new Equality(body, var__virtual_1_, var_Spacecraft); | ||
555 | // neg find indirectLinkAllowed(Spacecraft, GroundStation) | ||
556 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_GroundStation), IndirectLinkAllowed.instance().getInternalQueryRepresentation()); | ||
547 | bodies.add(body); | 557 | bodies.add(body); |
548 | } | 558 | } |
559 | { | ||
560 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
561 | annotation.addAttribute("severity", "error"); | ||
562 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
563 | new ParameterReference("Spacecraft") | ||
564 | })); | ||
565 | annotation.addAttribute("message", "Spacecraft has no potential communication path to the ground station."); | ||
566 | addAnnotation(annotation); | ||
567 | } | ||
549 | return bodies; | 568 | return bodies; |
550 | } | 569 | } |
551 | } | 570 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NotEnoughInterferometryPayloads.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NotEnoughInterferometryPayloads.java index 39af9d5b..d75dea5f 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NotEnoughInterferometryPayloads.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NotEnoughInterferometryPayloads.java | |||
@@ -28,6 +28,8 @@ import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | |||
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; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | 34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; |
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
@@ -45,8 +47,8 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | |||
45 | * <code><pre> | 47 | * <code><pre> |
46 | * // At least two spacecraft must have the interferometry payload configured | 48 | * // At least two spacecraft must have the interferometry payload configured |
47 | * | 49 | * |
48 | * //{@literal @}Constraint(severity = "error", key = {Mission}, | 50 | * {@literal @}Constraint(severity = "error", key = {Mission}, |
49 | * // message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.") | 51 | * message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.") |
50 | * pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) { | 52 | * pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) { |
51 | * InterferometryMission(Mission); | 53 | * InterferometryMission(Mission); |
52 | * neg find atLeastTwoInterferometryPayloads(Mission); | 54 | * neg find atLeastTwoInterferometryPayloads(Mission); |
@@ -233,8 +235,8 @@ public final class NotEnoughInterferometryPayloads extends BaseGeneratedEMFQuery | |||
233 | * <code><pre> | 235 | * <code><pre> |
234 | * // At least two spacecraft must have the interferometry payload configured | 236 | * // At least two spacecraft must have the interferometry payload configured |
235 | * | 237 | * |
236 | * //{@literal @}Constraint(severity = "error", key = {Mission}, | 238 | * {@literal @}Constraint(severity = "error", key = {Mission}, |
237 | * // message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.") | 239 | * message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.") |
238 | * pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) { | 240 | * pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) { |
239 | * InterferometryMission(Mission); | 241 | * InterferometryMission(Mission); |
240 | * neg find atLeastTwoInterferometryPayloads(Mission); | 242 | * neg find atLeastTwoInterferometryPayloads(Mission); |
@@ -542,6 +544,15 @@ public final class NotEnoughInterferometryPayloads extends BaseGeneratedEMFQuery | |||
542 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Mission), AtLeastTwoInterferometryPayloads.instance().getInternalQueryRepresentation()); | 544 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Mission), AtLeastTwoInterferometryPayloads.instance().getInternalQueryRepresentation()); |
543 | bodies.add(body); | 545 | bodies.add(body); |
544 | } | 546 | } |
547 | { | ||
548 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
549 | annotation.addAttribute("severity", "error"); | ||
550 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
551 | new ParameterReference("Mission") | ||
552 | })); | ||
553 | annotation.addAttribute("message", "Interferometry mission needs at least two spacecraft configured with the interferometry payload."); | ||
554 | addAnnotation(annotation); | ||
555 | } | ||
545 | return bodies; | 556 | return bodies; |
546 | } | 557 | } |
547 | } | 558 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java index b6601c28..c86761ce 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java | |||
@@ -5,16 +5,16 @@ package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | |||
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; | 7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; |
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric; | ||
10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; | 8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; |
11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; | 9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; |
12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain; | 10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain; |
13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow; | 11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow; |
14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; | 12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; |
13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation; | ||
15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; | 14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; |
15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; | ||
16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind; | ||
16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; | 17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; |
17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric; | ||
18 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow; | 18 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow; |
19 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium; | 19 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium; |
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | 20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; |
@@ -31,6 +31,7 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | |||
31 | * <li>communicationLinkDoesNotStartAtContainingElement</li> | 31 | * <li>communicationLinkDoesNotStartAtContainingElement</li> |
32 | * <li>notEnoughInterferometryPayloads</li> | 32 | * <li>notEnoughInterferometryPayloads</li> |
33 | * <li>noLinkToGroundStation</li> | 33 | * <li>noLinkToGroundStation</li> |
34 | * <li>noPotentialLinkToGroundStation</li> | ||
34 | * <li>communicationLoop</li> | 35 | * <li>communicationLoop</li> |
35 | * <li>incompatibleSourceAndTargetBand</li> | 36 | * <li>incompatibleSourceAndTargetBand</li> |
36 | * <li>incompatibleSourceAndTargetGain</li> | 37 | * <li>incompatibleSourceAndTargetGain</li> |
@@ -39,9 +40,8 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | |||
39 | * <li>kaAntennaGainLow</li> | 40 | * <li>kaAntennaGainLow</li> |
40 | * <li>threeUCubeSatWithNonUhfCrossLink</li> | 41 | * <li>threeUCubeSatWithNonUhfCrossLink</li> |
41 | * <li>cubeSatWithKaAntenna</li> | 42 | * <li>cubeSatWithKaAntenna</li> |
42 | * <li>coverageMetric</li> | 43 | * <li>smallSat</li> |
43 | * <li>timeMetric</li> | 44 | * <li>spacecraftOfKind</li> |
44 | * <li>costMetric</li> | ||
45 | * </ul> | 45 | * </ul> |
46 | * | 46 | * |
47 | * @see IQueryGroup | 47 | * @see IQueryGroup |
@@ -69,6 +69,7 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { | |||
69 | querySpecifications.add(CommunicationLinkDoesNotStartAtContainingElement.instance()); | 69 | querySpecifications.add(CommunicationLinkDoesNotStartAtContainingElement.instance()); |
70 | querySpecifications.add(NotEnoughInterferometryPayloads.instance()); | 70 | querySpecifications.add(NotEnoughInterferometryPayloads.instance()); |
71 | querySpecifications.add(NoLinkToGroundStation.instance()); | 71 | querySpecifications.add(NoLinkToGroundStation.instance()); |
72 | querySpecifications.add(NoPotentialLinkToGroundStation.instance()); | ||
72 | querySpecifications.add(CommunicationLoop.instance()); | 73 | querySpecifications.add(CommunicationLoop.instance()); |
73 | querySpecifications.add(IncompatibleSourceAndTargetBand.instance()); | 74 | querySpecifications.add(IncompatibleSourceAndTargetBand.instance()); |
74 | querySpecifications.add(IncompatibleSourceAndTargetGain.instance()); | 75 | querySpecifications.add(IncompatibleSourceAndTargetGain.instance()); |
@@ -77,9 +78,8 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { | |||
77 | querySpecifications.add(KaAntennaGainLow.instance()); | 78 | querySpecifications.add(KaAntennaGainLow.instance()); |
78 | querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance()); | 79 | querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance()); |
79 | querySpecifications.add(CubeSatWithKaAntenna.instance()); | 80 | querySpecifications.add(CubeSatWithKaAntenna.instance()); |
80 | querySpecifications.add(CoverageMetric.instance()); | 81 | querySpecifications.add(SmallSat.instance()); |
81 | querySpecifications.add(TimeMetric.instance()); | 82 | querySpecifications.add(SpacecraftOfKind.instance()); |
82 | querySpecifications.add(CostMetric.instance()); | ||
83 | } | 83 | } |
84 | 84 | ||
85 | public CommunicationLinkDoesNotStartAtContainingElement getCommunicationLinkDoesNotStartAtContainingElement() { | 85 | public CommunicationLinkDoesNotStartAtContainingElement getCommunicationLinkDoesNotStartAtContainingElement() { |
@@ -106,6 +106,14 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { | |||
106 | return NoLinkToGroundStation.Matcher.on(engine); | 106 | return NoLinkToGroundStation.Matcher.on(engine); |
107 | } | 107 | } |
108 | 108 | ||
109 | public NoPotentialLinkToGroundStation getNoPotentialLinkToGroundStation() { | ||
110 | return NoPotentialLinkToGroundStation.instance(); | ||
111 | } | ||
112 | |||
113 | public NoPotentialLinkToGroundStation.Matcher getNoPotentialLinkToGroundStation(final ViatraQueryEngine engine) { | ||
114 | return NoPotentialLinkToGroundStation.Matcher.on(engine); | ||
115 | } | ||
116 | |||
109 | public CommunicationLoop getCommunicationLoop() { | 117 | public CommunicationLoop getCommunicationLoop() { |
110 | return CommunicationLoop.instance(); | 118 | return CommunicationLoop.instance(); |
111 | } | 119 | } |
@@ -170,27 +178,19 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { | |||
170 | return CubeSatWithKaAntenna.Matcher.on(engine); | 178 | return CubeSatWithKaAntenna.Matcher.on(engine); |
171 | } | 179 | } |
172 | 180 | ||
173 | public CoverageMetric getCoverageMetric() { | 181 | public SmallSat getSmallSat() { |
174 | return CoverageMetric.instance(); | 182 | return SmallSat.instance(); |
175 | } | ||
176 | |||
177 | public CoverageMetric.Matcher getCoverageMetric(final ViatraQueryEngine engine) { | ||
178 | return CoverageMetric.Matcher.on(engine); | ||
179 | } | ||
180 | |||
181 | public TimeMetric getTimeMetric() { | ||
182 | return TimeMetric.instance(); | ||
183 | } | 183 | } |
184 | 184 | ||
185 | public TimeMetric.Matcher getTimeMetric(final ViatraQueryEngine engine) { | 185 | public SmallSat.Matcher getSmallSat(final ViatraQueryEngine engine) { |
186 | return TimeMetric.Matcher.on(engine); | 186 | return SmallSat.Matcher.on(engine); |
187 | } | 187 | } |
188 | 188 | ||
189 | public CostMetric getCostMetric() { | 189 | public SpacecraftOfKind getSpacecraftOfKind() { |
190 | return CostMetric.instance(); | 190 | return SpacecraftOfKind.instance(); |
191 | } | 191 | } |
192 | 192 | ||
193 | public CostMetric.Matcher getCostMetric(final ViatraQueryEngine engine) { | 193 | public SpacecraftOfKind.Matcher getSpacecraftOfKind(final ViatraQueryEngine engine) { |
194 | return CostMetric.Matcher.on(engine); | 194 | return SpacecraftOfKind.Matcher.on(engine); |
195 | } | 195 | } |
196 | } | 196 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SmallSat.java index 474719b2..7bc497ab 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SmallSat.java | |||
@@ -3,7 +3,6 @@ | |||
3 | */ | 3 | */ |
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | 4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; |
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost; | ||
7 | import java.util.Arrays; | 6 | import java.util.Arrays; |
8 | import java.util.Collection; | 7 | import java.util.Collection; |
9 | import java.util.LinkedHashSet; | 8 | import java.util.LinkedHashSet; |
@@ -15,6 +14,7 @@ import java.util.function.Consumer; | |||
15 | import java.util.stream.Collectors; | 14 | import java.util.stream.Collectors; |
16 | import java.util.stream.Stream; | 15 | import java.util.stream.Stream; |
17 | import org.apache.log4j.Logger; | 16 | import org.apache.log4j.Logger; |
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | 18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; |
19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | 19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; |
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | 20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; |
@@ -22,15 +22,12 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | |||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | 22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; |
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | 23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; |
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | 24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; |
25 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | 25 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
26 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 26 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
27 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 27 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | 28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; |
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | 30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | 33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; |
@@ -43,10 +40,8 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | |||
43 | * | 40 | * |
44 | * <p>Original source: | 41 | * <p>Original source: |
45 | * <code><pre> | 42 | * <code><pre> |
46 | * // Cost | 43 | * pattern smallSat(Sat : SmallSat) { |
47 | * | 44 | * SmallSat(Sat); |
48 | * pattern costMetric(Cost : java Double) { | ||
49 | * Cost == sum find missionCost(_, #_); | ||
50 | * } | 45 | * } |
51 | * </pre></code> | 46 | * </pre></code> |
52 | * | 47 | * |
@@ -55,9 +50,9 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | |||
55 | * | 50 | * |
56 | */ | 51 | */ |
57 | @SuppressWarnings("all") | 52 | @SuppressWarnings("all") |
58 | public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMetric.Matcher> { | 53 | public final class SmallSat extends BaseGeneratedEMFQuerySpecification<SmallSat.Matcher> { |
59 | /** | 54 | /** |
60 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric pattern, | 55 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat pattern, |
61 | * to be used in conjunction with {@link Matcher}. | 56 | * to be used in conjunction with {@link Matcher}. |
62 | * | 57 | * |
63 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | 58 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. |
@@ -69,69 +64,69 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
69 | * | 64 | * |
70 | */ | 65 | */ |
71 | public static abstract class Match extends BasePatternMatch { | 66 | public static abstract class Match extends BasePatternMatch { |
72 | private Double fCost; | 67 | private hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat fSat; |
73 | 68 | ||
74 | private static List<String> parameterNames = makeImmutableList("Cost"); | 69 | private static List<String> parameterNames = makeImmutableList("Sat"); |
75 | 70 | ||
76 | private Match(final Double pCost) { | 71 | private Match(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
77 | this.fCost = pCost; | 72 | this.fSat = pSat; |
78 | } | 73 | } |
79 | 74 | ||
80 | @Override | 75 | @Override |
81 | public Object get(final String parameterName) { | 76 | public Object get(final String parameterName) { |
82 | if ("Cost".equals(parameterName)) return this.fCost; | 77 | if ("Sat".equals(parameterName)) return this.fSat; |
83 | return null; | 78 | return null; |
84 | } | 79 | } |
85 | 80 | ||
86 | public Double getCost() { | 81 | public hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat getSat() { |
87 | return this.fCost; | 82 | return this.fSat; |
88 | } | 83 | } |
89 | 84 | ||
90 | @Override | 85 | @Override |
91 | public boolean set(final String parameterName, final Object newValue) { | 86 | public boolean set(final String parameterName, final Object newValue) { |
92 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 87 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
93 | if ("Cost".equals(parameterName) ) { | 88 | if ("Sat".equals(parameterName) ) { |
94 | this.fCost = (Double) newValue; | 89 | this.fSat = (hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) newValue; |
95 | return true; | 90 | return true; |
96 | } | 91 | } |
97 | return false; | 92 | return false; |
98 | } | 93 | } |
99 | 94 | ||
100 | public void setCost(final Double pCost) { | 95 | public void setSat(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
101 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 96 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
102 | this.fCost = pCost; | 97 | this.fSat = pSat; |
103 | } | 98 | } |
104 | 99 | ||
105 | @Override | 100 | @Override |
106 | public String patternName() { | 101 | public String patternName() { |
107 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric"; | 102 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat"; |
108 | } | 103 | } |
109 | 104 | ||
110 | @Override | 105 | @Override |
111 | public List<String> parameterNames() { | 106 | public List<String> parameterNames() { |
112 | return CostMetric.Match.parameterNames; | 107 | return SmallSat.Match.parameterNames; |
113 | } | 108 | } |
114 | 109 | ||
115 | @Override | 110 | @Override |
116 | public Object[] toArray() { | 111 | public Object[] toArray() { |
117 | return new Object[]{fCost}; | 112 | return new Object[]{fSat}; |
118 | } | 113 | } |
119 | 114 | ||
120 | @Override | 115 | @Override |
121 | public CostMetric.Match toImmutable() { | 116 | public SmallSat.Match toImmutable() { |
122 | return isMutable() ? newMatch(fCost) : this; | 117 | return isMutable() ? newMatch(fSat) : this; |
123 | } | 118 | } |
124 | 119 | ||
125 | @Override | 120 | @Override |
126 | public String prettyPrint() { | 121 | public String prettyPrint() { |
127 | StringBuilder result = new StringBuilder(); | 122 | StringBuilder result = new StringBuilder(); |
128 | result.append("\"Cost\"=" + prettyPrintValue(fCost)); | 123 | result.append("\"Sat\"=" + prettyPrintValue(fSat)); |
129 | return result.toString(); | 124 | return result.toString(); |
130 | } | 125 | } |
131 | 126 | ||
132 | @Override | 127 | @Override |
133 | public int hashCode() { | 128 | public int hashCode() { |
134 | return Objects.hash(fCost); | 129 | return Objects.hash(fSat); |
135 | } | 130 | } |
136 | 131 | ||
137 | @Override | 132 | @Override |
@@ -141,9 +136,9 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
141 | if (obj == null) { | 136 | if (obj == null) { |
142 | return false; | 137 | return false; |
143 | } | 138 | } |
144 | if ((obj instanceof CostMetric.Match)) { | 139 | if ((obj instanceof SmallSat.Match)) { |
145 | CostMetric.Match other = (CostMetric.Match) obj; | 140 | SmallSat.Match other = (SmallSat.Match) obj; |
146 | return Objects.equals(fCost, other.fCost); | 141 | return Objects.equals(fSat, other.fSat); |
147 | } else { | 142 | } else { |
148 | // this should be infrequent | 143 | // this should be infrequent |
149 | if (!(obj instanceof IPatternMatch)) { | 144 | if (!(obj instanceof IPatternMatch)) { |
@@ -155,8 +150,8 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
155 | } | 150 | } |
156 | 151 | ||
157 | @Override | 152 | @Override |
158 | public CostMetric specification() { | 153 | public SmallSat specification() { |
159 | return CostMetric.instance(); | 154 | return SmallSat.instance(); |
160 | } | 155 | } |
161 | 156 | ||
162 | /** | 157 | /** |
@@ -166,7 +161,7 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
166 | * @return the empty match. | 161 | * @return the empty match. |
167 | * | 162 | * |
168 | */ | 163 | */ |
169 | public static CostMetric.Match newEmptyMatch() { | 164 | public static SmallSat.Match newEmptyMatch() { |
170 | return new Mutable(null); | 165 | return new Mutable(null); |
171 | } | 166 | } |
172 | 167 | ||
@@ -174,29 +169,29 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
174 | * Returns a mutable (partial) match. | 169 | * Returns a mutable (partial) match. |
175 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | 170 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. |
176 | * | 171 | * |
177 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | 172 | * @param pSat the fixed value of pattern parameter Sat, or null if not bound. |
178 | * @return the new, mutable (partial) match object. | 173 | * @return the new, mutable (partial) match object. |
179 | * | 174 | * |
180 | */ | 175 | */ |
181 | public static CostMetric.Match newMutableMatch(final Double pCost) { | 176 | public static SmallSat.Match newMutableMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
182 | return new Mutable(pCost); | 177 | return new Mutable(pSat); |
183 | } | 178 | } |
184 | 179 | ||
185 | /** | 180 | /** |
186 | * Returns a new (partial) match. | 181 | * Returns a new (partial) match. |
187 | * This can be used e.g. to call the matcher with a partial match. | 182 | * This can be used e.g. to call the matcher with a partial match. |
188 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | 183 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. |
189 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | 184 | * @param pSat the fixed value of pattern parameter Sat, or null if not bound. |
190 | * @return the (partial) match object. | 185 | * @return the (partial) match object. |
191 | * | 186 | * |
192 | */ | 187 | */ |
193 | public static CostMetric.Match newMatch(final Double pCost) { | 188 | public static SmallSat.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
194 | return new Immutable(pCost); | 189 | return new Immutable(pSat); |
195 | } | 190 | } |
196 | 191 | ||
197 | private static final class Mutable extends CostMetric.Match { | 192 | private static final class Mutable extends SmallSat.Match { |
198 | Mutable(final Double pCost) { | 193 | Mutable(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
199 | super(pCost); | 194 | super(pSat); |
200 | } | 195 | } |
201 | 196 | ||
202 | @Override | 197 | @Override |
@@ -205,9 +200,9 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
205 | } | 200 | } |
206 | } | 201 | } |
207 | 202 | ||
208 | private static final class Immutable extends CostMetric.Match { | 203 | private static final class Immutable extends SmallSat.Match { |
209 | Immutable(final Double pCost) { | 204 | Immutable(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
210 | super(pCost); | 205 | super(pSat); |
211 | } | 206 | } |
212 | 207 | ||
213 | @Override | 208 | @Override |
@@ -218,7 +213,7 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
218 | } | 213 | } |
219 | 214 | ||
220 | /** | 215 | /** |
221 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric pattern, | 216 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat pattern, |
222 | * providing pattern-specific query methods. | 217 | * providing pattern-specific query methods. |
223 | * | 218 | * |
224 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | 219 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, |
@@ -228,18 +223,16 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
228 | * | 223 | * |
229 | * <p>Original source: | 224 | * <p>Original source: |
230 | * <code><pre> | 225 | * <code><pre> |
231 | * // Cost | 226 | * pattern smallSat(Sat : SmallSat) { |
232 | * | 227 | * SmallSat(Sat); |
233 | * pattern costMetric(Cost : java Double) { | ||
234 | * Cost == sum find missionCost(_, #_); | ||
235 | * } | 228 | * } |
236 | * </pre></code> | 229 | * </pre></code> |
237 | * | 230 | * |
238 | * @see Match | 231 | * @see Match |
239 | * @see CostMetric | 232 | * @see SmallSat |
240 | * | 233 | * |
241 | */ | 234 | */ |
242 | public static class Matcher extends BaseMatcher<CostMetric.Match> { | 235 | public static class Matcher extends BaseMatcher<SmallSat.Match> { |
243 | /** | 236 | /** |
244 | * Initializes the pattern matcher within an existing VIATRA Query engine. | 237 | * Initializes the pattern matcher within an existing VIATRA Query engine. |
245 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | 238 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. |
@@ -248,7 +241,7 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
248 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | 241 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation |
249 | * | 242 | * |
250 | */ | 243 | */ |
251 | public static CostMetric.Matcher on(final ViatraQueryEngine engine) { | 244 | public static SmallSat.Matcher on(final ViatraQueryEngine engine) { |
252 | // check if matcher already exists | 245 | // check if matcher already exists |
253 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | 246 | Matcher matcher = engine.getExistingMatcher(querySpecification()); |
254 | if (matcher == null) { | 247 | if (matcher == null) { |
@@ -263,13 +256,13 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
263 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | 256 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. |
264 | * | 257 | * |
265 | */ | 258 | */ |
266 | public static CostMetric.Matcher create() { | 259 | public static SmallSat.Matcher create() { |
267 | return new Matcher(); | 260 | return new Matcher(); |
268 | } | 261 | } |
269 | 262 | ||
270 | private static final int POSITION_COST = 0; | 263 | private static final int POSITION_SAT = 0; |
271 | 264 | ||
272 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CostMetric.Matcher.class); | 265 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SmallSat.Matcher.class); |
273 | 266 | ||
274 | /** | 267 | /** |
275 | * Initializes the pattern matcher within an existing VIATRA Query engine. | 268 | * Initializes the pattern matcher within an existing VIATRA Query engine. |
@@ -285,12 +278,12 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
285 | 278 | ||
286 | /** | 279 | /** |
287 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | 280 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. |
288 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | 281 | * @param pSat the fixed value of pattern parameter Sat, or null if not bound. |
289 | * @return matches represented as a Match object. | 282 | * @return matches represented as a Match object. |
290 | * | 283 | * |
291 | */ | 284 | */ |
292 | public Collection<CostMetric.Match> getAllMatches(final Double pCost) { | 285 | public Collection<SmallSat.Match> getAllMatches(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
293 | return rawStreamAllMatches(new Object[]{pCost}).collect(Collectors.toSet()); | 286 | return rawStreamAllMatches(new Object[]{pSat}).collect(Collectors.toSet()); |
294 | } | 287 | } |
295 | 288 | ||
296 | /** | 289 | /** |
@@ -299,101 +292,101 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
299 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | 292 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. |
300 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | 293 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. |
301 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | 294 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. |
302 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | 295 | * @param pSat the fixed value of pattern parameter Sat, or null if not bound. |
303 | * @return a stream of matches represented as a Match object. | 296 | * @return a stream of matches represented as a Match object. |
304 | * | 297 | * |
305 | */ | 298 | */ |
306 | public Stream<CostMetric.Match> streamAllMatches(final Double pCost) { | 299 | public Stream<SmallSat.Match> streamAllMatches(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
307 | return rawStreamAllMatches(new Object[]{pCost}); | 300 | return rawStreamAllMatches(new Object[]{pSat}); |
308 | } | 301 | } |
309 | 302 | ||
310 | /** | 303 | /** |
311 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | 304 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. |
312 | * Neither determinism nor randomness of selection is guaranteed. | 305 | * Neither determinism nor randomness of selection is guaranteed. |
313 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | 306 | * @param pSat the fixed value of pattern parameter Sat, or null if not bound. |
314 | * @return a match represented as a Match object, or null if no match is found. | 307 | * @return a match represented as a Match object, or null if no match is found. |
315 | * | 308 | * |
316 | */ | 309 | */ |
317 | public Optional<CostMetric.Match> getOneArbitraryMatch(final Double pCost) { | 310 | public Optional<SmallSat.Match> getOneArbitraryMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
318 | return rawGetOneArbitraryMatch(new Object[]{pCost}); | 311 | return rawGetOneArbitraryMatch(new Object[]{pSat}); |
319 | } | 312 | } |
320 | 313 | ||
321 | /** | 314 | /** |
322 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | 315 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, |
323 | * under any possible substitution of the unspecified parameters (if any). | 316 | * under any possible substitution of the unspecified parameters (if any). |
324 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | 317 | * @param pSat the fixed value of pattern parameter Sat, or null if not bound. |
325 | * @return true if the input is a valid (partial) match of the pattern. | 318 | * @return true if the input is a valid (partial) match of the pattern. |
326 | * | 319 | * |
327 | */ | 320 | */ |
328 | public boolean hasMatch(final Double pCost) { | 321 | public boolean hasMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
329 | return rawHasMatch(new Object[]{pCost}); | 322 | return rawHasMatch(new Object[]{pSat}); |
330 | } | 323 | } |
331 | 324 | ||
332 | /** | 325 | /** |
333 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | 326 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. |
334 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | 327 | * @param pSat the fixed value of pattern parameter Sat, or null if not bound. |
335 | * @return the number of pattern matches found. | 328 | * @return the number of pattern matches found. |
336 | * | 329 | * |
337 | */ | 330 | */ |
338 | public int countMatches(final Double pCost) { | 331 | public int countMatches(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
339 | return rawCountMatches(new Object[]{pCost}); | 332 | return rawCountMatches(new Object[]{pSat}); |
340 | } | 333 | } |
341 | 334 | ||
342 | /** | 335 | /** |
343 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | 336 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. |
344 | * Neither determinism nor randomness of selection is guaranteed. | 337 | * Neither determinism nor randomness of selection is guaranteed. |
345 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | 338 | * @param pSat the fixed value of pattern parameter Sat, or null if not bound. |
346 | * @param processor the action that will process the selected match. | 339 | * @param processor the action that will process the selected match. |
347 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | 340 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked |
348 | * | 341 | * |
349 | */ | 342 | */ |
350 | public boolean forOneArbitraryMatch(final Double pCost, final Consumer<? super CostMetric.Match> processor) { | 343 | public boolean forOneArbitraryMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat, final Consumer<? super SmallSat.Match> processor) { |
351 | return rawForOneArbitraryMatch(new Object[]{pCost}, processor); | 344 | return rawForOneArbitraryMatch(new Object[]{pSat}, processor); |
352 | } | 345 | } |
353 | 346 | ||
354 | /** | 347 | /** |
355 | * Returns a new (partial) match. | 348 | * Returns a new (partial) match. |
356 | * This can be used e.g. to call the matcher with a partial match. | 349 | * This can be used e.g. to call the matcher with a partial match. |
357 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | 350 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. |
358 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | 351 | * @param pSat the fixed value of pattern parameter Sat, or null if not bound. |
359 | * @return the (partial) match object. | 352 | * @return the (partial) match object. |
360 | * | 353 | * |
361 | */ | 354 | */ |
362 | public CostMetric.Match newMatch(final Double pCost) { | 355 | public SmallSat.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { |
363 | return CostMetric.Match.newMatch(pCost); | 356 | return SmallSat.Match.newMatch(pSat); |
364 | } | 357 | } |
365 | 358 | ||
366 | /** | 359 | /** |
367 | * Retrieve the set of values that occur in matches for Cost. | 360 | * Retrieve the set of values that occur in matches for Sat. |
368 | * @return the Set of all values or empty set if there are no matches | 361 | * @return the Set of all values or empty set if there are no matches |
369 | * | 362 | * |
370 | */ | 363 | */ |
371 | protected Stream<Double> rawStreamAllValuesOfCost(final Object[] parameters) { | 364 | protected Stream<hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat> rawStreamAllValuesOfSat(final Object[] parameters) { |
372 | return rawStreamAllValues(POSITION_COST, parameters).map(Double.class::cast); | 365 | return rawStreamAllValues(POSITION_SAT, parameters).map(hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat.class::cast); |
373 | } | 366 | } |
374 | 367 | ||
375 | /** | 368 | /** |
376 | * Retrieve the set of values that occur in matches for Cost. | 369 | * Retrieve the set of values that occur in matches for Sat. |
377 | * @return the Set of all values or empty set if there are no matches | 370 | * @return the Set of all values or empty set if there are no matches |
378 | * | 371 | * |
379 | */ | 372 | */ |
380 | public Set<Double> getAllValuesOfCost() { | 373 | public Set<hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat> getAllValuesOfSat() { |
381 | return rawStreamAllValuesOfCost(emptyArray()).collect(Collectors.toSet()); | 374 | return rawStreamAllValuesOfSat(emptyArray()).collect(Collectors.toSet()); |
382 | } | 375 | } |
383 | 376 | ||
384 | /** | 377 | /** |
385 | * Retrieve the set of values that occur in matches for Cost. | 378 | * Retrieve the set of values that occur in matches for Sat. |
386 | * @return the Set of all values or empty set if there are no matches | 379 | * @return the Set of all values or empty set if there are no matches |
387 | * | 380 | * |
388 | */ | 381 | */ |
389 | public Stream<Double> streamAllValuesOfCost() { | 382 | public Stream<hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat> streamAllValuesOfSat() { |
390 | return rawStreamAllValuesOfCost(emptyArray()); | 383 | return rawStreamAllValuesOfSat(emptyArray()); |
391 | } | 384 | } |
392 | 385 | ||
393 | @Override | 386 | @Override |
394 | protected CostMetric.Match tupleToMatch(final Tuple t) { | 387 | protected SmallSat.Match tupleToMatch(final Tuple t) { |
395 | try { | 388 | try { |
396 | return CostMetric.Match.newMatch((Double) t.get(POSITION_COST)); | 389 | return SmallSat.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) t.get(POSITION_SAT)); |
397 | } catch(ClassCastException e) { | 390 | } catch(ClassCastException e) { |
398 | LOGGER.error("Element(s) in tuple not properly typed!",e); | 391 | LOGGER.error("Element(s) in tuple not properly typed!",e); |
399 | return null; | 392 | return null; |
@@ -401,9 +394,9 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
401 | } | 394 | } |
402 | 395 | ||
403 | @Override | 396 | @Override |
404 | protected CostMetric.Match arrayToMatch(final Object[] match) { | 397 | protected SmallSat.Match arrayToMatch(final Object[] match) { |
405 | try { | 398 | try { |
406 | return CostMetric.Match.newMatch((Double) match[POSITION_COST]); | 399 | return SmallSat.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) match[POSITION_SAT]); |
407 | } catch(ClassCastException e) { | 400 | } catch(ClassCastException e) { |
408 | LOGGER.error("Element(s) in array not properly typed!",e); | 401 | LOGGER.error("Element(s) in array not properly typed!",e); |
409 | return null; | 402 | return null; |
@@ -411,9 +404,9 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
411 | } | 404 | } |
412 | 405 | ||
413 | @Override | 406 | @Override |
414 | protected CostMetric.Match arrayToMatchMutable(final Object[] match) { | 407 | protected SmallSat.Match arrayToMatchMutable(final Object[] match) { |
415 | try { | 408 | try { |
416 | return CostMetric.Match.newMutableMatch((Double) match[POSITION_COST]); | 409 | return SmallSat.Match.newMutableMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) match[POSITION_SAT]); |
417 | } catch(ClassCastException e) { | 410 | } catch(ClassCastException e) { |
418 | LOGGER.error("Element(s) in array not properly typed!",e); | 411 | LOGGER.error("Element(s) in array not properly typed!",e); |
419 | return null; | 412 | return null; |
@@ -425,12 +418,12 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
425 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | 418 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded |
426 | * | 419 | * |
427 | */ | 420 | */ |
428 | public static IQuerySpecification<CostMetric.Matcher> querySpecification() { | 421 | public static IQuerySpecification<SmallSat.Matcher> querySpecification() { |
429 | return CostMetric.instance(); | 422 | return SmallSat.instance(); |
430 | } | 423 | } |
431 | } | 424 | } |
432 | 425 | ||
433 | private CostMetric() { | 426 | private SmallSat() { |
434 | super(GeneratedPQuery.INSTANCE); | 427 | super(GeneratedPQuery.INSTANCE); |
435 | } | 428 | } |
436 | 429 | ||
@@ -439,7 +432,7 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
439 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | 432 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded |
440 | * | 433 | * |
441 | */ | 434 | */ |
442 | public static CostMetric instance() { | 435 | public static SmallSat instance() { |
443 | try{ | 436 | try{ |
444 | return LazyHolder.INSTANCE; | 437 | return LazyHolder.INSTANCE; |
445 | } catch (ExceptionInInitializerError err) { | 438 | } catch (ExceptionInInitializerError err) { |
@@ -448,35 +441,35 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
448 | } | 441 | } |
449 | 442 | ||
450 | @Override | 443 | @Override |
451 | protected CostMetric.Matcher instantiate(final ViatraQueryEngine engine) { | 444 | protected SmallSat.Matcher instantiate(final ViatraQueryEngine engine) { |
452 | return CostMetric.Matcher.on(engine); | 445 | return SmallSat.Matcher.on(engine); |
453 | } | 446 | } |
454 | 447 | ||
455 | @Override | 448 | @Override |
456 | public CostMetric.Matcher instantiate() { | 449 | public SmallSat.Matcher instantiate() { |
457 | return CostMetric.Matcher.create(); | 450 | return SmallSat.Matcher.create(); |
458 | } | 451 | } |
459 | 452 | ||
460 | @Override | 453 | @Override |
461 | public CostMetric.Match newEmptyMatch() { | 454 | public SmallSat.Match newEmptyMatch() { |
462 | return CostMetric.Match.newEmptyMatch(); | 455 | return SmallSat.Match.newEmptyMatch(); |
463 | } | 456 | } |
464 | 457 | ||
465 | @Override | 458 | @Override |
466 | public CostMetric.Match newMatch(final Object... parameters) { | 459 | public SmallSat.Match newMatch(final Object... parameters) { |
467 | return CostMetric.Match.newMatch((java.lang.Double) parameters[0]); | 460 | return SmallSat.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) parameters[0]); |
468 | } | 461 | } |
469 | 462 | ||
470 | /** | 463 | /** |
471 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric (visibility: PUBLIC, simpleName: CostMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | 464 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat (visibility: PUBLIC, simpleName: SmallSat, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created |
472 | * <b>not</b> at the class load time of the outer class, | 465 | * <b>not</b> at the class load time of the outer class, |
473 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric (visibility: PUBLIC, simpleName: CostMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | 466 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat (visibility: PUBLIC, simpleName: SmallSat, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. |
474 | * | 467 | * |
475 | * <p> This workaround is required e.g. to support recursion. | 468 | * <p> This workaround is required e.g. to support recursion. |
476 | * | 469 | * |
477 | */ | 470 | */ |
478 | private static class LazyHolder { | 471 | private static class LazyHolder { |
479 | private static final CostMetric INSTANCE = new CostMetric(); | 472 | private static final SmallSat INSTANCE = new SmallSat(); |
480 | 473 | ||
481 | /** | 474 | /** |
482 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | 475 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. |
@@ -494,11 +487,11 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
494 | } | 487 | } |
495 | 488 | ||
496 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | 489 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { |
497 | private static final CostMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | 490 | private static final SmallSat.GeneratedPQuery INSTANCE = new GeneratedPQuery(); |
498 | 491 | ||
499 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | 492 | private final PParameter parameter_Sat = new PParameter("Sat", "hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "SmallSat")), PParameterDirection.INOUT); |
500 | 493 | ||
501 | private final List<PParameter> parameters = Arrays.asList(parameter_Cost); | 494 | private final List<PParameter> parameters = Arrays.asList(parameter_Sat); |
502 | 495 | ||
503 | private GeneratedPQuery() { | 496 | private GeneratedPQuery() { |
504 | super(PVisibility.PUBLIC); | 497 | super(PVisibility.PUBLIC); |
@@ -506,12 +499,12 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
506 | 499 | ||
507 | @Override | 500 | @Override |
508 | public String getFullyQualifiedName() { | 501 | public String getFullyQualifiedName() { |
509 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric"; | 502 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat"; |
510 | } | 503 | } |
511 | 504 | ||
512 | @Override | 505 | @Override |
513 | public List<String> getParameterNames() { | 506 | public List<String> getParameterNames() { |
514 | return Arrays.asList("Cost"); | 507 | return Arrays.asList("Sat"); |
515 | } | 508 | } |
516 | 509 | ||
517 | @Override | 510 | @Override |
@@ -525,17 +518,13 @@ public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMet | |||
525 | Set<PBody> bodies = new LinkedHashSet<>(); | 518 | Set<PBody> bodies = new LinkedHashSet<>(); |
526 | { | 519 | { |
527 | PBody body = new PBody(this); | 520 | PBody body = new PBody(this); |
528 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | 521 | PVariable var_Sat = body.getOrCreateVariableByName("Sat"); |
529 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | 522 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat"))); |
530 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
531 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
532 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 523 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
533 | new ExportedParameter(body, var_Cost, parameter_Cost) | 524 | new ExportedParameter(body, var_Sat, parameter_Sat) |
534 | )); | 525 | )); |
535 | // Cost == sum find missionCost(_, #_) | 526 | // SmallSat(Sat) |
536 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | 527 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat"))); |
537 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), MissionCost.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
538 | new Equality(body, var_Cost, var__virtual_0_); | ||
539 | bodies.add(body); | 528 | bodies.add(body); |
540 | } | 529 | } |
541 | return bodies; | 530 | return bodies; |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SpacecraftOfKind.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SpacecraftOfKind.java new file mode 100644 index 00000000..52602bb5 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SpacecraftOfKind.java | |||
@@ -0,0 +1,754 @@ | |||
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; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.SpacecraftKind; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.Collection; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | import java.util.Optional; | ||
14 | import java.util.Set; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collectors; | ||
17 | import java.util.stream.Stream; | ||
18 | import org.apache.log4j.Logger; | ||
19 | import org.eclipse.emf.ecore.EClass; | ||
20 | import org.eclipse.emf.ecore.EDataType; | ||
21 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
22 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
27 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
43 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
44 | |||
45 | /** | ||
46 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
47 | * | ||
48 | * <p>Original source: | ||
49 | * <code><pre> | ||
50 | * {@literal @}QueryBasedFeature(feature = "kind") | ||
51 | * pattern spacecraftOfKind(Spacecraft : Spacecraft, Kind : SpacecraftKind) { | ||
52 | * CubeSat3U(Spacecraft); | ||
53 | * Kind == SpacecraftKind::CubeSat3U; | ||
54 | * } or { | ||
55 | * CubeSat6U(Spacecraft); | ||
56 | * Kind == SpacecraftKind::CubeSat6U; | ||
57 | * } or { | ||
58 | * SmallSat(Spacecraft); | ||
59 | * Kind == SpacecraftKind::SmallSat; | ||
60 | * } | ||
61 | * </pre></code> | ||
62 | * | ||
63 | * @see Matcher | ||
64 | * @see Match | ||
65 | * | ||
66 | */ | ||
67 | @SuppressWarnings("all") | ||
68 | public final class SpacecraftOfKind extends BaseGeneratedEMFQuerySpecification<SpacecraftOfKind.Matcher> { | ||
69 | /** | ||
70 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind pattern, | ||
71 | * to be used in conjunction with {@link Matcher}. | ||
72 | * | ||
73 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
74 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
75 | * usable to represent a match of the pattern in the result of a query, | ||
76 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
77 | * | ||
78 | * @see Matcher | ||
79 | * | ||
80 | */ | ||
81 | public static abstract class Match extends BasePatternMatch { | ||
82 | private Spacecraft fSpacecraft; | ||
83 | |||
84 | private SpacecraftKind fKind; | ||
85 | |||
86 | private static List<String> parameterNames = makeImmutableList("Spacecraft", "Kind"); | ||
87 | |||
88 | private Match(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
89 | this.fSpacecraft = pSpacecraft; | ||
90 | this.fKind = pKind; | ||
91 | } | ||
92 | |||
93 | @Override | ||
94 | public Object get(final String parameterName) { | ||
95 | if ("Spacecraft".equals(parameterName)) return this.fSpacecraft; | ||
96 | if ("Kind".equals(parameterName)) return this.fKind; | ||
97 | return null; | ||
98 | } | ||
99 | |||
100 | public Spacecraft getSpacecraft() { | ||
101 | return this.fSpacecraft; | ||
102 | } | ||
103 | |||
104 | public SpacecraftKind getKind() { | ||
105 | return this.fKind; | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | public boolean set(final String parameterName, final Object newValue) { | ||
110 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
111 | if ("Spacecraft".equals(parameterName) ) { | ||
112 | this.fSpacecraft = (Spacecraft) newValue; | ||
113 | return true; | ||
114 | } | ||
115 | if ("Kind".equals(parameterName) ) { | ||
116 | this.fKind = (SpacecraftKind) newValue; | ||
117 | return true; | ||
118 | } | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | public void setSpacecraft(final Spacecraft pSpacecraft) { | ||
123 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
124 | this.fSpacecraft = pSpacecraft; | ||
125 | } | ||
126 | |||
127 | public void setKind(final SpacecraftKind pKind) { | ||
128 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
129 | this.fKind = pKind; | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public String patternName() { | ||
134 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind"; | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public List<String> parameterNames() { | ||
139 | return SpacecraftOfKind.Match.parameterNames; | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public Object[] toArray() { | ||
144 | return new Object[]{fSpacecraft, fKind}; | ||
145 | } | ||
146 | |||
147 | @Override | ||
148 | public SpacecraftOfKind.Match toImmutable() { | ||
149 | return isMutable() ? newMatch(fSpacecraft, fKind) : this; | ||
150 | } | ||
151 | |||
152 | @Override | ||
153 | public String prettyPrint() { | ||
154 | StringBuilder result = new StringBuilder(); | ||
155 | result.append("\"Spacecraft\"=" + prettyPrintValue(fSpacecraft) + ", "); | ||
156 | result.append("\"Kind\"=" + prettyPrintValue(fKind)); | ||
157 | return result.toString(); | ||
158 | } | ||
159 | |||
160 | @Override | ||
161 | public int hashCode() { | ||
162 | return Objects.hash(fSpacecraft, fKind); | ||
163 | } | ||
164 | |||
165 | @Override | ||
166 | public boolean equals(final Object obj) { | ||
167 | if (this == obj) | ||
168 | return true; | ||
169 | if (obj == null) { | ||
170 | return false; | ||
171 | } | ||
172 | if ((obj instanceof SpacecraftOfKind.Match)) { | ||
173 | SpacecraftOfKind.Match other = (SpacecraftOfKind.Match) obj; | ||
174 | return Objects.equals(fSpacecraft, other.fSpacecraft) && Objects.equals(fKind, other.fKind); | ||
175 | } else { | ||
176 | // this should be infrequent | ||
177 | if (!(obj instanceof IPatternMatch)) { | ||
178 | return false; | ||
179 | } | ||
180 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
181 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | @Override | ||
186 | public SpacecraftOfKind specification() { | ||
187 | return SpacecraftOfKind.instance(); | ||
188 | } | ||
189 | |||
190 | /** | ||
191 | * Returns an empty, mutable match. | ||
192 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
193 | * | ||
194 | * @return the empty match. | ||
195 | * | ||
196 | */ | ||
197 | public static SpacecraftOfKind.Match newEmptyMatch() { | ||
198 | return new Mutable(null, null); | ||
199 | } | ||
200 | |||
201 | /** | ||
202 | * Returns a mutable (partial) match. | ||
203 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
204 | * | ||
205 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
206 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
207 | * @return the new, mutable (partial) match object. | ||
208 | * | ||
209 | */ | ||
210 | public static SpacecraftOfKind.Match newMutableMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
211 | return new Mutable(pSpacecraft, pKind); | ||
212 | } | ||
213 | |||
214 | /** | ||
215 | * Returns a new (partial) match. | ||
216 | * This can be used e.g. to call the matcher with a partial match. | ||
217 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
218 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
219 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
220 | * @return the (partial) match object. | ||
221 | * | ||
222 | */ | ||
223 | public static SpacecraftOfKind.Match newMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
224 | return new Immutable(pSpacecraft, pKind); | ||
225 | } | ||
226 | |||
227 | private static final class Mutable extends SpacecraftOfKind.Match { | ||
228 | Mutable(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
229 | super(pSpacecraft, pKind); | ||
230 | } | ||
231 | |||
232 | @Override | ||
233 | public boolean isMutable() { | ||
234 | return true; | ||
235 | } | ||
236 | } | ||
237 | |||
238 | private static final class Immutable extends SpacecraftOfKind.Match { | ||
239 | Immutable(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
240 | super(pSpacecraft, pKind); | ||
241 | } | ||
242 | |||
243 | @Override | ||
244 | public boolean isMutable() { | ||
245 | return false; | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | |||
250 | /** | ||
251 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind pattern, | ||
252 | * providing pattern-specific query methods. | ||
253 | * | ||
254 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
255 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
256 | * | ||
257 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
258 | * | ||
259 | * <p>Original source: | ||
260 | * <code><pre> | ||
261 | * {@literal @}QueryBasedFeature(feature = "kind") | ||
262 | * pattern spacecraftOfKind(Spacecraft : Spacecraft, Kind : SpacecraftKind) { | ||
263 | * CubeSat3U(Spacecraft); | ||
264 | * Kind == SpacecraftKind::CubeSat3U; | ||
265 | * } or { | ||
266 | * CubeSat6U(Spacecraft); | ||
267 | * Kind == SpacecraftKind::CubeSat6U; | ||
268 | * } or { | ||
269 | * SmallSat(Spacecraft); | ||
270 | * Kind == SpacecraftKind::SmallSat; | ||
271 | * } | ||
272 | * </pre></code> | ||
273 | * | ||
274 | * @see Match | ||
275 | * @see SpacecraftOfKind | ||
276 | * | ||
277 | */ | ||
278 | public static class Matcher extends BaseMatcher<SpacecraftOfKind.Match> { | ||
279 | /** | ||
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. | ||
282 | * | ||
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 | ||
285 | * | ||
286 | */ | ||
287 | public static SpacecraftOfKind.Matcher on(final ViatraQueryEngine engine) { | ||
288 | // check if matcher already exists | ||
289 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
290 | if (matcher == null) { | ||
291 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
292 | } | ||
293 | return matcher; | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
298 | * @return an initialized matcher | ||
299 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
300 | * | ||
301 | */ | ||
302 | public static SpacecraftOfKind.Matcher create() { | ||
303 | return new Matcher(); | ||
304 | } | ||
305 | |||
306 | private static final int POSITION_SPACECRAFT = 0; | ||
307 | |||
308 | private static final int POSITION_KIND = 1; | ||
309 | |||
310 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SpacecraftOfKind.Matcher.class); | ||
311 | |||
312 | /** | ||
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. | ||
315 | * | ||
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 | ||
318 | * | ||
319 | */ | ||
320 | private Matcher() { | ||
321 | super(querySpecification()); | ||
322 | } | ||
323 | |||
324 | /** | ||
325 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
326 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
327 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
328 | * @return matches represented as a Match object. | ||
329 | * | ||
330 | */ | ||
331 | public Collection<SpacecraftOfKind.Match> getAllMatches(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
332 | return rawStreamAllMatches(new Object[]{pSpacecraft, pKind}).collect(Collectors.toSet()); | ||
333 | } | ||
334 | |||
335 | /** | ||
336 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
337 | * </p> | ||
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>. | ||
340 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
341 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
342 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
343 | * @return a stream of matches represented as a Match object. | ||
344 | * | ||
345 | */ | ||
346 | public Stream<SpacecraftOfKind.Match> streamAllMatches(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
347 | return rawStreamAllMatches(new Object[]{pSpacecraft, pKind}); | ||
348 | } | ||
349 | |||
350 | /** | ||
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. | ||
353 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
354 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
355 | * @return a match represented as a Match object, or null if no match is found. | ||
356 | * | ||
357 | */ | ||
358 | public Optional<SpacecraftOfKind.Match> getOneArbitraryMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
359 | return rawGetOneArbitraryMatch(new Object[]{pSpacecraft, pKind}); | ||
360 | } | ||
361 | |||
362 | /** | ||
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). | ||
365 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
366 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
367 | * @return true if the input is a valid (partial) match of the pattern. | ||
368 | * | ||
369 | */ | ||
370 | public boolean hasMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
371 | return rawHasMatch(new Object[]{pSpacecraft, pKind}); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
376 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
377 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
378 | * @return the number of pattern matches found. | ||
379 | * | ||
380 | */ | ||
381 | public int countMatches(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
382 | return rawCountMatches(new Object[]{pSpacecraft, pKind}); | ||
383 | } | ||
384 | |||
385 | /** | ||
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. | ||
388 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
389 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
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 | ||
392 | * | ||
393 | */ | ||
394 | public boolean forOneArbitraryMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind, final Consumer<? super SpacecraftOfKind.Match> processor) { | ||
395 | return rawForOneArbitraryMatch(new Object[]{pSpacecraft, pKind}, processor); | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * Returns a new (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. | ||
402 | * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. | ||
403 | * @param pKind the fixed value of pattern parameter Kind, or null if not bound. | ||
404 | * @return the (partial) match object. | ||
405 | * | ||
406 | */ | ||
407 | public SpacecraftOfKind.Match newMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { | ||
408 | return SpacecraftOfKind.Match.newMatch(pSpacecraft, pKind); | ||
409 | } | ||
410 | |||
411 | /** | ||
412 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
413 | * @return the Set of all values or empty set if there are no matches | ||
414 | * | ||
415 | */ | ||
416 | protected Stream<Spacecraft> rawStreamAllValuesOfSpacecraft(final Object[] parameters) { | ||
417 | return rawStreamAllValues(POSITION_SPACECRAFT, parameters).map(Spacecraft.class::cast); | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
422 | * @return the Set of all values or empty set if there are no matches | ||
423 | * | ||
424 | */ | ||
425 | public Set<Spacecraft> getAllValuesOfSpacecraft() { | ||
426 | return rawStreamAllValuesOfSpacecraft(emptyArray()).collect(Collectors.toSet()); | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
431 | * @return the Set of all values or empty set if there are no matches | ||
432 | * | ||
433 | */ | ||
434 | public Stream<Spacecraft> streamAllValuesOfSpacecraft() { | ||
435 | return rawStreamAllValuesOfSpacecraft(emptyArray()); | ||
436 | } | ||
437 | |||
438 | /** | ||
439 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
440 | * </p> | ||
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>. | ||
443 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
444 | * | ||
445 | * @return the Stream of all values or empty set if there are no matches | ||
446 | * | ||
447 | */ | ||
448 | public Stream<Spacecraft> streamAllValuesOfSpacecraft(final SpacecraftOfKind.Match partialMatch) { | ||
449 | return rawStreamAllValuesOfSpacecraft(partialMatch.toArray()); | ||
450 | } | ||
451 | |||
452 | /** | ||
453 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
454 | * </p> | ||
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>. | ||
457 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
458 | * | ||
459 | * @return the Stream of all values or empty set if there are no matches | ||
460 | * | ||
461 | */ | ||
462 | public Stream<Spacecraft> streamAllValuesOfSpacecraft(final SpacecraftKind pKind) { | ||
463 | return rawStreamAllValuesOfSpacecraft(new Object[]{null, pKind}); | ||
464 | } | ||
465 | |||
466 | /** | ||
467 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
468 | * @return the Set of all values or empty set if there are no matches | ||
469 | * | ||
470 | */ | ||
471 | public Set<Spacecraft> getAllValuesOfSpacecraft(final SpacecraftOfKind.Match partialMatch) { | ||
472 | return rawStreamAllValuesOfSpacecraft(partialMatch.toArray()).collect(Collectors.toSet()); | ||
473 | } | ||
474 | |||
475 | /** | ||
476 | * Retrieve the set of values that occur in matches for Spacecraft. | ||
477 | * @return the Set of all values or empty set if there are no matches | ||
478 | * | ||
479 | */ | ||
480 | public Set<Spacecraft> getAllValuesOfSpacecraft(final SpacecraftKind pKind) { | ||
481 | return rawStreamAllValuesOfSpacecraft(new Object[]{null, pKind}).collect(Collectors.toSet()); | ||
482 | } | ||
483 | |||
484 | /** | ||
485 | * Retrieve the set of values that occur in matches for Kind. | ||
486 | * @return the Set of all values or empty set if there are no matches | ||
487 | * | ||
488 | */ | ||
489 | protected Stream<SpacecraftKind> rawStreamAllValuesOfKind(final Object[] parameters) { | ||
490 | return rawStreamAllValues(POSITION_KIND, parameters).map(SpacecraftKind.class::cast); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * Retrieve the set of values that occur in matches for Kind. | ||
495 | * @return the Set of all values or empty set if there are no matches | ||
496 | * | ||
497 | */ | ||
498 | public Set<SpacecraftKind> getAllValuesOfKind() { | ||
499 | return rawStreamAllValuesOfKind(emptyArray()).collect(Collectors.toSet()); | ||
500 | } | ||
501 | |||
502 | /** | ||
503 | * Retrieve the set of values that occur in matches for Kind. | ||
504 | * @return the Set of all values or empty set if there are no matches | ||
505 | * | ||
506 | */ | ||
507 | public Stream<SpacecraftKind> streamAllValuesOfKind() { | ||
508 | return rawStreamAllValuesOfKind(emptyArray()); | ||
509 | } | ||
510 | |||
511 | /** | ||
512 | * Retrieve the set of values that occur in matches for Kind. | ||
513 | * </p> | ||
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>. | ||
516 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
517 | * | ||
518 | * @return the Stream of all values or empty set if there are no matches | ||
519 | * | ||
520 | */ | ||
521 | public Stream<SpacecraftKind> streamAllValuesOfKind(final SpacecraftOfKind.Match partialMatch) { | ||
522 | return rawStreamAllValuesOfKind(partialMatch.toArray()); | ||
523 | } | ||
524 | |||
525 | /** | ||
526 | * Retrieve the set of values that occur in matches for Kind. | ||
527 | * </p> | ||
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>. | ||
530 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
531 | * | ||
532 | * @return the Stream of all values or empty set if there are no matches | ||
533 | * | ||
534 | */ | ||
535 | public Stream<SpacecraftKind> streamAllValuesOfKind(final Spacecraft pSpacecraft) { | ||
536 | return rawStreamAllValuesOfKind(new Object[]{pSpacecraft, null}); | ||
537 | } | ||
538 | |||
539 | /** | ||
540 | * Retrieve the set of values that occur in matches for Kind. | ||
541 | * @return the Set of all values or empty set if there are no matches | ||
542 | * | ||
543 | */ | ||
544 | public Set<SpacecraftKind> getAllValuesOfKind(final SpacecraftOfKind.Match partialMatch) { | ||
545 | return rawStreamAllValuesOfKind(partialMatch.toArray()).collect(Collectors.toSet()); | ||
546 | } | ||
547 | |||
548 | /** | ||
549 | * Retrieve the set of values that occur in matches for Kind. | ||
550 | * @return the Set of all values or empty set if there are no matches | ||
551 | * | ||
552 | */ | ||
553 | public Set<SpacecraftKind> getAllValuesOfKind(final Spacecraft pSpacecraft) { | ||
554 | return rawStreamAllValuesOfKind(new Object[]{pSpacecraft, null}).collect(Collectors.toSet()); | ||
555 | } | ||
556 | |||
557 | @Override | ||
558 | protected SpacecraftOfKind.Match tupleToMatch(final Tuple t) { | ||
559 | try { | ||
560 | return SpacecraftOfKind.Match.newMatch((Spacecraft) t.get(POSITION_SPACECRAFT), (SpacecraftKind) t.get(POSITION_KIND)); | ||
561 | } catch(ClassCastException e) { | ||
562 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
563 | return null; | ||
564 | } | ||
565 | } | ||
566 | |||
567 | @Override | ||
568 | protected SpacecraftOfKind.Match arrayToMatch(final Object[] match) { | ||
569 | try { | ||
570 | return SpacecraftOfKind.Match.newMatch((Spacecraft) match[POSITION_SPACECRAFT], (SpacecraftKind) match[POSITION_KIND]); | ||
571 | } catch(ClassCastException e) { | ||
572 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
573 | return null; | ||
574 | } | ||
575 | } | ||
576 | |||
577 | @Override | ||
578 | protected SpacecraftOfKind.Match arrayToMatchMutable(final Object[] match) { | ||
579 | try { | ||
580 | return SpacecraftOfKind.Match.newMutableMatch((Spacecraft) match[POSITION_SPACECRAFT], (SpacecraftKind) match[POSITION_KIND]); | ||
581 | } catch(ClassCastException e) { | ||
582 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
583 | return null; | ||
584 | } | ||
585 | } | ||
586 | |||
587 | /** | ||
588 | * @return the singleton instance of the query specification of this pattern | ||
589 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
590 | * | ||
591 | */ | ||
592 | public static IQuerySpecification<SpacecraftOfKind.Matcher> querySpecification() { | ||
593 | return SpacecraftOfKind.instance(); | ||
594 | } | ||
595 | } | ||
596 | |||
597 | private SpacecraftOfKind() { | ||
598 | super(GeneratedPQuery.INSTANCE); | ||
599 | } | ||
600 | |||
601 | /** | ||
602 | * @return the singleton instance of the query specification | ||
603 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
604 | * | ||
605 | */ | ||
606 | public static SpacecraftOfKind instance() { | ||
607 | try{ | ||
608 | return LazyHolder.INSTANCE; | ||
609 | } catch (ExceptionInInitializerError err) { | ||
610 | throw processInitializerError(err); | ||
611 | } | ||
612 | } | ||
613 | |||
614 | @Override | ||
615 | protected SpacecraftOfKind.Matcher instantiate(final ViatraQueryEngine engine) { | ||
616 | return SpacecraftOfKind.Matcher.on(engine); | ||
617 | } | ||
618 | |||
619 | @Override | ||
620 | public SpacecraftOfKind.Matcher instantiate() { | ||
621 | return SpacecraftOfKind.Matcher.create(); | ||
622 | } | ||
623 | |||
624 | @Override | ||
625 | public SpacecraftOfKind.Match newEmptyMatch() { | ||
626 | return SpacecraftOfKind.Match.newEmptyMatch(); | ||
627 | } | ||
628 | |||
629 | @Override | ||
630 | public SpacecraftOfKind.Match newMatch(final Object... parameters) { | ||
631 | return SpacecraftOfKind.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.satellite.SpacecraftKind) parameters[1]); | ||
632 | } | ||
633 | |||
634 | /** | ||
635 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind (visibility: PUBLIC, simpleName: SpacecraftOfKind, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
636 | * <b>not</b> at the class load time of the outer class, | ||
637 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind (visibility: PUBLIC, simpleName: SpacecraftOfKind, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
638 | * | ||
639 | * <p> This workaround is required e.g. to support recursion. | ||
640 | * | ||
641 | */ | ||
642 | private static class LazyHolder { | ||
643 | private static final SpacecraftOfKind INSTANCE = new SpacecraftOfKind(); | ||
644 | |||
645 | /** | ||
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. | ||
648 | * | ||
649 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
650 | * | ||
651 | */ | ||
652 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
653 | |||
654 | public static Object ensureInitialized() { | ||
655 | INSTANCE.ensureInitializedInternal(); | ||
656 | return null; | ||
657 | } | ||
658 | } | ||
659 | |||
660 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
661 | private static final SpacecraftOfKind.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
662 | |||
663 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
664 | |||
665 | private final PParameter parameter_Kind = new PParameter("Kind", "hu.bme.mit.inf.dslreasoner.domains.satellite.SpacecraftKind", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "SpacecraftKind")), PParameterDirection.INOUT); | ||
666 | |||
667 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Kind); | ||
668 | |||
669 | private GeneratedPQuery() { | ||
670 | super(PVisibility.PUBLIC); | ||
671 | } | ||
672 | |||
673 | @Override | ||
674 | public String getFullyQualifiedName() { | ||
675 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind"; | ||
676 | } | ||
677 | |||
678 | @Override | ||
679 | public List<String> getParameterNames() { | ||
680 | return Arrays.asList("Spacecraft","Kind"); | ||
681 | } | ||
682 | |||
683 | @Override | ||
684 | public List<PParameter> getParameters() { | ||
685 | return parameters; | ||
686 | } | ||
687 | |||
688 | @Override | ||
689 | public Set<PBody> doGetContainedBodies() { | ||
690 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
691 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
692 | { | ||
693 | PBody body = new PBody(this); | ||
694 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
695 | PVariable var_Kind = body.getOrCreateVariableByName("Kind"); | ||
696 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
697 | new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
698 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
699 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
700 | new ExportedParameter(body, var_Kind, parameter_Kind) | ||
701 | )); | ||
702 | // CubeSat3U(Spacecraft) | ||
703 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); | ||
704 | // Kind == SpacecraftKind::CubeSat3U | ||
705 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
706 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat3U").getInstance()); | ||
707 | new Equality(body, var_Kind, var__virtual_0_); | ||
708 | bodies.add(body); | ||
709 | } | ||
710 | { | ||
711 | PBody body = new PBody(this); | ||
712 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
713 | PVariable var_Kind = body.getOrCreateVariableByName("Kind"); | ||
714 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
715 | new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
716 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
717 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
718 | new ExportedParameter(body, var_Kind, parameter_Kind) | ||
719 | )); | ||
720 | // CubeSat6U(Spacecraft) | ||
721 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat6U"))); | ||
722 | // Kind == SpacecraftKind::CubeSat6U | ||
723 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
724 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat6U").getInstance()); | ||
725 | new Equality(body, var_Kind, var__virtual_0_); | ||
726 | bodies.add(body); | ||
727 | } | ||
728 | { | ||
729 | PBody body = new PBody(this); | ||
730 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
731 | PVariable var_Kind = body.getOrCreateVariableByName("Kind"); | ||
732 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
733 | new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
734 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
735 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
736 | new ExportedParameter(body, var_Kind, parameter_Kind) | ||
737 | )); | ||
738 | // SmallSat(Spacecraft) | ||
739 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat"))); | ||
740 | // Kind == SpacecraftKind::SmallSat | ||
741 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
742 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "SmallSat").getInstance()); | ||
743 | new Equality(body, var_Kind, var__virtual_0_); | ||
744 | bodies.add(body); | ||
745 | } | ||
746 | { | ||
747 | PAnnotation annotation = new PAnnotation("QueryBasedFeature"); | ||
748 | annotation.addAttribute("feature", "kind"); | ||
749 | addAnnotation(annotation); | ||
750 | } | ||
751 | return bodies; | ||
752 | } | ||
753 | } | ||
754 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/ThreeUCubeSatWithNonUhfCrossLink.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/ThreeUCubeSatWithNonUhfCrossLink.java index 6500c9d3..6408033b 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/ThreeUCubeSatWithNonUhfCrossLink.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/ThreeUCubeSatWithNonUhfCrossLink.java | |||
@@ -3,7 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | 4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; |
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.CubeSat3U; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; | 7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; |
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; | 8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; |
9 | import java.util.Arrays; | 9 | import java.util.Arrays; |
@@ -18,7 +18,6 @@ import java.util.stream.Collectors; | |||
18 | import java.util.stream.Stream; | 18 | import java.util.stream.Stream; |
19 | import org.apache.log4j.Logger; | 19 | import org.apache.log4j.Logger; |
20 | import org.eclipse.emf.ecore.EClass; | 20 | import org.eclipse.emf.ecore.EClass; |
21 | import org.eclipse.emf.ecore.EDataType; | ||
22 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | 21 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; |
23 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | 22 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; |
24 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | 23 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; |
@@ -27,7 +26,6 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificat | |||
27 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | 26 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; |
28 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | 27 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; |
29 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | 28 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
30 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
31 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | 29 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; |
32 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
@@ -37,7 +35,6 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterRe | |||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | 35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; |
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | 37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; |
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
42 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
43 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
@@ -56,8 +53,7 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | |||
56 | * | 53 | * |
57 | * {@literal @}Constraint(severity = "error", key = {Sat}, | 54 | * {@literal @}Constraint(severity = "error", key = {Sat}, |
58 | * message = "3U CubeSats can only cross-link using UHF.") | 55 | * message = "3U CubeSats can only cross-link using UHF.") |
59 | * pattern threeUCubeSatWithNonUhfCrossLink(Sat : Spacecraft) { | 56 | * pattern threeUCubeSatWithNonUhfCrossLink(Sat : CubeSat3U) { |
60 | * Spacecraft.kind(Sat, SpacecraftKind::CubeSat3U); | ||
61 | * CommunicatingElement.commSubsystem(Sat, SourceComm); | 57 | * CommunicatingElement.commSubsystem(Sat, SourceComm); |
62 | * neg find commSubsystemBandUhf(SourceComm); | 58 | * neg find commSubsystemBandUhf(SourceComm); |
63 | * DirectedCommunicationLink.source(Link, SourceComm); | 59 | * DirectedCommunicationLink.source(Link, SourceComm); |
@@ -86,11 +82,11 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
86 | * | 82 | * |
87 | */ | 83 | */ |
88 | public static abstract class Match extends BasePatternMatch { | 84 | public static abstract class Match extends BasePatternMatch { |
89 | private Spacecraft fSat; | 85 | private CubeSat3U fSat; |
90 | 86 | ||
91 | private static List<String> parameterNames = makeImmutableList("Sat"); | 87 | private static List<String> parameterNames = makeImmutableList("Sat"); |
92 | 88 | ||
93 | private Match(final Spacecraft pSat) { | 89 | private Match(final CubeSat3U pSat) { |
94 | this.fSat = pSat; | 90 | this.fSat = pSat; |
95 | } | 91 | } |
96 | 92 | ||
@@ -100,7 +96,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
100 | return null; | 96 | return null; |
101 | } | 97 | } |
102 | 98 | ||
103 | public Spacecraft getSat() { | 99 | public CubeSat3U getSat() { |
104 | return this.fSat; | 100 | return this.fSat; |
105 | } | 101 | } |
106 | 102 | ||
@@ -108,13 +104,13 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
108 | public boolean set(final String parameterName, final Object newValue) { | 104 | public boolean set(final String parameterName, final Object newValue) { |
109 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 105 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
110 | if ("Sat".equals(parameterName) ) { | 106 | if ("Sat".equals(parameterName) ) { |
111 | this.fSat = (Spacecraft) newValue; | 107 | this.fSat = (CubeSat3U) newValue; |
112 | return true; | 108 | return true; |
113 | } | 109 | } |
114 | return false; | 110 | return false; |
115 | } | 111 | } |
116 | 112 | ||
117 | public void setSat(final Spacecraft pSat) { | 113 | public void setSat(final CubeSat3U pSat) { |
118 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 114 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
119 | this.fSat = pSat; | 115 | this.fSat = pSat; |
120 | } | 116 | } |
@@ -195,7 +191,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
195 | * @return the new, mutable (partial) match object. | 191 | * @return the new, mutable (partial) match object. |
196 | * | 192 | * |
197 | */ | 193 | */ |
198 | public static ThreeUCubeSatWithNonUhfCrossLink.Match newMutableMatch(final Spacecraft pSat) { | 194 | public static ThreeUCubeSatWithNonUhfCrossLink.Match newMutableMatch(final CubeSat3U pSat) { |
199 | return new Mutable(pSat); | 195 | return new Mutable(pSat); |
200 | } | 196 | } |
201 | 197 | ||
@@ -207,12 +203,12 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
207 | * @return the (partial) match object. | 203 | * @return the (partial) match object. |
208 | * | 204 | * |
209 | */ | 205 | */ |
210 | public static ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final Spacecraft pSat) { | 206 | public static ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final CubeSat3U pSat) { |
211 | return new Immutable(pSat); | 207 | return new Immutable(pSat); |
212 | } | 208 | } |
213 | 209 | ||
214 | private static final class Mutable extends ThreeUCubeSatWithNonUhfCrossLink.Match { | 210 | private static final class Mutable extends ThreeUCubeSatWithNonUhfCrossLink.Match { |
215 | Mutable(final Spacecraft pSat) { | 211 | Mutable(final CubeSat3U pSat) { |
216 | super(pSat); | 212 | super(pSat); |
217 | } | 213 | } |
218 | 214 | ||
@@ -223,7 +219,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
223 | } | 219 | } |
224 | 220 | ||
225 | private static final class Immutable extends ThreeUCubeSatWithNonUhfCrossLink.Match { | 221 | private static final class Immutable extends ThreeUCubeSatWithNonUhfCrossLink.Match { |
226 | Immutable(final Spacecraft pSat) { | 222 | Immutable(final CubeSat3U pSat) { |
227 | super(pSat); | 223 | super(pSat); |
228 | } | 224 | } |
229 | 225 | ||
@@ -250,8 +246,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
250 | * | 246 | * |
251 | * {@literal @}Constraint(severity = "error", key = {Sat}, | 247 | * {@literal @}Constraint(severity = "error", key = {Sat}, |
252 | * message = "3U CubeSats can only cross-link using UHF.") | 248 | * message = "3U CubeSats can only cross-link using UHF.") |
253 | * pattern threeUCubeSatWithNonUhfCrossLink(Sat : Spacecraft) { | 249 | * pattern threeUCubeSatWithNonUhfCrossLink(Sat : CubeSat3U) { |
254 | * Spacecraft.kind(Sat, SpacecraftKind::CubeSat3U); | ||
255 | * CommunicatingElement.commSubsystem(Sat, SourceComm); | 250 | * CommunicatingElement.commSubsystem(Sat, SourceComm); |
256 | * neg find commSubsystemBandUhf(SourceComm); | 251 | * neg find commSubsystemBandUhf(SourceComm); |
257 | * DirectedCommunicationLink.source(Link, SourceComm); | 252 | * DirectedCommunicationLink.source(Link, SourceComm); |
@@ -315,7 +310,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
315 | * @return matches represented as a Match object. | 310 | * @return matches represented as a Match object. |
316 | * | 311 | * |
317 | */ | 312 | */ |
318 | public Collection<ThreeUCubeSatWithNonUhfCrossLink.Match> getAllMatches(final Spacecraft pSat) { | 313 | public Collection<ThreeUCubeSatWithNonUhfCrossLink.Match> getAllMatches(final CubeSat3U pSat) { |
319 | return rawStreamAllMatches(new Object[]{pSat}).collect(Collectors.toSet()); | 314 | return rawStreamAllMatches(new Object[]{pSat}).collect(Collectors.toSet()); |
320 | } | 315 | } |
321 | 316 | ||
@@ -329,7 +324,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
329 | * @return a stream of matches represented as a Match object. | 324 | * @return a stream of matches represented as a Match object. |
330 | * | 325 | * |
331 | */ | 326 | */ |
332 | public Stream<ThreeUCubeSatWithNonUhfCrossLink.Match> streamAllMatches(final Spacecraft pSat) { | 327 | public Stream<ThreeUCubeSatWithNonUhfCrossLink.Match> streamAllMatches(final CubeSat3U pSat) { |
333 | return rawStreamAllMatches(new Object[]{pSat}); | 328 | return rawStreamAllMatches(new Object[]{pSat}); |
334 | } | 329 | } |
335 | 330 | ||
@@ -340,7 +335,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
340 | * @return a match represented as a Match object, or null if no match is found. | 335 | * @return a match represented as a Match object, or null if no match is found. |
341 | * | 336 | * |
342 | */ | 337 | */ |
343 | public Optional<ThreeUCubeSatWithNonUhfCrossLink.Match> getOneArbitraryMatch(final Spacecraft pSat) { | 338 | public Optional<ThreeUCubeSatWithNonUhfCrossLink.Match> getOneArbitraryMatch(final CubeSat3U pSat) { |
344 | return rawGetOneArbitraryMatch(new Object[]{pSat}); | 339 | return rawGetOneArbitraryMatch(new Object[]{pSat}); |
345 | } | 340 | } |
346 | 341 | ||
@@ -351,7 +346,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
351 | * @return true if the input is a valid (partial) match of the pattern. | 346 | * @return true if the input is a valid (partial) match of the pattern. |
352 | * | 347 | * |
353 | */ | 348 | */ |
354 | public boolean hasMatch(final Spacecraft pSat) { | 349 | public boolean hasMatch(final CubeSat3U pSat) { |
355 | return rawHasMatch(new Object[]{pSat}); | 350 | return rawHasMatch(new Object[]{pSat}); |
356 | } | 351 | } |
357 | 352 | ||
@@ -361,7 +356,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
361 | * @return the number of pattern matches found. | 356 | * @return the number of pattern matches found. |
362 | * | 357 | * |
363 | */ | 358 | */ |
364 | public int countMatches(final Spacecraft pSat) { | 359 | public int countMatches(final CubeSat3U pSat) { |
365 | return rawCountMatches(new Object[]{pSat}); | 360 | return rawCountMatches(new Object[]{pSat}); |
366 | } | 361 | } |
367 | 362 | ||
@@ -373,7 +368,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
373 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | 368 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked |
374 | * | 369 | * |
375 | */ | 370 | */ |
376 | public boolean forOneArbitraryMatch(final Spacecraft pSat, final Consumer<? super ThreeUCubeSatWithNonUhfCrossLink.Match> processor) { | 371 | public boolean forOneArbitraryMatch(final CubeSat3U pSat, final Consumer<? super ThreeUCubeSatWithNonUhfCrossLink.Match> processor) { |
377 | return rawForOneArbitraryMatch(new Object[]{pSat}, processor); | 372 | return rawForOneArbitraryMatch(new Object[]{pSat}, processor); |
378 | } | 373 | } |
379 | 374 | ||
@@ -385,7 +380,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
385 | * @return the (partial) match object. | 380 | * @return the (partial) match object. |
386 | * | 381 | * |
387 | */ | 382 | */ |
388 | public ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final Spacecraft pSat) { | 383 | public ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final CubeSat3U pSat) { |
389 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch(pSat); | 384 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch(pSat); |
390 | } | 385 | } |
391 | 386 | ||
@@ -394,8 +389,8 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
394 | * @return the Set of all values or empty set if there are no matches | 389 | * @return the Set of all values or empty set if there are no matches |
395 | * | 390 | * |
396 | */ | 391 | */ |
397 | protected Stream<Spacecraft> rawStreamAllValuesOfSat(final Object[] parameters) { | 392 | protected Stream<CubeSat3U> rawStreamAllValuesOfSat(final Object[] parameters) { |
398 | return rawStreamAllValues(POSITION_SAT, parameters).map(Spacecraft.class::cast); | 393 | return rawStreamAllValues(POSITION_SAT, parameters).map(CubeSat3U.class::cast); |
399 | } | 394 | } |
400 | 395 | ||
401 | /** | 396 | /** |
@@ -403,7 +398,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
403 | * @return the Set of all values or empty set if there are no matches | 398 | * @return the Set of all values or empty set if there are no matches |
404 | * | 399 | * |
405 | */ | 400 | */ |
406 | public Set<Spacecraft> getAllValuesOfSat() { | 401 | public Set<CubeSat3U> getAllValuesOfSat() { |
407 | return rawStreamAllValuesOfSat(emptyArray()).collect(Collectors.toSet()); | 402 | return rawStreamAllValuesOfSat(emptyArray()).collect(Collectors.toSet()); |
408 | } | 403 | } |
409 | 404 | ||
@@ -412,14 +407,14 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
412 | * @return the Set of all values or empty set if there are no matches | 407 | * @return the Set of all values or empty set if there are no matches |
413 | * | 408 | * |
414 | */ | 409 | */ |
415 | public Stream<Spacecraft> streamAllValuesOfSat() { | 410 | public Stream<CubeSat3U> streamAllValuesOfSat() { |
416 | return rawStreamAllValuesOfSat(emptyArray()); | 411 | return rawStreamAllValuesOfSat(emptyArray()); |
417 | } | 412 | } |
418 | 413 | ||
419 | @Override | 414 | @Override |
420 | protected ThreeUCubeSatWithNonUhfCrossLink.Match tupleToMatch(final Tuple t) { | 415 | protected ThreeUCubeSatWithNonUhfCrossLink.Match tupleToMatch(final Tuple t) { |
421 | try { | 416 | try { |
422 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((Spacecraft) t.get(POSITION_SAT)); | 417 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((CubeSat3U) t.get(POSITION_SAT)); |
423 | } catch(ClassCastException e) { | 418 | } catch(ClassCastException e) { |
424 | LOGGER.error("Element(s) in tuple not properly typed!",e); | 419 | LOGGER.error("Element(s) in tuple not properly typed!",e); |
425 | return null; | 420 | return null; |
@@ -429,7 +424,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
429 | @Override | 424 | @Override |
430 | protected ThreeUCubeSatWithNonUhfCrossLink.Match arrayToMatch(final Object[] match) { | 425 | protected ThreeUCubeSatWithNonUhfCrossLink.Match arrayToMatch(final Object[] match) { |
431 | try { | 426 | try { |
432 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((Spacecraft) match[POSITION_SAT]); | 427 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((CubeSat3U) match[POSITION_SAT]); |
433 | } catch(ClassCastException e) { | 428 | } catch(ClassCastException e) { |
434 | LOGGER.error("Element(s) in array not properly typed!",e); | 429 | LOGGER.error("Element(s) in array not properly typed!",e); |
435 | return null; | 430 | return null; |
@@ -439,7 +434,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
439 | @Override | 434 | @Override |
440 | protected ThreeUCubeSatWithNonUhfCrossLink.Match arrayToMatchMutable(final Object[] match) { | 435 | protected ThreeUCubeSatWithNonUhfCrossLink.Match arrayToMatchMutable(final Object[] match) { |
441 | try { | 436 | try { |
442 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMutableMatch((Spacecraft) match[POSITION_SAT]); | 437 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMutableMatch((CubeSat3U) match[POSITION_SAT]); |
443 | } catch(ClassCastException e) { | 438 | } catch(ClassCastException e) { |
444 | LOGGER.error("Element(s) in array not properly typed!",e); | 439 | LOGGER.error("Element(s) in array not properly typed!",e); |
445 | return null; | 440 | return null; |
@@ -490,7 +485,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
490 | 485 | ||
491 | @Override | 486 | @Override |
492 | public ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final Object... parameters) { | 487 | public ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final Object... parameters) { |
493 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0]); | 488 | return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.CubeSat3U) parameters[0]); |
494 | } | 489 | } |
495 | 490 | ||
496 | /** | 491 | /** |
@@ -522,7 +517,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
522 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | 517 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { |
523 | private static final ThreeUCubeSatWithNonUhfCrossLink.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | 518 | private static final ThreeUCubeSatWithNonUhfCrossLink.GeneratedPQuery INSTANCE = new GeneratedPQuery(); |
524 | 519 | ||
525 | private final PParameter parameter_Sat = new PParameter("Sat", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | 520 | private final PParameter parameter_Sat = new PParameter("Sat", "hu.bme.mit.inf.dslreasoner.domains.satellite.CubeSat3U", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CubeSat3U")), PParameterDirection.INOUT); |
526 | 521 | ||
527 | private final List<PParameter> parameters = Arrays.asList(parameter_Sat); | 522 | private final List<PParameter> parameters = Arrays.asList(parameter_Sat); |
528 | 523 | ||
@@ -556,44 +551,36 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer | |||
556 | PVariable var_Link = body.getOrCreateVariableByName("Link"); | 551 | PVariable var_Link = body.getOrCreateVariableByName("Link"); |
557 | PVariable var_TargetComm = body.getOrCreateVariableByName("TargetComm"); | 552 | PVariable var_TargetComm = body.getOrCreateVariableByName("TargetComm"); |
558 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | 553 | PVariable var_Target = body.getOrCreateVariableByName("Target"); |
559 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | 554 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); |
560 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 555 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
561 | new ExportedParameter(body, var_Sat, parameter_Sat) | 556 | new ExportedParameter(body, var_Sat, parameter_Sat) |
562 | )); | 557 | )); |
563 | // Spacecraft.kind(Sat, SpacecraftKind::CubeSat3U) | ||
564 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
565 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat3U").getInstance()); | ||
566 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
567 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
568 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); | ||
569 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
570 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
571 | // CommunicatingElement.commSubsystem(Sat, SourceComm) | 558 | // CommunicatingElement.commSubsystem(Sat, SourceComm) |
572 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | 559 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
573 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | 560 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); |
574 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | 561 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); |
575 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 562 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); |
576 | new Equality(body, var__virtual_2_, var_SourceComm); | 563 | new Equality(body, var__virtual_0_, var_SourceComm); |
577 | // neg find commSubsystemBandUhf(SourceComm) | 564 | // neg find commSubsystemBandUhf(SourceComm) |
578 | new NegativePatternCall(body, Tuples.flatTupleOf(var_SourceComm), CommSubsystemBandUhf.instance().getInternalQueryRepresentation()); | 565 | new NegativePatternCall(body, Tuples.flatTupleOf(var_SourceComm), CommSubsystemBandUhf.instance().getInternalQueryRepresentation()); |
579 | // DirectedCommunicationLink.source(Link, SourceComm) | 566 | // DirectedCommunicationLink.source(Link, SourceComm) |
580 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | 567 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); |
581 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | 568 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); |
582 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source"))); | 569 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source"))); |
583 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 570 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); |
584 | new Equality(body, var__virtual_3_, var_SourceComm); | 571 | new Equality(body, var__virtual_1_, var_SourceComm); |
585 | // DirectedCommunicationLink.target(Link, TargetComm) | 572 | // DirectedCommunicationLink.target(Link, TargetComm) |
586 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | 573 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); |
587 | PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); | 574 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); |
588 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); | 575 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); |
589 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 576 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); |
590 | new Equality(body, var__virtual_4_, var_TargetComm); | 577 | new Equality(body, var__virtual_2_, var_TargetComm); |
591 | // CommunicatingElement.commSubsystem(Target, TargetComm) | 578 | // CommunicatingElement.commSubsystem(Target, TargetComm) |
592 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | 579 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
593 | PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); | 580 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); |
594 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | 581 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); |
595 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | 582 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); |
596 | new Equality(body, var__virtual_5_, var_TargetComm); | 583 | new Equality(body, var__virtual_3_, var_TargetComm); |
597 | // neg find groundStationNetwork(Target) | 584 | // neg find groundStationNetwork(Target) |
598 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Target), GroundStationNetwork.instance().getInternalQueryRepresentation()); | 585 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Target), GroundStationNetwork.instance().getInternalQueryRepresentation()); |
599 | bodies.add(body); | 586 | bodies.add(body); |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/TimeMetric.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/TimeMetric.java deleted file mode 100644 index 45d4cc35..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/TimeMetric.java +++ /dev/null | |||
@@ -1,544 +0,0 @@ | |||
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; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.Collection; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Objects; | ||
12 | import java.util.Optional; | ||
13 | import java.util.Set; | ||
14 | import java.util.function.Consumer; | ||
15 | import java.util.stream.Collectors; | ||
16 | import java.util.stream.Stream; | ||
17 | import org.apache.log4j.Logger; | ||
18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
21 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
39 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
40 | |||
41 | /** | ||
42 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
43 | * | ||
44 | * <p>Original source: | ||
45 | * <code><pre> | ||
46 | * // Time | ||
47 | * | ||
48 | * pattern timeMetric(Time : java Double) { | ||
49 | * Time == sum find missionTime(_, #_); | ||
50 | * } | ||
51 | * </pre></code> | ||
52 | * | ||
53 | * @see Matcher | ||
54 | * @see Match | ||
55 | * | ||
56 | */ | ||
57 | @SuppressWarnings("all") | ||
58 | public final class TimeMetric extends BaseGeneratedEMFQuerySpecification<TimeMetric.Matcher> { | ||
59 | /** | ||
60 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric pattern, | ||
61 | * to be used in conjunction with {@link Matcher}. | ||
62 | * | ||
63 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
64 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
65 | * usable to represent a match of the pattern in the result of a query, | ||
66 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
67 | * | ||
68 | * @see Matcher | ||
69 | * | ||
70 | */ | ||
71 | public static abstract class Match extends BasePatternMatch { | ||
72 | private Double fTime; | ||
73 | |||
74 | private static List<String> parameterNames = makeImmutableList("Time"); | ||
75 | |||
76 | private Match(final Double pTime) { | ||
77 | this.fTime = pTime; | ||
78 | } | ||
79 | |||
80 | @Override | ||
81 | public Object get(final String parameterName) { | ||
82 | if ("Time".equals(parameterName)) return this.fTime; | ||
83 | return null; | ||
84 | } | ||
85 | |||
86 | public Double getTime() { | ||
87 | return this.fTime; | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public boolean set(final String parameterName, final Object newValue) { | ||
92 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
93 | if ("Time".equals(parameterName) ) { | ||
94 | this.fTime = (Double) newValue; | ||
95 | return true; | ||
96 | } | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | public void setTime(final Double pTime) { | ||
101 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
102 | this.fTime = pTime; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String patternName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> parameterNames() { | ||
112 | return TimeMetric.Match.parameterNames; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Object[] toArray() { | ||
117 | return new Object[]{fTime}; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public TimeMetric.Match toImmutable() { | ||
122 | return isMutable() ? newMatch(fTime) : this; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public String prettyPrint() { | ||
127 | StringBuilder result = new StringBuilder(); | ||
128 | result.append("\"Time\"=" + prettyPrintValue(fTime)); | ||
129 | return result.toString(); | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public int hashCode() { | ||
134 | return Objects.hash(fTime); | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public boolean equals(final Object obj) { | ||
139 | if (this == obj) | ||
140 | return true; | ||
141 | if (obj == null) { | ||
142 | return false; | ||
143 | } | ||
144 | if ((obj instanceof TimeMetric.Match)) { | ||
145 | TimeMetric.Match other = (TimeMetric.Match) obj; | ||
146 | return Objects.equals(fTime, other.fTime); | ||
147 | } else { | ||
148 | // this should be infrequent | ||
149 | if (!(obj instanceof IPatternMatch)) { | ||
150 | return false; | ||
151 | } | ||
152 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
153 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | @Override | ||
158 | public TimeMetric specification() { | ||
159 | return TimeMetric.instance(); | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * Returns an empty, mutable match. | ||
164 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
165 | * | ||
166 | * @return the empty match. | ||
167 | * | ||
168 | */ | ||
169 | public static TimeMetric.Match newEmptyMatch() { | ||
170 | return new Mutable(null); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * Returns a mutable (partial) match. | ||
175 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
176 | * | ||
177 | * @param pTime the fixed value of pattern parameter Time, or null if not bound. | ||
178 | * @return the new, mutable (partial) match object. | ||
179 | * | ||
180 | */ | ||
181 | public static TimeMetric.Match newMutableMatch(final Double pTime) { | ||
182 | return new Mutable(pTime); | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | * Returns a new (partial) match. | ||
187 | * This can be used e.g. to call the matcher with a partial match. | ||
188 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
189 | * @param pTime the fixed value of pattern parameter Time, or null if not bound. | ||
190 | * @return the (partial) match object. | ||
191 | * | ||
192 | */ | ||
193 | public static TimeMetric.Match newMatch(final Double pTime) { | ||
194 | return new Immutable(pTime); | ||
195 | } | ||
196 | |||
197 | private static final class Mutable extends TimeMetric.Match { | ||
198 | Mutable(final Double pTime) { | ||
199 | super(pTime); | ||
200 | } | ||
201 | |||
202 | @Override | ||
203 | public boolean isMutable() { | ||
204 | return true; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | private static final class Immutable extends TimeMetric.Match { | ||
209 | Immutable(final Double pTime) { | ||
210 | super(pTime); | ||
211 | } | ||
212 | |||
213 | @Override | ||
214 | public boolean isMutable() { | ||
215 | return false; | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric pattern, | ||
222 | * providing pattern-specific query methods. | ||
223 | * | ||
224 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
225 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
226 | * | ||
227 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
228 | * | ||
229 | * <p>Original source: | ||
230 | * <code><pre> | ||
231 | * // Time | ||
232 | * | ||
233 | * pattern timeMetric(Time : java Double) { | ||
234 | * Time == sum find missionTime(_, #_); | ||
235 | * } | ||
236 | * </pre></code> | ||
237 | * | ||
238 | * @see Match | ||
239 | * @see TimeMetric | ||
240 | * | ||
241 | */ | ||
242 | public static class Matcher extends BaseMatcher<TimeMetric.Match> { | ||
243 | /** | ||
244 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
245 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
246 | * | ||
247 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
248 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
249 | * | ||
250 | */ | ||
251 | public static TimeMetric.Matcher on(final ViatraQueryEngine engine) { | ||
252 | // check if matcher already exists | ||
253 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
254 | if (matcher == null) { | ||
255 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
256 | } | ||
257 | return matcher; | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
262 | * @return an initialized matcher | ||
263 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
264 | * | ||
265 | */ | ||
266 | public static TimeMetric.Matcher create() { | ||
267 | return new Matcher(); | ||
268 | } | ||
269 | |||
270 | private static final int POSITION_TIME = 0; | ||
271 | |||
272 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TimeMetric.Matcher.class); | ||
273 | |||
274 | /** | ||
275 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
276 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
277 | * | ||
278 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
279 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
280 | * | ||
281 | */ | ||
282 | private Matcher() { | ||
283 | super(querySpecification()); | ||
284 | } | ||
285 | |||
286 | /** | ||
287 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
288 | * @param pTime the fixed value of pattern parameter Time, or null if not bound. | ||
289 | * @return matches represented as a Match object. | ||
290 | * | ||
291 | */ | ||
292 | public Collection<TimeMetric.Match> getAllMatches(final Double pTime) { | ||
293 | return rawStreamAllMatches(new Object[]{pTime}).collect(Collectors.toSet()); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
298 | * </p> | ||
299 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
300 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
301 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
302 | * @param pTime the fixed value of pattern parameter Time, or null if not bound. | ||
303 | * @return a stream of matches represented as a Match object. | ||
304 | * | ||
305 | */ | ||
306 | public Stream<TimeMetric.Match> streamAllMatches(final Double pTime) { | ||
307 | return rawStreamAllMatches(new Object[]{pTime}); | ||
308 | } | ||
309 | |||
310 | /** | ||
311 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
312 | * Neither determinism nor randomness of selection is guaranteed. | ||
313 | * @param pTime the fixed value of pattern parameter Time, or null if not bound. | ||
314 | * @return a match represented as a Match object, or null if no match is found. | ||
315 | * | ||
316 | */ | ||
317 | public Optional<TimeMetric.Match> getOneArbitraryMatch(final Double pTime) { | ||
318 | return rawGetOneArbitraryMatch(new Object[]{pTime}); | ||
319 | } | ||
320 | |||
321 | /** | ||
322 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
323 | * under any possible substitution of the unspecified parameters (if any). | ||
324 | * @param pTime the fixed value of pattern parameter Time, or null if not bound. | ||
325 | * @return true if the input is a valid (partial) match of the pattern. | ||
326 | * | ||
327 | */ | ||
328 | public boolean hasMatch(final Double pTime) { | ||
329 | return rawHasMatch(new Object[]{pTime}); | ||
330 | } | ||
331 | |||
332 | /** | ||
333 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
334 | * @param pTime the fixed value of pattern parameter Time, or null if not bound. | ||
335 | * @return the number of pattern matches found. | ||
336 | * | ||
337 | */ | ||
338 | public int countMatches(final Double pTime) { | ||
339 | return rawCountMatches(new Object[]{pTime}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
344 | * Neither determinism nor randomness of selection is guaranteed. | ||
345 | * @param pTime the fixed value of pattern parameter Time, or null if not bound. | ||
346 | * @param processor the action that will process the selected match. | ||
347 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
348 | * | ||
349 | */ | ||
350 | public boolean forOneArbitraryMatch(final Double pTime, final Consumer<? super TimeMetric.Match> processor) { | ||
351 | return rawForOneArbitraryMatch(new Object[]{pTime}, processor); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * Returns a new (partial) match. | ||
356 | * This can be used e.g. to call the matcher with a partial match. | ||
357 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
358 | * @param pTime the fixed value of pattern parameter Time, or null if not bound. | ||
359 | * @return the (partial) match object. | ||
360 | * | ||
361 | */ | ||
362 | public TimeMetric.Match newMatch(final Double pTime) { | ||
363 | return TimeMetric.Match.newMatch(pTime); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Retrieve the set of values that occur in matches for Time. | ||
368 | * @return the Set of all values or empty set if there are no matches | ||
369 | * | ||
370 | */ | ||
371 | protected Stream<Double> rawStreamAllValuesOfTime(final Object[] parameters) { | ||
372 | return rawStreamAllValues(POSITION_TIME, parameters).map(Double.class::cast); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * Retrieve the set of values that occur in matches for Time. | ||
377 | * @return the Set of all values or empty set if there are no matches | ||
378 | * | ||
379 | */ | ||
380 | public Set<Double> getAllValuesOfTime() { | ||
381 | return rawStreamAllValuesOfTime(emptyArray()).collect(Collectors.toSet()); | ||
382 | } | ||
383 | |||
384 | /** | ||
385 | * Retrieve the set of values that occur in matches for Time. | ||
386 | * @return the Set of all values or empty set if there are no matches | ||
387 | * | ||
388 | */ | ||
389 | public Stream<Double> streamAllValuesOfTime() { | ||
390 | return rawStreamAllValuesOfTime(emptyArray()); | ||
391 | } | ||
392 | |||
393 | @Override | ||
394 | protected TimeMetric.Match tupleToMatch(final Tuple t) { | ||
395 | try { | ||
396 | return TimeMetric.Match.newMatch((Double) t.get(POSITION_TIME)); | ||
397 | } catch(ClassCastException e) { | ||
398 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
399 | return null; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | @Override | ||
404 | protected TimeMetric.Match arrayToMatch(final Object[] match) { | ||
405 | try { | ||
406 | return TimeMetric.Match.newMatch((Double) match[POSITION_TIME]); | ||
407 | } catch(ClassCastException e) { | ||
408 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
409 | return null; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | @Override | ||
414 | protected TimeMetric.Match arrayToMatchMutable(final Object[] match) { | ||
415 | try { | ||
416 | return TimeMetric.Match.newMutableMatch((Double) match[POSITION_TIME]); | ||
417 | } catch(ClassCastException e) { | ||
418 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
419 | return null; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | /** | ||
424 | * @return the singleton instance of the query specification of this pattern | ||
425 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
426 | * | ||
427 | */ | ||
428 | public static IQuerySpecification<TimeMetric.Matcher> querySpecification() { | ||
429 | return TimeMetric.instance(); | ||
430 | } | ||
431 | } | ||
432 | |||
433 | private TimeMetric() { | ||
434 | super(GeneratedPQuery.INSTANCE); | ||
435 | } | ||
436 | |||
437 | /** | ||
438 | * @return the singleton instance of the query specification | ||
439 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
440 | * | ||
441 | */ | ||
442 | public static TimeMetric instance() { | ||
443 | try{ | ||
444 | return LazyHolder.INSTANCE; | ||
445 | } catch (ExceptionInInitializerError err) { | ||
446 | throw processInitializerError(err); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | @Override | ||
451 | protected TimeMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
452 | return TimeMetric.Matcher.on(engine); | ||
453 | } | ||
454 | |||
455 | @Override | ||
456 | public TimeMetric.Matcher instantiate() { | ||
457 | return TimeMetric.Matcher.create(); | ||
458 | } | ||
459 | |||
460 | @Override | ||
461 | public TimeMetric.Match newEmptyMatch() { | ||
462 | return TimeMetric.Match.newEmptyMatch(); | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | public TimeMetric.Match newMatch(final Object... parameters) { | ||
467 | return TimeMetric.Match.newMatch((java.lang.Double) parameters[0]); | ||
468 | } | ||
469 | |||
470 | /** | ||
471 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric (visibility: PUBLIC, simpleName: TimeMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
472 | * <b>not</b> at the class load time of the outer class, | ||
473 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric (visibility: PUBLIC, simpleName: TimeMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
474 | * | ||
475 | * <p> This workaround is required e.g. to support recursion. | ||
476 | * | ||
477 | */ | ||
478 | private static class LazyHolder { | ||
479 | private static final TimeMetric INSTANCE = new TimeMetric(); | ||
480 | |||
481 | /** | ||
482 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
483 | * This initialization order is required to support indirect recursion. | ||
484 | * | ||
485 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
486 | * | ||
487 | */ | ||
488 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
489 | |||
490 | public static Object ensureInitialized() { | ||
491 | INSTANCE.ensureInitializedInternal(); | ||
492 | return null; | ||
493 | } | ||
494 | } | ||
495 | |||
496 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
497 | private static final TimeMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
498 | |||
499 | private final PParameter parameter_Time = new PParameter("Time", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
500 | |||
501 | private final List<PParameter> parameters = Arrays.asList(parameter_Time); | ||
502 | |||
503 | private GeneratedPQuery() { | ||
504 | super(PVisibility.PUBLIC); | ||
505 | } | ||
506 | |||
507 | @Override | ||
508 | public String getFullyQualifiedName() { | ||
509 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric"; | ||
510 | } | ||
511 | |||
512 | @Override | ||
513 | public List<String> getParameterNames() { | ||
514 | return Arrays.asList("Time"); | ||
515 | } | ||
516 | |||
517 | @Override | ||
518 | public List<PParameter> getParameters() { | ||
519 | return parameters; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public Set<PBody> doGetContainedBodies() { | ||
524 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
525 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
526 | { | ||
527 | PBody body = new PBody(this); | ||
528 | PVariable var_Time = body.getOrCreateVariableByName("Time"); | ||
529 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
530 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
531 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Time), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
532 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
533 | new ExportedParameter(body, var_Time, parameter_Time) | ||
534 | )); | ||
535 | // Time == sum find missionTime(_, #_) | ||
536 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
537 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), MissionTime.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
538 | new Equality(body, var_Time, var__virtual_0_); | ||
539 | bodies.add(body); | ||
540 | } | ||
541 | return bodies; | ||
542 | } | ||
543 | } | ||
544 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore index f72ce8f1..4c8bcc9e 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore | |||
@@ -31,3 +31,8 @@ | |||
31 | /.AdditionalCommSubsystemCost.java._trace | 31 | /.AdditionalCommSubsystemCost.java._trace |
32 | /.SpacecraftWithTwoCommSubsystems.java._trace | 32 | /.SpacecraftWithTwoCommSubsystems.java._trace |
33 | /.SpacecraftCost.java._trace | 33 | /.SpacecraftCost.java._trace |
34 | /.CrossLinkAllowed.java._trace | ||
35 | /.MatchingAntenna.java._trace | ||
36 | /.CubeSat3U.java._trace | ||
37 | /.LinkAllowed.java._trace | ||
38 | /.IndirectLinkAllowed.java._trace | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AdditionalCommSubsystemCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AdditionalCommSubsystemCost.java deleted file mode 100644 index 61b1da52..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AdditionalCommSubsystemCost.java +++ /dev/null | |||
@@ -1,173 +0,0 @@ | |||
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.SpacecraftWithTwoCommSubsystems; | ||
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 additionalCommSubsystemCost(Spacecraft : Spacecraft, Cost : java Double) { | ||
37 | * find spacecraftWithTwoCommSubsystems(Spacecraft); | ||
38 | * Cost == 100000.0; | ||
39 | * } or { | ||
40 | * neg find spacecraftWithTwoCommSubsystems(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 AdditionalCommSubsystemCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
51 | private AdditionalCommSubsystemCost() { | ||
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 AdditionalCommSubsystemCost 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.AdditionalCommSubsystemCost (visibility: PUBLIC, simpleName: AdditionalCommSubsystemCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost, 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.AdditionalCommSubsystemCost (visibility: PUBLIC, simpleName: AdditionalCommSubsystemCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost, 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 AdditionalCommSubsystemCost INSTANCE = new AdditionalCommSubsystemCost(); | ||
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 AdditionalCommSubsystemCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
96 | |||
97 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.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.additionalCommSubsystemCost"; | ||
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 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
131 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
132 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
133 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
134 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
135 | )); | ||
136 | // find spacecraftWithTwoCommSubsystems(Spacecraft) | ||
137 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft), SpacecraftWithTwoCommSubsystems.instance().getInternalQueryRepresentation()); | ||
138 | // Cost == 100000.0 | ||
139 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
140 | new ConstantValue(body, var__virtual_0_, 100000.0); | ||
141 | new Equality(body, var_Cost, var__virtual_0_); | ||
142 | bodies.add(body); | ||
143 | } | ||
144 | { | ||
145 | PBody body = new PBody(this); | ||
146 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
147 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
149 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
150 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
151 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
152 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
153 | )); | ||
154 | // neg find spacecraftWithTwoCommSubsystems(Spacecraft) | ||
155 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft), SpacecraftWithTwoCommSubsystems.instance().getInternalQueryRepresentation()); | ||
156 | // Cost == 0.0 | ||
157 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
158 | new ConstantValue(body, var__virtual_0_, 0.0); | ||
159 | new Equality(body, var_Cost, var__virtual_0_); | ||
160 | bodies.add(body); | ||
161 | } | ||
162 | return bodies; | ||
163 | } | ||
164 | } | ||
165 | |||
166 | private static double evaluateExpression_1_1() { | ||
167 | return 100000.0; | ||
168 | } | ||
169 | |||
170 | private static double evaluateExpression_2_1() { | ||
171 | return 0.0; | ||
172 | } | ||
173 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/BasePrice.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/BasePrice.java deleted file mode 100644 index c70f4c8b..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/BasePrice.java +++ /dev/null | |||
@@ -1,216 +0,0 @@ | |||
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 java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
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.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
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 basePrice(Spacecraft : Spacecraft, BasePrice : java Double) { | ||
37 | * Spacecraft.kind(Spacecraft, SpacecraftKind::CubeSat3U); | ||
38 | * BasePrice == 250000.0; | ||
39 | * } or { | ||
40 | * Spacecraft.kind(Spacecraft, SpacecraftKind::CubeSat6U); | ||
41 | * BasePrice == 750000.0; | ||
42 | * } or { | ||
43 | * Spacecraft.kind(Spacecraft, SpacecraftKind::SmallSat); | ||
44 | * BasePrice == 3000000.0; | ||
45 | * } | ||
46 | * </pre></code> | ||
47 | * | ||
48 | * @see GenericPatternMatcher | ||
49 | * @see GenericPatternMatch | ||
50 | * | ||
51 | */ | ||
52 | @SuppressWarnings("all") | ||
53 | public final class BasePrice extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
54 | private BasePrice() { | ||
55 | super(GeneratedPQuery.INSTANCE); | ||
56 | } | ||
57 | |||
58 | /** | ||
59 | * @return the singleton instance of the query specification | ||
60 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
61 | * | ||
62 | */ | ||
63 | public static BasePrice instance() { | ||
64 | try{ | ||
65 | return LazyHolder.INSTANCE; | ||
66 | } catch (ExceptionInInitializerError err) { | ||
67 | throw processInitializerError(err); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice (visibility: PUBLIC, simpleName: BasePrice, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice, 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 | ||
73 | * <b>not</b> at the class load time of the outer class, | ||
74 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice (visibility: PUBLIC, simpleName: BasePrice, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice, 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()}. | ||
75 | * | ||
76 | * <p> This workaround is required e.g. to support recursion. | ||
77 | * | ||
78 | */ | ||
79 | private static class LazyHolder { | ||
80 | private static final BasePrice INSTANCE = new BasePrice(); | ||
81 | |||
82 | /** | ||
83 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
84 | * This initialization order is required to support indirect recursion. | ||
85 | * | ||
86 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
87 | * | ||
88 | */ | ||
89 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
90 | |||
91 | public static Object ensureInitialized() { | ||
92 | INSTANCE.ensureInitializedInternal(); | ||
93 | return null; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
98 | private static final BasePrice.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
99 | |||
100 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
101 | |||
102 | private final PParameter parameter_BasePrice = new PParameter("BasePrice", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
103 | |||
104 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_BasePrice); | ||
105 | |||
106 | private GeneratedPQuery() { | ||
107 | super(PVisibility.PRIVATE); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public String getFullyQualifiedName() { | ||
112 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.basePrice"; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<String> getParameterNames() { | ||
117 | return Arrays.asList("Spacecraft","BasePrice"); | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<PParameter> getParameters() { | ||
122 | return parameters; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Set<PBody> doGetContainedBodies() { | ||
127 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
128 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
129 | { | ||
130 | PBody body = new PBody(this); | ||
131 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
132 | PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
134 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_BasePrice), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
135 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
136 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
137 | new ExportedParameter(body, var_BasePrice, parameter_BasePrice) | ||
138 | )); | ||
139 | // Spacecraft.kind(Spacecraft, SpacecraftKind::CubeSat3U) | ||
140 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
141 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat3U").getInstance()); | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
143 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
146 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
147 | // BasePrice == 250000.0 | ||
148 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
149 | new ConstantValue(body, var__virtual_2_, 250000.0); | ||
150 | new Equality(body, var_BasePrice, var__virtual_2_); | ||
151 | bodies.add(body); | ||
152 | } | ||
153 | { | ||
154 | PBody body = new PBody(this); | ||
155 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
156 | PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); | ||
157 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
158 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_BasePrice), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
159 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
160 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
161 | new ExportedParameter(body, var_BasePrice, parameter_BasePrice) | ||
162 | )); | ||
163 | // Spacecraft.kind(Spacecraft, SpacecraftKind::CubeSat6U) | ||
164 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
165 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat6U").getInstance()); | ||
166 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
167 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
168 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); | ||
169 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
170 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
171 | // BasePrice == 750000.0 | ||
172 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
173 | new ConstantValue(body, var__virtual_2_, 750000.0); | ||
174 | new Equality(body, var_BasePrice, var__virtual_2_); | ||
175 | bodies.add(body); | ||
176 | } | ||
177 | { | ||
178 | PBody body = new PBody(this); | ||
179 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
180 | PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); | ||
181 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
182 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_BasePrice), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
183 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
184 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
185 | new ExportedParameter(body, var_BasePrice, parameter_BasePrice) | ||
186 | )); | ||
187 | // Spacecraft.kind(Spacecraft, SpacecraftKind::SmallSat) | ||
188 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
189 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "SmallSat").getInstance()); | ||
190 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
191 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
192 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); | ||
193 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
194 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
195 | // BasePrice == 3000000.0 | ||
196 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
197 | new ConstantValue(body, var__virtual_2_, 3000000.0); | ||
198 | new Equality(body, var_BasePrice, var__virtual_2_); | ||
199 | bodies.add(body); | ||
200 | } | ||
201 | return bodies; | ||
202 | } | ||
203 | } | ||
204 | |||
205 | private static double evaluateExpression_1_1() { | ||
206 | return 250000.0; | ||
207 | } | ||
208 | |||
209 | private static double evaluateExpression_2_1() { | ||
210 | return 750000.0; | ||
211 | } | ||
212 | |||
213 | private static double evaluateExpression_3_1() { | ||
214 | return 3000000.0; | ||
215 | } | ||
216 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SmallSat.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CubeSat3U.java index d74ed28a..fe789893 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SmallSat.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CubeSat3U.java | |||
@@ -8,18 +8,13 @@ import java.util.LinkedHashSet; | |||
8 | import java.util.List; | 8 | import java.util.List; |
9 | import java.util.Set; | 9 | import java.util.Set; |
10 | import org.eclipse.emf.ecore.EClass; | 10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | 11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; |
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | 12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; |
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | 13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 14 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 15 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | 16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; |
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 17 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 19 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 20 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
@@ -31,8 +26,8 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
31 | * | 26 | * |
32 | * <p>Original source: | 27 | * <p>Original source: |
33 | * <code><pre> | 28 | * <code><pre> |
34 | * private pattern smallSat(Sat : Spacecraft) { | 29 | * private pattern cubeSat3U(Sat : CubeSat3U) { |
35 | * Spacecraft.kind(Sat, SpacecraftKind::SmallSat); | 30 | * CubeSat3U(Sat); |
36 | * } | 31 | * } |
37 | * </pre></code> | 32 | * </pre></code> |
38 | * | 33 | * |
@@ -41,8 +36,8 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
41 | * | 36 | * |
42 | */ | 37 | */ |
43 | @SuppressWarnings("all") | 38 | @SuppressWarnings("all") |
44 | public final class SmallSat extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | 39 | public final class CubeSat3U extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { |
45 | private SmallSat() { | 40 | private CubeSat3U() { |
46 | super(GeneratedPQuery.INSTANCE); | 41 | super(GeneratedPQuery.INSTANCE); |
47 | } | 42 | } |
48 | 43 | ||
@@ -51,7 +46,7 @@ public final class SmallSat extends BaseGeneratedEMFQuerySpecificationWithGeneri | |||
51 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | 46 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded |
52 | * | 47 | * |
53 | */ | 48 | */ |
54 | public static SmallSat instance() { | 49 | public static CubeSat3U instance() { |
55 | try{ | 50 | try{ |
56 | return LazyHolder.INSTANCE; | 51 | return LazyHolder.INSTANCE; |
57 | } catch (ExceptionInInitializerError err) { | 52 | } catch (ExceptionInInitializerError err) { |
@@ -60,15 +55,15 @@ public final class SmallSat extends BaseGeneratedEMFQuerySpecificationWithGeneri | |||
60 | } | 55 | } |
61 | 56 | ||
62 | /** | 57 | /** |
63 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat (visibility: PUBLIC, simpleName: SmallSat, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat, 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 | 58 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U (visibility: PUBLIC, simpleName: CubeSat3U, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U, 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 |
64 | * <b>not</b> at the class load time of the outer class, | 59 | * <b>not</b> at the class load time of the outer class, |
65 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat (visibility: PUBLIC, simpleName: SmallSat, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat, 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()}. | 60 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U (visibility: PUBLIC, simpleName: CubeSat3U, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U, 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()}. |
66 | * | 61 | * |
67 | * <p> This workaround is required e.g. to support recursion. | 62 | * <p> This workaround is required e.g. to support recursion. |
68 | * | 63 | * |
69 | */ | 64 | */ |
70 | private static class LazyHolder { | 65 | private static class LazyHolder { |
71 | private static final SmallSat INSTANCE = new SmallSat(); | 66 | private static final CubeSat3U INSTANCE = new CubeSat3U(); |
72 | 67 | ||
73 | /** | 68 | /** |
74 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | 69 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. |
@@ -86,9 +81,9 @@ public final class SmallSat extends BaseGeneratedEMFQuerySpecificationWithGeneri | |||
86 | } | 81 | } |
87 | 82 | ||
88 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | 83 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { |
89 | private static final SmallSat.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | 84 | private static final CubeSat3U.GeneratedPQuery INSTANCE = new GeneratedPQuery(); |
90 | 85 | ||
91 | private final PParameter parameter_Sat = new PParameter("Sat", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | 86 | private final PParameter parameter_Sat = new PParameter("Sat", "hu.bme.mit.inf.dslreasoner.domains.satellite.CubeSat3U", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CubeSat3U")), PParameterDirection.INOUT); |
92 | 87 | ||
93 | private final List<PParameter> parameters = Arrays.asList(parameter_Sat); | 88 | private final List<PParameter> parameters = Arrays.asList(parameter_Sat); |
94 | 89 | ||
@@ -98,7 +93,7 @@ public final class SmallSat extends BaseGeneratedEMFQuerySpecificationWithGeneri | |||
98 | 93 | ||
99 | @Override | 94 | @Override |
100 | public String getFullyQualifiedName() { | 95 | public String getFullyQualifiedName() { |
101 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat"; | 96 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.cubeSat3U"; |
102 | } | 97 | } |
103 | 98 | ||
104 | @Override | 99 | @Override |
@@ -118,18 +113,12 @@ public final class SmallSat extends BaseGeneratedEMFQuerySpecificationWithGeneri | |||
118 | { | 113 | { |
119 | PBody body = new PBody(this); | 114 | PBody body = new PBody(this); |
120 | PVariable var_Sat = body.getOrCreateVariableByName("Sat"); | 115 | PVariable var_Sat = body.getOrCreateVariableByName("Sat"); |
121 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | 116 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); |
122 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 117 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
123 | new ExportedParameter(body, var_Sat, parameter_Sat) | 118 | new ExportedParameter(body, var_Sat, parameter_Sat) |
124 | )); | 119 | )); |
125 | // Spacecraft.kind(Sat, SpacecraftKind::SmallSat) | 120 | // CubeSat3U(Sat) |
126 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | 121 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); |
127 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "SmallSat").getInstance()); | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
129 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
132 | new Equality(body, var__virtual_1_, var__virtual_0_); | ||
133 | bodies.add(body); | 122 | bodies.add(body); |
134 | } | 123 | } |
135 | return bodies; | 124 | return bodies; |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IncomingData.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectLinkAllowed.java index 114bbf33..27648bf3 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IncomingData.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectLinkAllowed.java | |||
@@ -3,8 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; | 4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; |
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; | ||
8 | import java.util.Arrays; | 7 | import java.util.Arrays; |
9 | import java.util.LinkedHashSet; | 8 | import java.util.LinkedHashSet; |
10 | import java.util.List; | 9 | import java.util.List; |
@@ -14,12 +13,10 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | |||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | 13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; |
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | 14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; |
16 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
17 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | 16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; |
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | 17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; |
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | 19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; |
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 21 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | 22 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; |
@@ -31,9 +28,8 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
31 | * | 28 | * |
32 | * <p>Original source: | 29 | * <p>Original source: |
33 | * <code><pre> | 30 | * <code><pre> |
34 | * private pattern incomingData(Spacecraft : Spacecraft, Source : Spacecraft, Data : java Double) { | 31 | * private pattern indirectLinkAllowed(From : Spacecraft, To : CommunicatingElement) { |
35 | * find indirectCommunicationLink(Source, Spacecraft); | 32 | * find linkAllowed+(From, To); |
36 | * find scienceData(Source, Data); | ||
37 | * } | 33 | * } |
38 | * </pre></code> | 34 | * </pre></code> |
39 | * | 35 | * |
@@ -42,8 +38,8 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
42 | * | 38 | * |
43 | */ | 39 | */ |
44 | @SuppressWarnings("all") | 40 | @SuppressWarnings("all") |
45 | public final class IncomingData extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | 41 | public final class IndirectLinkAllowed extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { |
46 | private IncomingData() { | 42 | private IndirectLinkAllowed() { |
47 | super(GeneratedPQuery.INSTANCE); | 43 | super(GeneratedPQuery.INSTANCE); |
48 | } | 44 | } |
49 | 45 | ||
@@ -52,7 +48,7 @@ public final class IncomingData extends BaseGeneratedEMFQuerySpecificationWithGe | |||
52 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | 48 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded |
53 | * | 49 | * |
54 | */ | 50 | */ |
55 | public static IncomingData instance() { | 51 | public static IndirectLinkAllowed instance() { |
56 | try{ | 52 | try{ |
57 | return LazyHolder.INSTANCE; | 53 | return LazyHolder.INSTANCE; |
58 | } catch (ExceptionInInitializerError err) { | 54 | } catch (ExceptionInInitializerError err) { |
@@ -61,15 +57,15 @@ public final class IncomingData extends BaseGeneratedEMFQuerySpecificationWithGe | |||
61 | } | 57 | } |
62 | 58 | ||
63 | /** | 59 | /** |
64 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData (visibility: PUBLIC, simpleName: IncomingData, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData, 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 | 60 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed (visibility: PUBLIC, simpleName: IndirectLinkAllowed, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed, 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 |
65 | * <b>not</b> at the class load time of the outer class, | 61 | * <b>not</b> at the class load time of the outer class, |
66 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData (visibility: PUBLIC, simpleName: IncomingData, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData, 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()}. | 62 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed (visibility: PUBLIC, simpleName: IndirectLinkAllowed, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed, 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()}. |
67 | * | 63 | * |
68 | * <p> This workaround is required e.g. to support recursion. | 64 | * <p> This workaround is required e.g. to support recursion. |
69 | * | 65 | * |
70 | */ | 66 | */ |
71 | private static class LazyHolder { | 67 | private static class LazyHolder { |
72 | private static final IncomingData INSTANCE = new IncomingData(); | 68 | private static final IndirectLinkAllowed INSTANCE = new IndirectLinkAllowed(); |
73 | 69 | ||
74 | /** | 70 | /** |
75 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | 71 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. |
@@ -87,15 +83,13 @@ public final class IncomingData extends BaseGeneratedEMFQuerySpecificationWithGe | |||
87 | } | 83 | } |
88 | 84 | ||
89 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | 85 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { |
90 | private static final IncomingData.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | 86 | private static final IndirectLinkAllowed.GeneratedPQuery INSTANCE = new GeneratedPQuery(); |
91 | 87 | ||
92 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | 88 | private final PParameter parameter_From = new PParameter("From", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); |
93 | 89 | ||
94 | private final PParameter parameter_Source = new PParameter("Source", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | 90 | private final PParameter parameter_To = new PParameter("To", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT); |
95 | 91 | ||
96 | private final PParameter parameter_Data = new PParameter("Data", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | 92 | private final List<PParameter> parameters = Arrays.asList(parameter_From, parameter_To); |
97 | |||
98 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Source, parameter_Data); | ||
99 | 93 | ||
100 | private GeneratedPQuery() { | 94 | private GeneratedPQuery() { |
101 | super(PVisibility.PRIVATE); | 95 | super(PVisibility.PRIVATE); |
@@ -103,12 +97,12 @@ public final class IncomingData extends BaseGeneratedEMFQuerySpecificationWithGe | |||
103 | 97 | ||
104 | @Override | 98 | @Override |
105 | public String getFullyQualifiedName() { | 99 | public String getFullyQualifiedName() { |
106 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incomingData"; | 100 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.indirectLinkAllowed"; |
107 | } | 101 | } |
108 | 102 | ||
109 | @Override | 103 | @Override |
110 | public List<String> getParameterNames() { | 104 | public List<String> getParameterNames() { |
111 | return Arrays.asList("Spacecraft","Source","Data"); | 105 | return Arrays.asList("From","To"); |
112 | } | 106 | } |
113 | 107 | ||
114 | @Override | 108 | @Override |
@@ -122,21 +116,16 @@ public final class IncomingData extends BaseGeneratedEMFQuerySpecificationWithGe | |||
122 | Set<PBody> bodies = new LinkedHashSet<>(); | 116 | Set<PBody> bodies = new LinkedHashSet<>(); |
123 | { | 117 | { |
124 | PBody body = new PBody(this); | 118 | PBody body = new PBody(this); |
125 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | 119 | PVariable var_From = body.getOrCreateVariableByName("From"); |
126 | PVariable var_Source = body.getOrCreateVariableByName("Source"); | 120 | PVariable var_To = body.getOrCreateVariableByName("To"); |
127 | PVariable var_Data = body.getOrCreateVariableByName("Data"); | 121 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); |
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | 122 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); |
129 | new TypeConstraint(body, Tuples.flatTupleOf(var_Source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
130 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Data), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
131 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 123 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
132 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | 124 | new ExportedParameter(body, var_From, parameter_From), |
133 | new ExportedParameter(body, var_Source, parameter_Source), | 125 | new ExportedParameter(body, var_To, parameter_To) |
134 | new ExportedParameter(body, var_Data, parameter_Data) | ||
135 | )); | 126 | )); |
136 | // find indirectCommunicationLink(Source, Spacecraft) | 127 | // find linkAllowed+(From, To) |
137 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Source, var_Spacecraft), IndirectCommunicationLink.instance().getInternalQueryRepresentation()); | 128 | new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_From, var_To), LinkAllowed.instance().getInternalQueryRepresentation()); |
138 | // find scienceData(Source, Data) | ||
139 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Source, var_Data), ScienceData.instance().getInternalQueryRepresentation()); | ||
140 | bodies.add(body); | 129 | bodies.add(body); |
141 | } | 130 | } |
142 | return bodies; | 131 | return bodies; |
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 deleted file mode 100644 index 205d896a..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java +++ /dev/null | |||
@@ -1,175 +0,0 @@ | |||
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", "hu.bme.mit.inf.dslreasoner.domains.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 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/LinkAllowed.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/LinkAllowed.java new file mode 100644 index 00000000..e7529aa2 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/LinkAllowed.java | |||
@@ -0,0 +1,185 @@ | |||
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.CubeSat3U; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Set; | ||
12 | import org.eclipse.emf.ecore.EClass; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
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.ExportedParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
28 | |||
29 | /** | ||
30 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
31 | * | ||
32 | * <p>Original source: | ||
33 | * <code><pre> | ||
34 | * private pattern linkAllowed(From : Spacecraft, To : CommunicatingElement) { | ||
35 | * find matchingAntenna(From, To, _); | ||
36 | * neg find cubeSat3U(From); | ||
37 | * } or { | ||
38 | * find matchingAntenna(From, To, TransceiverBand::UHF); | ||
39 | * CubeSat3U(From); | ||
40 | * } or { | ||
41 | * find matchingAntenna(From, To, _); | ||
42 | * CubeSat3U(From); | ||
43 | * GroundStationNetwork(To); | ||
44 | * } | ||
45 | * </pre></code> | ||
46 | * | ||
47 | * @see GenericPatternMatcher | ||
48 | * @see GenericPatternMatch | ||
49 | * | ||
50 | */ | ||
51 | @SuppressWarnings("all") | ||
52 | public final class LinkAllowed extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
53 | private LinkAllowed() { | ||
54 | super(GeneratedPQuery.INSTANCE); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * @return the singleton instance of the query specification | ||
59 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
60 | * | ||
61 | */ | ||
62 | public static LinkAllowed instance() { | ||
63 | try{ | ||
64 | return LazyHolder.INSTANCE; | ||
65 | } catch (ExceptionInInitializerError err) { | ||
66 | throw processInitializerError(err); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed (visibility: PUBLIC, simpleName: LinkAllowed, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed, 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 | ||
72 | * <b>not</b> at the class load time of the outer class, | ||
73 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed (visibility: PUBLIC, simpleName: LinkAllowed, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed, 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()}. | ||
74 | * | ||
75 | * <p> This workaround is required e.g. to support recursion. | ||
76 | * | ||
77 | */ | ||
78 | private static class LazyHolder { | ||
79 | private static final LinkAllowed INSTANCE = new LinkAllowed(); | ||
80 | |||
81 | /** | ||
82 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
83 | * This initialization order is required to support indirect recursion. | ||
84 | * | ||
85 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
86 | * | ||
87 | */ | ||
88 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
89 | |||
90 | public static Object ensureInitialized() { | ||
91 | INSTANCE.ensureInitializedInternal(); | ||
92 | return null; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
97 | private static final LinkAllowed.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
98 | |||
99 | private final PParameter parameter_From = new PParameter("From", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
100 | |||
101 | private final PParameter parameter_To = new PParameter("To", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT); | ||
102 | |||
103 | private final List<PParameter> parameters = Arrays.asList(parameter_From, parameter_To); | ||
104 | |||
105 | private GeneratedPQuery() { | ||
106 | super(PVisibility.PRIVATE); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public String getFullyQualifiedName() { | ||
111 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.linkAllowed"; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public List<String> getParameterNames() { | ||
116 | return Arrays.asList("From","To"); | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public List<PParameter> getParameters() { | ||
121 | return parameters; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public Set<PBody> doGetContainedBodies() { | ||
126 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
127 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
128 | { | ||
129 | PBody body = new PBody(this); | ||
130 | PVariable var_From = body.getOrCreateVariableByName("From"); | ||
131 | PVariable var_To = body.getOrCreateVariableByName("To"); | ||
132 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
134 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
135 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
136 | new ExportedParameter(body, var_From, parameter_From), | ||
137 | new ExportedParameter(body, var_To, parameter_To) | ||
138 | )); | ||
139 | // find matchingAntenna(From, To, _) | ||
140 | new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To, var___0_), MatchingAntenna.instance().getInternalQueryRepresentation()); | ||
141 | // neg find cubeSat3U(From) | ||
142 | new NegativePatternCall(body, Tuples.flatTupleOf(var_From), CubeSat3U.instance().getInternalQueryRepresentation()); | ||
143 | bodies.add(body); | ||
144 | } | ||
145 | { | ||
146 | PBody body = new PBody(this); | ||
147 | PVariable var_From = body.getOrCreateVariableByName("From"); | ||
148 | PVariable var_To = body.getOrCreateVariableByName("To"); | ||
149 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
150 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
151 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
152 | new ExportedParameter(body, var_From, parameter_From), | ||
153 | new ExportedParameter(body, var_To, parameter_To) | ||
154 | )); | ||
155 | // find matchingAntenna(From, To, TransceiverBand::UHF) | ||
156 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
157 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance()); | ||
158 | new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To, var__virtual_0_), MatchingAntenna.instance().getInternalQueryRepresentation()); | ||
159 | // CubeSat3U(From) | ||
160 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); | ||
161 | bodies.add(body); | ||
162 | } | ||
163 | { | ||
164 | PBody body = new PBody(this); | ||
165 | PVariable var_From = body.getOrCreateVariableByName("From"); | ||
166 | PVariable var_To = body.getOrCreateVariableByName("To"); | ||
167 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
168 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
169 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
170 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
171 | new ExportedParameter(body, var_From, parameter_From), | ||
172 | new ExportedParameter(body, var_To, parameter_To) | ||
173 | )); | ||
174 | // find matchingAntenna(From, To, _) | ||
175 | new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To, var___0_), MatchingAntenna.instance().getInternalQueryRepresentation()); | ||
176 | // CubeSat3U(From) | ||
177 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); | ||
178 | // GroundStationNetwork(To) | ||
179 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); | ||
180 | bodies.add(body); | ||
181 | } | ||
182 | return bodies; | ||
183 | } | ||
184 | } | ||
185 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingAntenna.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingAntenna.java new file mode 100644 index 00000000..b4f0d9e9 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingAntenna.java | |||
@@ -0,0 +1,179 @@ | |||
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 java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
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.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern matchingAntenna(From : Spacecraft, To : CommunicatingElement, Band : TransceiverBand) { | ||
34 | * CommunicatingElement.commSubsystem.band(From, Band); | ||
35 | * CommunicatingElement.commSubsystem.band(To, Band); | ||
36 | * CommunicatingElement.commSubsystem.gain(From, Gain); | ||
37 | * CommunicatingElement.commSubsystem.gain(To, Gain); | ||
38 | * } | ||
39 | * </pre></code> | ||
40 | * | ||
41 | * @see GenericPatternMatcher | ||
42 | * @see GenericPatternMatch | ||
43 | * | ||
44 | */ | ||
45 | @SuppressWarnings("all") | ||
46 | public final class MatchingAntenna extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
47 | private MatchingAntenna() { | ||
48 | super(GeneratedPQuery.INSTANCE); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @return the singleton instance of the query specification | ||
53 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
54 | * | ||
55 | */ | ||
56 | public static MatchingAntenna instance() { | ||
57 | try{ | ||
58 | return LazyHolder.INSTANCE; | ||
59 | } catch (ExceptionInInitializerError err) { | ||
60 | throw processInitializerError(err); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna (visibility: PUBLIC, simpleName: MatchingAntenna, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna, 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 | ||
66 | * <b>not</b> at the class load time of the outer class, | ||
67 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna (visibility: PUBLIC, simpleName: MatchingAntenna, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna, 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()}. | ||
68 | * | ||
69 | * <p> This workaround is required e.g. to support recursion. | ||
70 | * | ||
71 | */ | ||
72 | private static class LazyHolder { | ||
73 | private static final MatchingAntenna INSTANCE = new MatchingAntenna(); | ||
74 | |||
75 | /** | ||
76 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
77 | * This initialization order is required to support indirect recursion. | ||
78 | * | ||
79 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
80 | * | ||
81 | */ | ||
82 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
83 | |||
84 | public static Object ensureInitialized() { | ||
85 | INSTANCE.ensureInitializedInternal(); | ||
86 | return null; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
91 | private static final MatchingAntenna.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
92 | |||
93 | private final PParameter parameter_From = new PParameter("From", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
94 | |||
95 | private final PParameter parameter_To = new PParameter("To", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT); | ||
96 | |||
97 | private final PParameter parameter_Band = new PParameter("Band", "hu.bme.mit.inf.dslreasoner.domains.satellite.TransceiverBand", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "TransceiverBand")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final List<PParameter> parameters = Arrays.asList(parameter_From, parameter_To, parameter_Band); | ||
100 | |||
101 | private GeneratedPQuery() { | ||
102 | super(PVisibility.PRIVATE); | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String getFullyQualifiedName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.matchingAntenna"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> getParameterNames() { | ||
112 | return Arrays.asList("From","To","Band"); | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<PParameter> getParameters() { | ||
117 | return parameters; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public Set<PBody> doGetContainedBodies() { | ||
122 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
123 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
124 | { | ||
125 | PBody body = new PBody(this); | ||
126 | PVariable var_From = body.getOrCreateVariableByName("From"); | ||
127 | PVariable var_To = body.getOrCreateVariableByName("To"); | ||
128 | PVariable var_Band = body.getOrCreateVariableByName("Band"); | ||
129 | PVariable var_Gain = body.getOrCreateVariableByName("Gain"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Band), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
133 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
134 | new ExportedParameter(body, var_From, parameter_From), | ||
135 | new ExportedParameter(body, var_To, parameter_To), | ||
136 | new ExportedParameter(body, var_Band, parameter_Band) | ||
137 | )); | ||
138 | // CommunicatingElement.commSubsystem.band(From, Band) | ||
139 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
140 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
141 | new TypeConstraint(body, Tuples.flatTupleOf(var_From, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
143 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
146 | new Equality(body, var__virtual_1_, var_Band); | ||
147 | // CommunicatingElement.commSubsystem.band(To, Band) | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
149 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
150 | new TypeConstraint(body, Tuples.flatTupleOf(var_To, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
151 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
152 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
153 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
154 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
155 | new Equality(body, var__virtual_3_, var_Band); | ||
156 | // CommunicatingElement.commSubsystem.gain(From, Gain) | ||
157 | new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
158 | PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); | ||
159 | new TypeConstraint(body, Tuples.flatTupleOf(var_From, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
160 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
161 | PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); | ||
162 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); | ||
163 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
164 | new Equality(body, var__virtual_5_, var_Gain); | ||
165 | // CommunicatingElement.commSubsystem.gain(To, Gain) | ||
166 | new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
167 | PVariable var__virtual_6_ = body.getOrCreateVariableByName(".virtual{6}"); | ||
168 | new TypeConstraint(body, Tuples.flatTupleOf(var_To, var__virtual_6_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
169 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
170 | PVariable var__virtual_7_ = body.getOrCreateVariableByName(".virtual{7}"); | ||
171 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_, var__virtual_7_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); | ||
172 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_7_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); | ||
173 | new Equality(body, var__virtual_7_, var_Gain); | ||
174 | bodies.add(body); | ||
175 | } | ||
176 | return bodies; | ||
177 | } | ||
178 | } | ||
179 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCost.java deleted file mode 100644 index 0374195f..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCost.java +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
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.SpacecraftCost; | ||
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.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
35 | |||
36 | /** | ||
37 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
38 | * | ||
39 | * <p>Original source: | ||
40 | * <code><pre> | ||
41 | * private pattern missionCost(Mission : InterferometryMission, Cost : java Double) { | ||
42 | * InterferometryMission.observationTime(Mission, ObservationTime); | ||
43 | * SpacecraftCost == sum find spacecraftCost(Mission, _, #_); | ||
44 | * Cost == eval(SpacecraftCost + 100000.0 ObservationTime); | ||
45 | * } | ||
46 | * </pre></code> | ||
47 | * | ||
48 | * @see GenericPatternMatcher | ||
49 | * @see GenericPatternMatch | ||
50 | * | ||
51 | */ | ||
52 | @SuppressWarnings("all") | ||
53 | public final class MissionCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
54 | private MissionCost() { | ||
55 | super(GeneratedPQuery.INSTANCE); | ||
56 | } | ||
57 | |||
58 | /** | ||
59 | * @return the singleton instance of the query specification | ||
60 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
61 | * | ||
62 | */ | ||
63 | public static MissionCost instance() { | ||
64 | try{ | ||
65 | return LazyHolder.INSTANCE; | ||
66 | } catch (ExceptionInInitializerError err) { | ||
67 | throw processInitializerError(err); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost (visibility: PUBLIC, simpleName: MissionCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost, 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 | ||
73 | * <b>not</b> at the class load time of the outer class, | ||
74 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost (visibility: PUBLIC, simpleName: MissionCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost, 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()}. | ||
75 | * | ||
76 | * <p> This workaround is required e.g. to support recursion. | ||
77 | * | ||
78 | */ | ||
79 | private static class LazyHolder { | ||
80 | private static final MissionCost INSTANCE = new MissionCost(); | ||
81 | |||
82 | /** | ||
83 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
84 | * This initialization order is required to support indirect recursion. | ||
85 | * | ||
86 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
87 | * | ||
88 | */ | ||
89 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
90 | |||
91 | public static Object ensureInitialized() { | ||
92 | INSTANCE.ensureInitializedInternal(); | ||
93 | return null; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
98 | private static final MissionCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
99 | |||
100 | private final PParameter parameter_Mission = new PParameter("Mission", "hu.bme.mit.inf.dslreasoner.domains.satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
101 | |||
102 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
103 | |||
104 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Cost); | ||
105 | |||
106 | private GeneratedPQuery() { | ||
107 | super(PVisibility.PRIVATE); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public String getFullyQualifiedName() { | ||
112 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.missionCost"; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<String> getParameterNames() { | ||
117 | return Arrays.asList("Mission","Cost"); | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<PParameter> getParameters() { | ||
122 | return parameters; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Set<PBody> doGetContainedBodies() { | ||
127 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
128 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
129 | { | ||
130 | PBody body = new PBody(this); | ||
131 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
132 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
133 | PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); | ||
134 | PVariable var_SpacecraftCost = body.getOrCreateVariableByName("SpacecraftCost"); | ||
135 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
136 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
137 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
138 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
139 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
140 | new ExportedParameter(body, var_Mission, parameter_Mission), | ||
141 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
142 | )); | ||
143 | // InterferometryMission.observationTime(Mission, ObservationTime) | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
145 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); | ||
147 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); | ||
148 | new Equality(body, var__virtual_0_, var_ObservationTime); | ||
149 | // SpacecraftCost == sum find spacecraftCost(Mission, _, #_) | ||
150 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
151 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var_Mission, var___0_, var___1_), SpacecraftCost.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); | ||
152 | new Equality(body, var_SpacecraftCost, var__virtual_1_); | ||
153 | // Cost == eval(SpacecraftCost + 100000.0 * ObservationTime) | ||
154 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
155 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
156 | |||
157 | @Override | ||
158 | public String getShortDescription() { | ||
159 | return "Expression evaluation from pattern missionCost"; | ||
160 | } | ||
161 | |||
162 | @Override | ||
163 | public Iterable<String> getInputParameterNames() { | ||
164 | return Arrays.asList("ObservationTime", "SpacecraftCost");} | ||
165 | |||
166 | @Override | ||
167 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
168 | Float ObservationTime = (Float) provider.getValue("ObservationTime"); | ||
169 | Double SpacecraftCost = (Double) provider.getValue("SpacecraftCost"); | ||
170 | return evaluateExpression_1_1(ObservationTime, SpacecraftCost); | ||
171 | } | ||
172 | }, var__virtual_2_ ); | ||
173 | new Equality(body, var_Cost, var__virtual_2_); | ||
174 | bodies.add(body); | ||
175 | } | ||
176 | return bodies; | ||
177 | } | ||
178 | } | ||
179 | |||
180 | private static double evaluateExpression_1_1(final Float ObservationTime, final Double SpacecraftCost) { | ||
181 | return ((SpacecraftCost).doubleValue() + (100000.0 * (ObservationTime).floatValue())); | ||
182 | } | ||
183 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCoverage.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCoverage.java deleted file mode 100644 index 583c2175..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCoverage.java +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
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.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
34 | |||
35 | /** | ||
36 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
37 | * | ||
38 | * <p>Original source: | ||
39 | * <code><pre> | ||
40 | * private pattern missionCoverage(Mission : InterferometryMission, Coverage : java Double) { | ||
41 | * InterferometryMission.observationTime(Mission, ObservationTime); | ||
42 | * ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _); | ||
43 | * Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9 (1.0 / ObservationTime)) + 0.05 ObservationTime / 3); | ||
44 | * } | ||
45 | * </pre></code> | ||
46 | * | ||
47 | * @see GenericPatternMatcher | ||
48 | * @see GenericPatternMatch | ||
49 | * | ||
50 | */ | ||
51 | @SuppressWarnings("all") | ||
52 | public final class MissionCoverage extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
53 | private MissionCoverage() { | ||
54 | super(GeneratedPQuery.INSTANCE); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * @return the singleton instance of the query specification | ||
59 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
60 | * | ||
61 | */ | ||
62 | public static MissionCoverage instance() { | ||
63 | try{ | ||
64 | return LazyHolder.INSTANCE; | ||
65 | } catch (ExceptionInInitializerError err) { | ||
66 | throw processInitializerError(err); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage (visibility: PUBLIC, simpleName: MissionCoverage, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage, 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 | ||
72 | * <b>not</b> at the class load time of the outer class, | ||
73 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage (visibility: PUBLIC, simpleName: MissionCoverage, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage, 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()}. | ||
74 | * | ||
75 | * <p> This workaround is required e.g. to support recursion. | ||
76 | * | ||
77 | */ | ||
78 | private static class LazyHolder { | ||
79 | private static final MissionCoverage INSTANCE = new MissionCoverage(); | ||
80 | |||
81 | /** | ||
82 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
83 | * This initialization order is required to support indirect recursion. | ||
84 | * | ||
85 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
86 | * | ||
87 | */ | ||
88 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
89 | |||
90 | public static Object ensureInitialized() { | ||
91 | INSTANCE.ensureInitializedInternal(); | ||
92 | return null; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
97 | private static final MissionCoverage.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
98 | |||
99 | private final PParameter parameter_Mission = new PParameter("Mission", "hu.bme.mit.inf.dslreasoner.domains.satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
100 | |||
101 | private final PParameter parameter_Coverage = new PParameter("Coverage", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
102 | |||
103 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Coverage); | ||
104 | |||
105 | private GeneratedPQuery() { | ||
106 | super(PVisibility.PRIVATE); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public String getFullyQualifiedName() { | ||
111 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.missionCoverage"; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public List<String> getParameterNames() { | ||
116 | return Arrays.asList("Mission","Coverage"); | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public List<PParameter> getParameters() { | ||
121 | return parameters; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public Set<PBody> doGetContainedBodies() { | ||
126 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
127 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
128 | { | ||
129 | PBody body = new PBody(this); | ||
130 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
131 | PVariable var_Coverage = body.getOrCreateVariableByName("Coverage"); | ||
132 | PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); | ||
133 | PVariable var_ObserverCount = body.getOrCreateVariableByName("ObserverCount"); | ||
134 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
135 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
136 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Coverage), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
137 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
138 | new ExportedParameter(body, var_Mission, parameter_Mission), | ||
139 | new ExportedParameter(body, var_Coverage, parameter_Coverage) | ||
140 | )); | ||
141 | // InterferometryMission.observationTime(Mission, ObservationTime) | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
143 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); | ||
146 | new Equality(body, var__virtual_0_, var_ObservationTime); | ||
147 | // ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _) | ||
148 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
149 | new PatternMatchCounter(body, Tuples.flatTupleOf(var_Mission, var___0_), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation(), var__virtual_1_); | ||
150 | new Equality(body, var_ObserverCount, var__virtual_1_); | ||
151 | // Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9 * (1.0 / ObservationTime)) + 0.05 * ObservationTime / 3) | ||
152 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
153 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
154 | |||
155 | @Override | ||
156 | public String getShortDescription() { | ||
157 | return "Expression evaluation from pattern missionCoverage"; | ||
158 | } | ||
159 | |||
160 | @Override | ||
161 | public Iterable<String> getInputParameterNames() { | ||
162 | return Arrays.asList("ObservationTime", "ObserverCount");} | ||
163 | |||
164 | @Override | ||
165 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
166 | Float ObservationTime = (Float) provider.getValue("ObservationTime"); | ||
167 | Integer ObserverCount = (Integer) provider.getValue("ObserverCount"); | ||
168 | return evaluateExpression_1_1(ObservationTime, ObserverCount); | ||
169 | } | ||
170 | }, var__virtual_2_ ); | ||
171 | new Equality(body, var_Coverage, var__virtual_2_); | ||
172 | bodies.add(body); | ||
173 | } | ||
174 | return bodies; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | private static double evaluateExpression_1_1(final Float ObservationTime, final Integer ObserverCount) { | ||
179 | double _pow = Math.pow((1 - (2.0 / (ObserverCount).intValue())), (1 + (9 * (1.0 / (ObservationTime).floatValue())))); | ||
180 | double _plus = (_pow + ((0.05 * (ObservationTime).floatValue()) / 3)); | ||
181 | return _plus; | ||
182 | } | ||
183 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionTime.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionTime.java deleted file mode 100644 index 3ad42bf5..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionTime.java +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
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.TransmitTime; | ||
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.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
35 | |||
36 | /** | ||
37 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
38 | * | ||
39 | * <p>Original source: | ||
40 | * <code><pre> | ||
41 | * private pattern missionTime(Mission : InterferometryMission, Time : java Double) { | ||
42 | * InterferometryMission.observationTime(Mission, ObservationTime); | ||
43 | * TrasmitTime == sum find transmitTime(Mission, _, #_); | ||
44 | * Time == eval(TrasmitTime + 60.0 ObservationTime); | ||
45 | * } | ||
46 | * </pre></code> | ||
47 | * | ||
48 | * @see GenericPatternMatcher | ||
49 | * @see GenericPatternMatch | ||
50 | * | ||
51 | */ | ||
52 | @SuppressWarnings("all") | ||
53 | public final class MissionTime extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
54 | private MissionTime() { | ||
55 | super(GeneratedPQuery.INSTANCE); | ||
56 | } | ||
57 | |||
58 | /** | ||
59 | * @return the singleton instance of the query specification | ||
60 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
61 | * | ||
62 | */ | ||
63 | public static MissionTime instance() { | ||
64 | try{ | ||
65 | return LazyHolder.INSTANCE; | ||
66 | } catch (ExceptionInInitializerError err) { | ||
67 | throw processInitializerError(err); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime (visibility: PUBLIC, simpleName: MissionTime, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime, 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 | ||
73 | * <b>not</b> at the class load time of the outer class, | ||
74 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime (visibility: PUBLIC, simpleName: MissionTime, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime, 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()}. | ||
75 | * | ||
76 | * <p> This workaround is required e.g. to support recursion. | ||
77 | * | ||
78 | */ | ||
79 | private static class LazyHolder { | ||
80 | private static final MissionTime INSTANCE = new MissionTime(); | ||
81 | |||
82 | /** | ||
83 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
84 | * This initialization order is required to support indirect recursion. | ||
85 | * | ||
86 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
87 | * | ||
88 | */ | ||
89 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
90 | |||
91 | public static Object ensureInitialized() { | ||
92 | INSTANCE.ensureInitializedInternal(); | ||
93 | return null; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
98 | private static final MissionTime.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
99 | |||
100 | private final PParameter parameter_Mission = new PParameter("Mission", "hu.bme.mit.inf.dslreasoner.domains.satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
101 | |||
102 | private final PParameter parameter_Time = new PParameter("Time", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
103 | |||
104 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Time); | ||
105 | |||
106 | private GeneratedPQuery() { | ||
107 | super(PVisibility.PRIVATE); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public String getFullyQualifiedName() { | ||
112 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.missionTime"; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<String> getParameterNames() { | ||
117 | return Arrays.asList("Mission","Time"); | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<PParameter> getParameters() { | ||
122 | return parameters; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Set<PBody> doGetContainedBodies() { | ||
127 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
128 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
129 | { | ||
130 | PBody body = new PBody(this); | ||
131 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
132 | PVariable var_Time = body.getOrCreateVariableByName("Time"); | ||
133 | PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); | ||
134 | PVariable var_TrasmitTime = body.getOrCreateVariableByName("TrasmitTime"); | ||
135 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
136 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
137 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
138 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Time), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
139 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
140 | new ExportedParameter(body, var_Mission, parameter_Mission), | ||
141 | new ExportedParameter(body, var_Time, parameter_Time) | ||
142 | )); | ||
143 | // InterferometryMission.observationTime(Mission, ObservationTime) | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
145 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); | ||
147 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); | ||
148 | new Equality(body, var__virtual_0_, var_ObservationTime); | ||
149 | // TrasmitTime == sum find transmitTime(Mission, _, #_) | ||
150 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
151 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var_Mission, var___0_, var___1_), TransmitTime.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); | ||
152 | new Equality(body, var_TrasmitTime, var__virtual_1_); | ||
153 | // Time == eval(TrasmitTime + 60.0 * ObservationTime) | ||
154 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
155 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
156 | |||
157 | @Override | ||
158 | public String getShortDescription() { | ||
159 | return "Expression evaluation from pattern missionTime"; | ||
160 | } | ||
161 | |||
162 | @Override | ||
163 | public Iterable<String> getInputParameterNames() { | ||
164 | return Arrays.asList("ObservationTime", "TrasmitTime");} | ||
165 | |||
166 | @Override | ||
167 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
168 | Float ObservationTime = (Float) provider.getValue("ObservationTime"); | ||
169 | Double TrasmitTime = (Double) provider.getValue("TrasmitTime"); | ||
170 | return evaluateExpression_1_1(ObservationTime, TrasmitTime); | ||
171 | } | ||
172 | }, var__virtual_2_ ); | ||
173 | new Equality(body, var_Time, var__virtual_2_); | ||
174 | bodies.add(body); | ||
175 | } | ||
176 | return bodies; | ||
177 | } | ||
178 | } | ||
179 | |||
180 | private static double evaluateExpression_1_1(final Float ObservationTime, final Double TrasmitTime) { | ||
181 | return ((TrasmitTime).doubleValue() + (60.0 * (ObservationTime).floatValue())); | ||
182 | } | ||
183 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java index 2f310711..36fa4557 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java | |||
@@ -5,43 +5,32 @@ package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; | |||
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; | 7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; |
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric; | ||
10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; | 8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; |
11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; | 9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; |
12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain; | 10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain; |
13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow; | 11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow; |
14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; | 12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; |
13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation; | ||
15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; | 14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; |
15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; | ||
16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind; | ||
16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; | 17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; |
17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric; | ||
18 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow; | 18 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow; |
19 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium; | 19 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium; |
20 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost; | ||
21 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads; | 20 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads; |
22 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice; | ||
23 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand; | 21 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand; |
24 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; | 22 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; |
25 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain; | 23 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain; |
26 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow; | 24 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow; |
27 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium; | 25 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium; |
26 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U; | ||
28 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink; | 27 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink; |
29 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; | 28 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; |
30 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData; | ||
31 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; | 29 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; |
32 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost; | 30 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed; |
33 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost; | 31 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed; |
34 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage; | 32 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna; |
35 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime; | ||
36 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; | ||
37 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat; | ||
38 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost; | ||
39 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKind; | ||
40 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink; | ||
41 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; | 33 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; |
42 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems; | ||
43 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate; | ||
44 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime; | ||
45 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | 34 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; |
46 | 35 | ||
47 | /** | 36 | /** |
@@ -55,6 +44,11 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | |||
55 | * <li>atLeastTwoInterferometryPayloads</li> | 44 | * <li>atLeastTwoInterferometryPayloads</li> |
56 | * <li>spacecraftWithInterferometryPayload</li> | 45 | * <li>spacecraftWithInterferometryPayload</li> |
57 | * <li>noLinkToGroundStation</li> | 46 | * <li>noLinkToGroundStation</li> |
47 | * <li>noPotentialLinkToGroundStation</li> | ||
48 | * <li>indirectLinkAllowed</li> | ||
49 | * <li>linkAllowed</li> | ||
50 | * <li>matchingAntenna</li> | ||
51 | * <li>cubeSat3U</li> | ||
58 | * <li>communicationLoop</li> | 52 | * <li>communicationLoop</li> |
59 | * <li>indirectCommunicationLink</li> | 53 | * <li>indirectCommunicationLink</li> |
60 | * <li>directCommunicationLink</li> | 54 | * <li>directCommunicationLink</li> |
@@ -72,23 +66,7 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | |||
72 | * <li>groundStationNetwork</li> | 66 | * <li>groundStationNetwork</li> |
73 | * <li>cubeSatWithKaAntenna</li> | 67 | * <li>cubeSatWithKaAntenna</li> |
74 | * <li>smallSat</li> | 68 | * <li>smallSat</li> |
75 | * <li>coverageMetric</li> | ||
76 | * <li>missionCoverage</li> | ||
77 | * <li>timeMetric</li> | ||
78 | * <li>missionTime</li> | ||
79 | * <li>transmitTime</li> | ||
80 | * <li>incomingData</li> | ||
81 | * <li>scienceData</li> | ||
82 | * <li>transmitRate</li> | ||
83 | * <li>spacecraftUplink</li> | ||
84 | * <li>costMetric</li> | ||
85 | * <li>missionCost</li> | ||
86 | * <li>spacecraftCost</li> | ||
87 | * <li>spacecraftOfKind</li> | 69 | * <li>spacecraftOfKind</li> |
88 | * <li>basePrice</li> | ||
89 | * <li>interferometryPayloadCost</li> | ||
90 | * <li>additionalCommSubsystemCost</li> | ||
91 | * <li>spacecraftWithTwoCommSubsystems</li> | ||
92 | * </ul> | 70 | * </ul> |
93 | * | 71 | * |
94 | * @see IQueryGroup | 72 | * @see IQueryGroup |
@@ -118,6 +96,11 @@ public final class SatelliteQueriesAll extends BaseGeneratedPatternGroup { | |||
118 | querySpecifications.add(AtLeastTwoInterferometryPayloads.instance()); | 96 | querySpecifications.add(AtLeastTwoInterferometryPayloads.instance()); |
119 | querySpecifications.add(SpacecraftWithInterferometryPayload.instance()); | 97 | querySpecifications.add(SpacecraftWithInterferometryPayload.instance()); |
120 | querySpecifications.add(NoLinkToGroundStation.instance()); | 98 | querySpecifications.add(NoLinkToGroundStation.instance()); |
99 | querySpecifications.add(NoPotentialLinkToGroundStation.instance()); | ||
100 | querySpecifications.add(IndirectLinkAllowed.instance()); | ||
101 | querySpecifications.add(LinkAllowed.instance()); | ||
102 | querySpecifications.add(MatchingAntenna.instance()); | ||
103 | querySpecifications.add(CubeSat3U.instance()); | ||
121 | querySpecifications.add(CommunicationLoop.instance()); | 104 | querySpecifications.add(CommunicationLoop.instance()); |
122 | querySpecifications.add(IndirectCommunicationLink.instance()); | 105 | querySpecifications.add(IndirectCommunicationLink.instance()); |
123 | querySpecifications.add(DirectCommunicationLink.instance()); | 106 | querySpecifications.add(DirectCommunicationLink.instance()); |
@@ -135,22 +118,6 @@ public final class SatelliteQueriesAll extends BaseGeneratedPatternGroup { | |||
135 | querySpecifications.add(GroundStationNetwork.instance()); | 118 | querySpecifications.add(GroundStationNetwork.instance()); |
136 | querySpecifications.add(CubeSatWithKaAntenna.instance()); | 119 | querySpecifications.add(CubeSatWithKaAntenna.instance()); |
137 | querySpecifications.add(SmallSat.instance()); | 120 | querySpecifications.add(SmallSat.instance()); |
138 | querySpecifications.add(CoverageMetric.instance()); | ||
139 | querySpecifications.add(MissionCoverage.instance()); | ||
140 | querySpecifications.add(TimeMetric.instance()); | ||
141 | querySpecifications.add(MissionTime.instance()); | ||
142 | querySpecifications.add(TransmitTime.instance()); | ||
143 | querySpecifications.add(IncomingData.instance()); | ||
144 | querySpecifications.add(ScienceData.instance()); | ||
145 | querySpecifications.add(TransmitRate.instance()); | ||
146 | querySpecifications.add(SpacecraftUplink.instance()); | ||
147 | querySpecifications.add(CostMetric.instance()); | ||
148 | querySpecifications.add(MissionCost.instance()); | ||
149 | querySpecifications.add(SpacecraftCost.instance()); | ||
150 | querySpecifications.add(SpacecraftOfKind.instance()); | 121 | querySpecifications.add(SpacecraftOfKind.instance()); |
151 | querySpecifications.add(BasePrice.instance()); | ||
152 | querySpecifications.add(InterferometryPayloadCost.instance()); | ||
153 | querySpecifications.add(AdditionalCommSubsystemCost.instance()); | ||
154 | querySpecifications.add(SpacecraftWithTwoCommSubsystems.instance()); | ||
155 | } | 122 | } |
156 | } | 123 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/ScienceData.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/ScienceData.java deleted file mode 100644 index b558e51e..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/ScienceData.java +++ /dev/null | |||
@@ -1,179 +0,0 @@ | |||
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 java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
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.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
32 | |||
33 | /** | ||
34 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
35 | * | ||
36 | * <p>Original source: | ||
37 | * <code><pre> | ||
38 | * private pattern scienceData(Spacecraft : Spacecraft, Data : java Double) { | ||
39 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
40 | * InterferometryMission.observationTime(Mission, ObservationTime); | ||
41 | * Data == eval(12.0 ObservationTime); | ||
42 | * } | ||
43 | * </pre></code> | ||
44 | * | ||
45 | * @see GenericPatternMatcher | ||
46 | * @see GenericPatternMatch | ||
47 | * | ||
48 | */ | ||
49 | @SuppressWarnings("all") | ||
50 | public final class ScienceData extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
51 | private ScienceData() { | ||
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 ScienceData 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.ScienceData (visibility: PUBLIC, simpleName: ScienceData, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData, 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.ScienceData (visibility: PUBLIC, simpleName: ScienceData, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData, 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 ScienceData INSTANCE = new ScienceData(); | ||
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 ScienceData.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
96 | |||
97 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final PParameter parameter_Data = new PParameter("Data", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
100 | |||
101 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Data); | ||
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.scienceData"; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public List<String> getParameterNames() { | ||
114 | return Arrays.asList("Spacecraft","Data"); | ||
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_Data = body.getOrCreateVariableByName("Data"); | ||
130 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
131 | PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
133 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Data), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
134 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
135 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
136 | new ExportedParameter(body, var_Data, parameter_Data) | ||
137 | )); | ||
138 | // ConstellationMission.spacecraft(Mission, Spacecraft) | ||
139 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
140 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
141 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
143 | new Equality(body, var__virtual_0_, var_Spacecraft); | ||
144 | // InterferometryMission.observationTime(Mission, ObservationTime) | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
146 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
147 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); | ||
149 | new Equality(body, var__virtual_1_, var_ObservationTime); | ||
150 | // Data == eval(12.0 * ObservationTime) | ||
151 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
152 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
153 | |||
154 | @Override | ||
155 | public String getShortDescription() { | ||
156 | return "Expression evaluation from pattern scienceData"; | ||
157 | } | ||
158 | |||
159 | @Override | ||
160 | public Iterable<String> getInputParameterNames() { | ||
161 | return Arrays.asList("ObservationTime");} | ||
162 | |||
163 | @Override | ||
164 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
165 | Float ObservationTime = (Float) provider.getValue("ObservationTime"); | ||
166 | return evaluateExpression_1_1(ObservationTime); | ||
167 | } | ||
168 | }, var__virtual_2_ ); | ||
169 | new Equality(body, var_Data, var__virtual_2_); | ||
170 | bodies.add(body); | ||
171 | } | ||
172 | return bodies; | ||
173 | } | ||
174 | } | ||
175 | |||
176 | private static double evaluateExpression_1_1(final Float ObservationTime) { | ||
177 | return (12.0 * (ObservationTime).floatValue()); | ||
178 | } | ||
179 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftCost.java deleted file mode 100644 index 65fed74a..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftCost.java +++ /dev/null | |||
@@ -1,215 +0,0 @@ | |||
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.AdditionalCommSubsystemCost; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKind; | ||
10 | import java.util.Arrays; | ||
11 | import java.util.LinkedHashSet; | ||
12 | import java.util.List; | ||
13 | import java.util.Set; | ||
14 | import org.eclipse.emf.ecore.EClass; | ||
15 | import org.eclipse.emf.ecore.EDataType; | ||
16 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
17 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
18 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
19 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
20 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
38 | |||
39 | /** | ||
40 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
41 | * | ||
42 | * <p>Original source: | ||
43 | * <code><pre> | ||
44 | * private pattern spacecraftCost(Mission : InterferometryMission, Spacecraft : Spacecraft, Cost : java Double) { | ||
45 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
46 | * Spacecraft.kind(Spacecraft, Kind); | ||
47 | * KindCount == count find spacecraftOfKind(_, Kind); | ||
48 | * find basePrice(Spacecraft, BasePrice); | ||
49 | * find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost); | ||
50 | * find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost); | ||
51 | * Cost == eval(BasePrice Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost); | ||
52 | * } | ||
53 | * </pre></code> | ||
54 | * | ||
55 | * @see GenericPatternMatcher | ||
56 | * @see GenericPatternMatch | ||
57 | * | ||
58 | */ | ||
59 | @SuppressWarnings("all") | ||
60 | public final class SpacecraftCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
61 | private SpacecraftCost() { | ||
62 | super(GeneratedPQuery.INSTANCE); | ||
63 | } | ||
64 | |||
65 | /** | ||
66 | * @return the singleton instance of the query specification | ||
67 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
68 | * | ||
69 | */ | ||
70 | public static SpacecraftCost instance() { | ||
71 | try{ | ||
72 | return LazyHolder.INSTANCE; | ||
73 | } catch (ExceptionInInitializerError err) { | ||
74 | throw processInitializerError(err); | ||
75 | } | ||
76 | } | ||
77 | |||
78 | /** | ||
79 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost (visibility: PUBLIC, simpleName: SpacecraftCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost, 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 | ||
80 | * <b>not</b> at the class load time of the outer class, | ||
81 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost (visibility: PUBLIC, simpleName: SpacecraftCost, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost, 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()}. | ||
82 | * | ||
83 | * <p> This workaround is required e.g. to support recursion. | ||
84 | * | ||
85 | */ | ||
86 | private static class LazyHolder { | ||
87 | private static final SpacecraftCost INSTANCE = new SpacecraftCost(); | ||
88 | |||
89 | /** | ||
90 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
91 | * This initialization order is required to support indirect recursion. | ||
92 | * | ||
93 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
94 | * | ||
95 | */ | ||
96 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
97 | |||
98 | public static Object ensureInitialized() { | ||
99 | INSTANCE.ensureInitializedInternal(); | ||
100 | return null; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
105 | private static final SpacecraftCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
106 | |||
107 | private final PParameter parameter_Mission = new PParameter("Mission", "hu.bme.mit.inf.dslreasoner.domains.satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
108 | |||
109 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
110 | |||
111 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
112 | |||
113 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Spacecraft, parameter_Cost); | ||
114 | |||
115 | private GeneratedPQuery() { | ||
116 | super(PVisibility.PRIVATE); | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public String getFullyQualifiedName() { | ||
121 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftCost"; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public List<String> getParameterNames() { | ||
126 | return Arrays.asList("Mission","Spacecraft","Cost"); | ||
127 | } | ||
128 | |||
129 | @Override | ||
130 | public List<PParameter> getParameters() { | ||
131 | return parameters; | ||
132 | } | ||
133 | |||
134 | @Override | ||
135 | public Set<PBody> doGetContainedBodies() { | ||
136 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
137 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
138 | { | ||
139 | PBody body = new PBody(this); | ||
140 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
141 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
142 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
143 | PVariable var_Kind = body.getOrCreateVariableByName("Kind"); | ||
144 | PVariable var_KindCount = body.getOrCreateVariableByName("KindCount"); | ||
145 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
146 | PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); | ||
147 | PVariable var_InterferometryPayloadCost = body.getOrCreateVariableByName("InterferometryPayloadCost"); | ||
148 | PVariable var_AdditionalCommSubsystemCost = body.getOrCreateVariableByName("AdditionalCommSubsystemCost"); | ||
149 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
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_Mission, parameter_Mission), | ||
154 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
155 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
156 | )); | ||
157 | // ConstellationMission.spacecraft(Mission, Spacecraft) | ||
158 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
159 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
160 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); | ||
161 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
162 | new Equality(body, var__virtual_0_, var_Spacecraft); | ||
163 | // Spacecraft.kind(Spacecraft, Kind) | ||
164 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
165 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
166 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); | ||
167 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
168 | new Equality(body, var__virtual_1_, var_Kind); | ||
169 | // KindCount == count find spacecraftOfKind(_, Kind) | ||
170 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
171 | new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_, var_Kind), SpacecraftOfKind.instance().getInternalQueryRepresentation(), var__virtual_2_); | ||
172 | new Equality(body, var_KindCount, var__virtual_2_); | ||
173 | // find basePrice(Spacecraft, BasePrice) | ||
174 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_BasePrice), BasePrice.instance().getInternalQueryRepresentation()); | ||
175 | // find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost) | ||
176 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_InterferometryPayloadCost), InterferometryPayloadCost.instance().getInternalQueryRepresentation()); | ||
177 | // find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost) | ||
178 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_AdditionalCommSubsystemCost), AdditionalCommSubsystemCost.instance().getInternalQueryRepresentation()); | ||
179 | // Cost == eval(BasePrice * Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost) | ||
180 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
181 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
182 | |||
183 | @Override | ||
184 | public String getShortDescription() { | ||
185 | return "Expression evaluation from pattern spacecraftCost"; | ||
186 | } | ||
187 | |||
188 | @Override | ||
189 | public Iterable<String> getInputParameterNames() { | ||
190 | return Arrays.asList("AdditionalCommSubsystemCost", "BasePrice", "InterferometryPayloadCost", "KindCount");} | ||
191 | |||
192 | @Override | ||
193 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
194 | Double AdditionalCommSubsystemCost = (Double) provider.getValue("AdditionalCommSubsystemCost"); | ||
195 | Double BasePrice = (Double) provider.getValue("BasePrice"); | ||
196 | Double InterferometryPayloadCost = (Double) provider.getValue("InterferometryPayloadCost"); | ||
197 | Integer KindCount = (Integer) provider.getValue("KindCount"); | ||
198 | return evaluateExpression_1_1(AdditionalCommSubsystemCost, BasePrice, InterferometryPayloadCost, KindCount); | ||
199 | } | ||
200 | }, var__virtual_3_ ); | ||
201 | new Equality(body, var_Cost, var__virtual_3_); | ||
202 | bodies.add(body); | ||
203 | } | ||
204 | return bodies; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | private static double evaluateExpression_1_1(final Double AdditionalCommSubsystemCost, final Double BasePrice, final Double InterferometryPayloadCost, final Integer KindCount) { | ||
209 | double _pow = Math.pow((KindCount).intValue(), (-0.25)); | ||
210 | double _multiply = ((BasePrice).doubleValue() * _pow); | ||
211 | double _plus = (_multiply + (InterferometryPayloadCost).doubleValue()); | ||
212 | double _plus_1 = (_plus + (AdditionalCommSubsystemCost).doubleValue()); | ||
213 | return _plus_1; | ||
214 | } | ||
215 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftOfKind.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftOfKind.java deleted file mode 100644 index 5e49aa58..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftOfKind.java +++ /dev/null | |||
@@ -1,140 +0,0 @@ | |||
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 java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
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.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern spacecraftOfKind(Spacecraft : Spacecraft, Kind : SpacecraftKind) { | ||
34 | * Spacecraft.kind(Spacecraft, Kind); | ||
35 | * } | ||
36 | * </pre></code> | ||
37 | * | ||
38 | * @see GenericPatternMatcher | ||
39 | * @see GenericPatternMatch | ||
40 | * | ||
41 | */ | ||
42 | @SuppressWarnings("all") | ||
43 | public final class SpacecraftOfKind extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
44 | private SpacecraftOfKind() { | ||
45 | super(GeneratedPQuery.INSTANCE); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @return the singleton instance of the query specification | ||
50 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
51 | * | ||
52 | */ | ||
53 | public static SpacecraftOfKind instance() { | ||
54 | try{ | ||
55 | return LazyHolder.INSTANCE; | ||
56 | } catch (ExceptionInInitializerError err) { | ||
57 | throw processInitializerError(err); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKind (visibility: PUBLIC, simpleName: SpacecraftOfKind, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKind, 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 | ||
63 | * <b>not</b> at the class load time of the outer class, | ||
64 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKind (visibility: PUBLIC, simpleName: SpacecraftOfKind, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKind, 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()}. | ||
65 | * | ||
66 | * <p> This workaround is required e.g. to support recursion. | ||
67 | * | ||
68 | */ | ||
69 | private static class LazyHolder { | ||
70 | private static final SpacecraftOfKind INSTANCE = new SpacecraftOfKind(); | ||
71 | |||
72 | /** | ||
73 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
74 | * This initialization order is required to support indirect recursion. | ||
75 | * | ||
76 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
77 | * | ||
78 | */ | ||
79 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
80 | |||
81 | public static Object ensureInitialized() { | ||
82 | INSTANCE.ensureInitializedInternal(); | ||
83 | return null; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
88 | private static final SpacecraftOfKind.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
89 | |||
90 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
91 | |||
92 | private final PParameter parameter_Kind = new PParameter("Kind", "hu.bme.mit.inf.dslreasoner.domains.satellite.SpacecraftKind", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "SpacecraftKind")), PParameterDirection.INOUT); | ||
93 | |||
94 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Kind); | ||
95 | |||
96 | private GeneratedPQuery() { | ||
97 | super(PVisibility.PRIVATE); | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public String getFullyQualifiedName() { | ||
102 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind"; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public List<String> getParameterNames() { | ||
107 | return Arrays.asList("Spacecraft","Kind"); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<PParameter> getParameters() { | ||
112 | return parameters; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Set<PBody> doGetContainedBodies() { | ||
117 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
118 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
119 | { | ||
120 | PBody body = new PBody(this); | ||
121 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
122 | PVariable var_Kind = body.getOrCreateVariableByName("Kind"); | ||
123 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
124 | new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
125 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
126 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
127 | new ExportedParameter(body, var_Kind, parameter_Kind) | ||
128 | )); | ||
129 | // Spacecraft.kind(Spacecraft, Kind) | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
131 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); | ||
134 | new Equality(body, var__virtual_0_, var_Kind); | ||
135 | bodies.add(body); | ||
136 | } | ||
137 | return bodies; | ||
138 | } | ||
139 | } | ||
140 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftUplink.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftUplink.java deleted file mode 100644 index 966ff6f8..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftUplink.java +++ /dev/null | |||
@@ -1,171 +0,0 @@ | |||
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 java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
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.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern spacecraftUplink(Spacecraft : Spacecraft, Band : TransceiverBand, Target : CommunicatingElement) { | ||
34 | * CommunicatingElement.communicationLink(Spacecraft, Link); | ||
35 | * DirectedCommunicationLink.source.band(Link, Band); | ||
36 | * DirectedCommunicationLink.target(Link, TargetSubsystem); | ||
37 | * CommunicatingElement.commSubsystem(Target, TargetSubsystem); | ||
38 | * } | ||
39 | * </pre></code> | ||
40 | * | ||
41 | * @see GenericPatternMatcher | ||
42 | * @see GenericPatternMatch | ||
43 | * | ||
44 | */ | ||
45 | @SuppressWarnings("all") | ||
46 | public final class SpacecraftUplink extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
47 | private SpacecraftUplink() { | ||
48 | super(GeneratedPQuery.INSTANCE); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @return the singleton instance of the query specification | ||
53 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
54 | * | ||
55 | */ | ||
56 | public static SpacecraftUplink instance() { | ||
57 | try{ | ||
58 | return LazyHolder.INSTANCE; | ||
59 | } catch (ExceptionInInitializerError err) { | ||
60 | throw processInitializerError(err); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink (visibility: PUBLIC, simpleName: SpacecraftUplink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink, 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 | ||
66 | * <b>not</b> at the class load time of the outer class, | ||
67 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink (visibility: PUBLIC, simpleName: SpacecraftUplink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink, 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()}. | ||
68 | * | ||
69 | * <p> This workaround is required e.g. to support recursion. | ||
70 | * | ||
71 | */ | ||
72 | private static class LazyHolder { | ||
73 | private static final SpacecraftUplink INSTANCE = new SpacecraftUplink(); | ||
74 | |||
75 | /** | ||
76 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
77 | * This initialization order is required to support indirect recursion. | ||
78 | * | ||
79 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
80 | * | ||
81 | */ | ||
82 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
83 | |||
84 | public static Object ensureInitialized() { | ||
85 | INSTANCE.ensureInitializedInternal(); | ||
86 | return null; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
91 | private static final SpacecraftUplink.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
92 | |||
93 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
94 | |||
95 | private final PParameter parameter_Band = new PParameter("Band", "hu.bme.mit.inf.dslreasoner.domains.satellite.TransceiverBand", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "TransceiverBand")), PParameterDirection.INOUT); | ||
96 | |||
97 | private final PParameter parameter_Target = new PParameter("Target", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_Band, parameter_Target); | ||
100 | |||
101 | private GeneratedPQuery() { | ||
102 | super(PVisibility.PRIVATE); | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String getFullyQualifiedName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftUplink"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> getParameterNames() { | ||
112 | return Arrays.asList("Spacecraft","Band","Target"); | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<PParameter> getParameters() { | ||
117 | return parameters; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public Set<PBody> doGetContainedBodies() { | ||
122 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
123 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
124 | { | ||
125 | PBody body = new PBody(this); | ||
126 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
127 | PVariable var_Band = body.getOrCreateVariableByName("Band"); | ||
128 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
129 | PVariable var_Link = body.getOrCreateVariableByName("Link"); | ||
130 | PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem"); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Band), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
134 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
135 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
136 | new ExportedParameter(body, var_Band, parameter_Band), | ||
137 | new ExportedParameter(body, var_Target, parameter_Target) | ||
138 | )); | ||
139 | // CommunicatingElement.communicationLink(Spacecraft, Link) | ||
140 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
141 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "communicationLink"))); | ||
143 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
144 | new Equality(body, var__virtual_0_, var_Link); | ||
145 | // DirectedCommunicationLink.source.band(Link, Band) | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
147 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source"))); | ||
149 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
150 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
151 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); | ||
152 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); | ||
153 | new Equality(body, var__virtual_2_, var_Band); | ||
154 | // DirectedCommunicationLink.target(Link, TargetSubsystem) | ||
155 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); | ||
156 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
157 | new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); | ||
158 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
159 | new Equality(body, var__virtual_3_, var_TargetSubsystem); | ||
160 | // CommunicatingElement.commSubsystem(Target, TargetSubsystem) | ||
161 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); | ||
162 | PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); | ||
163 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
164 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
165 | new Equality(body, var__virtual_4_, var_TargetSubsystem); | ||
166 | bodies.add(body); | ||
167 | } | ||
168 | return bodies; | ||
169 | } | ||
170 | } | ||
171 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithTwoCommSubsystems.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithTwoCommSubsystems.java deleted file mode 100644 index 98f1be7b..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithTwoCommSubsystems.java +++ /dev/null | |||
@@ -1,146 +0,0 @@ | |||
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 java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
26 | |||
27 | /** | ||
28 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
29 | * | ||
30 | * <p>Original source: | ||
31 | * <code><pre> | ||
32 | * private pattern spacecraftWithTwoCommSubsystems(Spacecraft : Spacecraft) { | ||
33 | * Spacecraft.commSubsystem(Spacecraft, Subsystem1); | ||
34 | * Spacecraft.commSubsystem(Spacecraft, Subsystem2); | ||
35 | * Subsystem1 != Subsystem2; | ||
36 | * } | ||
37 | * </pre></code> | ||
38 | * | ||
39 | * @see GenericPatternMatcher | ||
40 | * @see GenericPatternMatch | ||
41 | * | ||
42 | */ | ||
43 | @SuppressWarnings("all") | ||
44 | public final class SpacecraftWithTwoCommSubsystems extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
45 | private SpacecraftWithTwoCommSubsystems() { | ||
46 | super(GeneratedPQuery.INSTANCE); | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * @return the singleton instance of the query specification | ||
51 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
52 | * | ||
53 | */ | ||
54 | public static SpacecraftWithTwoCommSubsystems instance() { | ||
55 | try{ | ||
56 | return LazyHolder.INSTANCE; | ||
57 | } catch (ExceptionInInitializerError err) { | ||
58 | throw processInitializerError(err); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems (visibility: PUBLIC, simpleName: SpacecraftWithTwoCommSubsystems, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems, 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 | ||
64 | * <b>not</b> at the class load time of the outer class, | ||
65 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems (visibility: PUBLIC, simpleName: SpacecraftWithTwoCommSubsystems, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems, 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()}. | ||
66 | * | ||
67 | * <p> This workaround is required e.g. to support recursion. | ||
68 | * | ||
69 | */ | ||
70 | private static class LazyHolder { | ||
71 | private static final SpacecraftWithTwoCommSubsystems INSTANCE = new SpacecraftWithTwoCommSubsystems(); | ||
72 | |||
73 | /** | ||
74 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
75 | * This initialization order is required to support indirect recursion. | ||
76 | * | ||
77 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
78 | * | ||
79 | */ | ||
80 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
81 | |||
82 | public static Object ensureInitialized() { | ||
83 | INSTANCE.ensureInitializedInternal(); | ||
84 | return null; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
89 | private static final SpacecraftWithTwoCommSubsystems.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
90 | |||
91 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
92 | |||
93 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft); | ||
94 | |||
95 | private GeneratedPQuery() { | ||
96 | super(PVisibility.PRIVATE); | ||
97 | } | ||
98 | |||
99 | @Override | ||
100 | public String getFullyQualifiedName() { | ||
101 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftWithTwoCommSubsystems"; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public List<String> getParameterNames() { | ||
106 | return Arrays.asList("Spacecraft"); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public List<PParameter> getParameters() { | ||
111 | return parameters; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public Set<PBody> doGetContainedBodies() { | ||
116 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
117 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
118 | { | ||
119 | PBody body = new PBody(this); | ||
120 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
121 | PVariable var_Subsystem1 = body.getOrCreateVariableByName("Subsystem1"); | ||
122 | PVariable var_Subsystem2 = body.getOrCreateVariableByName("Subsystem2"); | ||
123 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
124 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
125 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft) | ||
126 | )); | ||
127 | // Spacecraft.commSubsystem(Spacecraft, Subsystem1) | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
129 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
132 | new Equality(body, var__virtual_0_, var_Subsystem1); | ||
133 | // Spacecraft.commSubsystem(Spacecraft, Subsystem2) | ||
134 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
135 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
136 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); | ||
137 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); | ||
138 | new Equality(body, var__virtual_1_, var_Subsystem2); | ||
139 | // Subsystem1 != Subsystem2 | ||
140 | new Inequality(body, var_Subsystem1, var_Subsystem2); | ||
141 | bodies.add(body); | ||
142 | } | ||
143 | return bodies; | ||
144 | } | ||
145 | } | ||
146 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitRate.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitRate.java deleted file mode 100644 index 2faa7733..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitRate.java +++ /dev/null | |||
@@ -1,277 +0,0 @@ | |||
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.SpacecraftUplink; | ||
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.TypeFilterConstraint; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
29 | |||
30 | /** | ||
31 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
32 | * | ||
33 | * <p>Original source: | ||
34 | * <code><pre> | ||
35 | * private pattern transmitRate(Spacecraft : Spacecraft, TransmitRate : java Double) { | ||
36 | * find spacecraftUplink(Spacecraft, TransceiverBand::UHF, Target); | ||
37 | * Spacecraft(Target); | ||
38 | * TransmitRate == 5.0; | ||
39 | * } or { | ||
40 | * find spacecraftUplink(Spacecraft, TransceiverBand::X, Target); | ||
41 | * Spacecraft(Target); | ||
42 | * TransmitRate == 1.6; | ||
43 | * } or { | ||
44 | * find spacecraftUplink(Spacecraft, TransceiverBand::X, Target); | ||
45 | * GroundStationNetwork(Target); | ||
46 | * TransmitRate == 0.7; | ||
47 | * } or { | ||
48 | * find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target); | ||
49 | * Spacecraft(Target); | ||
50 | * TransmitRate == 220.0; | ||
51 | * } or { | ||
52 | * find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target); | ||
53 | * GroundStationNetwork(Target); | ||
54 | * TransmitRate == 80.0; | ||
55 | * } | ||
56 | * </pre></code> | ||
57 | * | ||
58 | * @see GenericPatternMatcher | ||
59 | * @see GenericPatternMatch | ||
60 | * | ||
61 | */ | ||
62 | @SuppressWarnings("all") | ||
63 | public final class TransmitRate extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
64 | private TransmitRate() { | ||
65 | super(GeneratedPQuery.INSTANCE); | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * @return the singleton instance of the query specification | ||
70 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
71 | * | ||
72 | */ | ||
73 | public static TransmitRate instance() { | ||
74 | try{ | ||
75 | return LazyHolder.INSTANCE; | ||
76 | } catch (ExceptionInInitializerError err) { | ||
77 | throw processInitializerError(err); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | /** | ||
82 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate (visibility: PUBLIC, simpleName: TransmitRate, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate, 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 | ||
83 | * <b>not</b> at the class load time of the outer class, | ||
84 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate (visibility: PUBLIC, simpleName: TransmitRate, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate, 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()}. | ||
85 | * | ||
86 | * <p> This workaround is required e.g. to support recursion. | ||
87 | * | ||
88 | */ | ||
89 | private static class LazyHolder { | ||
90 | private static final TransmitRate INSTANCE = new TransmitRate(); | ||
91 | |||
92 | /** | ||
93 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
94 | * This initialization order is required to support indirect recursion. | ||
95 | * | ||
96 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
97 | * | ||
98 | */ | ||
99 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
100 | |||
101 | public static Object ensureInitialized() { | ||
102 | INSTANCE.ensureInitializedInternal(); | ||
103 | return null; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
108 | private static final TransmitRate.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
109 | |||
110 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
111 | |||
112 | private final PParameter parameter_TransmitRate = new PParameter("TransmitRate", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
113 | |||
114 | private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft, parameter_TransmitRate); | ||
115 | |||
116 | private GeneratedPQuery() { | ||
117 | super(PVisibility.PRIVATE); | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public String getFullyQualifiedName() { | ||
122 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.transmitRate"; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public List<String> getParameterNames() { | ||
127 | return Arrays.asList("Spacecraft","TransmitRate"); | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public List<PParameter> getParameters() { | ||
132 | return parameters; | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public Set<PBody> doGetContainedBodies() { | ||
137 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
138 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
139 | { | ||
140 | PBody body = new PBody(this); | ||
141 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
142 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
143 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
145 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
146 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
147 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
148 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
149 | )); | ||
150 | // find spacecraftUplink(Spacecraft, TransceiverBand::UHF, Target) | ||
151 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
152 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance()); | ||
153 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
154 | // Spacecraft(Target) | ||
155 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
156 | // TransmitRate == 5.0 | ||
157 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
158 | new ConstantValue(body, var__virtual_1_, 5.0); | ||
159 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
160 | bodies.add(body); | ||
161 | } | ||
162 | { | ||
163 | PBody body = new PBody(this); | ||
164 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
165 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
166 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
167 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
168 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
169 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
170 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
171 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
172 | )); | ||
173 | // find spacecraftUplink(Spacecraft, TransceiverBand::X, Target) | ||
174 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
175 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "X").getInstance()); | ||
176 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
177 | // Spacecraft(Target) | ||
178 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
179 | // TransmitRate == 1.6 | ||
180 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
181 | new ConstantValue(body, var__virtual_1_, 1.6); | ||
182 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
183 | bodies.add(body); | ||
184 | } | ||
185 | { | ||
186 | PBody body = new PBody(this); | ||
187 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
188 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
189 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
190 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
191 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
192 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
193 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
194 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
195 | )); | ||
196 | // find spacecraftUplink(Spacecraft, TransceiverBand::X, Target) | ||
197 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
198 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "X").getInstance()); | ||
199 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
200 | // GroundStationNetwork(Target) | ||
201 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); | ||
202 | // TransmitRate == 0.7 | ||
203 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
204 | new ConstantValue(body, var__virtual_1_, 0.7); | ||
205 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
206 | bodies.add(body); | ||
207 | } | ||
208 | { | ||
209 | PBody body = new PBody(this); | ||
210 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
211 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
212 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
213 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
214 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
215 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
216 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
217 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
218 | )); | ||
219 | // find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target) | ||
220 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
221 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance()); | ||
222 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
223 | // Spacecraft(Target) | ||
224 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
225 | // TransmitRate == 220.0 | ||
226 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
227 | new ConstantValue(body, var__virtual_1_, 220.0); | ||
228 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
229 | bodies.add(body); | ||
230 | } | ||
231 | { | ||
232 | PBody body = new PBody(this); | ||
233 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
234 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
235 | PVariable var_Target = body.getOrCreateVariableByName("Target"); | ||
236 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
237 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
238 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
239 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
240 | new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) | ||
241 | )); | ||
242 | // find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target) | ||
243 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
244 | new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance()); | ||
245 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); | ||
246 | // GroundStationNetwork(Target) | ||
247 | new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); | ||
248 | // TransmitRate == 80.0 | ||
249 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
250 | new ConstantValue(body, var__virtual_1_, 80.0); | ||
251 | new Equality(body, var_TransmitRate, var__virtual_1_); | ||
252 | bodies.add(body); | ||
253 | } | ||
254 | return bodies; | ||
255 | } | ||
256 | } | ||
257 | |||
258 | private static double evaluateExpression_1_1() { | ||
259 | return 5.0; | ||
260 | } | ||
261 | |||
262 | private static double evaluateExpression_2_1() { | ||
263 | return 1.6; | ||
264 | } | ||
265 | |||
266 | private static double evaluateExpression_3_1() { | ||
267 | return 0.7; | ||
268 | } | ||
269 | |||
270 | private static double evaluateExpression_4_1() { | ||
271 | return 220.0; | ||
272 | } | ||
273 | |||
274 | private static double evaluateExpression_5_1() { | ||
275 | return 80.0; | ||
276 | } | ||
277 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitTime.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitTime.java deleted file mode 100644 index eb338bec..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitTime.java +++ /dev/null | |||
@@ -1,200 +0,0 @@ | |||
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.IncomingData; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate; | ||
9 | import java.util.Arrays; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Set; | ||
13 | import org.eclipse.emf.ecore.EClass; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
15 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
36 | import org.eclipse.xtext.xbase.lib.DoubleExtensions; | ||
37 | |||
38 | /** | ||
39 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
40 | * | ||
41 | * <p>Original source: | ||
42 | * <code><pre> | ||
43 | * private pattern transmitTime(Mission : InterferometryMission, Spacecraft : Spacecraft, TransmitTime : java Double) { | ||
44 | * ConstellationMission.spacecraft(Mission, Spacecraft); | ||
45 | * find scienceData(Spacecraft, ScienceData); | ||
46 | * IncomingData == sum find incomingData(Spacecraft, _, #_); | ||
47 | * find transmitRate(Spacecraft, TransmitRate); | ||
48 | * TransmitTime == eval((ScienceData + IncomingData) / (7.5 TransmitRate)); | ||
49 | * } | ||
50 | * </pre></code> | ||
51 | * | ||
52 | * @see GenericPatternMatcher | ||
53 | * @see GenericPatternMatch | ||
54 | * | ||
55 | */ | ||
56 | @SuppressWarnings("all") | ||
57 | public final class TransmitTime extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
58 | private TransmitTime() { | ||
59 | super(GeneratedPQuery.INSTANCE); | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * @return the singleton instance of the query specification | ||
64 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
65 | * | ||
66 | */ | ||
67 | public static TransmitTime instance() { | ||
68 | try{ | ||
69 | return LazyHolder.INSTANCE; | ||
70 | } catch (ExceptionInInitializerError err) { | ||
71 | throw processInitializerError(err); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime (visibility: PUBLIC, simpleName: TransmitTime, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime, 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 | ||
77 | * <b>not</b> at the class load time of the outer class, | ||
78 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime (visibility: PUBLIC, simpleName: TransmitTime, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime, 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()}. | ||
79 | * | ||
80 | * <p> This workaround is required e.g. to support recursion. | ||
81 | * | ||
82 | */ | ||
83 | private static class LazyHolder { | ||
84 | private static final TransmitTime INSTANCE = new TransmitTime(); | ||
85 | |||
86 | /** | ||
87 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
88 | * This initialization order is required to support indirect recursion. | ||
89 | * | ||
90 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
91 | * | ||
92 | */ | ||
93 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
94 | |||
95 | public static Object ensureInitialized() { | ||
96 | INSTANCE.ensureInitializedInternal(); | ||
97 | return null; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
102 | private static final TransmitTime.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
103 | |||
104 | private final PParameter parameter_Mission = new PParameter("Mission", "hu.bme.mit.inf.dslreasoner.domains.satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT); | ||
105 | |||
106 | private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
107 | |||
108 | private final PParameter parameter_TransmitTime = new PParameter("TransmitTime", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
109 | |||
110 | private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Spacecraft, parameter_TransmitTime); | ||
111 | |||
112 | private GeneratedPQuery() { | ||
113 | super(PVisibility.PRIVATE); | ||
114 | } | ||
115 | |||
116 | @Override | ||
117 | public String getFullyQualifiedName() { | ||
118 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.transmitTime"; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public List<String> getParameterNames() { | ||
123 | return Arrays.asList("Mission","Spacecraft","TransmitTime"); | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public List<PParameter> getParameters() { | ||
128 | return parameters; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public Set<PBody> doGetContainedBodies() { | ||
133 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
134 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
135 | { | ||
136 | PBody body = new PBody(this); | ||
137 | PVariable var_Mission = body.getOrCreateVariableByName("Mission"); | ||
138 | PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); | ||
139 | PVariable var_TransmitTime = body.getOrCreateVariableByName("TransmitTime"); | ||
140 | PVariable var_ScienceData = body.getOrCreateVariableByName("ScienceData"); | ||
141 | PVariable var_IncomingData = body.getOrCreateVariableByName("IncomingData"); | ||
142 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
143 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
144 | PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
147 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitTime), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
148 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
149 | new ExportedParameter(body, var_Mission, parameter_Mission), | ||
150 | new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), | ||
151 | new ExportedParameter(body, var_TransmitTime, parameter_TransmitTime) | ||
152 | )); | ||
153 | // ConstellationMission.spacecraft(Mission, Spacecraft) | ||
154 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); | ||
155 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
156 | new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); | ||
157 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
158 | new Equality(body, var__virtual_0_, var_Spacecraft); | ||
159 | // find scienceData(Spacecraft, ScienceData) | ||
160 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_ScienceData), ScienceData.instance().getInternalQueryRepresentation()); | ||
161 | // IncomingData == sum find incomingData(Spacecraft, _, #_) | ||
162 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
163 | new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var_Spacecraft, var___0_, var___1_), IncomingData.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); | ||
164 | new Equality(body, var_IncomingData, var__virtual_1_); | ||
165 | // find transmitRate(Spacecraft, TransmitRate) | ||
166 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_TransmitRate), TransmitRate.instance().getInternalQueryRepresentation()); | ||
167 | // TransmitTime == eval((ScienceData + IncomingData) / (7.5 * TransmitRate)) | ||
168 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
169 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
170 | |||
171 | @Override | ||
172 | public String getShortDescription() { | ||
173 | return "Expression evaluation from pattern transmitTime"; | ||
174 | } | ||
175 | |||
176 | @Override | ||
177 | public Iterable<String> getInputParameterNames() { | ||
178 | return Arrays.asList("IncomingData", "ScienceData", "TransmitRate");} | ||
179 | |||
180 | @Override | ||
181 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
182 | Double IncomingData = (Double) provider.getValue("IncomingData"); | ||
183 | Double ScienceData = (Double) provider.getValue("ScienceData"); | ||
184 | Double TransmitRate = (Double) provider.getValue("TransmitRate"); | ||
185 | return evaluateExpression_1_1(IncomingData, ScienceData, TransmitRate); | ||
186 | } | ||
187 | }, var__virtual_2_ ); | ||
188 | new Equality(body, var_TransmitTime, var__virtual_2_); | ||
189 | bodies.add(body); | ||
190 | } | ||
191 | return bodies; | ||
192 | } | ||
193 | } | ||
194 | |||
195 | private static double evaluateExpression_1_1(final Double IncomingData, final Double ScienceData, final Double TransmitRate) { | ||
196 | double _plus = DoubleExtensions.operator_plus(ScienceData, IncomingData); | ||
197 | double _divide = (_plus / (7.5 * (TransmitRate).doubleValue())); | ||
198 | return _divide; | ||
199 | } | ||
200 | } | ||