From 09b1255f11ee17828da706f682e33f50316887fe Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Mon, 6 May 2019 18:42:22 -0400 Subject: Trying to implement spacecraft case study --- .../domains/satellite/metrics/.gitignore | 2 - .../domains/satellite/metrics/internal/.gitignore | 2 - .../domains/satellite/queries/.gitignore | 3 + .../domains/satellite/queries/CostMetric.java | 544 --------------- .../domains/satellite/queries/CoverageMetric.java | 552 --------------- .../satellite/queries/CubeSatWithKaAntenna.java | 2 +- .../queries/NoPotentialLinkToGroundStation.java | 571 ++++++++++++++++ .../queries/NotEnoughInterferometryPayloads.java | 19 +- .../satellite/queries/SatelliteQueries.java | 50 +- .../domains/satellite/queries/SmallSat.java | 533 +++++++++++++++ .../satellite/queries/SpacecraftOfKind.java | 754 +++++++++++++++++++++ .../queries/ThreeUCubeSatWithNonUhfCrossLink.java | 103 ++- .../domains/satellite/queries/TimeMetric.java | 544 --------------- .../domains/satellite/queries/internal/.gitignore | 5 + .../internal/AdditionalCommSubsystemCost.java | 173 ----- .../satellite/queries/internal/BasePrice.java | 216 ------ .../satellite/queries/internal/CubeSat3U.java | 127 ++++ .../satellite/queries/internal/IncomingData.java | 145 ---- .../queries/internal/IndirectLinkAllowed.java | 134 ++++ .../internal/InterferometryPayloadCost.java | 175 ----- .../satellite/queries/internal/LinkAllowed.java | 185 +++++ .../queries/internal/MatchingAntenna.java | 179 +++++ .../satellite/queries/internal/MissionCost.java | 183 ----- .../queries/internal/MissionCoverage.java | 183 ----- .../satellite/queries/internal/MissionTime.java | 183 ----- .../queries/internal/SatelliteQueriesAll.java | 67 +- .../satellite/queries/internal/ScienceData.java | 179 ----- .../satellite/queries/internal/SmallSat.java | 138 ---- .../satellite/queries/internal/SpacecraftCost.java | 215 ------ .../queries/internal/SpacecraftOfKind.java | 140 ---- .../queries/internal/SpacecraftUplink.java | 171 ----- .../internal/SpacecraftWithTwoCommSubsystems.java | 146 ---- .../satellite/queries/internal/TransmitRate.java | 277 -------- .../satellite/queries/internal/TransmitTime.java | 200 ------ 34 files changed, 2594 insertions(+), 4506 deletions(-) delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/metrics/.gitignore delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/metrics/internal/.gitignore delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CoverageMetric.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SmallSat.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SpacecraftOfKind.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/TimeMetric.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AdditionalCommSubsystemCost.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/BasePrice.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CubeSat3U.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IncomingData.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectLinkAllowed.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/InterferometryPayloadCost.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/LinkAllowed.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MatchingAntenna.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCost.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionCoverage.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/MissionTime.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/ScienceData.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SmallSat.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftCost.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftOfKind.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftUplink.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithTwoCommSubsystems.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitRate.java delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/TransmitTime.java (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen') 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 @@ -/.CoverageMetric.java._trace -/.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 @@ -/.MissionCoverage.java._trace -/.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 @@ /.TimeMetric.java._trace /.CostMetric.java._trace /.SpacecraftCost.java._trace +/.SpacecraftOfKind.java._trace +/.NoPotentialLinkToGroundStation.java._trace +/.SmallSat.java._trace 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/CostMetric.java deleted file mode 100644 index 474719b2..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CostMetric.java +++ /dev/null @@ -1,544 +0,0 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         // Cost
- *         
- *         pattern costMetric(Cost : java Double) {
- *         	Cost == sum find missionCost(_, #_);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class CostMetric extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Double fCost; - - private static List parameterNames = makeImmutableList("Cost"); - - private Match(final Double pCost) { - this.fCost = pCost; - } - - @Override - public Object get(final String parameterName) { - if ("Cost".equals(parameterName)) return this.fCost; - return null; - } - - public Double getCost() { - return this.fCost; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("Cost".equals(parameterName) ) { - this.fCost = (Double) newValue; - return true; - } - return false; - } - - public void setCost(final Double pCost) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fCost = pCost; - } - - @Override - public String patternName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric"; - } - - @Override - public List parameterNames() { - return CostMetric.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fCost}; - } - - @Override - public CostMetric.Match toImmutable() { - return isMutable() ? newMatch(fCost) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"Cost\"=" + prettyPrintValue(fCost)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fCost); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof CostMetric.Match)) { - CostMetric.Match other = (CostMetric.Match) obj; - return Objects.equals(fCost, other.fCost); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public CostMetric specification() { - return CostMetric.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static CostMetric.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pCost the fixed value of pattern parameter Cost, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static CostMetric.Match newMutableMatch(final Double pCost) { - return new Mutable(pCost); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pCost the fixed value of pattern parameter Cost, or null if not bound. - * @return the (partial) match object. - * - */ - public static CostMetric.Match newMatch(final Double pCost) { - return new Immutable(pCost); - } - - private static final class Mutable extends CostMetric.Match { - Mutable(final Double pCost) { - super(pCost); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends CostMetric.Match { - Immutable(final Double pCost) { - super(pCost); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * // Cost
-   * 
-   * pattern costMetric(Cost : java Double) {
-   * 	Cost == sum find missionCost(_, #_);
-   * }
-   * 
- * - * @see Match - * @see CostMetric - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static CostMetric.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static CostMetric.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_COST = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CostMetric.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pCost the fixed value of pattern parameter Cost, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Double pCost) { - return rawStreamAllMatches(new Object[]{pCost}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pCost the fixed value of pattern parameter Cost, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Double pCost) { - return rawStreamAllMatches(new Object[]{pCost}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pCost the fixed value of pattern parameter Cost, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Double pCost) { - return rawGetOneArbitraryMatch(new Object[]{pCost}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pCost the fixed value of pattern parameter Cost, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Double pCost) { - return rawHasMatch(new Object[]{pCost}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pCost the fixed value of pattern parameter Cost, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Double pCost) { - return rawCountMatches(new Object[]{pCost}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pCost the fixed value of pattern parameter Cost, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Double pCost, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pCost}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pCost the fixed value of pattern parameter Cost, or null if not bound. - * @return the (partial) match object. - * - */ - public CostMetric.Match newMatch(final Double pCost) { - return CostMetric.Match.newMatch(pCost); - } - - /** - * Retrieve the set of values that occur in matches for Cost. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfCost(final Object[] parameters) { - return rawStreamAllValues(POSITION_COST, parameters).map(Double.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for Cost. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfCost() { - return rawStreamAllValuesOfCost(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for Cost. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfCost() { - return rawStreamAllValuesOfCost(emptyArray()); - } - - @Override - protected CostMetric.Match tupleToMatch(final Tuple t) { - try { - return CostMetric.Match.newMatch((Double) t.get(POSITION_COST)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected CostMetric.Match arrayToMatch(final Object[] match) { - try { - return CostMetric.Match.newMatch((Double) match[POSITION_COST]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected CostMetric.Match arrayToMatchMutable(final Object[] match) { - try { - return CostMetric.Match.newMutableMatch((Double) match[POSITION_COST]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return CostMetric.instance(); - } - } - - private CostMetric() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static CostMetric instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected CostMetric.Matcher instantiate(final ViatraQueryEngine engine) { - return CostMetric.Matcher.on(engine); - } - - @Override - public CostMetric.Matcher instantiate() { - return CostMetric.Matcher.create(); - } - - @Override - public CostMetric.Match newEmptyMatch() { - return CostMetric.Match.newEmptyMatch(); - } - - @Override - public CostMetric.Match newMatch(final Object... parameters) { - return CostMetric.Match.newMatch((java.lang.Double) parameters[0]); - } - - /** - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final CostMetric INSTANCE = new CostMetric(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final CostMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Cost); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Cost"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Cost = body.getOrCreateVariableByName("Cost"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Cost, parameter_Cost) - )); - // Cost == sum find missionCost(_, #_) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), MissionCost.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); - new Equality(body, var_Cost, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} 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/CoverageMetric.java deleted file mode 100644 index 23b02ce4..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CoverageMetric.java +++ /dev/null @@ -1,552 +0,0 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         //
- *         // Metrics
- *         //
- *         
- *         // Coverage
- *         
- *         pattern coverageMetric(Coverage : java Double) {
- *         	Coverage == sum find missionCoverage(_, #_);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class CoverageMetric extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Double fCoverage; - - private static List parameterNames = makeImmutableList("Coverage"); - - private Match(final Double pCoverage) { - this.fCoverage = pCoverage; - } - - @Override - public Object get(final String parameterName) { - if ("Coverage".equals(parameterName)) return this.fCoverage; - return null; - } - - public Double getCoverage() { - return this.fCoverage; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("Coverage".equals(parameterName) ) { - this.fCoverage = (Double) newValue; - return true; - } - return false; - } - - public void setCoverage(final Double pCoverage) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fCoverage = pCoverage; - } - - @Override - public String patternName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric"; - } - - @Override - public List parameterNames() { - return CoverageMetric.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fCoverage}; - } - - @Override - public CoverageMetric.Match toImmutable() { - return isMutable() ? newMatch(fCoverage) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"Coverage\"=" + prettyPrintValue(fCoverage)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fCoverage); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof CoverageMetric.Match)) { - CoverageMetric.Match other = (CoverageMetric.Match) obj; - return Objects.equals(fCoverage, other.fCoverage); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public CoverageMetric specification() { - return CoverageMetric.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static CoverageMetric.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static CoverageMetric.Match newMutableMatch(final Double pCoverage) { - return new Mutable(pCoverage); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. - * @return the (partial) match object. - * - */ - public static CoverageMetric.Match newMatch(final Double pCoverage) { - return new Immutable(pCoverage); - } - - private static final class Mutable extends CoverageMetric.Match { - Mutable(final Double pCoverage) { - super(pCoverage); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends CoverageMetric.Match { - Immutable(final Double pCoverage) { - super(pCoverage); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * //
-   * // Metrics
-   * //
-   * 
-   * // Coverage
-   * 
-   * pattern coverageMetric(Coverage : java Double) {
-   * 	Coverage == sum find missionCoverage(_, #_);
-   * }
-   * 
- * - * @see Match - * @see CoverageMetric - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static CoverageMetric.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static CoverageMetric.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_COVERAGE = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CoverageMetric.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Double pCoverage) { - return rawStreamAllMatches(new Object[]{pCoverage}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Double pCoverage) { - return rawStreamAllMatches(new Object[]{pCoverage}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Double pCoverage) { - return rawGetOneArbitraryMatch(new Object[]{pCoverage}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Double pCoverage) { - return rawHasMatch(new Object[]{pCoverage}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Double pCoverage) { - return rawCountMatches(new Object[]{pCoverage}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Double pCoverage, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pCoverage}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pCoverage the fixed value of pattern parameter Coverage, or null if not bound. - * @return the (partial) match object. - * - */ - public CoverageMetric.Match newMatch(final Double pCoverage) { - return CoverageMetric.Match.newMatch(pCoverage); - } - - /** - * Retrieve the set of values that occur in matches for Coverage. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfCoverage(final Object[] parameters) { - return rawStreamAllValues(POSITION_COVERAGE, parameters).map(Double.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for Coverage. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfCoverage() { - return rawStreamAllValuesOfCoverage(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for Coverage. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfCoverage() { - return rawStreamAllValuesOfCoverage(emptyArray()); - } - - @Override - protected CoverageMetric.Match tupleToMatch(final Tuple t) { - try { - return CoverageMetric.Match.newMatch((Double) t.get(POSITION_COVERAGE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected CoverageMetric.Match arrayToMatch(final Object[] match) { - try { - return CoverageMetric.Match.newMatch((Double) match[POSITION_COVERAGE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected CoverageMetric.Match arrayToMatchMutable(final Object[] match) { - try { - return CoverageMetric.Match.newMutableMatch((Double) match[POSITION_COVERAGE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return CoverageMetric.instance(); - } - } - - private CoverageMetric() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static CoverageMetric instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected CoverageMetric.Matcher instantiate(final ViatraQueryEngine engine) { - return CoverageMetric.Matcher.on(engine); - } - - @Override - public CoverageMetric.Matcher instantiate() { - return CoverageMetric.Matcher.create(); - } - - @Override - public CoverageMetric.Match newEmptyMatch() { - return CoverageMetric.Match.newEmptyMatch(); - } - - @Override - public CoverageMetric.Match newMatch(final Object... parameters) { - return CoverageMetric.Match.newMatch((java.lang.Double) parameters[0]); - } - - /** - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final CoverageMetric INSTANCE = new CoverageMetric(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final CoverageMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_Coverage = new PParameter("Coverage", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Coverage); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Coverage"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Coverage = body.getOrCreateVariableByName("Coverage"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Coverage), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Coverage, parameter_Coverage) - )); - // Coverage == sum find missionCoverage(_, #_) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), MissionCoverage.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); - new Equality(body, var_Coverage, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} 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 @@ package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; import java.util.Arrays; import java.util.Collection; 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/NoPotentialLinkToGroundStation.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java new file mode 100644 index 00000000..1e8f8502 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoPotentialLinkToGroundStation.java @@ -0,0 +1,571 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; + +import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.log4j.Logger; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.viatra.query.runtime.api.IPatternMatch; +import org.eclipse.viatra.query.runtime.api.IQuerySpecification; +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; +import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; +import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; +import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; +import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; + +/** + * A pattern-specific query specification that can instantiate Matcher in a type-safe way. + * + *

Original source: + *

+ *         {@literal @}Constraint(severity = "error", key = {Spacecraft},
+ *         	message = "Spacecraft has no potential communication path to the ground station.")
+ *         pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) {
+ *         	ConstellationMission.groundStationNetwork(Mission, GroundStation);
+ *         	ConstellationMission.spacecraft(Mission, Spacecraft);
+ *         	neg find indirectLinkAllowed(Spacecraft, GroundStation);
+ *         }
+ * 
+ * + * @see Matcher + * @see Match + * + */ +@SuppressWarnings("all") +public final class NoPotentialLinkToGroundStation extends BaseGeneratedEMFQuerySpecification { + /** + * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation pattern, + * to be used in conjunction with {@link Matcher}. + * + *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. + * Each instance is a (possibly partial) substitution of pattern parameters, + * usable to represent a match of the pattern in the result of a query, + * or to specify the bound (fixed) input parameters when issuing a query. + * + * @see Matcher + * + */ + public static abstract class Match extends BasePatternMatch { + private Spacecraft fSpacecraft; + + private static List parameterNames = makeImmutableList("Spacecraft"); + + private Match(final Spacecraft pSpacecraft) { + this.fSpacecraft = pSpacecraft; + } + + @Override + public Object get(final String parameterName) { + if ("Spacecraft".equals(parameterName)) return this.fSpacecraft; + return null; + } + + public Spacecraft getSpacecraft() { + return this.fSpacecraft; + } + + @Override + public boolean set(final String parameterName, final Object newValue) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + if ("Spacecraft".equals(parameterName) ) { + this.fSpacecraft = (Spacecraft) newValue; + return true; + } + return false; + } + + public void setSpacecraft(final Spacecraft pSpacecraft) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + this.fSpacecraft = pSpacecraft; + } + + @Override + public String patternName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation"; + } + + @Override + public List parameterNames() { + return NoPotentialLinkToGroundStation.Match.parameterNames; + } + + @Override + public Object[] toArray() { + return new Object[]{fSpacecraft}; + } + + @Override + public NoPotentialLinkToGroundStation.Match toImmutable() { + return isMutable() ? newMatch(fSpacecraft) : this; + } + + @Override + public String prettyPrint() { + StringBuilder result = new StringBuilder(); + result.append("\"Spacecraft\"=" + prettyPrintValue(fSpacecraft)); + return result.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(fSpacecraft); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) { + return false; + } + if ((obj instanceof NoPotentialLinkToGroundStation.Match)) { + NoPotentialLinkToGroundStation.Match other = (NoPotentialLinkToGroundStation.Match) obj; + return Objects.equals(fSpacecraft, other.fSpacecraft); + } else { + // this should be infrequent + if (!(obj instanceof IPatternMatch)) { + return false; + } + IPatternMatch otherSig = (IPatternMatch) obj; + return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); + } + } + + @Override + public NoPotentialLinkToGroundStation specification() { + return NoPotentialLinkToGroundStation.instance(); + } + + /** + * Returns an empty, mutable match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @return the empty match. + * + */ + public static NoPotentialLinkToGroundStation.Match newEmptyMatch() { + return new Mutable(null); + } + + /** + * Returns a mutable (partial) match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @return the new, mutable (partial) match object. + * + */ + public static NoPotentialLinkToGroundStation.Match newMutableMatch(final Spacecraft pSpacecraft) { + return new Mutable(pSpacecraft); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @return the (partial) match object. + * + */ + public static NoPotentialLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) { + return new Immutable(pSpacecraft); + } + + private static final class Mutable extends NoPotentialLinkToGroundStation.Match { + Mutable(final Spacecraft pSpacecraft) { + super(pSpacecraft); + } + + @Override + public boolean isMutable() { + return true; + } + } + + private static final class Immutable extends NoPotentialLinkToGroundStation.Match { + Immutable(final Spacecraft pSpacecraft) { + super(pSpacecraft); + } + + @Override + public boolean isMutable() { + return false; + } + } + } + + /** + * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation pattern, + * providing pattern-specific query methods. + * + *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, + * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. + * + *

Matches of the pattern will be represented as {@link Match}. + * + *

Original source: + *

+   * {@literal @}Constraint(severity = "error", key = {Spacecraft},
+   * 	message = "Spacecraft has no potential communication path to the ground station.")
+   * pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) {
+   * 	ConstellationMission.groundStationNetwork(Mission, GroundStation);
+   * 	ConstellationMission.spacecraft(Mission, Spacecraft);
+   * 	neg find indirectLinkAllowed(Spacecraft, GroundStation);
+   * }
+   * 
+ * + * @see Match + * @see NoPotentialLinkToGroundStation + * + */ + public static class Matcher extends BaseMatcher { + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + public static NoPotentialLinkToGroundStation.Matcher on(final ViatraQueryEngine engine) { + // check if matcher already exists + Matcher matcher = engine.getExistingMatcher(querySpecification()); + if (matcher == null) { + matcher = (Matcher)engine.getMatcher(querySpecification()); + } + return matcher; + } + + /** + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * @return an initialized matcher + * @noreference This method is for internal matcher initialization by the framework, do not call it manually. + * + */ + public static NoPotentialLinkToGroundStation.Matcher create() { + return new Matcher(); + } + + private static final int POSITION_SPACECRAFT = 0; + + private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NoPotentialLinkToGroundStation.Matcher.class); + + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + private Matcher() { + super(querySpecification()); + } + + /** + * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @return matches represented as a Match object. + * + */ + public Collection getAllMatches(final Spacecraft pSpacecraft) { + return rawStreamAllMatches(new Object[]{pSpacecraft}).collect(Collectors.toSet()); + } + + /** + * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. + *

+ * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @return a stream of matches represented as a Match object. + * + */ + public Stream streamAllMatches(final Spacecraft pSpacecraft) { + return rawStreamAllMatches(new Object[]{pSpacecraft}); + } + + /** + * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @return a match represented as a Match object, or null if no match is found. + * + */ + public Optional getOneArbitraryMatch(final Spacecraft pSpacecraft) { + return rawGetOneArbitraryMatch(new Object[]{pSpacecraft}); + } + + /** + * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, + * under any possible substitution of the unspecified parameters (if any). + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @return true if the input is a valid (partial) match of the pattern. + * + */ + public boolean hasMatch(final Spacecraft pSpacecraft) { + return rawHasMatch(new Object[]{pSpacecraft}); + } + + /** + * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @return the number of pattern matches found. + * + */ + public int countMatches(final Spacecraft pSpacecraft) { + return rawCountMatches(new Object[]{pSpacecraft}); + } + + /** + * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param processor the action that will process the selected match. + * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked + * + */ + public boolean forOneArbitraryMatch(final Spacecraft pSpacecraft, final Consumer processor) { + return rawForOneArbitraryMatch(new Object[]{pSpacecraft}, processor); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @return the (partial) match object. + * + */ + public NoPotentialLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) { + return NoPotentialLinkToGroundStation.Match.newMatch(pSpacecraft); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOfSpacecraft(final Object[] parameters) { + return rawStreamAllValues(POSITION_SPACECRAFT, parameters).map(Spacecraft.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfSpacecraft() { + return rawStreamAllValuesOfSpacecraft(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfSpacecraft() { + return rawStreamAllValuesOfSpacecraft(emptyArray()); + } + + @Override + protected NoPotentialLinkToGroundStation.Match tupleToMatch(final Tuple t) { + try { + return NoPotentialLinkToGroundStation.Match.newMatch((Spacecraft) t.get(POSITION_SPACECRAFT)); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in tuple not properly typed!",e); + return null; + } + } + + @Override + protected NoPotentialLinkToGroundStation.Match arrayToMatch(final Object[] match) { + try { + return NoPotentialLinkToGroundStation.Match.newMatch((Spacecraft) match[POSITION_SPACECRAFT]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + @Override + protected NoPotentialLinkToGroundStation.Match arrayToMatchMutable(final Object[] match) { + try { + return NoPotentialLinkToGroundStation.Match.newMutableMatch((Spacecraft) match[POSITION_SPACECRAFT]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + /** + * @return the singleton instance of the query specification of this pattern + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static IQuerySpecification querySpecification() { + return NoPotentialLinkToGroundStation.instance(); + } + } + + private NoPotentialLinkToGroundStation() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static NoPotentialLinkToGroundStation instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + @Override + protected NoPotentialLinkToGroundStation.Matcher instantiate(final ViatraQueryEngine engine) { + return NoPotentialLinkToGroundStation.Matcher.on(engine); + } + + @Override + public NoPotentialLinkToGroundStation.Matcher instantiate() { + return NoPotentialLinkToGroundStation.Matcher.create(); + } + + @Override + public NoPotentialLinkToGroundStation.Match newEmptyMatch() { + return NoPotentialLinkToGroundStation.Match.newEmptyMatch(); + } + + @Override + public NoPotentialLinkToGroundStation.Match newMatch(final Object... parameters) { + return NoPotentialLinkToGroundStation.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0]); + } + + /** + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created + * not at the class load time of the outer class, + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. + * + *

This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final NoPotentialLinkToGroundStation INSTANCE = new NoPotentialLinkToGroundStation(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final NoPotentialLinkToGroundStation.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + 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); + + private final List parameters = Arrays.asList(parameter_Spacecraft); + + private GeneratedPQuery() { + super(PVisibility.PUBLIC); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("Spacecraft"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); + PVariable var_Mission = body.getOrCreateVariableByName("Mission"); + PVariable var_GroundStation = body.getOrCreateVariableByName("GroundStation"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft) + )); + // ConstellationMission.groundStationNetwork(Mission, GroundStation) + new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); + PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "groundStationNetwork"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); + new Equality(body, var__virtual_0_, var_GroundStation); + // ConstellationMission.spacecraft(Mission, Spacecraft) + new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); + PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new Equality(body, var__virtual_1_, var_Spacecraft); + // neg find indirectLinkAllowed(Spacecraft, GroundStation) + new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_GroundStation), IndirectLinkAllowed.instance().getInternalQueryRepresentation()); + bodies.add(body); + } + { + PAnnotation annotation = new PAnnotation("Constraint"); + annotation.addAttribute("severity", "error"); + annotation.addAttribute("key", Arrays.asList(new Object[] { + new ParameterReference("Spacecraft") + })); + annotation.addAttribute("message", "Spacecraft has no potential communication path to the ground station."); + addAnnotation(annotation); + } + return bodies; + } + } +} 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; import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; +import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; @@ -45,8 +47,8 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; *

  *         // At least two spacecraft must have the interferometry payload configured
  *         
- *         //{@literal @}Constraint(severity = "error", key = {Mission},
- *         //	message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.")
+ *         {@literal @}Constraint(severity = "error", key = {Mission},
+ *         	message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.")
  *         pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) {
  *         	InterferometryMission(Mission);
  *         	neg find atLeastTwoInterferometryPayloads(Mission);
@@ -233,8 +235,8 @@ public final class NotEnoughInterferometryPayloads extends BaseGeneratedEMFQuery
    * 
    * // At least two spacecraft must have the interferometry payload configured
    * 
-   * //{@literal @}Constraint(severity = "error", key = {Mission},
-   * //	message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.")
+   * {@literal @}Constraint(severity = "error", key = {Mission},
+   * 	message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.")
    * pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) {
    * 	InterferometryMission(Mission);
    * 	neg find atLeastTwoInterferometryPayloads(Mission);
@@ -542,6 +544,15 @@ public final class NotEnoughInterferometryPayloads extends BaseGeneratedEMFQuery
           new NegativePatternCall(body, Tuples.flatTupleOf(var_Mission), AtLeastTwoInterferometryPayloads.instance().getInternalQueryRepresentation());
           bodies.add(body);
       }
+      {
+          PAnnotation annotation = new PAnnotation("Constraint");
+          annotation.addAttribute("severity", "error");
+          annotation.addAttribute("key", Arrays.asList(new Object[] {
+                              new ParameterReference("Mission")
+                              }));
+          annotation.addAttribute("message", "Interferometry mission needs at least two spacecraft configured with the interferometry payload.");
+          addAnnotation(annotation);
+      }
       return bodies;
     }
   }
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;
 
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop;
-import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric;
-import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation;
+import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads;
+import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat;
+import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink;
-import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow;
 import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium;
 import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
@@ -31,6 +31,7 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
  * 
  • communicationLinkDoesNotStartAtContainingElement
  • *
  • notEnoughInterferometryPayloads
  • *
  • noLinkToGroundStation
  • + *
  • noPotentialLinkToGroundStation
  • *
  • communicationLoop
  • *
  • incompatibleSourceAndTargetBand
  • *
  • incompatibleSourceAndTargetGain
  • @@ -39,9 +40,8 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; *
  • kaAntennaGainLow
  • *
  • threeUCubeSatWithNonUhfCrossLink
  • *
  • cubeSatWithKaAntenna
  • - *
  • coverageMetric
  • - *
  • timeMetric
  • - *
  • costMetric
  • + *
  • smallSat
  • + *
  • spacecraftOfKind
  • * * * @see IQueryGroup @@ -69,6 +69,7 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { querySpecifications.add(CommunicationLinkDoesNotStartAtContainingElement.instance()); querySpecifications.add(NotEnoughInterferometryPayloads.instance()); querySpecifications.add(NoLinkToGroundStation.instance()); + querySpecifications.add(NoPotentialLinkToGroundStation.instance()); querySpecifications.add(CommunicationLoop.instance()); querySpecifications.add(IncompatibleSourceAndTargetBand.instance()); querySpecifications.add(IncompatibleSourceAndTargetGain.instance()); @@ -77,9 +78,8 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { querySpecifications.add(KaAntennaGainLow.instance()); querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance()); querySpecifications.add(CubeSatWithKaAntenna.instance()); - querySpecifications.add(CoverageMetric.instance()); - querySpecifications.add(TimeMetric.instance()); - querySpecifications.add(CostMetric.instance()); + querySpecifications.add(SmallSat.instance()); + querySpecifications.add(SpacecraftOfKind.instance()); } public CommunicationLinkDoesNotStartAtContainingElement getCommunicationLinkDoesNotStartAtContainingElement() { @@ -106,6 +106,14 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { return NoLinkToGroundStation.Matcher.on(engine); } + public NoPotentialLinkToGroundStation getNoPotentialLinkToGroundStation() { + return NoPotentialLinkToGroundStation.instance(); + } + + public NoPotentialLinkToGroundStation.Matcher getNoPotentialLinkToGroundStation(final ViatraQueryEngine engine) { + return NoPotentialLinkToGroundStation.Matcher.on(engine); + } + public CommunicationLoop getCommunicationLoop() { return CommunicationLoop.instance(); } @@ -170,27 +178,19 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { return CubeSatWithKaAntenna.Matcher.on(engine); } - public CoverageMetric getCoverageMetric() { - return CoverageMetric.instance(); - } - - public CoverageMetric.Matcher getCoverageMetric(final ViatraQueryEngine engine) { - return CoverageMetric.Matcher.on(engine); - } - - public TimeMetric getTimeMetric() { - return TimeMetric.instance(); + public SmallSat getSmallSat() { + return SmallSat.instance(); } - public TimeMetric.Matcher getTimeMetric(final ViatraQueryEngine engine) { - return TimeMetric.Matcher.on(engine); + public SmallSat.Matcher getSmallSat(final ViatraQueryEngine engine) { + return SmallSat.Matcher.on(engine); } - public CostMetric getCostMetric() { - return CostMetric.instance(); + public SpacecraftOfKind getSpacecraftOfKind() { + return SpacecraftOfKind.instance(); } - public CostMetric.Matcher getCostMetric(final ViatraQueryEngine engine) { - return CostMetric.Matcher.on(engine); + public SpacecraftOfKind.Matcher getSpacecraftOfKind(final ViatraQueryEngine engine) { + return SpacecraftOfKind.Matcher.on(engine); } } diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SmallSat.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SmallSat.java new file mode 100644 index 00000000..7bc497ab --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SmallSat.java @@ -0,0 +1,533 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; + +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.log4j.Logger; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.viatra.query.runtime.api.IPatternMatch; +import org.eclipse.viatra.query.runtime.api.IQuerySpecification; +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; +import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; +import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; +import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; + +/** + * A pattern-specific query specification that can instantiate Matcher in a type-safe way. + * + *

    Original source: + *

    + *         pattern smallSat(Sat : SmallSat) {
    + *         	SmallSat(Sat);
    + *         }
    + * 
    + * + * @see Matcher + * @see Match + * + */ +@SuppressWarnings("all") +public final class SmallSat extends BaseGeneratedEMFQuerySpecification { + /** + * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat pattern, + * to be used in conjunction with {@link Matcher}. + * + *

    Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. + * Each instance is a (possibly partial) substitution of pattern parameters, + * usable to represent a match of the pattern in the result of a query, + * or to specify the bound (fixed) input parameters when issuing a query. + * + * @see Matcher + * + */ + public static abstract class Match extends BasePatternMatch { + private hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat fSat; + + private static List parameterNames = makeImmutableList("Sat"); + + private Match(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + this.fSat = pSat; + } + + @Override + public Object get(final String parameterName) { + if ("Sat".equals(parameterName)) return this.fSat; + return null; + } + + public hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat getSat() { + return this.fSat; + } + + @Override + public boolean set(final String parameterName, final Object newValue) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + if ("Sat".equals(parameterName) ) { + this.fSat = (hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) newValue; + return true; + } + return false; + } + + public void setSat(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + this.fSat = pSat; + } + + @Override + public String patternName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat"; + } + + @Override + public List parameterNames() { + return SmallSat.Match.parameterNames; + } + + @Override + public Object[] toArray() { + return new Object[]{fSat}; + } + + @Override + public SmallSat.Match toImmutable() { + return isMutable() ? newMatch(fSat) : this; + } + + @Override + public String prettyPrint() { + StringBuilder result = new StringBuilder(); + result.append("\"Sat\"=" + prettyPrintValue(fSat)); + return result.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(fSat); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) { + return false; + } + if ((obj instanceof SmallSat.Match)) { + SmallSat.Match other = (SmallSat.Match) obj; + return Objects.equals(fSat, other.fSat); + } else { + // this should be infrequent + if (!(obj instanceof IPatternMatch)) { + return false; + } + IPatternMatch otherSig = (IPatternMatch) obj; + return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); + } + } + + @Override + public SmallSat specification() { + return SmallSat.instance(); + } + + /** + * Returns an empty, mutable match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @return the empty match. + * + */ + public static SmallSat.Match newEmptyMatch() { + return new Mutable(null); + } + + /** + * Returns a mutable (partial) match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @param pSat the fixed value of pattern parameter Sat, or null if not bound. + * @return the new, mutable (partial) match object. + * + */ + public static SmallSat.Match newMutableMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + return new Mutable(pSat); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pSat the fixed value of pattern parameter Sat, or null if not bound. + * @return the (partial) match object. + * + */ + public static SmallSat.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + return new Immutable(pSat); + } + + private static final class Mutable extends SmallSat.Match { + Mutable(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + super(pSat); + } + + @Override + public boolean isMutable() { + return true; + } + } + + private static final class Immutable extends SmallSat.Match { + Immutable(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + super(pSat); + } + + @Override + public boolean isMutable() { + return false; + } + } + } + + /** + * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat pattern, + * providing pattern-specific query methods. + * + *

    Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, + * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. + * + *

    Matches of the pattern will be represented as {@link Match}. + * + *

    Original source: + *

    +   * pattern smallSat(Sat : SmallSat) {
    +   * 	SmallSat(Sat);
    +   * }
    +   * 
    + * + * @see Match + * @see SmallSat + * + */ + public static class Matcher extends BaseMatcher { + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + public static SmallSat.Matcher on(final ViatraQueryEngine engine) { + // check if matcher already exists + Matcher matcher = engine.getExistingMatcher(querySpecification()); + if (matcher == null) { + matcher = (Matcher)engine.getMatcher(querySpecification()); + } + return matcher; + } + + /** + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * @return an initialized matcher + * @noreference This method is for internal matcher initialization by the framework, do not call it manually. + * + */ + public static SmallSat.Matcher create() { + return new Matcher(); + } + + private static final int POSITION_SAT = 0; + + private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SmallSat.Matcher.class); + + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + private Matcher() { + super(querySpecification()); + } + + /** + * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pSat the fixed value of pattern parameter Sat, or null if not bound. + * @return matches represented as a Match object. + * + */ + public Collection getAllMatches(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + return rawStreamAllMatches(new Object[]{pSat}).collect(Collectors.toSet()); + } + + /** + * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * @param pSat the fixed value of pattern parameter Sat, or null if not bound. + * @return a stream of matches represented as a Match object. + * + */ + public Stream streamAllMatches(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + return rawStreamAllMatches(new Object[]{pSat}); + } + + /** + * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pSat the fixed value of pattern parameter Sat, or null if not bound. + * @return a match represented as a Match object, or null if no match is found. + * + */ + public Optional getOneArbitraryMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + return rawGetOneArbitraryMatch(new Object[]{pSat}); + } + + /** + * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, + * under any possible substitution of the unspecified parameters (if any). + * @param pSat the fixed value of pattern parameter Sat, or null if not bound. + * @return true if the input is a valid (partial) match of the pattern. + * + */ + public boolean hasMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + return rawHasMatch(new Object[]{pSat}); + } + + /** + * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pSat the fixed value of pattern parameter Sat, or null if not bound. + * @return the number of pattern matches found. + * + */ + public int countMatches(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + return rawCountMatches(new Object[]{pSat}); + } + + /** + * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pSat the fixed value of pattern parameter Sat, or null if not bound. + * @param processor the action that will process the selected match. + * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked + * + */ + public boolean forOneArbitraryMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat, final Consumer processor) { + return rawForOneArbitraryMatch(new Object[]{pSat}, processor); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pSat the fixed value of pattern parameter Sat, or null if not bound. + * @return the (partial) match object. + * + */ + public SmallSat.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat pSat) { + return SmallSat.Match.newMatch(pSat); + } + + /** + * Retrieve the set of values that occur in matches for Sat. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOfSat(final Object[] parameters) { + return rawStreamAllValues(POSITION_SAT, parameters).map(hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for Sat. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfSat() { + return rawStreamAllValuesOfSat(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for Sat. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfSat() { + return rawStreamAllValuesOfSat(emptyArray()); + } + + @Override + protected SmallSat.Match tupleToMatch(final Tuple t) { + try { + return SmallSat.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) t.get(POSITION_SAT)); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in tuple not properly typed!",e); + return null; + } + } + + @Override + protected SmallSat.Match arrayToMatch(final Object[] match) { + try { + return SmallSat.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) match[POSITION_SAT]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + @Override + protected SmallSat.Match arrayToMatchMutable(final Object[] match) { + try { + return SmallSat.Match.newMutableMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) match[POSITION_SAT]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + /** + * @return the singleton instance of the query specification of this pattern + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static IQuerySpecification querySpecification() { + return SmallSat.instance(); + } + } + + private SmallSat() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static SmallSat instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + @Override + protected SmallSat.Matcher instantiate(final ViatraQueryEngine engine) { + return SmallSat.Matcher.on(engine); + } + + @Override + public SmallSat.Matcher instantiate() { + return SmallSat.Matcher.create(); + } + + @Override + public SmallSat.Match newEmptyMatch() { + return SmallSat.Match.newEmptyMatch(); + } + + @Override + public SmallSat.Match newMatch(final Object... parameters) { + return SmallSat.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat) parameters[0]); + } + + /** + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created + * not at the class load time of the outer class, + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final SmallSat INSTANCE = new SmallSat(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final SmallSat.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + 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); + + private final List parameters = Arrays.asList(parameter_Sat); + + private GeneratedPQuery() { + super(PVisibility.PUBLIC); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("Sat"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_Sat = body.getOrCreateVariableByName("Sat"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_Sat, parameter_Sat) + )); + // SmallSat(Sat) + new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat"))); + bodies.add(body); + } + 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 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; + +import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft; +import hu.bme.mit.inf.dslreasoner.domains.satellite.SpacecraftKind; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.log4j.Logger; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.viatra.query.runtime.api.IPatternMatch; +import org.eclipse.viatra.query.runtime.api.IQuerySpecification; +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; +import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; +import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; +import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; + +/** + * A pattern-specific query specification that can instantiate Matcher in a type-safe way. + * + *

    Original source: + *

    + *         {@literal @}QueryBasedFeature(feature = "kind")
    + *         pattern spacecraftOfKind(Spacecraft : Spacecraft, Kind : SpacecraftKind) {
    + *         	CubeSat3U(Spacecraft);
    + *         	Kind == SpacecraftKind::CubeSat3U;
    + *         } or {
    + *         	CubeSat6U(Spacecraft);
    + *         	Kind == SpacecraftKind::CubeSat6U;
    + *         } or {
    + *         	SmallSat(Spacecraft);
    + *         	Kind == SpacecraftKind::SmallSat;
    + *         }
    + * 
    + * + * @see Matcher + * @see Match + * + */ +@SuppressWarnings("all") +public final class SpacecraftOfKind extends BaseGeneratedEMFQuerySpecification { + /** + * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind pattern, + * to be used in conjunction with {@link Matcher}. + * + *

    Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. + * Each instance is a (possibly partial) substitution of pattern parameters, + * usable to represent a match of the pattern in the result of a query, + * or to specify the bound (fixed) input parameters when issuing a query. + * + * @see Matcher + * + */ + public static abstract class Match extends BasePatternMatch { + private Spacecraft fSpacecraft; + + private SpacecraftKind fKind; + + private static List parameterNames = makeImmutableList("Spacecraft", "Kind"); + + private Match(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + this.fSpacecraft = pSpacecraft; + this.fKind = pKind; + } + + @Override + public Object get(final String parameterName) { + if ("Spacecraft".equals(parameterName)) return this.fSpacecraft; + if ("Kind".equals(parameterName)) return this.fKind; + return null; + } + + public Spacecraft getSpacecraft() { + return this.fSpacecraft; + } + + public SpacecraftKind getKind() { + return this.fKind; + } + + @Override + public boolean set(final String parameterName, final Object newValue) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + if ("Spacecraft".equals(parameterName) ) { + this.fSpacecraft = (Spacecraft) newValue; + return true; + } + if ("Kind".equals(parameterName) ) { + this.fKind = (SpacecraftKind) newValue; + return true; + } + return false; + } + + public void setSpacecraft(final Spacecraft pSpacecraft) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + this.fSpacecraft = pSpacecraft; + } + + public void setKind(final SpacecraftKind pKind) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + this.fKind = pKind; + } + + @Override + public String patternName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind"; + } + + @Override + public List parameterNames() { + return SpacecraftOfKind.Match.parameterNames; + } + + @Override + public Object[] toArray() { + return new Object[]{fSpacecraft, fKind}; + } + + @Override + public SpacecraftOfKind.Match toImmutable() { + return isMutable() ? newMatch(fSpacecraft, fKind) : this; + } + + @Override + public String prettyPrint() { + StringBuilder result = new StringBuilder(); + result.append("\"Spacecraft\"=" + prettyPrintValue(fSpacecraft) + ", "); + result.append("\"Kind\"=" + prettyPrintValue(fKind)); + return result.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(fSpacecraft, fKind); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) { + return false; + } + if ((obj instanceof SpacecraftOfKind.Match)) { + SpacecraftOfKind.Match other = (SpacecraftOfKind.Match) obj; + return Objects.equals(fSpacecraft, other.fSpacecraft) && Objects.equals(fKind, other.fKind); + } else { + // this should be infrequent + if (!(obj instanceof IPatternMatch)) { + return false; + } + IPatternMatch otherSig = (IPatternMatch) obj; + return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); + } + } + + @Override + public SpacecraftOfKind specification() { + return SpacecraftOfKind.instance(); + } + + /** + * Returns an empty, mutable match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @return the empty match. + * + */ + public static SpacecraftOfKind.Match newEmptyMatch() { + return new Mutable(null, null); + } + + /** + * Returns a mutable (partial) match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param pKind the fixed value of pattern parameter Kind, or null if not bound. + * @return the new, mutable (partial) match object. + * + */ + public static SpacecraftOfKind.Match newMutableMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + return new Mutable(pSpacecraft, pKind); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param pKind the fixed value of pattern parameter Kind, or null if not bound. + * @return the (partial) match object. + * + */ + public static SpacecraftOfKind.Match newMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + return new Immutable(pSpacecraft, pKind); + } + + private static final class Mutable extends SpacecraftOfKind.Match { + Mutable(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + super(pSpacecraft, pKind); + } + + @Override + public boolean isMutable() { + return true; + } + } + + private static final class Immutable extends SpacecraftOfKind.Match { + Immutable(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + super(pSpacecraft, pKind); + } + + @Override + public boolean isMutable() { + return false; + } + } + } + + /** + * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind pattern, + * providing pattern-specific query methods. + * + *

    Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, + * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. + * + *

    Matches of the pattern will be represented as {@link Match}. + * + *

    Original source: + *

    +   * {@literal @}QueryBasedFeature(feature = "kind")
    +   * pattern spacecraftOfKind(Spacecraft : Spacecraft, Kind : SpacecraftKind) {
    +   * 	CubeSat3U(Spacecraft);
    +   * 	Kind == SpacecraftKind::CubeSat3U;
    +   * } or {
    +   * 	CubeSat6U(Spacecraft);
    +   * 	Kind == SpacecraftKind::CubeSat6U;
    +   * } or {
    +   * 	SmallSat(Spacecraft);
    +   * 	Kind == SpacecraftKind::SmallSat;
    +   * }
    +   * 
    + * + * @see Match + * @see SpacecraftOfKind + * + */ + public static class Matcher extends BaseMatcher { + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + public static SpacecraftOfKind.Matcher on(final ViatraQueryEngine engine) { + // check if matcher already exists + Matcher matcher = engine.getExistingMatcher(querySpecification()); + if (matcher == null) { + matcher = (Matcher)engine.getMatcher(querySpecification()); + } + return matcher; + } + + /** + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * @return an initialized matcher + * @noreference This method is for internal matcher initialization by the framework, do not call it manually. + * + */ + public static SpacecraftOfKind.Matcher create() { + return new Matcher(); + } + + private static final int POSITION_SPACECRAFT = 0; + + private static final int POSITION_KIND = 1; + + private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SpacecraftOfKind.Matcher.class); + + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + private Matcher() { + super(querySpecification()); + } + + /** + * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param pKind the fixed value of pattern parameter Kind, or null if not bound. + * @return matches represented as a Match object. + * + */ + public Collection getAllMatches(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + return rawStreamAllMatches(new Object[]{pSpacecraft, pKind}).collect(Collectors.toSet()); + } + + /** + * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param pKind the fixed value of pattern parameter Kind, or null if not bound. + * @return a stream of matches represented as a Match object. + * + */ + public Stream streamAllMatches(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + return rawStreamAllMatches(new Object[]{pSpacecraft, pKind}); + } + + /** + * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param pKind the fixed value of pattern parameter Kind, or null if not bound. + * @return a match represented as a Match object, or null if no match is found. + * + */ + public Optional getOneArbitraryMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + return rawGetOneArbitraryMatch(new Object[]{pSpacecraft, pKind}); + } + + /** + * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, + * under any possible substitution of the unspecified parameters (if any). + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param pKind the fixed value of pattern parameter Kind, or null if not bound. + * @return true if the input is a valid (partial) match of the pattern. + * + */ + public boolean hasMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + return rawHasMatch(new Object[]{pSpacecraft, pKind}); + } + + /** + * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param pKind the fixed value of pattern parameter Kind, or null if not bound. + * @return the number of pattern matches found. + * + */ + public int countMatches(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + return rawCountMatches(new Object[]{pSpacecraft, pKind}); + } + + /** + * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param pKind the fixed value of pattern parameter Kind, or null if not bound. + * @param processor the action that will process the selected match. + * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked + * + */ + public boolean forOneArbitraryMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind, final Consumer processor) { + return rawForOneArbitraryMatch(new Object[]{pSpacecraft, pKind}, processor); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound. + * @param pKind the fixed value of pattern parameter Kind, or null if not bound. + * @return the (partial) match object. + * + */ + public SpacecraftOfKind.Match newMatch(final Spacecraft pSpacecraft, final SpacecraftKind pKind) { + return SpacecraftOfKind.Match.newMatch(pSpacecraft, pKind); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOfSpacecraft(final Object[] parameters) { + return rawStreamAllValues(POSITION_SPACECRAFT, parameters).map(Spacecraft.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfSpacecraft() { + return rawStreamAllValuesOfSpacecraft(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfSpacecraft() { + return rawStreamAllValuesOfSpacecraft(emptyArray()); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * + * @return the Stream of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfSpacecraft(final SpacecraftOfKind.Match partialMatch) { + return rawStreamAllValuesOfSpacecraft(partialMatch.toArray()); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * + * @return the Stream of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfSpacecraft(final SpacecraftKind pKind) { + return rawStreamAllValuesOfSpacecraft(new Object[]{null, pKind}); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfSpacecraft(final SpacecraftOfKind.Match partialMatch) { + return rawStreamAllValuesOfSpacecraft(partialMatch.toArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for Spacecraft. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfSpacecraft(final SpacecraftKind pKind) { + return rawStreamAllValuesOfSpacecraft(new Object[]{null, pKind}).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for Kind. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOfKind(final Object[] parameters) { + return rawStreamAllValues(POSITION_KIND, parameters).map(SpacecraftKind.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for Kind. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfKind() { + return rawStreamAllValuesOfKind(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for Kind. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfKind() { + return rawStreamAllValuesOfKind(emptyArray()); + } + + /** + * Retrieve the set of values that occur in matches for Kind. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * + * @return the Stream of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfKind(final SpacecraftOfKind.Match partialMatch) { + return rawStreamAllValuesOfKind(partialMatch.toArray()); + } + + /** + * Retrieve the set of values that occur in matches for Kind. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * + * @return the Stream of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfKind(final Spacecraft pSpacecraft) { + return rawStreamAllValuesOfKind(new Object[]{pSpacecraft, null}); + } + + /** + * Retrieve the set of values that occur in matches for Kind. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfKind(final SpacecraftOfKind.Match partialMatch) { + return rawStreamAllValuesOfKind(partialMatch.toArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for Kind. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfKind(final Spacecraft pSpacecraft) { + return rawStreamAllValuesOfKind(new Object[]{pSpacecraft, null}).collect(Collectors.toSet()); + } + + @Override + protected SpacecraftOfKind.Match tupleToMatch(final Tuple t) { + try { + return SpacecraftOfKind.Match.newMatch((Spacecraft) t.get(POSITION_SPACECRAFT), (SpacecraftKind) t.get(POSITION_KIND)); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in tuple not properly typed!",e); + return null; + } + } + + @Override + protected SpacecraftOfKind.Match arrayToMatch(final Object[] match) { + try { + return SpacecraftOfKind.Match.newMatch((Spacecraft) match[POSITION_SPACECRAFT], (SpacecraftKind) match[POSITION_KIND]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + @Override + protected SpacecraftOfKind.Match arrayToMatchMutable(final Object[] match) { + try { + return SpacecraftOfKind.Match.newMutableMatch((Spacecraft) match[POSITION_SPACECRAFT], (SpacecraftKind) match[POSITION_KIND]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + /** + * @return the singleton instance of the query specification of this pattern + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static IQuerySpecification querySpecification() { + return SpacecraftOfKind.instance(); + } + } + + private SpacecraftOfKind() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static SpacecraftOfKind instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + @Override + protected SpacecraftOfKind.Matcher instantiate(final ViatraQueryEngine engine) { + return SpacecraftOfKind.Matcher.on(engine); + } + + @Override + public SpacecraftOfKind.Matcher instantiate() { + return SpacecraftOfKind.Matcher.create(); + } + + @Override + public SpacecraftOfKind.Match newEmptyMatch() { + return SpacecraftOfKind.Match.newEmptyMatch(); + } + + @Override + public SpacecraftOfKind.Match newMatch(final Object... parameters) { + return SpacecraftOfKind.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.satellite.SpacecraftKind) parameters[1]); + } + + /** + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created + * not at the class load time of the outer class, + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final SpacecraftOfKind INSTANCE = new SpacecraftOfKind(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final SpacecraftOfKind.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + 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); + + 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); + + private final List parameters = Arrays.asList(parameter_Spacecraft, parameter_Kind); + + private GeneratedPQuery() { + super(PVisibility.PUBLIC); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("Spacecraft","Kind"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); + PVariable var_Kind = body.getOrCreateVariableByName("Kind"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), + new ExportedParameter(body, var_Kind, parameter_Kind) + )); + // CubeSat3U(Spacecraft) + new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); + // Kind == SpacecraftKind::CubeSat3U + PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); + new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat3U").getInstance()); + new Equality(body, var_Kind, var__virtual_0_); + bodies.add(body); + } + { + PBody body = new PBody(this); + PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); + PVariable var_Kind = body.getOrCreateVariableByName("Kind"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), + new ExportedParameter(body, var_Kind, parameter_Kind) + )); + // CubeSat6U(Spacecraft) + new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat6U"))); + // Kind == SpacecraftKind::CubeSat6U + PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); + new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat6U").getInstance()); + new Equality(body, var_Kind, var__virtual_0_); + bodies.add(body); + } + { + PBody body = new PBody(this); + PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); + PVariable var_Kind = body.getOrCreateVariableByName("Kind"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), + new ExportedParameter(body, var_Kind, parameter_Kind) + )); + // SmallSat(Spacecraft) + new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat"))); + // Kind == SpacecraftKind::SmallSat + PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); + new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "SmallSat").getInstance()); + new Equality(body, var_Kind, var__virtual_0_); + bodies.add(body); + } + { + PAnnotation annotation = new PAnnotation("QueryBasedFeature"); + annotation.addAttribute("feature", "kind"); + addAnnotation(annotation); + } + return bodies; + } + } +} 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 @@ */ package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; -import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft; +import hu.bme.mit.inf.dslreasoner.domains.satellite.CubeSat3U; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; import java.util.Arrays; @@ -18,7 +18,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.log4j.Logger; import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; import org.eclipse.viatra.query.runtime.api.IPatternMatch; import org.eclipse.viatra.query.runtime.api.IQuerySpecification; import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; @@ -27,7 +26,6 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificat import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; @@ -37,7 +35,6 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterRe import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; @@ -56,8 +53,7 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; * * {@literal @}Constraint(severity = "error", key = {Sat}, * message = "3U CubeSats can only cross-link using UHF.") - * pattern threeUCubeSatWithNonUhfCrossLink(Sat : Spacecraft) { - * Spacecraft.kind(Sat, SpacecraftKind::CubeSat3U); + * pattern threeUCubeSatWithNonUhfCrossLink(Sat : CubeSat3U) { * CommunicatingElement.commSubsystem(Sat, SourceComm); * neg find commSubsystemBandUhf(SourceComm); * DirectedCommunicationLink.source(Link, SourceComm); @@ -86,11 +82,11 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * */ public static abstract class Match extends BasePatternMatch { - private Spacecraft fSat; + private CubeSat3U fSat; private static List parameterNames = makeImmutableList("Sat"); - private Match(final Spacecraft pSat) { + private Match(final CubeSat3U pSat) { this.fSat = pSat; } @@ -100,7 +96,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer return null; } - public Spacecraft getSat() { + public CubeSat3U getSat() { return this.fSat; } @@ -108,13 +104,13 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer public boolean set(final String parameterName, final Object newValue) { if (!isMutable()) throw new java.lang.UnsupportedOperationException(); if ("Sat".equals(parameterName) ) { - this.fSat = (Spacecraft) newValue; + this.fSat = (CubeSat3U) newValue; return true; } return false; } - public void setSat(final Spacecraft pSat) { + public void setSat(final CubeSat3U pSat) { if (!isMutable()) throw new java.lang.UnsupportedOperationException(); this.fSat = pSat; } @@ -195,7 +191,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return the new, mutable (partial) match object. * */ - public static ThreeUCubeSatWithNonUhfCrossLink.Match newMutableMatch(final Spacecraft pSat) { + public static ThreeUCubeSatWithNonUhfCrossLink.Match newMutableMatch(final CubeSat3U pSat) { return new Mutable(pSat); } @@ -207,12 +203,12 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return the (partial) match object. * */ - public static ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final Spacecraft pSat) { + public static ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final CubeSat3U pSat) { return new Immutable(pSat); } private static final class Mutable extends ThreeUCubeSatWithNonUhfCrossLink.Match { - Mutable(final Spacecraft pSat) { + Mutable(final CubeSat3U pSat) { super(pSat); } @@ -223,7 +219,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer } private static final class Immutable extends ThreeUCubeSatWithNonUhfCrossLink.Match { - Immutable(final Spacecraft pSat) { + Immutable(final CubeSat3U pSat) { super(pSat); } @@ -250,8 +246,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * * {@literal @}Constraint(severity = "error", key = {Sat}, * message = "3U CubeSats can only cross-link using UHF.") - * pattern threeUCubeSatWithNonUhfCrossLink(Sat : Spacecraft) { - * Spacecraft.kind(Sat, SpacecraftKind::CubeSat3U); + * pattern threeUCubeSatWithNonUhfCrossLink(Sat : CubeSat3U) { * CommunicatingElement.commSubsystem(Sat, SourceComm); * neg find commSubsystemBandUhf(SourceComm); * DirectedCommunicationLink.source(Link, SourceComm); @@ -315,7 +310,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return matches represented as a Match object. * */ - public Collection getAllMatches(final Spacecraft pSat) { + public Collection getAllMatches(final CubeSat3U pSat) { return rawStreamAllMatches(new Object[]{pSat}).collect(Collectors.toSet()); } @@ -329,7 +324,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return a stream of matches represented as a Match object. * */ - public Stream streamAllMatches(final Spacecraft pSat) { + public Stream streamAllMatches(final CubeSat3U pSat) { return rawStreamAllMatches(new Object[]{pSat}); } @@ -340,7 +335,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return a match represented as a Match object, or null if no match is found. * */ - public Optional getOneArbitraryMatch(final Spacecraft pSat) { + public Optional getOneArbitraryMatch(final CubeSat3U pSat) { return rawGetOneArbitraryMatch(new Object[]{pSat}); } @@ -351,7 +346,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return true if the input is a valid (partial) match of the pattern. * */ - public boolean hasMatch(final Spacecraft pSat) { + public boolean hasMatch(final CubeSat3U pSat) { return rawHasMatch(new Object[]{pSat}); } @@ -361,7 +356,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return the number of pattern matches found. * */ - public int countMatches(final Spacecraft pSat) { + public int countMatches(final CubeSat3U pSat) { return rawCountMatches(new Object[]{pSat}); } @@ -373,7 +368,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked * */ - public boolean forOneArbitraryMatch(final Spacecraft pSat, final Consumer processor) { + public boolean forOneArbitraryMatch(final CubeSat3U pSat, final Consumer processor) { return rawForOneArbitraryMatch(new Object[]{pSat}, processor); } @@ -385,7 +380,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return the (partial) match object. * */ - public ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final Spacecraft pSat) { + public ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final CubeSat3U pSat) { return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch(pSat); } @@ -394,8 +389,8 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return the Set of all values or empty set if there are no matches * */ - protected Stream rawStreamAllValuesOfSat(final Object[] parameters) { - return rawStreamAllValues(POSITION_SAT, parameters).map(Spacecraft.class::cast); + protected Stream rawStreamAllValuesOfSat(final Object[] parameters) { + return rawStreamAllValues(POSITION_SAT, parameters).map(CubeSat3U.class::cast); } /** @@ -403,7 +398,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return the Set of all values or empty set if there are no matches * */ - public Set getAllValuesOfSat() { + public Set getAllValuesOfSat() { return rawStreamAllValuesOfSat(emptyArray()).collect(Collectors.toSet()); } @@ -412,14 +407,14 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer * @return the Set of all values or empty set if there are no matches * */ - public Stream streamAllValuesOfSat() { + public Stream streamAllValuesOfSat() { return rawStreamAllValuesOfSat(emptyArray()); } @Override protected ThreeUCubeSatWithNonUhfCrossLink.Match tupleToMatch(final Tuple t) { try { - return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((Spacecraft) t.get(POSITION_SAT)); + return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((CubeSat3U) t.get(POSITION_SAT)); } catch(ClassCastException e) { LOGGER.error("Element(s) in tuple not properly typed!",e); return null; @@ -429,7 +424,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer @Override protected ThreeUCubeSatWithNonUhfCrossLink.Match arrayToMatch(final Object[] match) { try { - return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((Spacecraft) match[POSITION_SAT]); + return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((CubeSat3U) match[POSITION_SAT]); } catch(ClassCastException e) { LOGGER.error("Element(s) in array not properly typed!",e); return null; @@ -439,7 +434,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer @Override protected ThreeUCubeSatWithNonUhfCrossLink.Match arrayToMatchMutable(final Object[] match) { try { - return ThreeUCubeSatWithNonUhfCrossLink.Match.newMutableMatch((Spacecraft) match[POSITION_SAT]); + return ThreeUCubeSatWithNonUhfCrossLink.Match.newMutableMatch((CubeSat3U) match[POSITION_SAT]); } catch(ClassCastException e) { LOGGER.error("Element(s) in array not properly typed!",e); return null; @@ -490,7 +485,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer @Override public ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final Object... parameters) { - return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0]); + return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.CubeSat3U) parameters[0]); } /** @@ -522,7 +517,7 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { private static final ThreeUCubeSatWithNonUhfCrossLink.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - 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); + 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); private final List parameters = Arrays.asList(parameter_Sat); @@ -556,44 +551,36 @@ public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuer PVariable var_Link = body.getOrCreateVariableByName("Link"); PVariable var_TargetComm = body.getOrCreateVariableByName("TargetComm"); PVariable var_Target = body.getOrCreateVariableByName("Target"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); body.setSymbolicParameters(Arrays.asList( new ExportedParameter(body, var_Sat, parameter_Sat) )); - // Spacecraft.kind(Sat, SpacecraftKind::CubeSat3U) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat3U").getInstance()); - new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Sat, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); - new Equality(body, var__virtual_1_, var__virtual_0_); // CommunicatingElement.commSubsystem(Sat, SourceComm) new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Sat, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); - new Equality(body, var__virtual_2_, var_SourceComm); + PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Sat, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); + new Equality(body, var__virtual_0_, var_SourceComm); // neg find commSubsystemBandUhf(SourceComm) new NegativePatternCall(body, Tuples.flatTupleOf(var_SourceComm), CommSubsystemBandUhf.instance().getInternalQueryRepresentation()); // DirectedCommunicationLink.source(Link, SourceComm) new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); - new Equality(body, var__virtual_3_, var_SourceComm); + PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); + new Equality(body, var__virtual_1_, var_SourceComm); // DirectedCommunicationLink.target(Link, TargetComm) new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); - PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); - new Equality(body, var__virtual_4_, var_TargetComm); + PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); + new Equality(body, var__virtual_2_, var_TargetComm); // CommunicatingElement.commSubsystem(Target, TargetComm) new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); - PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Target, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); - new Equality(body, var__virtual_5_, var_TargetComm); + PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Target, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); + new Equality(body, var__virtual_3_, var_TargetComm); // neg find groundStationNetwork(Target) new NegativePatternCall(body, Tuples.flatTupleOf(var_Target), GroundStationNetwork.instance().getInternalQueryRepresentation()); 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

    Original source: - *

    - *         // Time
    - *         
    - *         pattern timeMetric(Time : java Double) {
    - *         	Time == sum find missionTime(_, #_);
    - *         }
    - * 
    - * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TimeMetric extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric pattern, - * to be used in conjunction with {@link Matcher}. - * - *

    Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Double fTime; - - private static List parameterNames = makeImmutableList("Time"); - - private Match(final Double pTime) { - this.fTime = pTime; - } - - @Override - public Object get(final String parameterName) { - if ("Time".equals(parameterName)) return this.fTime; - return null; - } - - public Double getTime() { - return this.fTime; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("Time".equals(parameterName) ) { - this.fTime = (Double) newValue; - return true; - } - return false; - } - - public void setTime(final Double pTime) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTime = pTime; - } - - @Override - public String patternName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric"; - } - - @Override - public List parameterNames() { - return TimeMetric.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fTime}; - } - - @Override - public TimeMetric.Match toImmutable() { - return isMutable() ? newMatch(fTime) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"Time\"=" + prettyPrintValue(fTime)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fTime); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TimeMetric.Match)) { - TimeMetric.Match other = (TimeMetric.Match) obj; - return Objects.equals(fTime, other.fTime); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TimeMetric specification() { - return TimeMetric.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TimeMetric.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pTime the fixed value of pattern parameter Time, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TimeMetric.Match newMutableMatch(final Double pTime) { - return new Mutable(pTime); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pTime the fixed value of pattern parameter Time, or null if not bound. - * @return the (partial) match object. - * - */ - public static TimeMetric.Match newMatch(final Double pTime) { - return new Immutable(pTime); - } - - private static final class Mutable extends TimeMetric.Match { - Mutable(final Double pTime) { - super(pTime); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TimeMetric.Match { - Immutable(final Double pTime) { - super(pTime); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric pattern, - * providing pattern-specific query methods. - * - *

    Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

    Matches of the pattern will be represented as {@link Match}. - * - *

    Original source: - *

    -   * // Time
    -   * 
    -   * pattern timeMetric(Time : java Double) {
    -   * 	Time == sum find missionTime(_, #_);
    -   * }
    -   * 
    - * - * @see Match - * @see TimeMetric - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TimeMetric.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TimeMetric.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_TIME = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TimeMetric.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pTime the fixed value of pattern parameter Time, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Double pTime) { - return rawStreamAllMatches(new Object[]{pTime}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

    - * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pTime the fixed value of pattern parameter Time, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Double pTime) { - return rawStreamAllMatches(new Object[]{pTime}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pTime the fixed value of pattern parameter Time, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Double pTime) { - return rawGetOneArbitraryMatch(new Object[]{pTime}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pTime the fixed value of pattern parameter Time, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Double pTime) { - return rawHasMatch(new Object[]{pTime}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pTime the fixed value of pattern parameter Time, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Double pTime) { - return rawCountMatches(new Object[]{pTime}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pTime the fixed value of pattern parameter Time, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Double pTime, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pTime}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pTime the fixed value of pattern parameter Time, or null if not bound. - * @return the (partial) match object. - * - */ - public TimeMetric.Match newMatch(final Double pTime) { - return TimeMetric.Match.newMatch(pTime); - } - - /** - * Retrieve the set of values that occur in matches for Time. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfTime(final Object[] parameters) { - return rawStreamAllValues(POSITION_TIME, parameters).map(Double.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for Time. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfTime() { - return rawStreamAllValuesOfTime(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for Time. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfTime() { - return rawStreamAllValuesOfTime(emptyArray()); - } - - @Override - protected TimeMetric.Match tupleToMatch(final Tuple t) { - try { - return TimeMetric.Match.newMatch((Double) t.get(POSITION_TIME)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TimeMetric.Match arrayToMatch(final Object[] match) { - try { - return TimeMetric.Match.newMatch((Double) match[POSITION_TIME]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TimeMetric.Match arrayToMatchMutable(final Object[] match) { - try { - return TimeMetric.Match.newMutableMatch((Double) match[POSITION_TIME]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TimeMetric.instance(); - } - } - - private TimeMetric() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TimeMetric instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TimeMetric.Matcher instantiate(final ViatraQueryEngine engine) { - return TimeMetric.Matcher.on(engine); - } - - @Override - public TimeMetric.Matcher instantiate() { - return TimeMetric.Matcher.create(); - } - - @Override - public TimeMetric.Match newEmptyMatch() { - return TimeMetric.Match.newEmptyMatch(); - } - - @Override - public TimeMetric.Match newMatch(final Object... parameters) { - return TimeMetric.Match.newMatch((java.lang.Double) parameters[0]); - } - - /** - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TimeMetric INSTANCE = new TimeMetric(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TimeMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_Time = new PParameter("Time", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Time); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Time"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Time = body.getOrCreateVariableByName("Time"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Time), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Time, parameter_Time) - )); - // Time == sum find missionTime(_, #_) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), MissionTime.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); - new Equality(body, var_Time, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} 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 @@ /.AdditionalCommSubsystemCost.java._trace /.SpacecraftWithTwoCommSubsystems.java._trace /.SpacecraftCost.java._trace +/.CrossLinkAllowed.java._trace +/.MatchingAntenna.java._trace +/.CubeSat3U.java._trace +/.LinkAllowed.java._trace +/.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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern additionalCommSubsystemCost(Spacecraft : Spacecraft, Cost : java Double) {
    - *         	find spacecraftWithTwoCommSubsystems(Spacecraft);
    - *         	Cost == 100000.0;
    - *         } or {
    - *         	neg find spacecraftWithTwoCommSubsystems(Spacecraft);
    - *         	Cost == 0.0;
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class AdditionalCommSubsystemCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private AdditionalCommSubsystemCost() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static AdditionalCommSubsystemCost instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final AdditionalCommSubsystemCost INSTANCE = new AdditionalCommSubsystemCost(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final AdditionalCommSubsystemCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Spacecraft, parameter_Cost); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.additionalCommSubsystemCost"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Spacecraft","Cost"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Cost = body.getOrCreateVariableByName("Cost"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_Cost, parameter_Cost) - )); - // find spacecraftWithTwoCommSubsystems(Spacecraft) - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft), SpacecraftWithTwoCommSubsystems.instance().getInternalQueryRepresentation()); - // Cost == 100000.0 - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, 100000.0); - new Equality(body, var_Cost, var__virtual_0_); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Cost = body.getOrCreateVariableByName("Cost"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_Cost, parameter_Cost) - )); - // neg find spacecraftWithTwoCommSubsystems(Spacecraft) - new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft), SpacecraftWithTwoCommSubsystems.instance().getInternalQueryRepresentation()); - // Cost == 0.0 - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, 0.0); - new Equality(body, var_Cost, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1() { - return 100000.0; - } - - private static double evaluateExpression_2_1() { - return 0.0; - } -} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern basePrice(Spacecraft : Spacecraft, BasePrice : java Double) {
    - *         	Spacecraft.kind(Spacecraft, SpacecraftKind::CubeSat3U);
    - *         	BasePrice == 250000.0;
    - *         } or {
    - *         	Spacecraft.kind(Spacecraft, SpacecraftKind::CubeSat6U);
    - *         	BasePrice == 750000.0;
    - *         } or {
    - *         	Spacecraft.kind(Spacecraft, SpacecraftKind::SmallSat);
    - *         	BasePrice == 3000000.0;
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class BasePrice extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private BasePrice() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static BasePrice instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final BasePrice INSTANCE = new BasePrice(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final BasePrice.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final PParameter parameter_BasePrice = new PParameter("BasePrice", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Spacecraft, parameter_BasePrice); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.basePrice"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Spacecraft","BasePrice"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_BasePrice), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_BasePrice, parameter_BasePrice) - )); - // Spacecraft.kind(Spacecraft, SpacecraftKind::CubeSat3U) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat3U").getInstance()); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); - new Equality(body, var__virtual_1_, var__virtual_0_); - // BasePrice == 250000.0 - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ConstantValue(body, var__virtual_2_, 250000.0); - new Equality(body, var_BasePrice, var__virtual_2_); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_BasePrice), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_BasePrice, parameter_BasePrice) - )); - // Spacecraft.kind(Spacecraft, SpacecraftKind::CubeSat6U) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "CubeSat6U").getInstance()); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); - new Equality(body, var__virtual_1_, var__virtual_0_); - // BasePrice == 750000.0 - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ConstantValue(body, var__virtual_2_, 750000.0); - new Equality(body, var_BasePrice, var__virtual_2_); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_BasePrice), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_BasePrice, parameter_BasePrice) - )); - // Spacecraft.kind(Spacecraft, SpacecraftKind::SmallSat) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "SmallSat").getInstance()); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); - new Equality(body, var__virtual_1_, var__virtual_0_); - // BasePrice == 3000000.0 - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ConstantValue(body, var__virtual_2_, 3000000.0); - new Equality(body, var_BasePrice, var__virtual_2_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1() { - return 250000.0; - } - - private static double evaluateExpression_2_1() { - return 750000.0; - } - - private static double evaluateExpression_3_1() { - return 3000000.0; - } -} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CubeSat3U.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CubeSat3U.java new file mode 100644 index 00000000..fe789893 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CubeSat3U.java @@ -0,0 +1,127 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; + +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; + +/** + * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. + * + *

    Original source: + *

    + *         private pattern cubeSat3U(Sat : CubeSat3U) {
    + *         	CubeSat3U(Sat);
    + *         }
    + * 
    + * + * @see GenericPatternMatcher + * @see GenericPatternMatch + * + */ +@SuppressWarnings("all") +public final class CubeSat3U extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { + private CubeSat3U() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static CubeSat3U instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + /** + * 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: ) (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 + * not at the class load time of the outer class, + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final CubeSat3U INSTANCE = new CubeSat3U(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final CubeSat3U.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + 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); + + private final List parameters = Arrays.asList(parameter_Sat); + + private GeneratedPQuery() { + super(PVisibility.PRIVATE); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.cubeSat3U"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("Sat"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_Sat = body.getOrCreateVariableByName("Sat"); + new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_Sat, parameter_Sat) + )); + // CubeSat3U(Sat) + new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); + bodies.add(body); + } + 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/IncomingData.java deleted file mode 100644 index 114bbf33..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IncomingData.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern incomingData(Spacecraft : Spacecraft, Source : Spacecraft, Data : java Double) {
    - *         	find indirectCommunicationLink(Source, Spacecraft);
    - *         	find scienceData(Source, Data);
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class IncomingData extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private IncomingData() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IncomingData instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final IncomingData INSTANCE = new IncomingData(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final IncomingData.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - 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); - - private final PParameter parameter_Data = new PParameter("Data", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Spacecraft, parameter_Source, parameter_Data); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incomingData"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Spacecraft","Source","Data"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Source = body.getOrCreateVariableByName("Source"); - PVariable var_Data = body.getOrCreateVariableByName("Data"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_Source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Data), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_Source, parameter_Source), - new ExportedParameter(body, var_Data, parameter_Data) - )); - // find indirectCommunicationLink(Source, Spacecraft) - new PositivePatternCall(body, Tuples.flatTupleOf(var_Source, var_Spacecraft), IndirectCommunicationLink.instance().getInternalQueryRepresentation()); - // find scienceData(Source, Data) - new PositivePatternCall(body, Tuples.flatTupleOf(var_Source, var_Data), ScienceData.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectLinkAllowed.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectLinkAllowed.java new file mode 100644 index 00000000..27648bf3 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectLinkAllowed.java @@ -0,0 +1,134 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; + +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; + +/** + * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. + * + *

    Original source: + *

    + *         private pattern indirectLinkAllowed(From : Spacecraft, To : CommunicatingElement) {
    + *         	find linkAllowed+(From, To);
    + *         }
    + * 
    + * + * @see GenericPatternMatcher + * @see GenericPatternMatch + * + */ +@SuppressWarnings("all") +public final class IndirectLinkAllowed extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { + private IndirectLinkAllowed() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static IndirectLinkAllowed instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + /** + * 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: ) (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 + * not at the class load time of the outer class, + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final IndirectLinkAllowed INSTANCE = new IndirectLinkAllowed(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final IndirectLinkAllowed.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + 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); + + 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); + + private final List parameters = Arrays.asList(parameter_From, parameter_To); + + private GeneratedPQuery() { + super(PVisibility.PRIVATE); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.indirectLinkAllowed"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("From","To"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_From = body.getOrCreateVariableByName("From"); + PVariable var_To = body.getOrCreateVariableByName("To"); + new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_From, parameter_From), + new ExportedParameter(body, var_To, parameter_To) + )); + // find linkAllowed+(From, To) + new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_From, var_To), LinkAllowed.instance().getInternalQueryRepresentation()); + bodies.add(body); + } + 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern interferometryPayloadCost(Spacecraft : Spacecraft, Cost : java Double) {
    - *         	find spacecraftWithInterferometryPayload(_, Spacecraft);
    - *         	Cost == 50000.0;
    - *         } or {
    - *         	neg find spacecraftWithInterferometryPayload(_, Spacecraft);
    - *         	Cost == 0.0;
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class InterferometryPayloadCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private InterferometryPayloadCost() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static InterferometryPayloadCost instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final InterferometryPayloadCost INSTANCE = new InterferometryPayloadCost(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final InterferometryPayloadCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Spacecraft, parameter_Cost); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.interferometryPayloadCost"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Spacecraft","Cost"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Cost = body.getOrCreateVariableByName("Cost"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_Cost, parameter_Cost) - )); - // find spacecraftWithInterferometryPayload(_, Spacecraft) - new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_Spacecraft), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation()); - // Cost == 50000.0 - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, 50000.0); - new Equality(body, var_Cost, var__virtual_0_); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Cost = body.getOrCreateVariableByName("Cost"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_Cost, parameter_Cost) - )); - // neg find spacecraftWithInterferometryPayload(_, Spacecraft) - new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var_Spacecraft), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation()); - // Cost == 0.0 - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, 0.0); - new Equality(body, var_Cost, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1() { - return 50000.0; - } - - private static double evaluateExpression_2_1() { - return 0.0; - } -} 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 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; + +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; + +/** + * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. + * + *

    Original source: + *

    + *         private pattern linkAllowed(From : Spacecraft, To : CommunicatingElement) {
    + *         	find matchingAntenna(From, To, _);
    + *         	neg find cubeSat3U(From);
    + *         } or {
    + *         	find matchingAntenna(From, To, TransceiverBand::UHF);
    + *         	CubeSat3U(From);
    + *         } or {
    + *         	find matchingAntenna(From, To, _);
    + *         	CubeSat3U(From);
    + *         	GroundStationNetwork(To);
    + *         }
    + * 
    + * + * @see GenericPatternMatcher + * @see GenericPatternMatch + * + */ +@SuppressWarnings("all") +public final class LinkAllowed extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { + private LinkAllowed() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static LinkAllowed instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + /** + * 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: ) (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 + * not at the class load time of the outer class, + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final LinkAllowed INSTANCE = new LinkAllowed(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final LinkAllowed.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + 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); + + 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); + + private final List parameters = Arrays.asList(parameter_From, parameter_To); + + private GeneratedPQuery() { + super(PVisibility.PRIVATE); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.linkAllowed"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("From","To"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_From = body.getOrCreateVariableByName("From"); + PVariable var_To = body.getOrCreateVariableByName("To"); + PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); + new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_From, parameter_From), + new ExportedParameter(body, var_To, parameter_To) + )); + // find matchingAntenna(From, To, _) + new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To, var___0_), MatchingAntenna.instance().getInternalQueryRepresentation()); + // neg find cubeSat3U(From) + new NegativePatternCall(body, Tuples.flatTupleOf(var_From), CubeSat3U.instance().getInternalQueryRepresentation()); + bodies.add(body); + } + { + PBody body = new PBody(this); + PVariable var_From = body.getOrCreateVariableByName("From"); + PVariable var_To = body.getOrCreateVariableByName("To"); + new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_From, parameter_From), + new ExportedParameter(body, var_To, parameter_To) + )); + // find matchingAntenna(From, To, TransceiverBand::UHF) + PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); + new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance()); + new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To, var__virtual_0_), MatchingAntenna.instance().getInternalQueryRepresentation()); + // CubeSat3U(From) + new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); + bodies.add(body); + } + { + PBody body = new PBody(this); + PVariable var_From = body.getOrCreateVariableByName("From"); + PVariable var_To = body.getOrCreateVariableByName("To"); + PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); + new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_From, parameter_From), + new ExportedParameter(body, var_To, parameter_To) + )); + // find matchingAntenna(From, To, _) + new PositivePatternCall(body, Tuples.flatTupleOf(var_From, var_To, var___0_), MatchingAntenna.instance().getInternalQueryRepresentation()); + // CubeSat3U(From) + new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); + // GroundStationNetwork(To) + new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); + bodies.add(body); + } + return bodies; + } + } +} 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 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; + +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; +import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; + +/** + * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. + * + *

    Original source: + *

    + *         private pattern matchingAntenna(From : Spacecraft, To : CommunicatingElement, Band : TransceiverBand) {
    + *         	CommunicatingElement.commSubsystem.band(From, Band);
    + *         	CommunicatingElement.commSubsystem.band(To, Band);
    + *         	CommunicatingElement.commSubsystem.gain(From, Gain);
    + *         	CommunicatingElement.commSubsystem.gain(To, Gain);
    + *         }
    + * 
    + * + * @see GenericPatternMatcher + * @see GenericPatternMatch + * + */ +@SuppressWarnings("all") +public final class MatchingAntenna extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { + private MatchingAntenna() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static MatchingAntenna instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + /** + * 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: ) (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 + * not at the class load time of the outer class, + * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final MatchingAntenna INSTANCE = new MatchingAntenna(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final MatchingAntenna.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + 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); + + 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); + + 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); + + private final List parameters = Arrays.asList(parameter_From, parameter_To, parameter_Band); + + private GeneratedPQuery() { + super(PVisibility.PRIVATE); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.matchingAntenna"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("From","To","Band"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_From = body.getOrCreateVariableByName("From"); + PVariable var_To = body.getOrCreateVariableByName("To"); + PVariable var_Band = body.getOrCreateVariableByName("Band"); + PVariable var_Gain = body.getOrCreateVariableByName("Gain"); + new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_Band), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_From, parameter_From), + new ExportedParameter(body, var_To, parameter_To), + new ExportedParameter(body, var_Band, parameter_Band) + )); + // CommunicatingElement.commSubsystem.band(From, Band) + new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); + PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_From, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); + PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); + new Equality(body, var__virtual_1_, var_Band); + // CommunicatingElement.commSubsystem.band(To, Band) + new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); + PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_To, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); + PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); + new Equality(body, var__virtual_3_, var_Band); + // CommunicatingElement.commSubsystem.gain(From, Gain) + new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); + PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_From, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); + PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); + new Equality(body, var__virtual_5_, var_Gain); + // CommunicatingElement.commSubsystem.gain(To, Gain) + new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); + PVariable var__virtual_6_ = body.getOrCreateVariableByName(".virtual{6}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_To, var__virtual_6_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); + PVariable var__virtual_7_ = body.getOrCreateVariableByName(".virtual{7}"); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_, var__virtual_7_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_7_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain"))); + new Equality(body, var__virtual_7_, var_Gain); + bodies.add(body); + } + return bodies; + } + } +} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern missionCost(Mission : InterferometryMission, Cost : java Double) {
    - *         	InterferometryMission.observationTime(Mission, ObservationTime);
    - *         	SpacecraftCost == sum find spacecraftCost(Mission, _, #_);
    - *         	Cost == eval(SpacecraftCost + 100000.0  ObservationTime);
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class MissionCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private MissionCost() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static MissionCost instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final MissionCost INSTANCE = new MissionCost(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final MissionCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Mission, parameter_Cost); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.missionCost"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Mission","Cost"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Mission = body.getOrCreateVariableByName("Mission"); - PVariable var_Cost = body.getOrCreateVariableByName("Cost"); - PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); - PVariable var_SpacecraftCost = body.getOrCreateVariableByName("SpacecraftCost"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Mission, parameter_Mission), - new ExportedParameter(body, var_Cost, parameter_Cost) - )); - // InterferometryMission.observationTime(Mission, ObservationTime) - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); - new Equality(body, var__virtual_0_, var_ObservationTime); - // SpacecraftCost == sum find spacecraftCost(Mission, _, #_) - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var_Mission, var___0_, var___1_), SpacecraftCost.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); - new Equality(body, var_SpacecraftCost, var__virtual_1_); - // Cost == eval(SpacecraftCost + 100000.0 * ObservationTime) - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern missionCost"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("ObservationTime", "SpacecraftCost");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Float ObservationTime = (Float) provider.getValue("ObservationTime"); - Double SpacecraftCost = (Double) provider.getValue("SpacecraftCost"); - return evaluateExpression_1_1(ObservationTime, SpacecraftCost); - } - }, var__virtual_2_ ); - new Equality(body, var_Cost, var__virtual_2_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1(final Float ObservationTime, final Double SpacecraftCost) { - return ((SpacecraftCost).doubleValue() + (100000.0 * (ObservationTime).floatValue())); - } -} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern missionCoverage(Mission : InterferometryMission, Coverage : java Double) {
    - *         	InterferometryMission.observationTime(Mission, ObservationTime);
    - *         	ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _);
    - *         	Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9  (1.0 / ObservationTime)) + 0.05  ObservationTime / 3);
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class MissionCoverage extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private MissionCoverage() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static MissionCoverage instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final MissionCoverage INSTANCE = new MissionCoverage(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final MissionCoverage.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final PParameter parameter_Coverage = new PParameter("Coverage", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Mission, parameter_Coverage); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.missionCoverage"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Mission","Coverage"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Mission = body.getOrCreateVariableByName("Mission"); - PVariable var_Coverage = body.getOrCreateVariableByName("Coverage"); - PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); - PVariable var_ObserverCount = body.getOrCreateVariableByName("ObserverCount"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Coverage), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Mission, parameter_Mission), - new ExportedParameter(body, var_Coverage, parameter_Coverage) - )); - // InterferometryMission.observationTime(Mission, ObservationTime) - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); - new Equality(body, var__virtual_0_, var_ObservationTime); - // ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _) - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var_Mission, var___0_), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation(), var__virtual_1_); - new Equality(body, var_ObserverCount, var__virtual_1_); - // Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9 * (1.0 / ObservationTime)) + 0.05 * ObservationTime / 3) - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern missionCoverage"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("ObservationTime", "ObserverCount");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Float ObservationTime = (Float) provider.getValue("ObservationTime"); - Integer ObserverCount = (Integer) provider.getValue("ObserverCount"); - return evaluateExpression_1_1(ObservationTime, ObserverCount); - } - }, var__virtual_2_ ); - new Equality(body, var_Coverage, var__virtual_2_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1(final Float ObservationTime, final Integer ObserverCount) { - double _pow = Math.pow((1 - (2.0 / (ObserverCount).intValue())), (1 + (9 * (1.0 / (ObservationTime).floatValue())))); - double _plus = (_pow + ((0.05 * (ObservationTime).floatValue()) / 3)); - return _plus; - } -} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern missionTime(Mission : InterferometryMission, Time : java Double) {
    - *         	InterferometryMission.observationTime(Mission, ObservationTime);
    - *         	TrasmitTime == sum find transmitTime(Mission, _, #_);
    - *         	Time == eval(TrasmitTime + 60.0  ObservationTime);
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class MissionTime extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private MissionTime() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static MissionTime instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final MissionTime INSTANCE = new MissionTime(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final MissionTime.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final PParameter parameter_Time = new PParameter("Time", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Mission, parameter_Time); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.missionTime"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Mission","Time"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Mission = body.getOrCreateVariableByName("Mission"); - PVariable var_Time = body.getOrCreateVariableByName("Time"); - PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); - PVariable var_TrasmitTime = body.getOrCreateVariableByName("TrasmitTime"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Time), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Mission, parameter_Mission), - new ExportedParameter(body, var_Time, parameter_Time) - )); - // InterferometryMission.observationTime(Mission, ObservationTime) - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); - new Equality(body, var__virtual_0_, var_ObservationTime); - // TrasmitTime == sum find transmitTime(Mission, _, #_) - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var_Mission, var___0_, var___1_), TransmitTime.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); - new Equality(body, var_TrasmitTime, var__virtual_1_); - // Time == eval(TrasmitTime + 60.0 * ObservationTime) - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern missionTime"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("ObservationTime", "TrasmitTime");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Float ObservationTime = (Float) provider.getValue("ObservationTime"); - Double TrasmitTime = (Double) provider.getValue("TrasmitTime"); - return evaluateExpression_1_1(ObservationTime, TrasmitTime); - } - }, var__virtual_2_ ); - new Equality(body, var_Time, var__virtual_2_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1(final Float ObservationTime, final Double TrasmitTime) { - return ((TrasmitTime).doubleValue() + (60.0 * (ObservationTime).floatValue())); - } -} 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; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGroundStation; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SpacecraftOfKind; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKind; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed; +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna; import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime; import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; /** @@ -55,6 +44,11 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; *

  • atLeastTwoInterferometryPayloads
  • *
  • spacecraftWithInterferometryPayload
  • *
  • noLinkToGroundStation
  • + *
  • noPotentialLinkToGroundStation
  • + *
  • indirectLinkAllowed
  • + *
  • linkAllowed
  • + *
  • matchingAntenna
  • + *
  • cubeSat3U
  • *
  • communicationLoop
  • *
  • indirectCommunicationLink
  • *
  • directCommunicationLink
  • @@ -72,23 +66,7 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; *
  • groundStationNetwork
  • *
  • cubeSatWithKaAntenna
  • *
  • smallSat
  • - *
  • coverageMetric
  • - *
  • missionCoverage
  • - *
  • timeMetric
  • - *
  • missionTime
  • - *
  • transmitTime
  • - *
  • incomingData
  • - *
  • scienceData
  • - *
  • transmitRate
  • - *
  • spacecraftUplink
  • - *
  • costMetric
  • - *
  • missionCost
  • - *
  • spacecraftCost
  • *
  • spacecraftOfKind
  • - *
  • basePrice
  • - *
  • interferometryPayloadCost
  • - *
  • additionalCommSubsystemCost
  • - *
  • spacecraftWithTwoCommSubsystems
  • * * * @see IQueryGroup @@ -118,6 +96,11 @@ public final class SatelliteQueriesAll extends BaseGeneratedPatternGroup { querySpecifications.add(AtLeastTwoInterferometryPayloads.instance()); querySpecifications.add(SpacecraftWithInterferometryPayload.instance()); querySpecifications.add(NoLinkToGroundStation.instance()); + querySpecifications.add(NoPotentialLinkToGroundStation.instance()); + querySpecifications.add(IndirectLinkAllowed.instance()); + querySpecifications.add(LinkAllowed.instance()); + querySpecifications.add(MatchingAntenna.instance()); + querySpecifications.add(CubeSat3U.instance()); querySpecifications.add(CommunicationLoop.instance()); querySpecifications.add(IndirectCommunicationLink.instance()); querySpecifications.add(DirectCommunicationLink.instance()); @@ -135,22 +118,6 @@ public final class SatelliteQueriesAll extends BaseGeneratedPatternGroup { querySpecifications.add(GroundStationNetwork.instance()); querySpecifications.add(CubeSatWithKaAntenna.instance()); querySpecifications.add(SmallSat.instance()); - querySpecifications.add(CoverageMetric.instance()); - querySpecifications.add(MissionCoverage.instance()); - querySpecifications.add(TimeMetric.instance()); - querySpecifications.add(MissionTime.instance()); - querySpecifications.add(TransmitTime.instance()); - querySpecifications.add(IncomingData.instance()); - querySpecifications.add(ScienceData.instance()); - querySpecifications.add(TransmitRate.instance()); - querySpecifications.add(SpacecraftUplink.instance()); - querySpecifications.add(CostMetric.instance()); - querySpecifications.add(MissionCost.instance()); - querySpecifications.add(SpacecraftCost.instance()); querySpecifications.add(SpacecraftOfKind.instance()); - querySpecifications.add(BasePrice.instance()); - querySpecifications.add(InterferometryPayloadCost.instance()); - querySpecifications.add(AdditionalCommSubsystemCost.instance()); - querySpecifications.add(SpacecraftWithTwoCommSubsystems.instance()); } } 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern scienceData(Spacecraft : Spacecraft, Data : java Double) {
    - *         	ConstellationMission.spacecraft(Mission, Spacecraft);
    - *         	InterferometryMission.observationTime(Mission, ObservationTime);
    - *         	Data == eval(12.0  ObservationTime);
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class ScienceData extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private ScienceData() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static ScienceData instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final ScienceData INSTANCE = new ScienceData(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final ScienceData.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final PParameter parameter_Data = new PParameter("Data", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Spacecraft, parameter_Data); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.scienceData"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Spacecraft","Data"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Data = body.getOrCreateVariableByName("Data"); - PVariable var_Mission = body.getOrCreateVariableByName("Mission"); - PVariable var_ObservationTime = body.getOrCreateVariableByName("ObservationTime"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Data), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_Data, parameter_Data) - )); - // ConstellationMission.spacecraft(Mission, Spacecraft) - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new Equality(body, var__virtual_0_, var_Spacecraft); - // InterferometryMission.observationTime(Mission, ObservationTime) - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "InterferometryMission", "observationTime"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EFloat"))); - new Equality(body, var__virtual_1_, var_ObservationTime); - // Data == eval(12.0 * ObservationTime) - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern scienceData"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("ObservationTime");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Float ObservationTime = (Float) provider.getValue("ObservationTime"); - return evaluateExpression_1_1(ObservationTime); - } - }, var__virtual_2_ ); - new Equality(body, var_Data, var__virtual_2_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1(final Float ObservationTime) { - return (12.0 * (ObservationTime).floatValue()); - } -} 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/SmallSat.java deleted file mode 100644 index d74ed28a..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SmallSat.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern smallSat(Sat : Spacecraft) {
    - *         	Spacecraft.kind(Sat, SpacecraftKind::SmallSat);
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class SmallSat extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private SmallSat() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static SmallSat instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final SmallSat INSTANCE = new SmallSat(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final SmallSat.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final List parameters = Arrays.asList(parameter_Sat); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Sat"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Sat = body.getOrCreateVariableByName("Sat"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Sat, parameter_Sat) - )); - // Spacecraft.kind(Sat, SpacecraftKind::SmallSat) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "SpacecraftKind", "SmallSat").getInstance()); - new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Sat, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); - new Equality(body, var__virtual_1_, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKind; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern spacecraftCost(Mission : InterferometryMission, Spacecraft : Spacecraft, Cost : java Double) {
    - *         	ConstellationMission.spacecraft(Mission, Spacecraft);
    - *         	Spacecraft.kind(Spacecraft, Kind);
    - *         	KindCount == count find spacecraftOfKind(_, Kind);
    - *         	find basePrice(Spacecraft, BasePrice);
    - *         	find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost);
    - *         	find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost);
    - *         	Cost == eval(BasePrice  Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost);
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class SpacecraftCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private SpacecraftCost() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static SpacecraftCost instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final SpacecraftCost INSTANCE = new SpacecraftCost(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final SpacecraftCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - 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); - - private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Mission, parameter_Spacecraft, parameter_Cost); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftCost"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Mission","Spacecraft","Cost"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Mission = body.getOrCreateVariableByName("Mission"); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Cost = body.getOrCreateVariableByName("Cost"); - PVariable var_Kind = body.getOrCreateVariableByName("Kind"); - PVariable var_KindCount = body.getOrCreateVariableByName("KindCount"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var_BasePrice = body.getOrCreateVariableByName("BasePrice"); - PVariable var_InterferometryPayloadCost = body.getOrCreateVariableByName("InterferometryPayloadCost"); - PVariable var_AdditionalCommSubsystemCost = body.getOrCreateVariableByName("AdditionalCommSubsystemCost"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Mission, parameter_Mission), - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_Cost, parameter_Cost) - )); - // ConstellationMission.spacecraft(Mission, Spacecraft) - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new Equality(body, var__virtual_0_, var_Spacecraft); - // Spacecraft.kind(Spacecraft, Kind) - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); - new Equality(body, var__virtual_1_, var_Kind); - // KindCount == count find spacecraftOfKind(_, Kind) - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_, var_Kind), SpacecraftOfKind.instance().getInternalQueryRepresentation(), var__virtual_2_); - new Equality(body, var_KindCount, var__virtual_2_); - // find basePrice(Spacecraft, BasePrice) - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_BasePrice), BasePrice.instance().getInternalQueryRepresentation()); - // find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost) - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_InterferometryPayloadCost), InterferometryPayloadCost.instance().getInternalQueryRepresentation()); - // find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost) - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_AdditionalCommSubsystemCost), AdditionalCommSubsystemCost.instance().getInternalQueryRepresentation()); - // Cost == eval(BasePrice * Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost) - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern spacecraftCost"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("AdditionalCommSubsystemCost", "BasePrice", "InterferometryPayloadCost", "KindCount");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Double AdditionalCommSubsystemCost = (Double) provider.getValue("AdditionalCommSubsystemCost"); - Double BasePrice = (Double) provider.getValue("BasePrice"); - Double InterferometryPayloadCost = (Double) provider.getValue("InterferometryPayloadCost"); - Integer KindCount = (Integer) provider.getValue("KindCount"); - return evaluateExpression_1_1(AdditionalCommSubsystemCost, BasePrice, InterferometryPayloadCost, KindCount); - } - }, var__virtual_3_ ); - new Equality(body, var_Cost, var__virtual_3_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1(final Double AdditionalCommSubsystemCost, final Double BasePrice, final Double InterferometryPayloadCost, final Integer KindCount) { - double _pow = Math.pow((KindCount).intValue(), (-0.25)); - double _multiply = ((BasePrice).doubleValue() * _pow); - double _plus = (_multiply + (InterferometryPayloadCost).doubleValue()); - double _plus_1 = (_plus + (AdditionalCommSubsystemCost).doubleValue()); - return _plus_1; - } -} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern spacecraftOfKind(Spacecraft : Spacecraft, Kind : SpacecraftKind) {
    - *         	Spacecraft.kind(Spacecraft, Kind);
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class SpacecraftOfKind extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private SpacecraftOfKind() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static SpacecraftOfKind instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final SpacecraftOfKind INSTANCE = new SpacecraftOfKind(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final SpacecraftOfKind.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - 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); - - private final List parameters = Arrays.asList(parameter_Spacecraft, parameter_Kind); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKind"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Spacecraft","Kind"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Kind = body.getOrCreateVariableByName("Kind"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_Kind), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_Kind, parameter_Kind) - )); - // Spacecraft.kind(Spacecraft, Kind) - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "kind"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "SpacecraftKind"))); - new Equality(body, var__virtual_0_, var_Kind); - bodies.add(body); - } - return bodies; - } - } -} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern spacecraftUplink(Spacecraft : Spacecraft, Band : TransceiverBand, Target : CommunicatingElement) {
    - *         	CommunicatingElement.communicationLink(Spacecraft, Link);
    - *         	DirectedCommunicationLink.source.band(Link, Band);
    - *         	DirectedCommunicationLink.target(Link, TargetSubsystem);
    - *         	CommunicatingElement.commSubsystem(Target, TargetSubsystem);
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class SpacecraftUplink extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private SpacecraftUplink() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static SpacecraftUplink instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final SpacecraftUplink INSTANCE = new SpacecraftUplink(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final SpacecraftUplink.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - 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); - - 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); - - private final List parameters = Arrays.asList(parameter_Spacecraft, parameter_Band, parameter_Target); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftUplink"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Spacecraft","Band","Target"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Band = body.getOrCreateVariableByName("Band"); - PVariable var_Target = body.getOrCreateVariableByName("Target"); - PVariable var_Link = body.getOrCreateVariableByName("Link"); - PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_Band), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_Band, parameter_Band), - new ExportedParameter(body, var_Target, parameter_Target) - )); - // CommunicatingElement.communicationLink(Spacecraft, Link) - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "communicationLink"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); - new Equality(body, var__virtual_0_, var_Link); - // DirectedCommunicationLink.source.band(Link, Band) - new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand"))); - new Equality(body, var__virtual_2_, var_Band); - // DirectedCommunicationLink.target(Link, TargetSubsystem) - new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); - new Equality(body, var__virtual_3_, var_TargetSubsystem); - // CommunicatingElement.commSubsystem(Target, TargetSubsystem) - new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement"))); - PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Target, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); - new Equality(body, var__virtual_4_, var_TargetSubsystem); - bodies.add(body); - } - return bodies; - } - } -} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern spacecraftWithTwoCommSubsystems(Spacecraft : Spacecraft) {
    - *         	Spacecraft.commSubsystem(Spacecraft, Subsystem1);
    - *         	Spacecraft.commSubsystem(Spacecraft, Subsystem2);
    - *         	Subsystem1 != Subsystem2;
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class SpacecraftWithTwoCommSubsystems extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private SpacecraftWithTwoCommSubsystems() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static SpacecraftWithTwoCommSubsystems instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final SpacecraftWithTwoCommSubsystems INSTANCE = new SpacecraftWithTwoCommSubsystems(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final SpacecraftWithTwoCommSubsystems.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final List parameters = Arrays.asList(parameter_Spacecraft); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftWithTwoCommSubsystems"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Spacecraft"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_Subsystem1 = body.getOrCreateVariableByName("Subsystem1"); - PVariable var_Subsystem2 = body.getOrCreateVariableByName("Subsystem2"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft) - )); - // Spacecraft.commSubsystem(Spacecraft, Subsystem1) - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); - new Equality(body, var__virtual_0_, var_Subsystem1); - // Spacecraft.commSubsystem(Spacecraft, Subsystem2) - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem"))); - new Equality(body, var__virtual_1_, var_Subsystem2); - // Subsystem1 != Subsystem2 - new Inequality(body, var_Subsystem1, var_Subsystem2); - bodies.add(body); - } - return bodies; - } - } -} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern transmitRate(Spacecraft : Spacecraft, TransmitRate : java Double) {
    - *         	find spacecraftUplink(Spacecraft, TransceiverBand::UHF, Target);
    - *         	Spacecraft(Target);
    - *         	TransmitRate == 5.0;
    - *         } or {
    - *         	find spacecraftUplink(Spacecraft, TransceiverBand::X, Target);
    - *         	Spacecraft(Target);
    - *         	TransmitRate == 1.6;
    - *         } or {
    - *         	find spacecraftUplink(Spacecraft, TransceiverBand::X, Target);
    - *         	GroundStationNetwork(Target);
    - *         	TransmitRate == 0.7;
    - *         } or {
    - *         	find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target);
    - *         	Spacecraft(Target);
    - *         	TransmitRate == 220.0;
    - *         } or {
    - *         	find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target);
    - *         	GroundStationNetwork(Target);
    - *         	TransmitRate == 80.0;
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class TransmitRate extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private TransmitRate() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransmitRate instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransmitRate INSTANCE = new TransmitRate(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransmitRate.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - private final PParameter parameter_TransmitRate = new PParameter("TransmitRate", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Spacecraft, parameter_TransmitRate); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.transmitRate"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Spacecraft","TransmitRate"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); - PVariable var_Target = body.getOrCreateVariableByName("Target"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) - )); - // find spacecraftUplink(Spacecraft, TransceiverBand::UHF, Target) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance()); - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); - // Spacecraft(Target) - new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - // TransmitRate == 5.0 - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new ConstantValue(body, var__virtual_1_, 5.0); - new Equality(body, var_TransmitRate, var__virtual_1_); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); - PVariable var_Target = body.getOrCreateVariableByName("Target"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) - )); - // find spacecraftUplink(Spacecraft, TransceiverBand::X, Target) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "X").getInstance()); - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); - // Spacecraft(Target) - new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - // TransmitRate == 1.6 - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new ConstantValue(body, var__virtual_1_, 1.6); - new Equality(body, var_TransmitRate, var__virtual_1_); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); - PVariable var_Target = body.getOrCreateVariableByName("Target"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) - )); - // find spacecraftUplink(Spacecraft, TransceiverBand::X, Target) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "X").getInstance()); - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); - // GroundStationNetwork(Target) - new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); - // TransmitRate == 0.7 - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new ConstantValue(body, var__virtual_1_, 0.7); - new Equality(body, var_TransmitRate, var__virtual_1_); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); - PVariable var_Target = body.getOrCreateVariableByName("Target"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) - )); - // find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance()); - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); - // Spacecraft(Target) - new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - // TransmitRate == 220.0 - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new ConstantValue(body, var__virtual_1_, 220.0); - new Equality(body, var_TransmitRate, var__virtual_1_); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); - PVariable var_Target = body.getOrCreateVariableByName("Target"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitRate), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_TransmitRate, parameter_TransmitRate) - )); - // find spacecraftUplink(Spacecraft, TransceiverBand::Ka, Target) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance()); - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_0_, var_Target), SpacecraftUplink.instance().getInternalQueryRepresentation()); - // GroundStationNetwork(Target) - new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork"))); - // TransmitRate == 80.0 - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new ConstantValue(body, var__virtual_1_, 80.0); - new Equality(body, var_TransmitRate, var__virtual_1_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1() { - return 5.0; - } - - private static double evaluateExpression_2_1() { - return 1.6; - } - - private static double evaluateExpression_3_1() { - return 0.7; - } - - private static double evaluateExpression_4_1() { - return 220.0; - } - - private static double evaluateExpression_5_1() { - return 80.0; - } -} 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 @@ -/** - * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql - */ -package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.xtext.xbase.lib.DoubleExtensions; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

    Original source: - *

    - *         private pattern transmitTime(Mission : InterferometryMission, Spacecraft : Spacecraft, TransmitTime : java Double) {
    - *         	ConstellationMission.spacecraft(Mission, Spacecraft);
    - *         	find scienceData(Spacecraft, ScienceData);
    - *         	IncomingData == sum find incomingData(Spacecraft, _, #_);
    - *         	find transmitRate(Spacecraft, TransmitRate);
    - *         	TransmitTime == eval((ScienceData + IncomingData) / (7.5  TransmitRate));
    - *         }
    - * 
    - * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class TransmitTime extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private TransmitTime() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransmitTime instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * 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: ) (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 - * not at the class load time of the outer class, - * 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: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

    This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransmitTime INSTANCE = new TransmitTime(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

    The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransmitTime.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - 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); - - 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); - - private final PParameter parameter_TransmitTime = new PParameter("TransmitTime", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_Mission, parameter_Spacecraft, parameter_TransmitTime); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.transmitTime"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("Mission","Spacecraft","TransmitTime"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_Mission = body.getOrCreateVariableByName("Mission"); - PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft"); - PVariable var_TransmitTime = body.getOrCreateVariableByName("TransmitTime"); - PVariable var_ScienceData = body.getOrCreateVariableByName("ScienceData"); - PVariable var_IncomingData = body.getOrCreateVariableByName("IncomingData"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - PVariable var_TransmitRate = body.getOrCreateVariableByName("TransmitRate"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_TransmitTime), new JavaTransitiveInstancesKey(java.lang.Double.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_Mission, parameter_Mission), - new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft), - new ExportedParameter(body, var_TransmitTime, parameter_TransmitTime) - )); - // ConstellationMission.spacecraft(Mission, Spacecraft) - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); - new Equality(body, var__virtual_0_, var_Spacecraft); - // find scienceData(Spacecraft, ScienceData) - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_ScienceData), ScienceData.instance().getInternalQueryRepresentation()); - // IncomingData == sum find incomingData(Spacecraft, _, #_) - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new AggregatorConstraint(new sum().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var_Spacecraft, var___0_, var___1_), IncomingData.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); - new Equality(body, var_IncomingData, var__virtual_1_); - // find transmitRate(Spacecraft, TransmitRate) - new PositivePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_TransmitRate), TransmitRate.instance().getInternalQueryRepresentation()); - // TransmitTime == eval((ScienceData + IncomingData) / (7.5 * TransmitRate)) - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern transmitTime"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("IncomingData", "ScienceData", "TransmitRate");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Double IncomingData = (Double) provider.getValue("IncomingData"); - Double ScienceData = (Double) provider.getValue("ScienceData"); - Double TransmitRate = (Double) provider.getValue("TransmitRate"); - return evaluateExpression_1_1(IncomingData, ScienceData, TransmitRate); - } - }, var__virtual_2_ ); - new Equality(body, var_TransmitTime, var__virtual_2_); - bodies.add(body); - } - return bodies; - } - } - - private static double evaluateExpression_1_1(final Double IncomingData, final Double ScienceData, final Double TransmitRate) { - double _plus = DoubleExtensions.operator_plus(ScienceData, IncomingData); - double _divide = (_plus / (7.5 * (TransmitRate).doubleValue())); - return _divide; - } -} -- cgit v1.2.3-70-g09d2