diff options
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.cps')
89 files changed, 21679 insertions, 0 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.classpath b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.classpath new file mode 100644 index 00000000..faa51b1d --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.classpath | |||
@@ -0,0 +1,15 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="src" path="ecore-gen"/> | ||
4 | <classpathentry kind="src" path="xtend-gen"/> | ||
5 | <classpathentry kind="src" path="src"/> | ||
6 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
7 | <attributes> | ||
8 | <attribute name="module" value="true"/> | ||
9 | </attributes> | ||
10 | </classpathentry> | ||
11 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
12 | <classpathentry kind="src" path="src-gen"/> | ||
13 | <classpathentry kind="con" path="uk.ac.kcl.inf.mdeoptimiser.languages.ui.Mopt.MDEO_CONTAINER/dsl"/> | ||
14 | <classpathentry kind="output" path="bin"/> | ||
15 | </classpath> | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.gitignore new file mode 100644 index 00000000..2affc42f --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.gitignore | |||
@@ -0,0 +1,7 @@ | |||
1 | /bin/ | ||
2 | /xtend-gen/ | ||
3 | /problem.lp | ||
4 | /solution.txt | ||
5 | /model/cps_fixup.henshin | ||
6 | /model/problem.xmi | ||
7 | /mdeo-results | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.project b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.project new file mode 100644 index 00000000..41867b27 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.project | |||
@@ -0,0 +1,40 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>hu.bme.mit.inf.dslreasoner.domains.cps</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.viatra.query.tooling.ui.projectbuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
14 | <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
19 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
20 | <arguments> | ||
21 | </arguments> | ||
22 | </buildCommand> | ||
23 | <buildCommand> | ||
24 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
25 | <arguments> | ||
26 | </arguments> | ||
27 | </buildCommand> | ||
28 | <buildCommand> | ||
29 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
30 | <arguments> | ||
31 | </arguments> | ||
32 | </buildCommand> | ||
33 | </buildSpec> | ||
34 | <natures> | ||
35 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
36 | <nature>org.eclipse.pde.PluginNature</nature> | ||
37 | <nature>org.eclipse.viatra.query.projectnature</nature> | ||
38 | <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> | ||
39 | </natures> | ||
40 | </projectDescription> | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.settings/org.eclipse.core.resources.prefs b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..6d3062d3 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/.settings/org.eclipse.core.resources.prefs | |||
@@ -0,0 +1,3 @@ | |||
1 | eclipse.preferences.version=1 | ||
2 | encoding//model/cps.henshin=UTF-8 | ||
3 | encoding//model/cps.henshin_diagram=UTF-8 | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/META-INF/MANIFEST.MF b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/META-INF/MANIFEST.MF new file mode 100644 index 00000000..e13a18cf --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,43 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: %pluginName | ||
4 | Bundle-SymbolicName: hu.bme.mit.inf.dslreasoner.domains.cps;singleton:=true | ||
5 | Bundle-Version: 0.1.0.qualifier | ||
6 | Bundle-ClassPath: . | ||
7 | Bundle-Vendor: %providerName | ||
8 | Bundle-Localization: plugin | ||
9 | Export-Package: hu.bme.mit.inf.dslreasoner.domains.cps, | ||
10 | hu.bme.mit.inf.dslreasoner.domains.cps.impl, | ||
11 | hu.bme.mit.inf.dslreasoner.domains.cps.queries, | ||
12 | hu.bme.mit.inf.dslreasoner.domains.cps.util | ||
13 | Require-Bundle: org.eclipse.viatra.addon.querybasedfeatures.runtime, | ||
14 | org.eclipse.viatra.query.runtime, | ||
15 | org.eclipse.viatra.query.runtime.rete, | ||
16 | org.eclipse.viatra.query.runtime.localsearch, | ||
17 | org.eclipse.xtext.xbase.lib, | ||
18 | org.eclipse.emf.ecore;visibility:=reexport, | ||
19 | org.eclipse.core.runtime, | ||
20 | org.eclipse.xtend.lib;bundle-version="2.16.0", | ||
21 | org.eclipse.xtend.lib.macro;bundle-version="2.16.0", | ||
22 | hu.bme.mit.inf.dslreasoner.application;bundle-version="1.0.0", | ||
23 | org.eclipse.viatra.dse, | ||
24 | org.eclipse.viatra.dse.genetic, | ||
25 | hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner;bundle-version="1.0.0", | ||
26 | org.eclipse.emf.ecore.xmi;bundle-version="2.15.0", | ||
27 | uk.ac.kcl.inf.mdeoptimiser.libraries.core;bundle-version="1.0.0", | ||
28 | uk.ac.kcl.inf.mdeoptimiser.interfaces.cli;bundle-version="1.0.0", | ||
29 | org.eclipse.emf.henshin.interpreter;bundle-version="1.5.0", | ||
30 | uk.ac.kcl.inf.mdeoptimiser.libraries.rulegen;bundle-version="1.0.0", | ||
31 | org.sidiff.common;bundle-version="1.0.0", | ||
32 | org.sidiff.common.emf;bundle-version="1.0.0", | ||
33 | org.sidiff.common.emf.extensions;bundle-version="1.0.0", | ||
34 | org.moeaframework;bundle-version="2.13.0", | ||
35 | org.apache.commons.math3;bundle-version="3.6.1", | ||
36 | org.apache.commons.lang3;bundle-version="3.8.1", | ||
37 | com.google.inject;bundle-version="3.0.0", | ||
38 | org.sidiff.common.henshin;bundle-version="1.0.0", | ||
39 | org.sidiff.serge;bundle-version="1.0.0" | ||
40 | Import-Package: org.apache.log4j | ||
41 | Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.domains.cps | ||
42 | Bundle-ActivationPolicy: lazy | ||
43 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/README.md b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/README.md new file mode 100644 index 00000000..986663fd --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/README.md | |||
@@ -0,0 +1,7 @@ | |||
1 | # Cyber Physical System case study for VIATRA Solver | ||
2 | |||
3 | ## Modifications to the metamodel | ||
4 | |||
5 | * Removed the `State` enumeration and the `ApplicationInstance.state` attribute, as we are only optimizing static configurations of applications instead of deployment strategies. | ||
6 | * Added `ApplicationInstance.requirement` as an opposite reference of `Requirement.instances` with multiplicity `[1..1]` to ensure that each `ApplicationInstance` satisfies exactly one `Requirement`. | ||
7 | * Marked `HostInstance.availableMemory`, `availableHdd`, `totalMemory`, `totalHdd` as derived. The values of `availableMemory` and `availableHdd` can be computed from `totalMemory`, `totalHdd` and the `ResourceRequirement`s associated with the `ApplicationInstances` allocated to the `HostInstance`, while `totalMemory` and `totalHdd` are always equal to `HostType.defaultMemory` and `defaultHdd`. \ No newline at end of file | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/build.properties b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/build.properties new file mode 100644 index 00000000..37a7e53b --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/build.properties | |||
@@ -0,0 +1,9 @@ | |||
1 | bin.includes = .,\ | ||
2 | model/,\ | ||
3 | META-INF/,\ | ||
4 | plugin.xml,\ | ||
5 | plugin.properties | ||
6 | jars.compile.order = . | ||
7 | source.. = ecore-gen/,\ | ||
8 | src-gen/ | ||
9 | output.. = bin/ | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/ApplicationInstance.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/ApplicationInstance.java new file mode 100644 index 00000000..dc9426f2 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/ApplicationInstance.java | |||
@@ -0,0 +1,110 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.ecore.EObject; | ||
6 | |||
7 | /** | ||
8 | * <!-- begin-user-doc --> | ||
9 | * A representation of the model object '<em><b>Application Instance</b></em>'. | ||
10 | * <!-- end-user-doc --> | ||
11 | * | ||
12 | * <p> | ||
13 | * The following features are supported: | ||
14 | * </p> | ||
15 | * <ul> | ||
16 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getRequirement <em>Requirement</em>}</li> | ||
17 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getType <em>Type</em>}</li> | ||
18 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getAllocatedTo <em>Allocated To</em>}</li> | ||
19 | * </ul> | ||
20 | * | ||
21 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getApplicationInstance() | ||
22 | * @model | ||
23 | * @generated | ||
24 | */ | ||
25 | public interface ApplicationInstance extends EObject { | ||
26 | /** | ||
27 | * Returns the value of the '<em><b>Requirement</b></em>' reference. | ||
28 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getInstances <em>Instances</em>}'. | ||
29 | * <!-- begin-user-doc --> | ||
30 | * <p> | ||
31 | * If the meaning of the '<em>Requirement</em>' reference isn't clear, | ||
32 | * there really should be more of a description here... | ||
33 | * </p> | ||
34 | * <!-- end-user-doc --> | ||
35 | * @return the value of the '<em>Requirement</em>' reference. | ||
36 | * @see #setRequirement(Requirement) | ||
37 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getApplicationInstance_Requirement() | ||
38 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getInstances | ||
39 | * @model opposite="instances" | ||
40 | * @generated | ||
41 | */ | ||
42 | Requirement getRequirement(); | ||
43 | |||
44 | /** | ||
45 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getRequirement <em>Requirement</em>}' reference. | ||
46 | * <!-- begin-user-doc --> | ||
47 | * <!-- end-user-doc --> | ||
48 | * @param value the new value of the '<em>Requirement</em>' reference. | ||
49 | * @see #getRequirement() | ||
50 | * @generated | ||
51 | */ | ||
52 | void setRequirement(Requirement value); | ||
53 | |||
54 | /** | ||
55 | * Returns the value of the '<em><b>Type</b></em>' container reference. | ||
56 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType#getInstances <em>Instances</em>}'. | ||
57 | * <!-- begin-user-doc --> | ||
58 | * <p> | ||
59 | * If the meaning of the '<em>Type</em>' container reference isn't clear, | ||
60 | * there really should be more of a description here... | ||
61 | * </p> | ||
62 | * <!-- end-user-doc --> | ||
63 | * @return the value of the '<em>Type</em>' container reference. | ||
64 | * @see #setType(ApplicationType) | ||
65 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getApplicationInstance_Type() | ||
66 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType#getInstances | ||
67 | * @model opposite="instances" required="true" transient="false" | ||
68 | * @generated | ||
69 | */ | ||
70 | ApplicationType getType(); | ||
71 | |||
72 | /** | ||
73 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getType <em>Type</em>}' container reference. | ||
74 | * <!-- begin-user-doc --> | ||
75 | * <!-- end-user-doc --> | ||
76 | * @param value the new value of the '<em>Type</em>' container reference. | ||
77 | * @see #getType() | ||
78 | * @generated | ||
79 | */ | ||
80 | void setType(ApplicationType value); | ||
81 | |||
82 | /** | ||
83 | * Returns the value of the '<em><b>Allocated To</b></em>' reference. | ||
84 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getApplications <em>Applications</em>}'. | ||
85 | * <!-- begin-user-doc --> | ||
86 | * <p> | ||
87 | * If the meaning of the '<em>Allocated To</em>' reference isn't clear, | ||
88 | * there really should be more of a description here... | ||
89 | * </p> | ||
90 | * <!-- end-user-doc --> | ||
91 | * @return the value of the '<em>Allocated To</em>' reference. | ||
92 | * @see #setAllocatedTo(HostInstance) | ||
93 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getApplicationInstance_AllocatedTo() | ||
94 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getApplications | ||
95 | * @model opposite="applications" required="true" | ||
96 | * @generated | ||
97 | */ | ||
98 | HostInstance getAllocatedTo(); | ||
99 | |||
100 | /** | ||
101 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getAllocatedTo <em>Allocated To</em>}' reference. | ||
102 | * <!-- begin-user-doc --> | ||
103 | * <!-- end-user-doc --> | ||
104 | * @param value the new value of the '<em>Allocated To</em>' reference. | ||
105 | * @see #getAllocatedTo() | ||
106 | * @generated | ||
107 | */ | ||
108 | void setAllocatedTo(HostInstance value); | ||
109 | |||
110 | } // ApplicationInstance | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/ApplicationType.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/ApplicationType.java new file mode 100644 index 00000000..f44287ae --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/ApplicationType.java | |||
@@ -0,0 +1,61 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.common.util.EList; | ||
6 | |||
7 | import org.eclipse.emf.ecore.EObject; | ||
8 | |||
9 | /** | ||
10 | * <!-- begin-user-doc --> | ||
11 | * A representation of the model object '<em><b>Application Type</b></em>'. | ||
12 | * <!-- end-user-doc --> | ||
13 | * | ||
14 | * <p> | ||
15 | * The following features are supported: | ||
16 | * </p> | ||
17 | * <ul> | ||
18 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType#getInstances <em>Instances</em>}</li> | ||
19 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType#getRequirements <em>Requirements</em>}</li> | ||
20 | * </ul> | ||
21 | * | ||
22 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getApplicationType() | ||
23 | * @model | ||
24 | * @generated | ||
25 | */ | ||
26 | public interface ApplicationType extends EObject { | ||
27 | /** | ||
28 | * Returns the value of the '<em><b>Instances</b></em>' containment reference list. | ||
29 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance}. | ||
30 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getType <em>Type</em>}'. | ||
31 | * <!-- begin-user-doc --> | ||
32 | * <p> | ||
33 | * If the meaning of the '<em>Instances</em>' containment reference list isn't clear, | ||
34 | * there really should be more of a description here... | ||
35 | * </p> | ||
36 | * <!-- end-user-doc --> | ||
37 | * @return the value of the '<em>Instances</em>' containment reference list. | ||
38 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getApplicationType_Instances() | ||
39 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getType | ||
40 | * @model opposite="type" containment="true" | ||
41 | * @generated | ||
42 | */ | ||
43 | EList<ApplicationInstance> getInstances(); | ||
44 | |||
45 | /** | ||
46 | * Returns the value of the '<em><b>Requirements</b></em>' containment reference list. | ||
47 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement}. | ||
48 | * <!-- begin-user-doc --> | ||
49 | * <p> | ||
50 | * If the meaning of the '<em>Requirements</em>' containment reference list isn't clear, | ||
51 | * there really should be more of a description here... | ||
52 | * </p> | ||
53 | * <!-- end-user-doc --> | ||
54 | * @return the value of the '<em>Requirements</em>' containment reference list. | ||
55 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getApplicationType_Requirements() | ||
56 | * @model containment="true" | ||
57 | * @generated | ||
58 | */ | ||
59 | EList<ResourceRequirement> getRequirements(); | ||
60 | |||
61 | } // ApplicationType | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/CpsFactory.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/CpsFactory.java new file mode 100644 index 00000000..93a5fc95 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/CpsFactory.java | |||
@@ -0,0 +1,105 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.ecore.EFactory; | ||
6 | |||
7 | /** | ||
8 | * <!-- begin-user-doc --> | ||
9 | * The <b>Factory</b> for the model. | ||
10 | * It provides a create method for each non-abstract class of the model. | ||
11 | * <!-- end-user-doc --> | ||
12 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage | ||
13 | * @generated | ||
14 | */ | ||
15 | public interface CpsFactory extends EFactory { | ||
16 | /** | ||
17 | * The singleton instance of the factory. | ||
18 | * <!-- begin-user-doc --> | ||
19 | * <!-- end-user-doc --> | ||
20 | * @generated | ||
21 | */ | ||
22 | CpsFactory eINSTANCE = hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsFactoryImpl.init(); | ||
23 | |||
24 | /** | ||
25 | * Returns a new object of class '<em>Cyber Physical System</em>'. | ||
26 | * <!-- begin-user-doc --> | ||
27 | * <!-- end-user-doc --> | ||
28 | * @return a new object of class '<em>Cyber Physical System</em>'. | ||
29 | * @generated | ||
30 | */ | ||
31 | CyberPhysicalSystem createCyberPhysicalSystem(); | ||
32 | |||
33 | /** | ||
34 | * Returns a new object of class '<em>Application Type</em>'. | ||
35 | * <!-- begin-user-doc --> | ||
36 | * <!-- end-user-doc --> | ||
37 | * @return a new object of class '<em>Application Type</em>'. | ||
38 | * @generated | ||
39 | */ | ||
40 | ApplicationType createApplicationType(); | ||
41 | |||
42 | /** | ||
43 | * Returns a new object of class '<em>Host Type</em>'. | ||
44 | * <!-- begin-user-doc --> | ||
45 | * <!-- end-user-doc --> | ||
46 | * @return a new object of class '<em>Host Type</em>'. | ||
47 | * @generated | ||
48 | */ | ||
49 | HostType createHostType(); | ||
50 | |||
51 | /** | ||
52 | * Returns a new object of class '<em>Request</em>'. | ||
53 | * <!-- begin-user-doc --> | ||
54 | * <!-- end-user-doc --> | ||
55 | * @return a new object of class '<em>Request</em>'. | ||
56 | * @generated | ||
57 | */ | ||
58 | Request createRequest(); | ||
59 | |||
60 | /** | ||
61 | * Returns a new object of class '<em>Requirement</em>'. | ||
62 | * <!-- begin-user-doc --> | ||
63 | * <!-- end-user-doc --> | ||
64 | * @return a new object of class '<em>Requirement</em>'. | ||
65 | * @generated | ||
66 | */ | ||
67 | Requirement createRequirement(); | ||
68 | |||
69 | /** | ||
70 | * Returns a new object of class '<em>Application Instance</em>'. | ||
71 | * <!-- begin-user-doc --> | ||
72 | * <!-- end-user-doc --> | ||
73 | * @return a new object of class '<em>Application Instance</em>'. | ||
74 | * @generated | ||
75 | */ | ||
76 | ApplicationInstance createApplicationInstance(); | ||
77 | |||
78 | /** | ||
79 | * Returns a new object of class '<em>Resource Requirement</em>'. | ||
80 | * <!-- begin-user-doc --> | ||
81 | * <!-- end-user-doc --> | ||
82 | * @return a new object of class '<em>Resource Requirement</em>'. | ||
83 | * @generated | ||
84 | */ | ||
85 | ResourceRequirement createResourceRequirement(); | ||
86 | |||
87 | /** | ||
88 | * Returns a new object of class '<em>Host Instance</em>'. | ||
89 | * <!-- begin-user-doc --> | ||
90 | * <!-- end-user-doc --> | ||
91 | * @return a new object of class '<em>Host Instance</em>'. | ||
92 | * @generated | ||
93 | */ | ||
94 | HostInstance createHostInstance(); | ||
95 | |||
96 | /** | ||
97 | * Returns the package supported by this factory. | ||
98 | * <!-- begin-user-doc --> | ||
99 | * <!-- end-user-doc --> | ||
100 | * @return the package supported by this factory. | ||
101 | * @generated | ||
102 | */ | ||
103 | CpsPackage getCpsPackage(); | ||
104 | |||
105 | } //CpsFactory | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/CpsPackage.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/CpsPackage.java new file mode 100644 index 00000000..b0c69786 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/CpsPackage.java | |||
@@ -0,0 +1,1084 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.ecore.EAttribute; | ||
6 | import org.eclipse.emf.ecore.EClass; | ||
7 | import org.eclipse.emf.ecore.EPackage; | ||
8 | import org.eclipse.emf.ecore.EReference; | ||
9 | |||
10 | /** | ||
11 | * <!-- begin-user-doc --> | ||
12 | * The <b>Package</b> for the model. | ||
13 | * It contains accessors for the meta objects to represent | ||
14 | * <ul> | ||
15 | * <li>each class,</li> | ||
16 | * <li>each feature of each class,</li> | ||
17 | * <li>each operation of each class,</li> | ||
18 | * <li>each enum,</li> | ||
19 | * <li>and each data type</li> | ||
20 | * </ul> | ||
21 | * <!-- end-user-doc --> | ||
22 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsFactory | ||
23 | * @model kind="package" | ||
24 | * @generated | ||
25 | */ | ||
26 | public interface CpsPackage extends EPackage { | ||
27 | /** | ||
28 | * The package name. | ||
29 | * <!-- begin-user-doc --> | ||
30 | * <!-- end-user-doc --> | ||
31 | * @generated | ||
32 | */ | ||
33 | String eNAME = "cps"; | ||
34 | |||
35 | /** | ||
36 | * The package namespace URI. | ||
37 | * <!-- begin-user-doc --> | ||
38 | * <!-- end-user-doc --> | ||
39 | * @generated | ||
40 | */ | ||
41 | String eNS_URI = "http://www.example.org/cps"; | ||
42 | |||
43 | /** | ||
44 | * The package namespace name. | ||
45 | * <!-- begin-user-doc --> | ||
46 | * <!-- end-user-doc --> | ||
47 | * @generated | ||
48 | */ | ||
49 | String eNS_PREFIX = "cps"; | ||
50 | |||
51 | /** | ||
52 | * The singleton instance of the package. | ||
53 | * <!-- begin-user-doc --> | ||
54 | * <!-- end-user-doc --> | ||
55 | * @generated | ||
56 | */ | ||
57 | CpsPackage eINSTANCE = hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl.init(); | ||
58 | |||
59 | /** | ||
60 | * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.CyberPhysicalSystemImpl <em>Cyber Physical System</em>}' class. | ||
61 | * <!-- begin-user-doc --> | ||
62 | * <!-- end-user-doc --> | ||
63 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CyberPhysicalSystemImpl | ||
64 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getCyberPhysicalSystem() | ||
65 | * @generated | ||
66 | */ | ||
67 | int CYBER_PHYSICAL_SYSTEM = 0; | ||
68 | |||
69 | /** | ||
70 | * The feature id for the '<em><b>Requests</b></em>' containment reference list. | ||
71 | * <!-- begin-user-doc --> | ||
72 | * <!-- end-user-doc --> | ||
73 | * @generated | ||
74 | * @ordered | ||
75 | */ | ||
76 | int CYBER_PHYSICAL_SYSTEM__REQUESTS = 0; | ||
77 | |||
78 | /** | ||
79 | * The feature id for the '<em><b>Application Types</b></em>' containment reference list. | ||
80 | * <!-- begin-user-doc --> | ||
81 | * <!-- end-user-doc --> | ||
82 | * @generated | ||
83 | * @ordered | ||
84 | */ | ||
85 | int CYBER_PHYSICAL_SYSTEM__APPLICATION_TYPES = 1; | ||
86 | |||
87 | /** | ||
88 | * The feature id for the '<em><b>Host Types</b></em>' containment reference list. | ||
89 | * <!-- begin-user-doc --> | ||
90 | * <!-- end-user-doc --> | ||
91 | * @generated | ||
92 | * @ordered | ||
93 | */ | ||
94 | int CYBER_PHYSICAL_SYSTEM__HOST_TYPES = 2; | ||
95 | |||
96 | /** | ||
97 | * The number of structural features of the '<em>Cyber Physical System</em>' class. | ||
98 | * <!-- begin-user-doc --> | ||
99 | * <!-- end-user-doc --> | ||
100 | * @generated | ||
101 | * @ordered | ||
102 | */ | ||
103 | int CYBER_PHYSICAL_SYSTEM_FEATURE_COUNT = 3; | ||
104 | |||
105 | /** | ||
106 | * The number of operations of the '<em>Cyber Physical System</em>' class. | ||
107 | * <!-- begin-user-doc --> | ||
108 | * <!-- end-user-doc --> | ||
109 | * @generated | ||
110 | * @ordered | ||
111 | */ | ||
112 | int CYBER_PHYSICAL_SYSTEM_OPERATION_COUNT = 0; | ||
113 | |||
114 | /** | ||
115 | * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationTypeImpl <em>Application Type</em>}' class. | ||
116 | * <!-- begin-user-doc --> | ||
117 | * <!-- end-user-doc --> | ||
118 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationTypeImpl | ||
119 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getApplicationType() | ||
120 | * @generated | ||
121 | */ | ||
122 | int APPLICATION_TYPE = 1; | ||
123 | |||
124 | /** | ||
125 | * The feature id for the '<em><b>Instances</b></em>' containment reference list. | ||
126 | * <!-- begin-user-doc --> | ||
127 | * <!-- end-user-doc --> | ||
128 | * @generated | ||
129 | * @ordered | ||
130 | */ | ||
131 | int APPLICATION_TYPE__INSTANCES = 0; | ||
132 | |||
133 | /** | ||
134 | * The feature id for the '<em><b>Requirements</b></em>' containment reference list. | ||
135 | * <!-- begin-user-doc --> | ||
136 | * <!-- end-user-doc --> | ||
137 | * @generated | ||
138 | * @ordered | ||
139 | */ | ||
140 | int APPLICATION_TYPE__REQUIREMENTS = 1; | ||
141 | |||
142 | /** | ||
143 | * The number of structural features of the '<em>Application Type</em>' class. | ||
144 | * <!-- begin-user-doc --> | ||
145 | * <!-- end-user-doc --> | ||
146 | * @generated | ||
147 | * @ordered | ||
148 | */ | ||
149 | int APPLICATION_TYPE_FEATURE_COUNT = 2; | ||
150 | |||
151 | /** | ||
152 | * The number of operations of the '<em>Application Type</em>' class. | ||
153 | * <!-- begin-user-doc --> | ||
154 | * <!-- end-user-doc --> | ||
155 | * @generated | ||
156 | * @ordered | ||
157 | */ | ||
158 | int APPLICATION_TYPE_OPERATION_COUNT = 0; | ||
159 | |||
160 | /** | ||
161 | * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostTypeImpl <em>Host Type</em>}' class. | ||
162 | * <!-- begin-user-doc --> | ||
163 | * <!-- end-user-doc --> | ||
164 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostTypeImpl | ||
165 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getHostType() | ||
166 | * @generated | ||
167 | */ | ||
168 | int HOST_TYPE = 2; | ||
169 | |||
170 | /** | ||
171 | * The feature id for the '<em><b>Default Memory</b></em>' attribute. | ||
172 | * <!-- begin-user-doc --> | ||
173 | * <!-- end-user-doc --> | ||
174 | * @generated | ||
175 | * @ordered | ||
176 | */ | ||
177 | int HOST_TYPE__DEFAULT_MEMORY = 0; | ||
178 | |||
179 | /** | ||
180 | * The feature id for the '<em><b>Default Hdd</b></em>' attribute. | ||
181 | * <!-- begin-user-doc --> | ||
182 | * <!-- end-user-doc --> | ||
183 | * @generated | ||
184 | * @ordered | ||
185 | */ | ||
186 | int HOST_TYPE__DEFAULT_HDD = 1; | ||
187 | |||
188 | /** | ||
189 | * The feature id for the '<em><b>Instances</b></em>' containment reference list. | ||
190 | * <!-- begin-user-doc --> | ||
191 | * <!-- end-user-doc --> | ||
192 | * @generated | ||
193 | * @ordered | ||
194 | */ | ||
195 | int HOST_TYPE__INSTANCES = 2; | ||
196 | |||
197 | /** | ||
198 | * The feature id for the '<em><b>Cost</b></em>' attribute. | ||
199 | * <!-- begin-user-doc --> | ||
200 | * <!-- end-user-doc --> | ||
201 | * @generated | ||
202 | * @ordered | ||
203 | */ | ||
204 | int HOST_TYPE__COST = 3; | ||
205 | |||
206 | /** | ||
207 | * The number of structural features of the '<em>Host Type</em>' class. | ||
208 | * <!-- begin-user-doc --> | ||
209 | * <!-- end-user-doc --> | ||
210 | * @generated | ||
211 | * @ordered | ||
212 | */ | ||
213 | int HOST_TYPE_FEATURE_COUNT = 4; | ||
214 | |||
215 | /** | ||
216 | * The number of operations of the '<em>Host Type</em>' class. | ||
217 | * <!-- begin-user-doc --> | ||
218 | * <!-- end-user-doc --> | ||
219 | * @generated | ||
220 | * @ordered | ||
221 | */ | ||
222 | int HOST_TYPE_OPERATION_COUNT = 0; | ||
223 | |||
224 | /** | ||
225 | * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequestImpl <em>Request</em>}' class. | ||
226 | * <!-- begin-user-doc --> | ||
227 | * <!-- end-user-doc --> | ||
228 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequestImpl | ||
229 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getRequest() | ||
230 | * @generated | ||
231 | */ | ||
232 | int REQUEST = 3; | ||
233 | |||
234 | /** | ||
235 | * The feature id for the '<em><b>Requirements</b></em>' containment reference list. | ||
236 | * <!-- begin-user-doc --> | ||
237 | * <!-- end-user-doc --> | ||
238 | * @generated | ||
239 | * @ordered | ||
240 | */ | ||
241 | int REQUEST__REQUIREMENTS = 0; | ||
242 | |||
243 | /** | ||
244 | * The number of structural features of the '<em>Request</em>' class. | ||
245 | * <!-- begin-user-doc --> | ||
246 | * <!-- end-user-doc --> | ||
247 | * @generated | ||
248 | * @ordered | ||
249 | */ | ||
250 | int REQUEST_FEATURE_COUNT = 1; | ||
251 | |||
252 | /** | ||
253 | * The number of operations of the '<em>Request</em>' class. | ||
254 | * <!-- begin-user-doc --> | ||
255 | * <!-- end-user-doc --> | ||
256 | * @generated | ||
257 | * @ordered | ||
258 | */ | ||
259 | int REQUEST_OPERATION_COUNT = 0; | ||
260 | |||
261 | /** | ||
262 | * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequirementImpl <em>Requirement</em>}' class. | ||
263 | * <!-- begin-user-doc --> | ||
264 | * <!-- end-user-doc --> | ||
265 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequirementImpl | ||
266 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getRequirement() | ||
267 | * @generated | ||
268 | */ | ||
269 | int REQUIREMENT = 4; | ||
270 | |||
271 | /** | ||
272 | * The feature id for the '<em><b>Request</b></em>' container reference. | ||
273 | * <!-- begin-user-doc --> | ||
274 | * <!-- end-user-doc --> | ||
275 | * @generated | ||
276 | * @ordered | ||
277 | */ | ||
278 | int REQUIREMENT__REQUEST = 0; | ||
279 | |||
280 | /** | ||
281 | * The feature id for the '<em><b>Count</b></em>' attribute. | ||
282 | * <!-- begin-user-doc --> | ||
283 | * <!-- end-user-doc --> | ||
284 | * @generated | ||
285 | * @ordered | ||
286 | */ | ||
287 | int REQUIREMENT__COUNT = 1; | ||
288 | |||
289 | /** | ||
290 | * The feature id for the '<em><b>Type</b></em>' reference. | ||
291 | * <!-- begin-user-doc --> | ||
292 | * <!-- end-user-doc --> | ||
293 | * @generated | ||
294 | * @ordered | ||
295 | */ | ||
296 | int REQUIREMENT__TYPE = 2; | ||
297 | |||
298 | /** | ||
299 | * The feature id for the '<em><b>Instances</b></em>' reference list. | ||
300 | * <!-- begin-user-doc --> | ||
301 | * <!-- end-user-doc --> | ||
302 | * @generated | ||
303 | * @ordered | ||
304 | */ | ||
305 | int REQUIREMENT__INSTANCES = 3; | ||
306 | |||
307 | /** | ||
308 | * The number of structural features of the '<em>Requirement</em>' class. | ||
309 | * <!-- begin-user-doc --> | ||
310 | * <!-- end-user-doc --> | ||
311 | * @generated | ||
312 | * @ordered | ||
313 | */ | ||
314 | int REQUIREMENT_FEATURE_COUNT = 4; | ||
315 | |||
316 | /** | ||
317 | * The number of operations of the '<em>Requirement</em>' class. | ||
318 | * <!-- begin-user-doc --> | ||
319 | * <!-- end-user-doc --> | ||
320 | * @generated | ||
321 | * @ordered | ||
322 | */ | ||
323 | int REQUIREMENT_OPERATION_COUNT = 0; | ||
324 | |||
325 | /** | ||
326 | * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationInstanceImpl <em>Application Instance</em>}' class. | ||
327 | * <!-- begin-user-doc --> | ||
328 | * <!-- end-user-doc --> | ||
329 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationInstanceImpl | ||
330 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getApplicationInstance() | ||
331 | * @generated | ||
332 | */ | ||
333 | int APPLICATION_INSTANCE = 5; | ||
334 | |||
335 | /** | ||
336 | * The feature id for the '<em><b>Requirement</b></em>' reference. | ||
337 | * <!-- begin-user-doc --> | ||
338 | * <!-- end-user-doc --> | ||
339 | * @generated | ||
340 | * @ordered | ||
341 | */ | ||
342 | int APPLICATION_INSTANCE__REQUIREMENT = 0; | ||
343 | |||
344 | /** | ||
345 | * The feature id for the '<em><b>Type</b></em>' container reference. | ||
346 | * <!-- begin-user-doc --> | ||
347 | * <!-- end-user-doc --> | ||
348 | * @generated | ||
349 | * @ordered | ||
350 | */ | ||
351 | int APPLICATION_INSTANCE__TYPE = 1; | ||
352 | |||
353 | /** | ||
354 | * The feature id for the '<em><b>Allocated To</b></em>' reference. | ||
355 | * <!-- begin-user-doc --> | ||
356 | * <!-- end-user-doc --> | ||
357 | * @generated | ||
358 | * @ordered | ||
359 | */ | ||
360 | int APPLICATION_INSTANCE__ALLOCATED_TO = 2; | ||
361 | |||
362 | /** | ||
363 | * The number of structural features of the '<em>Application Instance</em>' class. | ||
364 | * <!-- begin-user-doc --> | ||
365 | * <!-- end-user-doc --> | ||
366 | * @generated | ||
367 | * @ordered | ||
368 | */ | ||
369 | int APPLICATION_INSTANCE_FEATURE_COUNT = 3; | ||
370 | |||
371 | /** | ||
372 | * The number of operations of the '<em>Application Instance</em>' class. | ||
373 | * <!-- begin-user-doc --> | ||
374 | * <!-- end-user-doc --> | ||
375 | * @generated | ||
376 | * @ordered | ||
377 | */ | ||
378 | int APPLICATION_INSTANCE_OPERATION_COUNT = 0; | ||
379 | |||
380 | /** | ||
381 | * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ResourceRequirementImpl <em>Resource Requirement</em>}' class. | ||
382 | * <!-- begin-user-doc --> | ||
383 | * <!-- end-user-doc --> | ||
384 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.ResourceRequirementImpl | ||
385 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getResourceRequirement() | ||
386 | * @generated | ||
387 | */ | ||
388 | int RESOURCE_REQUIREMENT = 6; | ||
389 | |||
390 | /** | ||
391 | * The feature id for the '<em><b>Required Memory</b></em>' attribute. | ||
392 | * <!-- begin-user-doc --> | ||
393 | * <!-- end-user-doc --> | ||
394 | * @generated | ||
395 | * @ordered | ||
396 | */ | ||
397 | int RESOURCE_REQUIREMENT__REQUIRED_MEMORY = 0; | ||
398 | |||
399 | /** | ||
400 | * The feature id for the '<em><b>Required Hdd</b></em>' attribute. | ||
401 | * <!-- begin-user-doc --> | ||
402 | * <!-- end-user-doc --> | ||
403 | * @generated | ||
404 | * @ordered | ||
405 | */ | ||
406 | int RESOURCE_REQUIREMENT__REQUIRED_HDD = 1; | ||
407 | |||
408 | /** | ||
409 | * The feature id for the '<em><b>Host Type</b></em>' reference. | ||
410 | * <!-- begin-user-doc --> | ||
411 | * <!-- end-user-doc --> | ||
412 | * @generated | ||
413 | * @ordered | ||
414 | */ | ||
415 | int RESOURCE_REQUIREMENT__HOST_TYPE = 2; | ||
416 | |||
417 | /** | ||
418 | * The number of structural features of the '<em>Resource Requirement</em>' class. | ||
419 | * <!-- begin-user-doc --> | ||
420 | * <!-- end-user-doc --> | ||
421 | * @generated | ||
422 | * @ordered | ||
423 | */ | ||
424 | int RESOURCE_REQUIREMENT_FEATURE_COUNT = 3; | ||
425 | |||
426 | /** | ||
427 | * The number of operations of the '<em>Resource Requirement</em>' class. | ||
428 | * <!-- begin-user-doc --> | ||
429 | * <!-- end-user-doc --> | ||
430 | * @generated | ||
431 | * @ordered | ||
432 | */ | ||
433 | int RESOURCE_REQUIREMENT_OPERATION_COUNT = 0; | ||
434 | |||
435 | /** | ||
436 | * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostInstanceImpl <em>Host Instance</em>}' class. | ||
437 | * <!-- begin-user-doc --> | ||
438 | * <!-- end-user-doc --> | ||
439 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostInstanceImpl | ||
440 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getHostInstance() | ||
441 | * @generated | ||
442 | */ | ||
443 | int HOST_INSTANCE = 7; | ||
444 | |||
445 | /** | ||
446 | * The feature id for the '<em><b>Type</b></em>' container reference. | ||
447 | * <!-- begin-user-doc --> | ||
448 | * <!-- end-user-doc --> | ||
449 | * @generated | ||
450 | * @ordered | ||
451 | */ | ||
452 | int HOST_INSTANCE__TYPE = 0; | ||
453 | |||
454 | /** | ||
455 | * The feature id for the '<em><b>Applications</b></em>' reference list. | ||
456 | * <!-- begin-user-doc --> | ||
457 | * <!-- end-user-doc --> | ||
458 | * @generated | ||
459 | * @ordered | ||
460 | */ | ||
461 | int HOST_INSTANCE__APPLICATIONS = 1; | ||
462 | |||
463 | /** | ||
464 | * The number of structural features of the '<em>Host Instance</em>' class. | ||
465 | * <!-- begin-user-doc --> | ||
466 | * <!-- end-user-doc --> | ||
467 | * @generated | ||
468 | * @ordered | ||
469 | */ | ||
470 | int HOST_INSTANCE_FEATURE_COUNT = 2; | ||
471 | |||
472 | /** | ||
473 | * The number of operations of the '<em>Host Instance</em>' class. | ||
474 | * <!-- begin-user-doc --> | ||
475 | * <!-- end-user-doc --> | ||
476 | * @generated | ||
477 | * @ordered | ||
478 | */ | ||
479 | int HOST_INSTANCE_OPERATION_COUNT = 0; | ||
480 | |||
481 | /** | ||
482 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem <em>Cyber Physical System</em>}'. | ||
483 | * <!-- begin-user-doc --> | ||
484 | * <!-- end-user-doc --> | ||
485 | * @return the meta object for class '<em>Cyber Physical System</em>'. | ||
486 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
487 | * @generated | ||
488 | */ | ||
489 | EClass getCyberPhysicalSystem(); | ||
490 | |||
491 | /** | ||
492 | * Returns the meta object for the containment reference list '{@link hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem#getRequests <em>Requests</em>}'. | ||
493 | * <!-- begin-user-doc --> | ||
494 | * <!-- end-user-doc --> | ||
495 | * @return the meta object for the containment reference list '<em>Requests</em>'. | ||
496 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem#getRequests() | ||
497 | * @see #getCyberPhysicalSystem() | ||
498 | * @generated | ||
499 | */ | ||
500 | EReference getCyberPhysicalSystem_Requests(); | ||
501 | |||
502 | /** | ||
503 | * Returns the meta object for the containment reference list '{@link hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem#getApplicationTypes <em>Application Types</em>}'. | ||
504 | * <!-- begin-user-doc --> | ||
505 | * <!-- end-user-doc --> | ||
506 | * @return the meta object for the containment reference list '<em>Application Types</em>'. | ||
507 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem#getApplicationTypes() | ||
508 | * @see #getCyberPhysicalSystem() | ||
509 | * @generated | ||
510 | */ | ||
511 | EReference getCyberPhysicalSystem_ApplicationTypes(); | ||
512 | |||
513 | /** | ||
514 | * Returns the meta object for the containment reference list '{@link hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem#getHostTypes <em>Host Types</em>}'. | ||
515 | * <!-- begin-user-doc --> | ||
516 | * <!-- end-user-doc --> | ||
517 | * @return the meta object for the containment reference list '<em>Host Types</em>'. | ||
518 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem#getHostTypes() | ||
519 | * @see #getCyberPhysicalSystem() | ||
520 | * @generated | ||
521 | */ | ||
522 | EReference getCyberPhysicalSystem_HostTypes(); | ||
523 | |||
524 | /** | ||
525 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType <em>Application Type</em>}'. | ||
526 | * <!-- begin-user-doc --> | ||
527 | * <!-- end-user-doc --> | ||
528 | * @return the meta object for class '<em>Application Type</em>'. | ||
529 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType | ||
530 | * @generated | ||
531 | */ | ||
532 | EClass getApplicationType(); | ||
533 | |||
534 | /** | ||
535 | * Returns the meta object for the containment reference list '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType#getInstances <em>Instances</em>}'. | ||
536 | * <!-- begin-user-doc --> | ||
537 | * <!-- end-user-doc --> | ||
538 | * @return the meta object for the containment reference list '<em>Instances</em>'. | ||
539 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType#getInstances() | ||
540 | * @see #getApplicationType() | ||
541 | * @generated | ||
542 | */ | ||
543 | EReference getApplicationType_Instances(); | ||
544 | |||
545 | /** | ||
546 | * Returns the meta object for the containment reference list '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType#getRequirements <em>Requirements</em>}'. | ||
547 | * <!-- begin-user-doc --> | ||
548 | * <!-- end-user-doc --> | ||
549 | * @return the meta object for the containment reference list '<em>Requirements</em>'. | ||
550 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType#getRequirements() | ||
551 | * @see #getApplicationType() | ||
552 | * @generated | ||
553 | */ | ||
554 | EReference getApplicationType_Requirements(); | ||
555 | |||
556 | /** | ||
557 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType <em>Host Type</em>}'. | ||
558 | * <!-- begin-user-doc --> | ||
559 | * <!-- end-user-doc --> | ||
560 | * @return the meta object for class '<em>Host Type</em>'. | ||
561 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostType | ||
562 | * @generated | ||
563 | */ | ||
564 | EClass getHostType(); | ||
565 | |||
566 | /** | ||
567 | * Returns the meta object for the attribute '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getDefaultMemory <em>Default Memory</em>}'. | ||
568 | * <!-- begin-user-doc --> | ||
569 | * <!-- end-user-doc --> | ||
570 | * @return the meta object for the attribute '<em>Default Memory</em>'. | ||
571 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getDefaultMemory() | ||
572 | * @see #getHostType() | ||
573 | * @generated | ||
574 | */ | ||
575 | EAttribute getHostType_DefaultMemory(); | ||
576 | |||
577 | /** | ||
578 | * Returns the meta object for the attribute '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getDefaultHdd <em>Default Hdd</em>}'. | ||
579 | * <!-- begin-user-doc --> | ||
580 | * <!-- end-user-doc --> | ||
581 | * @return the meta object for the attribute '<em>Default Hdd</em>'. | ||
582 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getDefaultHdd() | ||
583 | * @see #getHostType() | ||
584 | * @generated | ||
585 | */ | ||
586 | EAttribute getHostType_DefaultHdd(); | ||
587 | |||
588 | /** | ||
589 | * Returns the meta object for the containment reference list '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getInstances <em>Instances</em>}'. | ||
590 | * <!-- begin-user-doc --> | ||
591 | * <!-- end-user-doc --> | ||
592 | * @return the meta object for the containment reference list '<em>Instances</em>'. | ||
593 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getInstances() | ||
594 | * @see #getHostType() | ||
595 | * @generated | ||
596 | */ | ||
597 | EReference getHostType_Instances(); | ||
598 | |||
599 | /** | ||
600 | * Returns the meta object for the attribute '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getCost <em>Cost</em>}'. | ||
601 | * <!-- begin-user-doc --> | ||
602 | * <!-- end-user-doc --> | ||
603 | * @return the meta object for the attribute '<em>Cost</em>'. | ||
604 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getCost() | ||
605 | * @see #getHostType() | ||
606 | * @generated | ||
607 | */ | ||
608 | EAttribute getHostType_Cost(); | ||
609 | |||
610 | /** | ||
611 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Request <em>Request</em>}'. | ||
612 | * <!-- begin-user-doc --> | ||
613 | * <!-- end-user-doc --> | ||
614 | * @return the meta object for class '<em>Request</em>'. | ||
615 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Request | ||
616 | * @generated | ||
617 | */ | ||
618 | EClass getRequest(); | ||
619 | |||
620 | /** | ||
621 | * Returns the meta object for the containment reference list '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Request#getRequirements <em>Requirements</em>}'. | ||
622 | * <!-- begin-user-doc --> | ||
623 | * <!-- end-user-doc --> | ||
624 | * @return the meta object for the containment reference list '<em>Requirements</em>'. | ||
625 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Request#getRequirements() | ||
626 | * @see #getRequest() | ||
627 | * @generated | ||
628 | */ | ||
629 | EReference getRequest_Requirements(); | ||
630 | |||
631 | /** | ||
632 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement <em>Requirement</em>}'. | ||
633 | * <!-- begin-user-doc --> | ||
634 | * <!-- end-user-doc --> | ||
635 | * @return the meta object for class '<em>Requirement</em>'. | ||
636 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Requirement | ||
637 | * @generated | ||
638 | */ | ||
639 | EClass getRequirement(); | ||
640 | |||
641 | /** | ||
642 | * Returns the meta object for the container reference '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getRequest <em>Request</em>}'. | ||
643 | * <!-- begin-user-doc --> | ||
644 | * <!-- end-user-doc --> | ||
645 | * @return the meta object for the container reference '<em>Request</em>'. | ||
646 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getRequest() | ||
647 | * @see #getRequirement() | ||
648 | * @generated | ||
649 | */ | ||
650 | EReference getRequirement_Request(); | ||
651 | |||
652 | /** | ||
653 | * Returns the meta object for the attribute '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getCount <em>Count</em>}'. | ||
654 | * <!-- begin-user-doc --> | ||
655 | * <!-- end-user-doc --> | ||
656 | * @return the meta object for the attribute '<em>Count</em>'. | ||
657 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getCount() | ||
658 | * @see #getRequirement() | ||
659 | * @generated | ||
660 | */ | ||
661 | EAttribute getRequirement_Count(); | ||
662 | |||
663 | /** | ||
664 | * Returns the meta object for the reference '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getType <em>Type</em>}'. | ||
665 | * <!-- begin-user-doc --> | ||
666 | * <!-- end-user-doc --> | ||
667 | * @return the meta object for the reference '<em>Type</em>'. | ||
668 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getType() | ||
669 | * @see #getRequirement() | ||
670 | * @generated | ||
671 | */ | ||
672 | EReference getRequirement_Type(); | ||
673 | |||
674 | /** | ||
675 | * Returns the meta object for the reference list '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getInstances <em>Instances</em>}'. | ||
676 | * <!-- begin-user-doc --> | ||
677 | * <!-- end-user-doc --> | ||
678 | * @return the meta object for the reference list '<em>Instances</em>'. | ||
679 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getInstances() | ||
680 | * @see #getRequirement() | ||
681 | * @generated | ||
682 | */ | ||
683 | EReference getRequirement_Instances(); | ||
684 | |||
685 | /** | ||
686 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance <em>Application Instance</em>}'. | ||
687 | * <!-- begin-user-doc --> | ||
688 | * <!-- end-user-doc --> | ||
689 | * @return the meta object for class '<em>Application Instance</em>'. | ||
690 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance | ||
691 | * @generated | ||
692 | */ | ||
693 | EClass getApplicationInstance(); | ||
694 | |||
695 | /** | ||
696 | * Returns the meta object for the reference '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getRequirement <em>Requirement</em>}'. | ||
697 | * <!-- begin-user-doc --> | ||
698 | * <!-- end-user-doc --> | ||
699 | * @return the meta object for the reference '<em>Requirement</em>'. | ||
700 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getRequirement() | ||
701 | * @see #getApplicationInstance() | ||
702 | * @generated | ||
703 | */ | ||
704 | EReference getApplicationInstance_Requirement(); | ||
705 | |||
706 | /** | ||
707 | * Returns the meta object for the container reference '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getType <em>Type</em>}'. | ||
708 | * <!-- begin-user-doc --> | ||
709 | * <!-- end-user-doc --> | ||
710 | * @return the meta object for the container reference '<em>Type</em>'. | ||
711 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getType() | ||
712 | * @see #getApplicationInstance() | ||
713 | * @generated | ||
714 | */ | ||
715 | EReference getApplicationInstance_Type(); | ||
716 | |||
717 | /** | ||
718 | * Returns the meta object for the reference '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getAllocatedTo <em>Allocated To</em>}'. | ||
719 | * <!-- begin-user-doc --> | ||
720 | * <!-- end-user-doc --> | ||
721 | * @return the meta object for the reference '<em>Allocated To</em>'. | ||
722 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getAllocatedTo() | ||
723 | * @see #getApplicationInstance() | ||
724 | * @generated | ||
725 | */ | ||
726 | EReference getApplicationInstance_AllocatedTo(); | ||
727 | |||
728 | /** | ||
729 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement <em>Resource Requirement</em>}'. | ||
730 | * <!-- begin-user-doc --> | ||
731 | * <!-- end-user-doc --> | ||
732 | * @return the meta object for class '<em>Resource Requirement</em>'. | ||
733 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement | ||
734 | * @generated | ||
735 | */ | ||
736 | EClass getResourceRequirement(); | ||
737 | |||
738 | /** | ||
739 | * Returns the meta object for the attribute '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getRequiredMemory <em>Required Memory</em>}'. | ||
740 | * <!-- begin-user-doc --> | ||
741 | * <!-- end-user-doc --> | ||
742 | * @return the meta object for the attribute '<em>Required Memory</em>'. | ||
743 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getRequiredMemory() | ||
744 | * @see #getResourceRequirement() | ||
745 | * @generated | ||
746 | */ | ||
747 | EAttribute getResourceRequirement_RequiredMemory(); | ||
748 | |||
749 | /** | ||
750 | * Returns the meta object for the attribute '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getRequiredHdd <em>Required Hdd</em>}'. | ||
751 | * <!-- begin-user-doc --> | ||
752 | * <!-- end-user-doc --> | ||
753 | * @return the meta object for the attribute '<em>Required Hdd</em>'. | ||
754 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getRequiredHdd() | ||
755 | * @see #getResourceRequirement() | ||
756 | * @generated | ||
757 | */ | ||
758 | EAttribute getResourceRequirement_RequiredHdd(); | ||
759 | |||
760 | /** | ||
761 | * Returns the meta object for the reference '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getHostType <em>Host Type</em>}'. | ||
762 | * <!-- begin-user-doc --> | ||
763 | * <!-- end-user-doc --> | ||
764 | * @return the meta object for the reference '<em>Host Type</em>'. | ||
765 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getHostType() | ||
766 | * @see #getResourceRequirement() | ||
767 | * @generated | ||
768 | */ | ||
769 | EReference getResourceRequirement_HostType(); | ||
770 | |||
771 | /** | ||
772 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance <em>Host Instance</em>}'. | ||
773 | * <!-- begin-user-doc --> | ||
774 | * <!-- end-user-doc --> | ||
775 | * @return the meta object for class '<em>Host Instance</em>'. | ||
776 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance | ||
777 | * @generated | ||
778 | */ | ||
779 | EClass getHostInstance(); | ||
780 | |||
781 | /** | ||
782 | * Returns the meta object for the container reference '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getType <em>Type</em>}'. | ||
783 | * <!-- begin-user-doc --> | ||
784 | * <!-- end-user-doc --> | ||
785 | * @return the meta object for the container reference '<em>Type</em>'. | ||
786 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getType() | ||
787 | * @see #getHostInstance() | ||
788 | * @generated | ||
789 | */ | ||
790 | EReference getHostInstance_Type(); | ||
791 | |||
792 | /** | ||
793 | * Returns the meta object for the reference list '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getApplications <em>Applications</em>}'. | ||
794 | * <!-- begin-user-doc --> | ||
795 | * <!-- end-user-doc --> | ||
796 | * @return the meta object for the reference list '<em>Applications</em>'. | ||
797 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getApplications() | ||
798 | * @see #getHostInstance() | ||
799 | * @generated | ||
800 | */ | ||
801 | EReference getHostInstance_Applications(); | ||
802 | |||
803 | /** | ||
804 | * Returns the factory that creates the instances of the model. | ||
805 | * <!-- begin-user-doc --> | ||
806 | * <!-- end-user-doc --> | ||
807 | * @return the factory that creates the instances of the model. | ||
808 | * @generated | ||
809 | */ | ||
810 | CpsFactory getCpsFactory(); | ||
811 | |||
812 | /** | ||
813 | * <!-- begin-user-doc --> | ||
814 | * Defines literals for the meta objects that represent | ||
815 | * <ul> | ||
816 | * <li>each class,</li> | ||
817 | * <li>each feature of each class,</li> | ||
818 | * <li>each operation of each class,</li> | ||
819 | * <li>each enum,</li> | ||
820 | * <li>and each data type</li> | ||
821 | * </ul> | ||
822 | * <!-- end-user-doc --> | ||
823 | * @generated | ||
824 | */ | ||
825 | interface Literals { | ||
826 | /** | ||
827 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.CyberPhysicalSystemImpl <em>Cyber Physical System</em>}' class. | ||
828 | * <!-- begin-user-doc --> | ||
829 | * <!-- end-user-doc --> | ||
830 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CyberPhysicalSystemImpl | ||
831 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getCyberPhysicalSystem() | ||
832 | * @generated | ||
833 | */ | ||
834 | EClass CYBER_PHYSICAL_SYSTEM = eINSTANCE.getCyberPhysicalSystem(); | ||
835 | |||
836 | /** | ||
837 | * The meta object literal for the '<em><b>Requests</b></em>' containment reference list feature. | ||
838 | * <!-- begin-user-doc --> | ||
839 | * <!-- end-user-doc --> | ||
840 | * @generated | ||
841 | */ | ||
842 | EReference CYBER_PHYSICAL_SYSTEM__REQUESTS = eINSTANCE.getCyberPhysicalSystem_Requests(); | ||
843 | |||
844 | /** | ||
845 | * The meta object literal for the '<em><b>Application Types</b></em>' containment reference list feature. | ||
846 | * <!-- begin-user-doc --> | ||
847 | * <!-- end-user-doc --> | ||
848 | * @generated | ||
849 | */ | ||
850 | EReference CYBER_PHYSICAL_SYSTEM__APPLICATION_TYPES = eINSTANCE.getCyberPhysicalSystem_ApplicationTypes(); | ||
851 | |||
852 | /** | ||
853 | * The meta object literal for the '<em><b>Host Types</b></em>' containment reference list feature. | ||
854 | * <!-- begin-user-doc --> | ||
855 | * <!-- end-user-doc --> | ||
856 | * @generated | ||
857 | */ | ||
858 | EReference CYBER_PHYSICAL_SYSTEM__HOST_TYPES = eINSTANCE.getCyberPhysicalSystem_HostTypes(); | ||
859 | |||
860 | /** | ||
861 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationTypeImpl <em>Application Type</em>}' class. | ||
862 | * <!-- begin-user-doc --> | ||
863 | * <!-- end-user-doc --> | ||
864 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationTypeImpl | ||
865 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getApplicationType() | ||
866 | * @generated | ||
867 | */ | ||
868 | EClass APPLICATION_TYPE = eINSTANCE.getApplicationType(); | ||
869 | |||
870 | /** | ||
871 | * The meta object literal for the '<em><b>Instances</b></em>' containment reference list feature. | ||
872 | * <!-- begin-user-doc --> | ||
873 | * <!-- end-user-doc --> | ||
874 | * @generated | ||
875 | */ | ||
876 | EReference APPLICATION_TYPE__INSTANCES = eINSTANCE.getApplicationType_Instances(); | ||
877 | |||
878 | /** | ||
879 | * The meta object literal for the '<em><b>Requirements</b></em>' containment reference list feature. | ||
880 | * <!-- begin-user-doc --> | ||
881 | * <!-- end-user-doc --> | ||
882 | * @generated | ||
883 | */ | ||
884 | EReference APPLICATION_TYPE__REQUIREMENTS = eINSTANCE.getApplicationType_Requirements(); | ||
885 | |||
886 | /** | ||
887 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostTypeImpl <em>Host Type</em>}' class. | ||
888 | * <!-- begin-user-doc --> | ||
889 | * <!-- end-user-doc --> | ||
890 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostTypeImpl | ||
891 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getHostType() | ||
892 | * @generated | ||
893 | */ | ||
894 | EClass HOST_TYPE = eINSTANCE.getHostType(); | ||
895 | |||
896 | /** | ||
897 | * The meta object literal for the '<em><b>Default Memory</b></em>' attribute feature. | ||
898 | * <!-- begin-user-doc --> | ||
899 | * <!-- end-user-doc --> | ||
900 | * @generated | ||
901 | */ | ||
902 | EAttribute HOST_TYPE__DEFAULT_MEMORY = eINSTANCE.getHostType_DefaultMemory(); | ||
903 | |||
904 | /** | ||
905 | * The meta object literal for the '<em><b>Default Hdd</b></em>' attribute feature. | ||
906 | * <!-- begin-user-doc --> | ||
907 | * <!-- end-user-doc --> | ||
908 | * @generated | ||
909 | */ | ||
910 | EAttribute HOST_TYPE__DEFAULT_HDD = eINSTANCE.getHostType_DefaultHdd(); | ||
911 | |||
912 | /** | ||
913 | * The meta object literal for the '<em><b>Instances</b></em>' containment reference list feature. | ||
914 | * <!-- begin-user-doc --> | ||
915 | * <!-- end-user-doc --> | ||
916 | * @generated | ||
917 | */ | ||
918 | EReference HOST_TYPE__INSTANCES = eINSTANCE.getHostType_Instances(); | ||
919 | |||
920 | /** | ||
921 | * The meta object literal for the '<em><b>Cost</b></em>' attribute feature. | ||
922 | * <!-- begin-user-doc --> | ||
923 | * <!-- end-user-doc --> | ||
924 | * @generated | ||
925 | */ | ||
926 | EAttribute HOST_TYPE__COST = eINSTANCE.getHostType_Cost(); | ||
927 | |||
928 | /** | ||
929 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequestImpl <em>Request</em>}' class. | ||
930 | * <!-- begin-user-doc --> | ||
931 | * <!-- end-user-doc --> | ||
932 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequestImpl | ||
933 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getRequest() | ||
934 | * @generated | ||
935 | */ | ||
936 | EClass REQUEST = eINSTANCE.getRequest(); | ||
937 | |||
938 | /** | ||
939 | * The meta object literal for the '<em><b>Requirements</b></em>' containment reference list feature. | ||
940 | * <!-- begin-user-doc --> | ||
941 | * <!-- end-user-doc --> | ||
942 | * @generated | ||
943 | */ | ||
944 | EReference REQUEST__REQUIREMENTS = eINSTANCE.getRequest_Requirements(); | ||
945 | |||
946 | /** | ||
947 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequirementImpl <em>Requirement</em>}' class. | ||
948 | * <!-- begin-user-doc --> | ||
949 | * <!-- end-user-doc --> | ||
950 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequirementImpl | ||
951 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getRequirement() | ||
952 | * @generated | ||
953 | */ | ||
954 | EClass REQUIREMENT = eINSTANCE.getRequirement(); | ||
955 | |||
956 | /** | ||
957 | * The meta object literal for the '<em><b>Request</b></em>' container reference feature. | ||
958 | * <!-- begin-user-doc --> | ||
959 | * <!-- end-user-doc --> | ||
960 | * @generated | ||
961 | */ | ||
962 | EReference REQUIREMENT__REQUEST = eINSTANCE.getRequirement_Request(); | ||
963 | |||
964 | /** | ||
965 | * The meta object literal for the '<em><b>Count</b></em>' attribute feature. | ||
966 | * <!-- begin-user-doc --> | ||
967 | * <!-- end-user-doc --> | ||
968 | * @generated | ||
969 | */ | ||
970 | EAttribute REQUIREMENT__COUNT = eINSTANCE.getRequirement_Count(); | ||
971 | |||
972 | /** | ||
973 | * The meta object literal for the '<em><b>Type</b></em>' reference feature. | ||
974 | * <!-- begin-user-doc --> | ||
975 | * <!-- end-user-doc --> | ||
976 | * @generated | ||
977 | */ | ||
978 | EReference REQUIREMENT__TYPE = eINSTANCE.getRequirement_Type(); | ||
979 | |||
980 | /** | ||
981 | * The meta object literal for the '<em><b>Instances</b></em>' reference list feature. | ||
982 | * <!-- begin-user-doc --> | ||
983 | * <!-- end-user-doc --> | ||
984 | * @generated | ||
985 | */ | ||
986 | EReference REQUIREMENT__INSTANCES = eINSTANCE.getRequirement_Instances(); | ||
987 | |||
988 | /** | ||
989 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationInstanceImpl <em>Application Instance</em>}' class. | ||
990 | * <!-- begin-user-doc --> | ||
991 | * <!-- end-user-doc --> | ||
992 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationInstanceImpl | ||
993 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getApplicationInstance() | ||
994 | * @generated | ||
995 | */ | ||
996 | EClass APPLICATION_INSTANCE = eINSTANCE.getApplicationInstance(); | ||
997 | |||
998 | /** | ||
999 | * The meta object literal for the '<em><b>Requirement</b></em>' reference feature. | ||
1000 | * <!-- begin-user-doc --> | ||
1001 | * <!-- end-user-doc --> | ||
1002 | * @generated | ||
1003 | */ | ||
1004 | EReference APPLICATION_INSTANCE__REQUIREMENT = eINSTANCE.getApplicationInstance_Requirement(); | ||
1005 | |||
1006 | /** | ||
1007 | * The meta object literal for the '<em><b>Type</b></em>' container reference feature. | ||
1008 | * <!-- begin-user-doc --> | ||
1009 | * <!-- end-user-doc --> | ||
1010 | * @generated | ||
1011 | */ | ||
1012 | EReference APPLICATION_INSTANCE__TYPE = eINSTANCE.getApplicationInstance_Type(); | ||
1013 | |||
1014 | /** | ||
1015 | * The meta object literal for the '<em><b>Allocated To</b></em>' reference feature. | ||
1016 | * <!-- begin-user-doc --> | ||
1017 | * <!-- end-user-doc --> | ||
1018 | * @generated | ||
1019 | */ | ||
1020 | EReference APPLICATION_INSTANCE__ALLOCATED_TO = eINSTANCE.getApplicationInstance_AllocatedTo(); | ||
1021 | |||
1022 | /** | ||
1023 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ResourceRequirementImpl <em>Resource Requirement</em>}' class. | ||
1024 | * <!-- begin-user-doc --> | ||
1025 | * <!-- end-user-doc --> | ||
1026 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.ResourceRequirementImpl | ||
1027 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getResourceRequirement() | ||
1028 | * @generated | ||
1029 | */ | ||
1030 | EClass RESOURCE_REQUIREMENT = eINSTANCE.getResourceRequirement(); | ||
1031 | |||
1032 | /** | ||
1033 | * The meta object literal for the '<em><b>Required Memory</b></em>' attribute feature. | ||
1034 | * <!-- begin-user-doc --> | ||
1035 | * <!-- end-user-doc --> | ||
1036 | * @generated | ||
1037 | */ | ||
1038 | EAttribute RESOURCE_REQUIREMENT__REQUIRED_MEMORY = eINSTANCE.getResourceRequirement_RequiredMemory(); | ||
1039 | |||
1040 | /** | ||
1041 | * The meta object literal for the '<em><b>Required Hdd</b></em>' attribute feature. | ||
1042 | * <!-- begin-user-doc --> | ||
1043 | * <!-- end-user-doc --> | ||
1044 | * @generated | ||
1045 | */ | ||
1046 | EAttribute RESOURCE_REQUIREMENT__REQUIRED_HDD = eINSTANCE.getResourceRequirement_RequiredHdd(); | ||
1047 | |||
1048 | /** | ||
1049 | * The meta object literal for the '<em><b>Host Type</b></em>' reference feature. | ||
1050 | * <!-- begin-user-doc --> | ||
1051 | * <!-- end-user-doc --> | ||
1052 | * @generated | ||
1053 | */ | ||
1054 | EReference RESOURCE_REQUIREMENT__HOST_TYPE = eINSTANCE.getResourceRequirement_HostType(); | ||
1055 | |||
1056 | /** | ||
1057 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostInstanceImpl <em>Host Instance</em>}' class. | ||
1058 | * <!-- begin-user-doc --> | ||
1059 | * <!-- end-user-doc --> | ||
1060 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostInstanceImpl | ||
1061 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.impl.CpsPackageImpl#getHostInstance() | ||
1062 | * @generated | ||
1063 | */ | ||
1064 | EClass HOST_INSTANCE = eINSTANCE.getHostInstance(); | ||
1065 | |||
1066 | /** | ||
1067 | * The meta object literal for the '<em><b>Type</b></em>' container reference feature. | ||
1068 | * <!-- begin-user-doc --> | ||
1069 | * <!-- end-user-doc --> | ||
1070 | * @generated | ||
1071 | */ | ||
1072 | EReference HOST_INSTANCE__TYPE = eINSTANCE.getHostInstance_Type(); | ||
1073 | |||
1074 | /** | ||
1075 | * The meta object literal for the '<em><b>Applications</b></em>' reference list feature. | ||
1076 | * <!-- begin-user-doc --> | ||
1077 | * <!-- end-user-doc --> | ||
1078 | * @generated | ||
1079 | */ | ||
1080 | EReference HOST_INSTANCE__APPLICATIONS = eINSTANCE.getHostInstance_Applications(); | ||
1081 | |||
1082 | } | ||
1083 | |||
1084 | } //CpsPackage | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/CyberPhysicalSystem.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/CyberPhysicalSystem.java new file mode 100644 index 00000000..fbf4ce0d --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/CyberPhysicalSystem.java | |||
@@ -0,0 +1,76 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.common.util.EList; | ||
6 | |||
7 | import org.eclipse.emf.ecore.EObject; | ||
8 | |||
9 | /** | ||
10 | * <!-- begin-user-doc --> | ||
11 | * A representation of the model object '<em><b>Cyber Physical System</b></em>'. | ||
12 | * <!-- end-user-doc --> | ||
13 | * | ||
14 | * <p> | ||
15 | * The following features are supported: | ||
16 | * </p> | ||
17 | * <ul> | ||
18 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem#getRequests <em>Requests</em>}</li> | ||
19 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem#getApplicationTypes <em>Application Types</em>}</li> | ||
20 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem#getHostTypes <em>Host Types</em>}</li> | ||
21 | * </ul> | ||
22 | * | ||
23 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getCyberPhysicalSystem() | ||
24 | * @model | ||
25 | * @generated | ||
26 | */ | ||
27 | public interface CyberPhysicalSystem extends EObject { | ||
28 | /** | ||
29 | * Returns the value of the '<em><b>Requests</b></em>' containment reference list. | ||
30 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.cps.Request}. | ||
31 | * <!-- begin-user-doc --> | ||
32 | * <p> | ||
33 | * If the meaning of the '<em>Requests</em>' containment reference list isn't clear, | ||
34 | * there really should be more of a description here... | ||
35 | * </p> | ||
36 | * <!-- end-user-doc --> | ||
37 | * @return the value of the '<em>Requests</em>' containment reference list. | ||
38 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getCyberPhysicalSystem_Requests() | ||
39 | * @model containment="true" | ||
40 | * @generated | ||
41 | */ | ||
42 | EList<Request> getRequests(); | ||
43 | |||
44 | /** | ||
45 | * Returns the value of the '<em><b>Application Types</b></em>' containment reference list. | ||
46 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType}. | ||
47 | * <!-- begin-user-doc --> | ||
48 | * <p> | ||
49 | * If the meaning of the '<em>Application Types</em>' containment reference list isn't clear, | ||
50 | * there really should be more of a description here... | ||
51 | * </p> | ||
52 | * <!-- end-user-doc --> | ||
53 | * @return the value of the '<em>Application Types</em>' containment reference list. | ||
54 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getCyberPhysicalSystem_ApplicationTypes() | ||
55 | * @model containment="true" | ||
56 | * @generated | ||
57 | */ | ||
58 | EList<ApplicationType> getApplicationTypes(); | ||
59 | |||
60 | /** | ||
61 | * Returns the value of the '<em><b>Host Types</b></em>' containment reference list. | ||
62 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType}. | ||
63 | * <!-- begin-user-doc --> | ||
64 | * <p> | ||
65 | * If the meaning of the '<em>Host Types</em>' containment reference list isn't clear, | ||
66 | * there really should be more of a description here... | ||
67 | * </p> | ||
68 | * <!-- end-user-doc --> | ||
69 | * @return the value of the '<em>Host Types</em>' containment reference list. | ||
70 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getCyberPhysicalSystem_HostTypes() | ||
71 | * @model containment="true" | ||
72 | * @generated | ||
73 | */ | ||
74 | EList<HostType> getHostTypes(); | ||
75 | |||
76 | } // CyberPhysicalSystem | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/HostInstance.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/HostInstance.java new file mode 100644 index 00000000..b4721842 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/HostInstance.java | |||
@@ -0,0 +1,73 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.common.util.EList; | ||
6 | |||
7 | import org.eclipse.emf.ecore.EObject; | ||
8 | |||
9 | /** | ||
10 | * <!-- begin-user-doc --> | ||
11 | * A representation of the model object '<em><b>Host Instance</b></em>'. | ||
12 | * <!-- end-user-doc --> | ||
13 | * | ||
14 | * <p> | ||
15 | * The following features are supported: | ||
16 | * </p> | ||
17 | * <ul> | ||
18 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getType <em>Type</em>}</li> | ||
19 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getApplications <em>Applications</em>}</li> | ||
20 | * </ul> | ||
21 | * | ||
22 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getHostInstance() | ||
23 | * @model | ||
24 | * @generated | ||
25 | */ | ||
26 | public interface HostInstance extends EObject { | ||
27 | /** | ||
28 | * Returns the value of the '<em><b>Type</b></em>' container reference. | ||
29 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getInstances <em>Instances</em>}'. | ||
30 | * <!-- begin-user-doc --> | ||
31 | * <p> | ||
32 | * If the meaning of the '<em>Type</em>' container reference isn't clear, | ||
33 | * there really should be more of a description here... | ||
34 | * </p> | ||
35 | * <!-- end-user-doc --> | ||
36 | * @return the value of the '<em>Type</em>' container reference. | ||
37 | * @see #setType(HostType) | ||
38 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getHostInstance_Type() | ||
39 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getInstances | ||
40 | * @model opposite="instances" required="true" transient="false" | ||
41 | * @generated | ||
42 | */ | ||
43 | HostType getType(); | ||
44 | |||
45 | /** | ||
46 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getType <em>Type</em>}' container reference. | ||
47 | * <!-- begin-user-doc --> | ||
48 | * <!-- end-user-doc --> | ||
49 | * @param value the new value of the '<em>Type</em>' container reference. | ||
50 | * @see #getType() | ||
51 | * @generated | ||
52 | */ | ||
53 | void setType(HostType value); | ||
54 | |||
55 | /** | ||
56 | * Returns the value of the '<em><b>Applications</b></em>' reference list. | ||
57 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance}. | ||
58 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getAllocatedTo <em>Allocated To</em>}'. | ||
59 | * <!-- begin-user-doc --> | ||
60 | * <p> | ||
61 | * If the meaning of the '<em>Applications</em>' reference list isn't clear, | ||
62 | * there really should be more of a description here... | ||
63 | * </p> | ||
64 | * <!-- end-user-doc --> | ||
65 | * @return the value of the '<em>Applications</em>' reference list. | ||
66 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getHostInstance_Applications() | ||
67 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getAllocatedTo | ||
68 | * @model opposite="allocatedTo" | ||
69 | * @generated | ||
70 | */ | ||
71 | EList<ApplicationInstance> getApplications(); | ||
72 | |||
73 | } // HostInstance | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/HostType.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/HostType.java new file mode 100644 index 00000000..45201930 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/HostType.java | |||
@@ -0,0 +1,125 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.common.util.EList; | ||
6 | |||
7 | import org.eclipse.emf.ecore.EObject; | ||
8 | |||
9 | /** | ||
10 | * <!-- begin-user-doc --> | ||
11 | * A representation of the model object '<em><b>Host Type</b></em>'. | ||
12 | * <!-- end-user-doc --> | ||
13 | * | ||
14 | * <p> | ||
15 | * The following features are supported: | ||
16 | * </p> | ||
17 | * <ul> | ||
18 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getDefaultMemory <em>Default Memory</em>}</li> | ||
19 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getDefaultHdd <em>Default Hdd</em>}</li> | ||
20 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getInstances <em>Instances</em>}</li> | ||
21 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getCost <em>Cost</em>}</li> | ||
22 | * </ul> | ||
23 | * | ||
24 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getHostType() | ||
25 | * @model | ||
26 | * @generated | ||
27 | */ | ||
28 | public interface HostType extends EObject { | ||
29 | /** | ||
30 | * Returns the value of the '<em><b>Default Memory</b></em>' attribute. | ||
31 | * <!-- begin-user-doc --> | ||
32 | * <p> | ||
33 | * If the meaning of the '<em>Default Memory</em>' attribute isn't clear, | ||
34 | * there really should be more of a description here... | ||
35 | * </p> | ||
36 | * <!-- end-user-doc --> | ||
37 | * @return the value of the '<em>Default Memory</em>' attribute. | ||
38 | * @see #setDefaultMemory(int) | ||
39 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getHostType_DefaultMemory() | ||
40 | * @model required="true" | ||
41 | * @generated | ||
42 | */ | ||
43 | int getDefaultMemory(); | ||
44 | |||
45 | /** | ||
46 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getDefaultMemory <em>Default Memory</em>}' attribute. | ||
47 | * <!-- begin-user-doc --> | ||
48 | * <!-- end-user-doc --> | ||
49 | * @param value the new value of the '<em>Default Memory</em>' attribute. | ||
50 | * @see #getDefaultMemory() | ||
51 | * @generated | ||
52 | */ | ||
53 | void setDefaultMemory(int value); | ||
54 | |||
55 | /** | ||
56 | * Returns the value of the '<em><b>Default Hdd</b></em>' attribute. | ||
57 | * <!-- begin-user-doc --> | ||
58 | * <p> | ||
59 | * If the meaning of the '<em>Default Hdd</em>' attribute isn't clear, | ||
60 | * there really should be more of a description here... | ||
61 | * </p> | ||
62 | * <!-- end-user-doc --> | ||
63 | * @return the value of the '<em>Default Hdd</em>' attribute. | ||
64 | * @see #setDefaultHdd(int) | ||
65 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getHostType_DefaultHdd() | ||
66 | * @model required="true" | ||
67 | * @generated | ||
68 | */ | ||
69 | int getDefaultHdd(); | ||
70 | |||
71 | /** | ||
72 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getDefaultHdd <em>Default Hdd</em>}' attribute. | ||
73 | * <!-- begin-user-doc --> | ||
74 | * <!-- end-user-doc --> | ||
75 | * @param value the new value of the '<em>Default Hdd</em>' attribute. | ||
76 | * @see #getDefaultHdd() | ||
77 | * @generated | ||
78 | */ | ||
79 | void setDefaultHdd(int value); | ||
80 | |||
81 | /** | ||
82 | * Returns the value of the '<em><b>Instances</b></em>' containment reference list. | ||
83 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance}. | ||
84 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getType <em>Type</em>}'. | ||
85 | * <!-- begin-user-doc --> | ||
86 | * <p> | ||
87 | * If the meaning of the '<em>Instances</em>' containment reference list isn't clear, | ||
88 | * there really should be more of a description here... | ||
89 | * </p> | ||
90 | * <!-- end-user-doc --> | ||
91 | * @return the value of the '<em>Instances</em>' containment reference list. | ||
92 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getHostType_Instances() | ||
93 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance#getType | ||
94 | * @model opposite="type" containment="true" | ||
95 | * @generated | ||
96 | */ | ||
97 | EList<HostInstance> getInstances(); | ||
98 | |||
99 | /** | ||
100 | * Returns the value of the '<em><b>Cost</b></em>' attribute. | ||
101 | * <!-- begin-user-doc --> | ||
102 | * <p> | ||
103 | * If the meaning of the '<em>Cost</em>' attribute isn't clear, | ||
104 | * there really should be more of a description here... | ||
105 | * </p> | ||
106 | * <!-- end-user-doc --> | ||
107 | * @return the value of the '<em>Cost</em>' attribute. | ||
108 | * @see #setCost(int) | ||
109 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getHostType_Cost() | ||
110 | * @model required="true" | ||
111 | * @generated | ||
112 | */ | ||
113 | int getCost(); | ||
114 | |||
115 | /** | ||
116 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType#getCost <em>Cost</em>}' attribute. | ||
117 | * <!-- begin-user-doc --> | ||
118 | * <!-- end-user-doc --> | ||
119 | * @param value the new value of the '<em>Cost</em>' attribute. | ||
120 | * @see #getCost() | ||
121 | * @generated | ||
122 | */ | ||
123 | void setCost(int value); | ||
124 | |||
125 | } // HostType | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/Request.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/Request.java new file mode 100644 index 00000000..261562a0 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/Request.java | |||
@@ -0,0 +1,44 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.common.util.EList; | ||
6 | |||
7 | import org.eclipse.emf.ecore.EObject; | ||
8 | |||
9 | /** | ||
10 | * <!-- begin-user-doc --> | ||
11 | * A representation of the model object '<em><b>Request</b></em>'. | ||
12 | * <!-- end-user-doc --> | ||
13 | * | ||
14 | * <p> | ||
15 | * The following features are supported: | ||
16 | * </p> | ||
17 | * <ul> | ||
18 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.Request#getRequirements <em>Requirements</em>}</li> | ||
19 | * </ul> | ||
20 | * | ||
21 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getRequest() | ||
22 | * @model | ||
23 | * @generated | ||
24 | */ | ||
25 | public interface Request extends EObject { | ||
26 | /** | ||
27 | * Returns the value of the '<em><b>Requirements</b></em>' containment reference list. | ||
28 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement}. | ||
29 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getRequest <em>Request</em>}'. | ||
30 | * <!-- begin-user-doc --> | ||
31 | * <p> | ||
32 | * If the meaning of the '<em>Requirements</em>' containment reference list isn't clear, | ||
33 | * there really should be more of a description here... | ||
34 | * </p> | ||
35 | * <!-- end-user-doc --> | ||
36 | * @return the value of the '<em>Requirements</em>' containment reference list. | ||
37 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getRequest_Requirements() | ||
38 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getRequest | ||
39 | * @model opposite="request" containment="true" | ||
40 | * @generated | ||
41 | */ | ||
42 | EList<Requirement> getRequirements(); | ||
43 | |||
44 | } // Request | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/Requirement.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/Requirement.java new file mode 100644 index 00000000..a1d494e4 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/Requirement.java | |||
@@ -0,0 +1,127 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.common.util.EList; | ||
6 | |||
7 | import org.eclipse.emf.ecore.EObject; | ||
8 | |||
9 | /** | ||
10 | * <!-- begin-user-doc --> | ||
11 | * A representation of the model object '<em><b>Requirement</b></em>'. | ||
12 | * <!-- end-user-doc --> | ||
13 | * | ||
14 | * <p> | ||
15 | * The following features are supported: | ||
16 | * </p> | ||
17 | * <ul> | ||
18 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getRequest <em>Request</em>}</li> | ||
19 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getCount <em>Count</em>}</li> | ||
20 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getType <em>Type</em>}</li> | ||
21 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getInstances <em>Instances</em>}</li> | ||
22 | * </ul> | ||
23 | * | ||
24 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getRequirement() | ||
25 | * @model | ||
26 | * @generated | ||
27 | */ | ||
28 | public interface Requirement extends EObject { | ||
29 | /** | ||
30 | * Returns the value of the '<em><b>Request</b></em>' container reference. | ||
31 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Request#getRequirements <em>Requirements</em>}'. | ||
32 | * <!-- begin-user-doc --> | ||
33 | * <p> | ||
34 | * If the meaning of the '<em>Request</em>' container reference isn't clear, | ||
35 | * there really should be more of a description here... | ||
36 | * </p> | ||
37 | * <!-- end-user-doc --> | ||
38 | * @return the value of the '<em>Request</em>' container reference. | ||
39 | * @see #setRequest(Request) | ||
40 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getRequirement_Request() | ||
41 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Request#getRequirements | ||
42 | * @model opposite="requirements" required="true" transient="false" | ||
43 | * @generated | ||
44 | */ | ||
45 | Request getRequest(); | ||
46 | |||
47 | /** | ||
48 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getRequest <em>Request</em>}' container reference. | ||
49 | * <!-- begin-user-doc --> | ||
50 | * <!-- end-user-doc --> | ||
51 | * @param value the new value of the '<em>Request</em>' container reference. | ||
52 | * @see #getRequest() | ||
53 | * @generated | ||
54 | */ | ||
55 | void setRequest(Request value); | ||
56 | |||
57 | /** | ||
58 | * Returns the value of the '<em><b>Count</b></em>' attribute. | ||
59 | * <!-- begin-user-doc --> | ||
60 | * <p> | ||
61 | * If the meaning of the '<em>Count</em>' attribute isn't clear, | ||
62 | * there really should be more of a description here... | ||
63 | * </p> | ||
64 | * <!-- end-user-doc --> | ||
65 | * @return the value of the '<em>Count</em>' attribute. | ||
66 | * @see #setCount(int) | ||
67 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getRequirement_Count() | ||
68 | * @model required="true" | ||
69 | * @generated | ||
70 | */ | ||
71 | int getCount(); | ||
72 | |||
73 | /** | ||
74 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getCount <em>Count</em>}' attribute. | ||
75 | * <!-- begin-user-doc --> | ||
76 | * <!-- end-user-doc --> | ||
77 | * @param value the new value of the '<em>Count</em>' attribute. | ||
78 | * @see #getCount() | ||
79 | * @generated | ||
80 | */ | ||
81 | void setCount(int value); | ||
82 | |||
83 | /** | ||
84 | * Returns the value of the '<em><b>Type</b></em>' reference. | ||
85 | * <!-- begin-user-doc --> | ||
86 | * <p> | ||
87 | * If the meaning of the '<em>Type</em>' reference isn't clear, | ||
88 | * there really should be more of a description here... | ||
89 | * </p> | ||
90 | * <!-- end-user-doc --> | ||
91 | * @return the value of the '<em>Type</em>' reference. | ||
92 | * @see #setType(ApplicationType) | ||
93 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getRequirement_Type() | ||
94 | * @model | ||
95 | * @generated | ||
96 | */ | ||
97 | ApplicationType getType(); | ||
98 | |||
99 | /** | ||
100 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement#getType <em>Type</em>}' reference. | ||
101 | * <!-- begin-user-doc --> | ||
102 | * <!-- end-user-doc --> | ||
103 | * @param value the new value of the '<em>Type</em>' reference. | ||
104 | * @see #getType() | ||
105 | * @generated | ||
106 | */ | ||
107 | void setType(ApplicationType value); | ||
108 | |||
109 | /** | ||
110 | * Returns the value of the '<em><b>Instances</b></em>' reference list. | ||
111 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance}. | ||
112 | * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getRequirement <em>Requirement</em>}'. | ||
113 | * <!-- begin-user-doc --> | ||
114 | * <p> | ||
115 | * If the meaning of the '<em>Instances</em>' reference list isn't clear, | ||
116 | * there really should be more of a description here... | ||
117 | * </p> | ||
118 | * <!-- end-user-doc --> | ||
119 | * @return the value of the '<em>Instances</em>' reference list. | ||
120 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getRequirement_Instances() | ||
121 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance#getRequirement | ||
122 | * @model opposite="requirement" | ||
123 | * @generated | ||
124 | */ | ||
125 | EList<ApplicationInstance> getInstances(); | ||
126 | |||
127 | } // Requirement | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/ResourceRequirement.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/ResourceRequirement.java new file mode 100644 index 00000000..a99cc12e --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/ResourceRequirement.java | |||
@@ -0,0 +1,104 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps; | ||
4 | |||
5 | import org.eclipse.emf.ecore.EObject; | ||
6 | |||
7 | /** | ||
8 | * <!-- begin-user-doc --> | ||
9 | * A representation of the model object '<em><b>Resource Requirement</b></em>'. | ||
10 | * <!-- end-user-doc --> | ||
11 | * | ||
12 | * <p> | ||
13 | * The following features are supported: | ||
14 | * </p> | ||
15 | * <ul> | ||
16 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getRequiredMemory <em>Required Memory</em>}</li> | ||
17 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getRequiredHdd <em>Required Hdd</em>}</li> | ||
18 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getHostType <em>Host Type</em>}</li> | ||
19 | * </ul> | ||
20 | * | ||
21 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getResourceRequirement() | ||
22 | * @model | ||
23 | * @generated | ||
24 | */ | ||
25 | public interface ResourceRequirement extends EObject { | ||
26 | /** | ||
27 | * Returns the value of the '<em><b>Required Memory</b></em>' attribute. | ||
28 | * <!-- begin-user-doc --> | ||
29 | * <p> | ||
30 | * If the meaning of the '<em>Required Memory</em>' attribute isn't clear, | ||
31 | * there really should be more of a description here... | ||
32 | * </p> | ||
33 | * <!-- end-user-doc --> | ||
34 | * @return the value of the '<em>Required Memory</em>' attribute. | ||
35 | * @see #setRequiredMemory(int) | ||
36 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getResourceRequirement_RequiredMemory() | ||
37 | * @model required="true" | ||
38 | * @generated | ||
39 | */ | ||
40 | int getRequiredMemory(); | ||
41 | |||
42 | /** | ||
43 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getRequiredMemory <em>Required Memory</em>}' attribute. | ||
44 | * <!-- begin-user-doc --> | ||
45 | * <!-- end-user-doc --> | ||
46 | * @param value the new value of the '<em>Required Memory</em>' attribute. | ||
47 | * @see #getRequiredMemory() | ||
48 | * @generated | ||
49 | */ | ||
50 | void setRequiredMemory(int value); | ||
51 | |||
52 | /** | ||
53 | * Returns the value of the '<em><b>Required Hdd</b></em>' attribute. | ||
54 | * <!-- begin-user-doc --> | ||
55 | * <p> | ||
56 | * If the meaning of the '<em>Required Hdd</em>' attribute isn't clear, | ||
57 | * there really should be more of a description here... | ||
58 | * </p> | ||
59 | * <!-- end-user-doc --> | ||
60 | * @return the value of the '<em>Required Hdd</em>' attribute. | ||
61 | * @see #setRequiredHdd(int) | ||
62 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getResourceRequirement_RequiredHdd() | ||
63 | * @model required="true" | ||
64 | * @generated | ||
65 | */ | ||
66 | int getRequiredHdd(); | ||
67 | |||
68 | /** | ||
69 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getRequiredHdd <em>Required Hdd</em>}' attribute. | ||
70 | * <!-- begin-user-doc --> | ||
71 | * <!-- end-user-doc --> | ||
72 | * @param value the new value of the '<em>Required Hdd</em>' attribute. | ||
73 | * @see #getRequiredHdd() | ||
74 | * @generated | ||
75 | */ | ||
76 | void setRequiredHdd(int value); | ||
77 | |||
78 | /** | ||
79 | * Returns the value of the '<em><b>Host Type</b></em>' reference. | ||
80 | * <!-- begin-user-doc --> | ||
81 | * <p> | ||
82 | * If the meaning of the '<em>Host Type</em>' reference isn't clear, | ||
83 | * there really should be more of a description here... | ||
84 | * </p> | ||
85 | * <!-- end-user-doc --> | ||
86 | * @return the value of the '<em>Host Type</em>' reference. | ||
87 | * @see #setHostType(HostType) | ||
88 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#getResourceRequirement_HostType() | ||
89 | * @model required="true" | ||
90 | * @generated | ||
91 | */ | ||
92 | HostType getHostType(); | ||
93 | |||
94 | /** | ||
95 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement#getHostType <em>Host Type</em>}' reference. | ||
96 | * <!-- begin-user-doc --> | ||
97 | * <!-- end-user-doc --> | ||
98 | * @param value the new value of the '<em>Host Type</em>' reference. | ||
99 | * @see #getHostType() | ||
100 | * @generated | ||
101 | */ | ||
102 | void setHostType(HostType value); | ||
103 | |||
104 | } // ResourceRequirement | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/ApplicationInstanceImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/ApplicationInstanceImpl.java new file mode 100644 index 00000000..cea2d6f4 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/ApplicationInstanceImpl.java | |||
@@ -0,0 +1,405 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.cps.Requirement; | ||
10 | |||
11 | import org.eclipse.emf.common.notify.Notification; | ||
12 | import org.eclipse.emf.common.notify.NotificationChain; | ||
13 | |||
14 | import org.eclipse.emf.ecore.EClass; | ||
15 | import org.eclipse.emf.ecore.InternalEObject; | ||
16 | |||
17 | import org.eclipse.emf.ecore.impl.ENotificationImpl; | ||
18 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
19 | |||
20 | import org.eclipse.emf.ecore.util.EcoreUtil; | ||
21 | |||
22 | /** | ||
23 | * <!-- begin-user-doc --> | ||
24 | * An implementation of the model object '<em><b>Application Instance</b></em>'. | ||
25 | * <!-- end-user-doc --> | ||
26 | * <p> | ||
27 | * The following features are implemented: | ||
28 | * </p> | ||
29 | * <ul> | ||
30 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationInstanceImpl#getRequirement <em>Requirement</em>}</li> | ||
31 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationInstanceImpl#getType <em>Type</em>}</li> | ||
32 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationInstanceImpl#getAllocatedTo <em>Allocated To</em>}</li> | ||
33 | * </ul> | ||
34 | * | ||
35 | * @generated | ||
36 | */ | ||
37 | public class ApplicationInstanceImpl extends MinimalEObjectImpl.Container implements ApplicationInstance { | ||
38 | /** | ||
39 | * The cached value of the '{@link #getRequirement() <em>Requirement</em>}' reference. | ||
40 | * <!-- begin-user-doc --> | ||
41 | * <!-- end-user-doc --> | ||
42 | * @see #getRequirement() | ||
43 | * @generated | ||
44 | * @ordered | ||
45 | */ | ||
46 | protected Requirement requirement; | ||
47 | |||
48 | /** | ||
49 | * The cached value of the '{@link #getAllocatedTo() <em>Allocated To</em>}' reference. | ||
50 | * <!-- begin-user-doc --> | ||
51 | * <!-- end-user-doc --> | ||
52 | * @see #getAllocatedTo() | ||
53 | * @generated | ||
54 | * @ordered | ||
55 | */ | ||
56 | protected HostInstance allocatedTo; | ||
57 | |||
58 | /** | ||
59 | * <!-- begin-user-doc --> | ||
60 | * <!-- end-user-doc --> | ||
61 | * @generated | ||
62 | */ | ||
63 | protected ApplicationInstanceImpl() { | ||
64 | super(); | ||
65 | } | ||
66 | |||
67 | /** | ||
68 | * <!-- begin-user-doc --> | ||
69 | * <!-- end-user-doc --> | ||
70 | * @generated | ||
71 | */ | ||
72 | @Override | ||
73 | protected EClass eStaticClass() { | ||
74 | return CpsPackage.Literals.APPLICATION_INSTANCE; | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * <!-- begin-user-doc --> | ||
79 | * <!-- end-user-doc --> | ||
80 | * @generated | ||
81 | */ | ||
82 | @Override | ||
83 | public Requirement getRequirement() { | ||
84 | if (requirement != null && requirement.eIsProxy()) { | ||
85 | InternalEObject oldRequirement = (InternalEObject) requirement; | ||
86 | requirement = (Requirement) eResolveProxy(oldRequirement); | ||
87 | if (requirement != oldRequirement) { | ||
88 | if (eNotificationRequired()) | ||
89 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, | ||
90 | CpsPackage.APPLICATION_INSTANCE__REQUIREMENT, oldRequirement, requirement)); | ||
91 | } | ||
92 | } | ||
93 | return requirement; | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * <!-- begin-user-doc --> | ||
98 | * <!-- end-user-doc --> | ||
99 | * @generated | ||
100 | */ | ||
101 | public Requirement basicGetRequirement() { | ||
102 | return requirement; | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * <!-- begin-user-doc --> | ||
107 | * <!-- end-user-doc --> | ||
108 | * @generated | ||
109 | */ | ||
110 | public NotificationChain basicSetRequirement(Requirement newRequirement, NotificationChain msgs) { | ||
111 | Requirement oldRequirement = requirement; | ||
112 | requirement = newRequirement; | ||
113 | if (eNotificationRequired()) { | ||
114 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, | ||
115 | CpsPackage.APPLICATION_INSTANCE__REQUIREMENT, oldRequirement, newRequirement); | ||
116 | if (msgs == null) | ||
117 | msgs = notification; | ||
118 | else | ||
119 | msgs.add(notification); | ||
120 | } | ||
121 | return msgs; | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * <!-- begin-user-doc --> | ||
126 | * <!-- end-user-doc --> | ||
127 | * @generated | ||
128 | */ | ||
129 | @Override | ||
130 | public void setRequirement(Requirement newRequirement) { | ||
131 | if (newRequirement != requirement) { | ||
132 | NotificationChain msgs = null; | ||
133 | if (requirement != null) | ||
134 | msgs = ((InternalEObject) requirement).eInverseRemove(this, CpsPackage.REQUIREMENT__INSTANCES, | ||
135 | Requirement.class, msgs); | ||
136 | if (newRequirement != null) | ||
137 | msgs = ((InternalEObject) newRequirement).eInverseAdd(this, CpsPackage.REQUIREMENT__INSTANCES, | ||
138 | Requirement.class, msgs); | ||
139 | msgs = basicSetRequirement(newRequirement, msgs); | ||
140 | if (msgs != null) | ||
141 | msgs.dispatch(); | ||
142 | } else if (eNotificationRequired()) | ||
143 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.APPLICATION_INSTANCE__REQUIREMENT, | ||
144 | newRequirement, newRequirement)); | ||
145 | } | ||
146 | |||
147 | /** | ||
148 | * <!-- begin-user-doc --> | ||
149 | * <!-- end-user-doc --> | ||
150 | * @generated | ||
151 | */ | ||
152 | @Override | ||
153 | public ApplicationType getType() { | ||
154 | if (eContainerFeatureID() != CpsPackage.APPLICATION_INSTANCE__TYPE) | ||
155 | return null; | ||
156 | return (ApplicationType) eInternalContainer(); | ||
157 | } | ||
158 | |||
159 | /** | ||
160 | * <!-- begin-user-doc --> | ||
161 | * <!-- end-user-doc --> | ||
162 | * @generated | ||
163 | */ | ||
164 | public NotificationChain basicSetType(ApplicationType newType, NotificationChain msgs) { | ||
165 | msgs = eBasicSetContainer((InternalEObject) newType, CpsPackage.APPLICATION_INSTANCE__TYPE, msgs); | ||
166 | return msgs; | ||
167 | } | ||
168 | |||
169 | /** | ||
170 | * <!-- begin-user-doc --> | ||
171 | * <!-- end-user-doc --> | ||
172 | * @generated | ||
173 | */ | ||
174 | @Override | ||
175 | public void setType(ApplicationType newType) { | ||
176 | if (newType != eInternalContainer() | ||
177 | || (eContainerFeatureID() != CpsPackage.APPLICATION_INSTANCE__TYPE && newType != null)) { | ||
178 | if (EcoreUtil.isAncestor(this, newType)) | ||
179 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); | ||
180 | NotificationChain msgs = null; | ||
181 | if (eInternalContainer() != null) | ||
182 | msgs = eBasicRemoveFromContainer(msgs); | ||
183 | if (newType != null) | ||
184 | msgs = ((InternalEObject) newType).eInverseAdd(this, CpsPackage.APPLICATION_TYPE__INSTANCES, | ||
185 | ApplicationType.class, msgs); | ||
186 | msgs = basicSetType(newType, msgs); | ||
187 | if (msgs != null) | ||
188 | msgs.dispatch(); | ||
189 | } else if (eNotificationRequired()) | ||
190 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.APPLICATION_INSTANCE__TYPE, newType, | ||
191 | newType)); | ||
192 | } | ||
193 | |||
194 | /** | ||
195 | * <!-- begin-user-doc --> | ||
196 | * <!-- end-user-doc --> | ||
197 | * @generated | ||
198 | */ | ||
199 | @Override | ||
200 | public HostInstance getAllocatedTo() { | ||
201 | if (allocatedTo != null && allocatedTo.eIsProxy()) { | ||
202 | InternalEObject oldAllocatedTo = (InternalEObject) allocatedTo; | ||
203 | allocatedTo = (HostInstance) eResolveProxy(oldAllocatedTo); | ||
204 | if (allocatedTo != oldAllocatedTo) { | ||
205 | if (eNotificationRequired()) | ||
206 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, | ||
207 | CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO, oldAllocatedTo, allocatedTo)); | ||
208 | } | ||
209 | } | ||
210 | return allocatedTo; | ||
211 | } | ||
212 | |||
213 | /** | ||
214 | * <!-- begin-user-doc --> | ||
215 | * <!-- end-user-doc --> | ||
216 | * @generated | ||
217 | */ | ||
218 | public HostInstance basicGetAllocatedTo() { | ||
219 | return allocatedTo; | ||
220 | } | ||
221 | |||
222 | /** | ||
223 | * <!-- begin-user-doc --> | ||
224 | * <!-- end-user-doc --> | ||
225 | * @generated | ||
226 | */ | ||
227 | public NotificationChain basicSetAllocatedTo(HostInstance newAllocatedTo, NotificationChain msgs) { | ||
228 | HostInstance oldAllocatedTo = allocatedTo; | ||
229 | allocatedTo = newAllocatedTo; | ||
230 | if (eNotificationRequired()) { | ||
231 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, | ||
232 | CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO, oldAllocatedTo, newAllocatedTo); | ||
233 | if (msgs == null) | ||
234 | msgs = notification; | ||
235 | else | ||
236 | msgs.add(notification); | ||
237 | } | ||
238 | return msgs; | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * <!-- begin-user-doc --> | ||
243 | * <!-- end-user-doc --> | ||
244 | * @generated | ||
245 | */ | ||
246 | @Override | ||
247 | public void setAllocatedTo(HostInstance newAllocatedTo) { | ||
248 | if (newAllocatedTo != allocatedTo) { | ||
249 | NotificationChain msgs = null; | ||
250 | if (allocatedTo != null) | ||
251 | msgs = ((InternalEObject) allocatedTo).eInverseRemove(this, CpsPackage.HOST_INSTANCE__APPLICATIONS, | ||
252 | HostInstance.class, msgs); | ||
253 | if (newAllocatedTo != null) | ||
254 | msgs = ((InternalEObject) newAllocatedTo).eInverseAdd(this, CpsPackage.HOST_INSTANCE__APPLICATIONS, | ||
255 | HostInstance.class, msgs); | ||
256 | msgs = basicSetAllocatedTo(newAllocatedTo, msgs); | ||
257 | if (msgs != null) | ||
258 | msgs.dispatch(); | ||
259 | } else if (eNotificationRequired()) | ||
260 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO, | ||
261 | newAllocatedTo, newAllocatedTo)); | ||
262 | } | ||
263 | |||
264 | /** | ||
265 | * <!-- begin-user-doc --> | ||
266 | * <!-- end-user-doc --> | ||
267 | * @generated | ||
268 | */ | ||
269 | @Override | ||
270 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
271 | switch (featureID) { | ||
272 | case CpsPackage.APPLICATION_INSTANCE__REQUIREMENT: | ||
273 | if (requirement != null) | ||
274 | msgs = ((InternalEObject) requirement).eInverseRemove(this, CpsPackage.REQUIREMENT__INSTANCES, | ||
275 | Requirement.class, msgs); | ||
276 | return basicSetRequirement((Requirement) otherEnd, msgs); | ||
277 | case CpsPackage.APPLICATION_INSTANCE__TYPE: | ||
278 | if (eInternalContainer() != null) | ||
279 | msgs = eBasicRemoveFromContainer(msgs); | ||
280 | return basicSetType((ApplicationType) otherEnd, msgs); | ||
281 | case CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO: | ||
282 | if (allocatedTo != null) | ||
283 | msgs = ((InternalEObject) allocatedTo).eInverseRemove(this, CpsPackage.HOST_INSTANCE__APPLICATIONS, | ||
284 | HostInstance.class, msgs); | ||
285 | return basicSetAllocatedTo((HostInstance) otherEnd, msgs); | ||
286 | } | ||
287 | return super.eInverseAdd(otherEnd, featureID, msgs); | ||
288 | } | ||
289 | |||
290 | /** | ||
291 | * <!-- begin-user-doc --> | ||
292 | * <!-- end-user-doc --> | ||
293 | * @generated | ||
294 | */ | ||
295 | @Override | ||
296 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
297 | switch (featureID) { | ||
298 | case CpsPackage.APPLICATION_INSTANCE__REQUIREMENT: | ||
299 | return basicSetRequirement(null, msgs); | ||
300 | case CpsPackage.APPLICATION_INSTANCE__TYPE: | ||
301 | return basicSetType(null, msgs); | ||
302 | case CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO: | ||
303 | return basicSetAllocatedTo(null, msgs); | ||
304 | } | ||
305 | return super.eInverseRemove(otherEnd, featureID, msgs); | ||
306 | } | ||
307 | |||
308 | /** | ||
309 | * <!-- begin-user-doc --> | ||
310 | * <!-- end-user-doc --> | ||
311 | * @generated | ||
312 | */ | ||
313 | @Override | ||
314 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { | ||
315 | switch (eContainerFeatureID()) { | ||
316 | case CpsPackage.APPLICATION_INSTANCE__TYPE: | ||
317 | return eInternalContainer().eInverseRemove(this, CpsPackage.APPLICATION_TYPE__INSTANCES, | ||
318 | ApplicationType.class, msgs); | ||
319 | } | ||
320 | return super.eBasicRemoveFromContainerFeature(msgs); | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * <!-- begin-user-doc --> | ||
325 | * <!-- end-user-doc --> | ||
326 | * @generated | ||
327 | */ | ||
328 | @Override | ||
329 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
330 | switch (featureID) { | ||
331 | case CpsPackage.APPLICATION_INSTANCE__REQUIREMENT: | ||
332 | if (resolve) | ||
333 | return getRequirement(); | ||
334 | return basicGetRequirement(); | ||
335 | case CpsPackage.APPLICATION_INSTANCE__TYPE: | ||
336 | return getType(); | ||
337 | case CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO: | ||
338 | if (resolve) | ||
339 | return getAllocatedTo(); | ||
340 | return basicGetAllocatedTo(); | ||
341 | } | ||
342 | return super.eGet(featureID, resolve, coreType); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * <!-- begin-user-doc --> | ||
347 | * <!-- end-user-doc --> | ||
348 | * @generated | ||
349 | */ | ||
350 | @Override | ||
351 | public void eSet(int featureID, Object newValue) { | ||
352 | switch (featureID) { | ||
353 | case CpsPackage.APPLICATION_INSTANCE__REQUIREMENT: | ||
354 | setRequirement((Requirement) newValue); | ||
355 | return; | ||
356 | case CpsPackage.APPLICATION_INSTANCE__TYPE: | ||
357 | setType((ApplicationType) newValue); | ||
358 | return; | ||
359 | case CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO: | ||
360 | setAllocatedTo((HostInstance) newValue); | ||
361 | return; | ||
362 | } | ||
363 | super.eSet(featureID, newValue); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * <!-- begin-user-doc --> | ||
368 | * <!-- end-user-doc --> | ||
369 | * @generated | ||
370 | */ | ||
371 | @Override | ||
372 | public void eUnset(int featureID) { | ||
373 | switch (featureID) { | ||
374 | case CpsPackage.APPLICATION_INSTANCE__REQUIREMENT: | ||
375 | setRequirement((Requirement) null); | ||
376 | return; | ||
377 | case CpsPackage.APPLICATION_INSTANCE__TYPE: | ||
378 | setType((ApplicationType) null); | ||
379 | return; | ||
380 | case CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO: | ||
381 | setAllocatedTo((HostInstance) null); | ||
382 | return; | ||
383 | } | ||
384 | super.eUnset(featureID); | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * <!-- begin-user-doc --> | ||
389 | * <!-- end-user-doc --> | ||
390 | * @generated | ||
391 | */ | ||
392 | @Override | ||
393 | public boolean eIsSet(int featureID) { | ||
394 | switch (featureID) { | ||
395 | case CpsPackage.APPLICATION_INSTANCE__REQUIREMENT: | ||
396 | return requirement != null; | ||
397 | case CpsPackage.APPLICATION_INSTANCE__TYPE: | ||
398 | return getType() != null; | ||
399 | case CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO: | ||
400 | return allocatedTo != null; | ||
401 | } | ||
402 | return super.eIsSet(featureID); | ||
403 | } | ||
404 | |||
405 | } //ApplicationInstanceImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/ApplicationTypeImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/ApplicationTypeImpl.java new file mode 100644 index 00000000..f8793e30 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/ApplicationTypeImpl.java | |||
@@ -0,0 +1,209 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement; | ||
9 | |||
10 | import java.util.Collection; | ||
11 | |||
12 | import org.eclipse.emf.common.notify.NotificationChain; | ||
13 | |||
14 | import org.eclipse.emf.common.util.EList; | ||
15 | |||
16 | import org.eclipse.emf.ecore.EClass; | ||
17 | import org.eclipse.emf.ecore.InternalEObject; | ||
18 | |||
19 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
20 | |||
21 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; | ||
22 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; | ||
23 | import org.eclipse.emf.ecore.util.InternalEList; | ||
24 | |||
25 | /** | ||
26 | * <!-- begin-user-doc --> | ||
27 | * An implementation of the model object '<em><b>Application Type</b></em>'. | ||
28 | * <!-- end-user-doc --> | ||
29 | * <p> | ||
30 | * The following features are implemented: | ||
31 | * </p> | ||
32 | * <ul> | ||
33 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationTypeImpl#getInstances <em>Instances</em>}</li> | ||
34 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ApplicationTypeImpl#getRequirements <em>Requirements</em>}</li> | ||
35 | * </ul> | ||
36 | * | ||
37 | * @generated | ||
38 | */ | ||
39 | public class ApplicationTypeImpl extends MinimalEObjectImpl.Container implements ApplicationType { | ||
40 | /** | ||
41 | * The cached value of the '{@link #getInstances() <em>Instances</em>}' containment reference list. | ||
42 | * <!-- begin-user-doc --> | ||
43 | * <!-- end-user-doc --> | ||
44 | * @see #getInstances() | ||
45 | * @generated | ||
46 | * @ordered | ||
47 | */ | ||
48 | protected EList<ApplicationInstance> instances; | ||
49 | |||
50 | /** | ||
51 | * The cached value of the '{@link #getRequirements() <em>Requirements</em>}' containment reference list. | ||
52 | * <!-- begin-user-doc --> | ||
53 | * <!-- end-user-doc --> | ||
54 | * @see #getRequirements() | ||
55 | * @generated | ||
56 | * @ordered | ||
57 | */ | ||
58 | protected EList<ResourceRequirement> requirements; | ||
59 | |||
60 | /** | ||
61 | * <!-- begin-user-doc --> | ||
62 | * <!-- end-user-doc --> | ||
63 | * @generated | ||
64 | */ | ||
65 | protected ApplicationTypeImpl() { | ||
66 | super(); | ||
67 | } | ||
68 | |||
69 | /** | ||
70 | * <!-- begin-user-doc --> | ||
71 | * <!-- end-user-doc --> | ||
72 | * @generated | ||
73 | */ | ||
74 | @Override | ||
75 | protected EClass eStaticClass() { | ||
76 | return CpsPackage.Literals.APPLICATION_TYPE; | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * <!-- begin-user-doc --> | ||
81 | * <!-- end-user-doc --> | ||
82 | * @generated | ||
83 | */ | ||
84 | @Override | ||
85 | public EList<ApplicationInstance> getInstances() { | ||
86 | if (instances == null) { | ||
87 | instances = new EObjectContainmentWithInverseEList<ApplicationInstance>(ApplicationInstance.class, this, | ||
88 | CpsPackage.APPLICATION_TYPE__INSTANCES, CpsPackage.APPLICATION_INSTANCE__TYPE); | ||
89 | } | ||
90 | return instances; | ||
91 | } | ||
92 | |||
93 | /** | ||
94 | * <!-- begin-user-doc --> | ||
95 | * <!-- end-user-doc --> | ||
96 | * @generated | ||
97 | */ | ||
98 | @Override | ||
99 | public EList<ResourceRequirement> getRequirements() { | ||
100 | if (requirements == null) { | ||
101 | requirements = new EObjectContainmentEList<ResourceRequirement>(ResourceRequirement.class, this, | ||
102 | CpsPackage.APPLICATION_TYPE__REQUIREMENTS); | ||
103 | } | ||
104 | return requirements; | ||
105 | } | ||
106 | |||
107 | /** | ||
108 | * <!-- begin-user-doc --> | ||
109 | * <!-- end-user-doc --> | ||
110 | * @generated | ||
111 | */ | ||
112 | @SuppressWarnings("unchecked") | ||
113 | @Override | ||
114 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
115 | switch (featureID) { | ||
116 | case CpsPackage.APPLICATION_TYPE__INSTANCES: | ||
117 | return ((InternalEList<InternalEObject>) (InternalEList<?>) getInstances()).basicAdd(otherEnd, msgs); | ||
118 | } | ||
119 | return super.eInverseAdd(otherEnd, featureID, msgs); | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * <!-- begin-user-doc --> | ||
124 | * <!-- end-user-doc --> | ||
125 | * @generated | ||
126 | */ | ||
127 | @Override | ||
128 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
129 | switch (featureID) { | ||
130 | case CpsPackage.APPLICATION_TYPE__INSTANCES: | ||
131 | return ((InternalEList<?>) getInstances()).basicRemove(otherEnd, msgs); | ||
132 | case CpsPackage.APPLICATION_TYPE__REQUIREMENTS: | ||
133 | return ((InternalEList<?>) getRequirements()).basicRemove(otherEnd, msgs); | ||
134 | } | ||
135 | return super.eInverseRemove(otherEnd, featureID, msgs); | ||
136 | } | ||
137 | |||
138 | /** | ||
139 | * <!-- begin-user-doc --> | ||
140 | * <!-- end-user-doc --> | ||
141 | * @generated | ||
142 | */ | ||
143 | @Override | ||
144 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
145 | switch (featureID) { | ||
146 | case CpsPackage.APPLICATION_TYPE__INSTANCES: | ||
147 | return getInstances(); | ||
148 | case CpsPackage.APPLICATION_TYPE__REQUIREMENTS: | ||
149 | return getRequirements(); | ||
150 | } | ||
151 | return super.eGet(featureID, resolve, coreType); | ||
152 | } | ||
153 | |||
154 | /** | ||
155 | * <!-- begin-user-doc --> | ||
156 | * <!-- end-user-doc --> | ||
157 | * @generated | ||
158 | */ | ||
159 | @SuppressWarnings("unchecked") | ||
160 | @Override | ||
161 | public void eSet(int featureID, Object newValue) { | ||
162 | switch (featureID) { | ||
163 | case CpsPackage.APPLICATION_TYPE__INSTANCES: | ||
164 | getInstances().clear(); | ||
165 | getInstances().addAll((Collection<? extends ApplicationInstance>) newValue); | ||
166 | return; | ||
167 | case CpsPackage.APPLICATION_TYPE__REQUIREMENTS: | ||
168 | getRequirements().clear(); | ||
169 | getRequirements().addAll((Collection<? extends ResourceRequirement>) newValue); | ||
170 | return; | ||
171 | } | ||
172 | super.eSet(featureID, newValue); | ||
173 | } | ||
174 | |||
175 | /** | ||
176 | * <!-- begin-user-doc --> | ||
177 | * <!-- end-user-doc --> | ||
178 | * @generated | ||
179 | */ | ||
180 | @Override | ||
181 | public void eUnset(int featureID) { | ||
182 | switch (featureID) { | ||
183 | case CpsPackage.APPLICATION_TYPE__INSTANCES: | ||
184 | getInstances().clear(); | ||
185 | return; | ||
186 | case CpsPackage.APPLICATION_TYPE__REQUIREMENTS: | ||
187 | getRequirements().clear(); | ||
188 | return; | ||
189 | } | ||
190 | super.eUnset(featureID); | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * <!-- begin-user-doc --> | ||
195 | * <!-- end-user-doc --> | ||
196 | * @generated | ||
197 | */ | ||
198 | @Override | ||
199 | public boolean eIsSet(int featureID) { | ||
200 | switch (featureID) { | ||
201 | case CpsPackage.APPLICATION_TYPE__INSTANCES: | ||
202 | return instances != null && !instances.isEmpty(); | ||
203 | case CpsPackage.APPLICATION_TYPE__REQUIREMENTS: | ||
204 | return requirements != null && !requirements.isEmpty(); | ||
205 | } | ||
206 | return super.eIsSet(featureID); | ||
207 | } | ||
208 | |||
209 | } //ApplicationTypeImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/CpsFactoryImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/CpsFactoryImpl.java new file mode 100644 index 00000000..110f5abb --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/CpsFactoryImpl.java | |||
@@ -0,0 +1,188 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.*; | ||
6 | |||
7 | import org.eclipse.emf.ecore.EClass; | ||
8 | import org.eclipse.emf.ecore.EObject; | ||
9 | import org.eclipse.emf.ecore.EPackage; | ||
10 | |||
11 | import org.eclipse.emf.ecore.impl.EFactoryImpl; | ||
12 | |||
13 | import org.eclipse.emf.ecore.plugin.EcorePlugin; | ||
14 | |||
15 | /** | ||
16 | * <!-- begin-user-doc --> | ||
17 | * An implementation of the model <b>Factory</b>. | ||
18 | * <!-- end-user-doc --> | ||
19 | * @generated | ||
20 | */ | ||
21 | public class CpsFactoryImpl extends EFactoryImpl implements CpsFactory { | ||
22 | /** | ||
23 | * Creates the default factory implementation. | ||
24 | * <!-- begin-user-doc --> | ||
25 | * <!-- end-user-doc --> | ||
26 | * @generated | ||
27 | */ | ||
28 | public static CpsFactory init() { | ||
29 | try { | ||
30 | CpsFactory theCpsFactory = (CpsFactory) EPackage.Registry.INSTANCE.getEFactory(CpsPackage.eNS_URI); | ||
31 | if (theCpsFactory != null) { | ||
32 | return theCpsFactory; | ||
33 | } | ||
34 | } catch (Exception exception) { | ||
35 | EcorePlugin.INSTANCE.log(exception); | ||
36 | } | ||
37 | return new CpsFactoryImpl(); | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * Creates an instance of the factory. | ||
42 | * <!-- begin-user-doc --> | ||
43 | * <!-- end-user-doc --> | ||
44 | * @generated | ||
45 | */ | ||
46 | public CpsFactoryImpl() { | ||
47 | super(); | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * <!-- begin-user-doc --> | ||
52 | * <!-- end-user-doc --> | ||
53 | * @generated | ||
54 | */ | ||
55 | @Override | ||
56 | public EObject create(EClass eClass) { | ||
57 | switch (eClass.getClassifierID()) { | ||
58 | case CpsPackage.CYBER_PHYSICAL_SYSTEM: | ||
59 | return createCyberPhysicalSystem(); | ||
60 | case CpsPackage.APPLICATION_TYPE: | ||
61 | return createApplicationType(); | ||
62 | case CpsPackage.HOST_TYPE: | ||
63 | return createHostType(); | ||
64 | case CpsPackage.REQUEST: | ||
65 | return createRequest(); | ||
66 | case CpsPackage.REQUIREMENT: | ||
67 | return createRequirement(); | ||
68 | case CpsPackage.APPLICATION_INSTANCE: | ||
69 | return createApplicationInstance(); | ||
70 | case CpsPackage.RESOURCE_REQUIREMENT: | ||
71 | return createResourceRequirement(); | ||
72 | case CpsPackage.HOST_INSTANCE: | ||
73 | return createHostInstance(); | ||
74 | default: | ||
75 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * <!-- begin-user-doc --> | ||
81 | * <!-- end-user-doc --> | ||
82 | * @generated | ||
83 | */ | ||
84 | @Override | ||
85 | public CyberPhysicalSystem createCyberPhysicalSystem() { | ||
86 | CyberPhysicalSystemImpl cyberPhysicalSystem = new CyberPhysicalSystemImpl(); | ||
87 | return cyberPhysicalSystem; | ||
88 | } | ||
89 | |||
90 | /** | ||
91 | * <!-- begin-user-doc --> | ||
92 | * <!-- end-user-doc --> | ||
93 | * @generated | ||
94 | */ | ||
95 | @Override | ||
96 | public ApplicationType createApplicationType() { | ||
97 | ApplicationTypeImpl applicationType = new ApplicationTypeImpl(); | ||
98 | return applicationType; | ||
99 | } | ||
100 | |||
101 | /** | ||
102 | * <!-- begin-user-doc --> | ||
103 | * <!-- end-user-doc --> | ||
104 | * @generated | ||
105 | */ | ||
106 | @Override | ||
107 | public HostType createHostType() { | ||
108 | HostTypeImpl hostType = new HostTypeImpl(); | ||
109 | return hostType; | ||
110 | } | ||
111 | |||
112 | /** | ||
113 | * <!-- begin-user-doc --> | ||
114 | * <!-- end-user-doc --> | ||
115 | * @generated | ||
116 | */ | ||
117 | @Override | ||
118 | public Request createRequest() { | ||
119 | RequestImpl request = new RequestImpl(); | ||
120 | return request; | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * <!-- begin-user-doc --> | ||
125 | * <!-- end-user-doc --> | ||
126 | * @generated | ||
127 | */ | ||
128 | @Override | ||
129 | public Requirement createRequirement() { | ||
130 | RequirementImpl requirement = new RequirementImpl(); | ||
131 | return requirement; | ||
132 | } | ||
133 | |||
134 | /** | ||
135 | * <!-- begin-user-doc --> | ||
136 | * <!-- end-user-doc --> | ||
137 | * @generated | ||
138 | */ | ||
139 | @Override | ||
140 | public ApplicationInstance createApplicationInstance() { | ||
141 | ApplicationInstanceImpl applicationInstance = new ApplicationInstanceImpl(); | ||
142 | return applicationInstance; | ||
143 | } | ||
144 | |||
145 | /** | ||
146 | * <!-- begin-user-doc --> | ||
147 | * <!-- end-user-doc --> | ||
148 | * @generated | ||
149 | */ | ||
150 | @Override | ||
151 | public ResourceRequirement createResourceRequirement() { | ||
152 | ResourceRequirementImpl resourceRequirement = new ResourceRequirementImpl(); | ||
153 | return resourceRequirement; | ||
154 | } | ||
155 | |||
156 | /** | ||
157 | * <!-- begin-user-doc --> | ||
158 | * <!-- end-user-doc --> | ||
159 | * @generated | ||
160 | */ | ||
161 | @Override | ||
162 | public HostInstance createHostInstance() { | ||
163 | HostInstanceImpl hostInstance = new HostInstanceImpl(); | ||
164 | return hostInstance; | ||
165 | } | ||
166 | |||
167 | /** | ||
168 | * <!-- begin-user-doc --> | ||
169 | * <!-- end-user-doc --> | ||
170 | * @generated | ||
171 | */ | ||
172 | @Override | ||
173 | public CpsPackage getCpsPackage() { | ||
174 | return (CpsPackage) getEPackage(); | ||
175 | } | ||
176 | |||
177 | /** | ||
178 | * <!-- begin-user-doc --> | ||
179 | * <!-- end-user-doc --> | ||
180 | * @deprecated | ||
181 | * @generated | ||
182 | */ | ||
183 | @Deprecated | ||
184 | public static CpsPackage getPackage() { | ||
185 | return CpsPackage.eINSTANCE; | ||
186 | } | ||
187 | |||
188 | } //CpsFactoryImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/CpsPackageImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/CpsPackageImpl.java new file mode 100644 index 00000000..e29ccccd --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/CpsPackageImpl.java | |||
@@ -0,0 +1,643 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsFactory; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem; | ||
10 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
11 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType; | ||
12 | import hu.bme.mit.inf.dslreasoner.domains.cps.Request; | ||
13 | import hu.bme.mit.inf.dslreasoner.domains.cps.Requirement; | ||
14 | import hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement; | ||
15 | |||
16 | import org.eclipse.emf.ecore.EAttribute; | ||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.emf.ecore.EPackage; | ||
19 | import org.eclipse.emf.ecore.EReference; | ||
20 | |||
21 | import org.eclipse.emf.ecore.impl.EPackageImpl; | ||
22 | |||
23 | /** | ||
24 | * <!-- begin-user-doc --> | ||
25 | * An implementation of the model <b>Package</b>. | ||
26 | * <!-- end-user-doc --> | ||
27 | * @generated | ||
28 | */ | ||
29 | public class CpsPackageImpl extends EPackageImpl implements CpsPackage { | ||
30 | /** | ||
31 | * <!-- begin-user-doc --> | ||
32 | * <!-- end-user-doc --> | ||
33 | * @generated | ||
34 | */ | ||
35 | private EClass cyberPhysicalSystemEClass = null; | ||
36 | |||
37 | /** | ||
38 | * <!-- begin-user-doc --> | ||
39 | * <!-- end-user-doc --> | ||
40 | * @generated | ||
41 | */ | ||
42 | private EClass applicationTypeEClass = null; | ||
43 | |||
44 | /** | ||
45 | * <!-- begin-user-doc --> | ||
46 | * <!-- end-user-doc --> | ||
47 | * @generated | ||
48 | */ | ||
49 | private EClass hostTypeEClass = null; | ||
50 | |||
51 | /** | ||
52 | * <!-- begin-user-doc --> | ||
53 | * <!-- end-user-doc --> | ||
54 | * @generated | ||
55 | */ | ||
56 | private EClass requestEClass = null; | ||
57 | |||
58 | /** | ||
59 | * <!-- begin-user-doc --> | ||
60 | * <!-- end-user-doc --> | ||
61 | * @generated | ||
62 | */ | ||
63 | private EClass requirementEClass = null; | ||
64 | |||
65 | /** | ||
66 | * <!-- begin-user-doc --> | ||
67 | * <!-- end-user-doc --> | ||
68 | * @generated | ||
69 | */ | ||
70 | private EClass applicationInstanceEClass = null; | ||
71 | |||
72 | /** | ||
73 | * <!-- begin-user-doc --> | ||
74 | * <!-- end-user-doc --> | ||
75 | * @generated | ||
76 | */ | ||
77 | private EClass resourceRequirementEClass = null; | ||
78 | |||
79 | /** | ||
80 | * <!-- begin-user-doc --> | ||
81 | * <!-- end-user-doc --> | ||
82 | * @generated | ||
83 | */ | ||
84 | private EClass hostInstanceEClass = null; | ||
85 | |||
86 | /** | ||
87 | * Creates an instance of the model <b>Package</b>, registered with | ||
88 | * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package | ||
89 | * package URI value. | ||
90 | * <p>Note: the correct way to create the package is via the static | ||
91 | * factory method {@link #init init()}, which also performs | ||
92 | * initialization of the package, or returns the registered package, | ||
93 | * if one already exists. | ||
94 | * <!-- begin-user-doc --> | ||
95 | * <!-- end-user-doc --> | ||
96 | * @see org.eclipse.emf.ecore.EPackage.Registry | ||
97 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage#eNS_URI | ||
98 | * @see #init() | ||
99 | * @generated | ||
100 | */ | ||
101 | private CpsPackageImpl() { | ||
102 | super(eNS_URI, CpsFactory.eINSTANCE); | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * <!-- begin-user-doc --> | ||
107 | * <!-- end-user-doc --> | ||
108 | * @generated | ||
109 | */ | ||
110 | private static boolean isInited = false; | ||
111 | |||
112 | /** | ||
113 | * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. | ||
114 | * | ||
115 | * <p>This method is used to initialize {@link CpsPackage#eINSTANCE} when that field is accessed. | ||
116 | * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. | ||
117 | * <!-- begin-user-doc --> | ||
118 | * <!-- end-user-doc --> | ||
119 | * @see #eNS_URI | ||
120 | * @see #createPackageContents() | ||
121 | * @see #initializePackageContents() | ||
122 | * @generated | ||
123 | */ | ||
124 | public static CpsPackage init() { | ||
125 | if (isInited) | ||
126 | return (CpsPackage) EPackage.Registry.INSTANCE.getEPackage(CpsPackage.eNS_URI); | ||
127 | |||
128 | // Obtain or create and register package | ||
129 | Object registeredCpsPackage = EPackage.Registry.INSTANCE.get(eNS_URI); | ||
130 | CpsPackageImpl theCpsPackage = registeredCpsPackage instanceof CpsPackageImpl | ||
131 | ? (CpsPackageImpl) registeredCpsPackage | ||
132 | : new CpsPackageImpl(); | ||
133 | |||
134 | isInited = true; | ||
135 | |||
136 | // Create package meta-data objects | ||
137 | theCpsPackage.createPackageContents(); | ||
138 | |||
139 | // Initialize created meta-data | ||
140 | theCpsPackage.initializePackageContents(); | ||
141 | |||
142 | // Mark meta-data to indicate it can't be changed | ||
143 | theCpsPackage.freeze(); | ||
144 | |||
145 | // Update the registry and return the package | ||
146 | EPackage.Registry.INSTANCE.put(CpsPackage.eNS_URI, theCpsPackage); | ||
147 | return theCpsPackage; | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * <!-- begin-user-doc --> | ||
152 | * <!-- end-user-doc --> | ||
153 | * @generated | ||
154 | */ | ||
155 | @Override | ||
156 | public EClass getCyberPhysicalSystem() { | ||
157 | return cyberPhysicalSystemEClass; | ||
158 | } | ||
159 | |||
160 | /** | ||
161 | * <!-- begin-user-doc --> | ||
162 | * <!-- end-user-doc --> | ||
163 | * @generated | ||
164 | */ | ||
165 | @Override | ||
166 | public EReference getCyberPhysicalSystem_Requests() { | ||
167 | return (EReference) cyberPhysicalSystemEClass.getEStructuralFeatures().get(0); | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * <!-- begin-user-doc --> | ||
172 | * <!-- end-user-doc --> | ||
173 | * @generated | ||
174 | */ | ||
175 | @Override | ||
176 | public EReference getCyberPhysicalSystem_ApplicationTypes() { | ||
177 | return (EReference) cyberPhysicalSystemEClass.getEStructuralFeatures().get(1); | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * <!-- begin-user-doc --> | ||
182 | * <!-- end-user-doc --> | ||
183 | * @generated | ||
184 | */ | ||
185 | @Override | ||
186 | public EReference getCyberPhysicalSystem_HostTypes() { | ||
187 | return (EReference) cyberPhysicalSystemEClass.getEStructuralFeatures().get(2); | ||
188 | } | ||
189 | |||
190 | /** | ||
191 | * <!-- begin-user-doc --> | ||
192 | * <!-- end-user-doc --> | ||
193 | * @generated | ||
194 | */ | ||
195 | @Override | ||
196 | public EClass getApplicationType() { | ||
197 | return applicationTypeEClass; | ||
198 | } | ||
199 | |||
200 | /** | ||
201 | * <!-- begin-user-doc --> | ||
202 | * <!-- end-user-doc --> | ||
203 | * @generated | ||
204 | */ | ||
205 | @Override | ||
206 | public EReference getApplicationType_Instances() { | ||
207 | return (EReference) applicationTypeEClass.getEStructuralFeatures().get(0); | ||
208 | } | ||
209 | |||
210 | /** | ||
211 | * <!-- begin-user-doc --> | ||
212 | * <!-- end-user-doc --> | ||
213 | * @generated | ||
214 | */ | ||
215 | @Override | ||
216 | public EReference getApplicationType_Requirements() { | ||
217 | return (EReference) applicationTypeEClass.getEStructuralFeatures().get(1); | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * <!-- begin-user-doc --> | ||
222 | * <!-- end-user-doc --> | ||
223 | * @generated | ||
224 | */ | ||
225 | @Override | ||
226 | public EClass getHostType() { | ||
227 | return hostTypeEClass; | ||
228 | } | ||
229 | |||
230 | /** | ||
231 | * <!-- begin-user-doc --> | ||
232 | * <!-- end-user-doc --> | ||
233 | * @generated | ||
234 | */ | ||
235 | @Override | ||
236 | public EAttribute getHostType_DefaultMemory() { | ||
237 | return (EAttribute) hostTypeEClass.getEStructuralFeatures().get(0); | ||
238 | } | ||
239 | |||
240 | /** | ||
241 | * <!-- begin-user-doc --> | ||
242 | * <!-- end-user-doc --> | ||
243 | * @generated | ||
244 | */ | ||
245 | @Override | ||
246 | public EAttribute getHostType_DefaultHdd() { | ||
247 | return (EAttribute) hostTypeEClass.getEStructuralFeatures().get(1); | ||
248 | } | ||
249 | |||
250 | /** | ||
251 | * <!-- begin-user-doc --> | ||
252 | * <!-- end-user-doc --> | ||
253 | * @generated | ||
254 | */ | ||
255 | @Override | ||
256 | public EReference getHostType_Instances() { | ||
257 | return (EReference) hostTypeEClass.getEStructuralFeatures().get(2); | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * <!-- begin-user-doc --> | ||
262 | * <!-- end-user-doc --> | ||
263 | * @generated | ||
264 | */ | ||
265 | @Override | ||
266 | public EAttribute getHostType_Cost() { | ||
267 | return (EAttribute) hostTypeEClass.getEStructuralFeatures().get(3); | ||
268 | } | ||
269 | |||
270 | /** | ||
271 | * <!-- begin-user-doc --> | ||
272 | * <!-- end-user-doc --> | ||
273 | * @generated | ||
274 | */ | ||
275 | @Override | ||
276 | public EClass getRequest() { | ||
277 | return requestEClass; | ||
278 | } | ||
279 | |||
280 | /** | ||
281 | * <!-- begin-user-doc --> | ||
282 | * <!-- end-user-doc --> | ||
283 | * @generated | ||
284 | */ | ||
285 | @Override | ||
286 | public EReference getRequest_Requirements() { | ||
287 | return (EReference) requestEClass.getEStructuralFeatures().get(0); | ||
288 | } | ||
289 | |||
290 | /** | ||
291 | * <!-- begin-user-doc --> | ||
292 | * <!-- end-user-doc --> | ||
293 | * @generated | ||
294 | */ | ||
295 | @Override | ||
296 | public EClass getRequirement() { | ||
297 | return requirementEClass; | ||
298 | } | ||
299 | |||
300 | /** | ||
301 | * <!-- begin-user-doc --> | ||
302 | * <!-- end-user-doc --> | ||
303 | * @generated | ||
304 | */ | ||
305 | @Override | ||
306 | public EReference getRequirement_Request() { | ||
307 | return (EReference) requirementEClass.getEStructuralFeatures().get(0); | ||
308 | } | ||
309 | |||
310 | /** | ||
311 | * <!-- begin-user-doc --> | ||
312 | * <!-- end-user-doc --> | ||
313 | * @generated | ||
314 | */ | ||
315 | @Override | ||
316 | public EAttribute getRequirement_Count() { | ||
317 | return (EAttribute) requirementEClass.getEStructuralFeatures().get(1); | ||
318 | } | ||
319 | |||
320 | /** | ||
321 | * <!-- begin-user-doc --> | ||
322 | * <!-- end-user-doc --> | ||
323 | * @generated | ||
324 | */ | ||
325 | @Override | ||
326 | public EReference getRequirement_Type() { | ||
327 | return (EReference) requirementEClass.getEStructuralFeatures().get(2); | ||
328 | } | ||
329 | |||
330 | /** | ||
331 | * <!-- begin-user-doc --> | ||
332 | * <!-- end-user-doc --> | ||
333 | * @generated | ||
334 | */ | ||
335 | @Override | ||
336 | public EReference getRequirement_Instances() { | ||
337 | return (EReference) requirementEClass.getEStructuralFeatures().get(3); | ||
338 | } | ||
339 | |||
340 | /** | ||
341 | * <!-- begin-user-doc --> | ||
342 | * <!-- end-user-doc --> | ||
343 | * @generated | ||
344 | */ | ||
345 | @Override | ||
346 | public EClass getApplicationInstance() { | ||
347 | return applicationInstanceEClass; | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * <!-- begin-user-doc --> | ||
352 | * <!-- end-user-doc --> | ||
353 | * @generated | ||
354 | */ | ||
355 | @Override | ||
356 | public EReference getApplicationInstance_Requirement() { | ||
357 | return (EReference) applicationInstanceEClass.getEStructuralFeatures().get(0); | ||
358 | } | ||
359 | |||
360 | /** | ||
361 | * <!-- begin-user-doc --> | ||
362 | * <!-- end-user-doc --> | ||
363 | * @generated | ||
364 | */ | ||
365 | @Override | ||
366 | public EReference getApplicationInstance_Type() { | ||
367 | return (EReference) applicationInstanceEClass.getEStructuralFeatures().get(1); | ||
368 | } | ||
369 | |||
370 | /** | ||
371 | * <!-- begin-user-doc --> | ||
372 | * <!-- end-user-doc --> | ||
373 | * @generated | ||
374 | */ | ||
375 | @Override | ||
376 | public EReference getApplicationInstance_AllocatedTo() { | ||
377 | return (EReference) applicationInstanceEClass.getEStructuralFeatures().get(2); | ||
378 | } | ||
379 | |||
380 | /** | ||
381 | * <!-- begin-user-doc --> | ||
382 | * <!-- end-user-doc --> | ||
383 | * @generated | ||
384 | */ | ||
385 | @Override | ||
386 | public EClass getResourceRequirement() { | ||
387 | return resourceRequirementEClass; | ||
388 | } | ||
389 | |||
390 | /** | ||
391 | * <!-- begin-user-doc --> | ||
392 | * <!-- end-user-doc --> | ||
393 | * @generated | ||
394 | */ | ||
395 | @Override | ||
396 | public EAttribute getResourceRequirement_RequiredMemory() { | ||
397 | return (EAttribute) resourceRequirementEClass.getEStructuralFeatures().get(0); | ||
398 | } | ||
399 | |||
400 | /** | ||
401 | * <!-- begin-user-doc --> | ||
402 | * <!-- end-user-doc --> | ||
403 | * @generated | ||
404 | */ | ||
405 | @Override | ||
406 | public EAttribute getResourceRequirement_RequiredHdd() { | ||
407 | return (EAttribute) resourceRequirementEClass.getEStructuralFeatures().get(1); | ||
408 | } | ||
409 | |||
410 | /** | ||
411 | * <!-- begin-user-doc --> | ||
412 | * <!-- end-user-doc --> | ||
413 | * @generated | ||
414 | */ | ||
415 | @Override | ||
416 | public EReference getResourceRequirement_HostType() { | ||
417 | return (EReference) resourceRequirementEClass.getEStructuralFeatures().get(2); | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * <!-- begin-user-doc --> | ||
422 | * <!-- end-user-doc --> | ||
423 | * @generated | ||
424 | */ | ||
425 | @Override | ||
426 | public EClass getHostInstance() { | ||
427 | return hostInstanceEClass; | ||
428 | } | ||
429 | |||
430 | /** | ||
431 | * <!-- begin-user-doc --> | ||
432 | * <!-- end-user-doc --> | ||
433 | * @generated | ||
434 | */ | ||
435 | @Override | ||
436 | public EReference getHostInstance_Type() { | ||
437 | return (EReference) hostInstanceEClass.getEStructuralFeatures().get(0); | ||
438 | } | ||
439 | |||
440 | /** | ||
441 | * <!-- begin-user-doc --> | ||
442 | * <!-- end-user-doc --> | ||
443 | * @generated | ||
444 | */ | ||
445 | @Override | ||
446 | public EReference getHostInstance_Applications() { | ||
447 | return (EReference) hostInstanceEClass.getEStructuralFeatures().get(1); | ||
448 | } | ||
449 | |||
450 | /** | ||
451 | * <!-- begin-user-doc --> | ||
452 | * <!-- end-user-doc --> | ||
453 | * @generated | ||
454 | */ | ||
455 | @Override | ||
456 | public CpsFactory getCpsFactory() { | ||
457 | return (CpsFactory) getEFactoryInstance(); | ||
458 | } | ||
459 | |||
460 | /** | ||
461 | * <!-- begin-user-doc --> | ||
462 | * <!-- end-user-doc --> | ||
463 | * @generated | ||
464 | */ | ||
465 | private boolean isCreated = false; | ||
466 | |||
467 | /** | ||
468 | * Creates the meta-model objects for the package. This method is | ||
469 | * guarded to have no affect on any invocation but its first. | ||
470 | * <!-- begin-user-doc --> | ||
471 | * <!-- end-user-doc --> | ||
472 | * @generated | ||
473 | */ | ||
474 | public void createPackageContents() { | ||
475 | if (isCreated) | ||
476 | return; | ||
477 | isCreated = true; | ||
478 | |||
479 | // Create classes and their features | ||
480 | cyberPhysicalSystemEClass = createEClass(CYBER_PHYSICAL_SYSTEM); | ||
481 | createEReference(cyberPhysicalSystemEClass, CYBER_PHYSICAL_SYSTEM__REQUESTS); | ||
482 | createEReference(cyberPhysicalSystemEClass, CYBER_PHYSICAL_SYSTEM__APPLICATION_TYPES); | ||
483 | createEReference(cyberPhysicalSystemEClass, CYBER_PHYSICAL_SYSTEM__HOST_TYPES); | ||
484 | |||
485 | applicationTypeEClass = createEClass(APPLICATION_TYPE); | ||
486 | createEReference(applicationTypeEClass, APPLICATION_TYPE__INSTANCES); | ||
487 | createEReference(applicationTypeEClass, APPLICATION_TYPE__REQUIREMENTS); | ||
488 | |||
489 | hostTypeEClass = createEClass(HOST_TYPE); | ||
490 | createEAttribute(hostTypeEClass, HOST_TYPE__DEFAULT_MEMORY); | ||
491 | createEAttribute(hostTypeEClass, HOST_TYPE__DEFAULT_HDD); | ||
492 | createEReference(hostTypeEClass, HOST_TYPE__INSTANCES); | ||
493 | createEAttribute(hostTypeEClass, HOST_TYPE__COST); | ||
494 | |||
495 | requestEClass = createEClass(REQUEST); | ||
496 | createEReference(requestEClass, REQUEST__REQUIREMENTS); | ||
497 | |||
498 | requirementEClass = createEClass(REQUIREMENT); | ||
499 | createEReference(requirementEClass, REQUIREMENT__REQUEST); | ||
500 | createEAttribute(requirementEClass, REQUIREMENT__COUNT); | ||
501 | createEReference(requirementEClass, REQUIREMENT__TYPE); | ||
502 | createEReference(requirementEClass, REQUIREMENT__INSTANCES); | ||
503 | |||
504 | applicationInstanceEClass = createEClass(APPLICATION_INSTANCE); | ||
505 | createEReference(applicationInstanceEClass, APPLICATION_INSTANCE__REQUIREMENT); | ||
506 | createEReference(applicationInstanceEClass, APPLICATION_INSTANCE__TYPE); | ||
507 | createEReference(applicationInstanceEClass, APPLICATION_INSTANCE__ALLOCATED_TO); | ||
508 | |||
509 | resourceRequirementEClass = createEClass(RESOURCE_REQUIREMENT); | ||
510 | createEAttribute(resourceRequirementEClass, RESOURCE_REQUIREMENT__REQUIRED_MEMORY); | ||
511 | createEAttribute(resourceRequirementEClass, RESOURCE_REQUIREMENT__REQUIRED_HDD); | ||
512 | createEReference(resourceRequirementEClass, RESOURCE_REQUIREMENT__HOST_TYPE); | ||
513 | |||
514 | hostInstanceEClass = createEClass(HOST_INSTANCE); | ||
515 | createEReference(hostInstanceEClass, HOST_INSTANCE__TYPE); | ||
516 | createEReference(hostInstanceEClass, HOST_INSTANCE__APPLICATIONS); | ||
517 | } | ||
518 | |||
519 | /** | ||
520 | * <!-- begin-user-doc --> | ||
521 | * <!-- end-user-doc --> | ||
522 | * @generated | ||
523 | */ | ||
524 | private boolean isInitialized = false; | ||
525 | |||
526 | /** | ||
527 | * Complete the initialization of the package and its meta-model. This | ||
528 | * method is guarded to have no affect on any invocation but its first. | ||
529 | * <!-- begin-user-doc --> | ||
530 | * <!-- end-user-doc --> | ||
531 | * @generated | ||
532 | */ | ||
533 | public void initializePackageContents() { | ||
534 | if (isInitialized) | ||
535 | return; | ||
536 | isInitialized = true; | ||
537 | |||
538 | // Initialize package | ||
539 | setName(eNAME); | ||
540 | setNsPrefix(eNS_PREFIX); | ||
541 | setNsURI(eNS_URI); | ||
542 | |||
543 | // Create type parameters | ||
544 | |||
545 | // Set bounds for type parameters | ||
546 | |||
547 | // Add supertypes to classes | ||
548 | |||
549 | // Initialize classes, features, and operations; add parameters | ||
550 | initEClass(cyberPhysicalSystemEClass, CyberPhysicalSystem.class, "CyberPhysicalSystem", !IS_ABSTRACT, | ||
551 | !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | ||
552 | initEReference(getCyberPhysicalSystem_Requests(), this.getRequest(), null, "requests", null, 0, -1, | ||
553 | CyberPhysicalSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, | ||
554 | !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
555 | initEReference(getCyberPhysicalSystem_ApplicationTypes(), this.getApplicationType(), null, "applicationTypes", | ||
556 | null, 0, -1, CyberPhysicalSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, | ||
557 | !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
558 | initEReference(getCyberPhysicalSystem_HostTypes(), this.getHostType(), null, "hostTypes", null, 0, -1, | ||
559 | CyberPhysicalSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, | ||
560 | !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
561 | |||
562 | initEClass(applicationTypeEClass, ApplicationType.class, "ApplicationType", !IS_ABSTRACT, !IS_INTERFACE, | ||
563 | IS_GENERATED_INSTANCE_CLASS); | ||
564 | initEReference(getApplicationType_Instances(), this.getApplicationInstance(), | ||
565 | this.getApplicationInstance_Type(), "instances", null, 0, -1, ApplicationType.class, !IS_TRANSIENT, | ||
566 | !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, | ||
567 | IS_ORDERED); | ||
568 | initEReference(getApplicationType_Requirements(), this.getResourceRequirement(), null, "requirements", null, 0, | ||
569 | -1, ApplicationType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, | ||
570 | !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
571 | |||
572 | initEClass(hostTypeEClass, HostType.class, "HostType", !IS_ABSTRACT, !IS_INTERFACE, | ||
573 | IS_GENERATED_INSTANCE_CLASS); | ||
574 | initEAttribute(getHostType_DefaultMemory(), ecorePackage.getEInt(), "defaultMemory", null, 1, 1, HostType.class, | ||
575 | !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
576 | initEAttribute(getHostType_DefaultHdd(), ecorePackage.getEInt(), "defaultHdd", null, 1, 1, HostType.class, | ||
577 | !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
578 | initEReference(getHostType_Instances(), this.getHostInstance(), this.getHostInstance_Type(), "instances", null, | ||
579 | 0, -1, HostType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, | ||
580 | !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
581 | initEAttribute(getHostType_Cost(), ecorePackage.getEInt(), "cost", null, 1, 1, HostType.class, !IS_TRANSIENT, | ||
582 | !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
583 | |||
584 | initEClass(requestEClass, Request.class, "Request", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | ||
585 | initEReference(getRequest_Requirements(), this.getRequirement(), this.getRequirement_Request(), "requirements", | ||
586 | null, 0, -1, Request.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, | ||
587 | !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
588 | |||
589 | initEClass(requirementEClass, Requirement.class, "Requirement", !IS_ABSTRACT, !IS_INTERFACE, | ||
590 | IS_GENERATED_INSTANCE_CLASS); | ||
591 | initEReference(getRequirement_Request(), this.getRequest(), this.getRequest_Requirements(), "request", null, 1, | ||
592 | 1, Requirement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, | ||
593 | !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
594 | initEAttribute(getRequirement_Count(), ecorePackage.getEInt(), "count", null, 1, 1, Requirement.class, | ||
595 | !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
596 | initEReference(getRequirement_Type(), this.getApplicationType(), null, "type", null, 0, 1, Requirement.class, | ||
597 | !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, | ||
598 | IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
599 | initEReference(getRequirement_Instances(), this.getApplicationInstance(), | ||
600 | this.getApplicationInstance_Requirement(), "instances", null, 0, -1, Requirement.class, !IS_TRANSIENT, | ||
601 | !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, | ||
602 | IS_ORDERED); | ||
603 | |||
604 | initEClass(applicationInstanceEClass, ApplicationInstance.class, "ApplicationInstance", !IS_ABSTRACT, | ||
605 | !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | ||
606 | initEReference(getApplicationInstance_Requirement(), this.getRequirement(), this.getRequirement_Instances(), | ||
607 | "requirement", null, 0, 1, ApplicationInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, | ||
608 | !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
609 | initEReference(getApplicationInstance_Type(), this.getApplicationType(), this.getApplicationType_Instances(), | ||
610 | "type", null, 1, 1, ApplicationInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, | ||
611 | !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
612 | initEReference(getApplicationInstance_AllocatedTo(), this.getHostInstance(), | ||
613 | this.getHostInstance_Applications(), "allocatedTo", null, 1, 1, ApplicationInstance.class, | ||
614 | !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, | ||
615 | IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
616 | |||
617 | initEClass(resourceRequirementEClass, ResourceRequirement.class, "ResourceRequirement", !IS_ABSTRACT, | ||
618 | !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | ||
619 | initEAttribute(getResourceRequirement_RequiredMemory(), ecorePackage.getEInt(), "requiredMemory", null, 1, 1, | ||
620 | ResourceRequirement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, | ||
621 | IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
622 | initEAttribute(getResourceRequirement_RequiredHdd(), ecorePackage.getEInt(), "requiredHdd", null, 1, 1, | ||
623 | ResourceRequirement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, | ||
624 | IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
625 | initEReference(getResourceRequirement_HostType(), this.getHostType(), null, "hostType", null, 1, 1, | ||
626 | ResourceRequirement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, | ||
627 | IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
628 | |||
629 | initEClass(hostInstanceEClass, HostInstance.class, "HostInstance", !IS_ABSTRACT, !IS_INTERFACE, | ||
630 | IS_GENERATED_INSTANCE_CLASS); | ||
631 | initEReference(getHostInstance_Type(), this.getHostType(), this.getHostType_Instances(), "type", null, 1, 1, | ||
632 | HostInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, | ||
633 | !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
634 | initEReference(getHostInstance_Applications(), this.getApplicationInstance(), | ||
635 | this.getApplicationInstance_AllocatedTo(), "applications", null, 0, -1, HostInstance.class, | ||
636 | !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, | ||
637 | IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
638 | |||
639 | // Create resource | ||
640 | createResource(eNS_URI); | ||
641 | } | ||
642 | |||
643 | } //CpsPackageImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/CyberPhysicalSystemImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/CyberPhysicalSystemImpl.java new file mode 100644 index 00000000..3ba111af --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/CyberPhysicalSystemImpl.java | |||
@@ -0,0 +1,232 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.cps.Request; | ||
10 | |||
11 | import java.util.Collection; | ||
12 | |||
13 | import org.eclipse.emf.common.notify.NotificationChain; | ||
14 | |||
15 | import org.eclipse.emf.common.util.EList; | ||
16 | |||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.emf.ecore.InternalEObject; | ||
19 | |||
20 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
21 | |||
22 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; | ||
23 | import org.eclipse.emf.ecore.util.InternalEList; | ||
24 | |||
25 | /** | ||
26 | * <!-- begin-user-doc --> | ||
27 | * An implementation of the model object '<em><b>Cyber Physical System</b></em>'. | ||
28 | * <!-- end-user-doc --> | ||
29 | * <p> | ||
30 | * The following features are implemented: | ||
31 | * </p> | ||
32 | * <ul> | ||
33 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.CyberPhysicalSystemImpl#getRequests <em>Requests</em>}</li> | ||
34 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.CyberPhysicalSystemImpl#getApplicationTypes <em>Application Types</em>}</li> | ||
35 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.CyberPhysicalSystemImpl#getHostTypes <em>Host Types</em>}</li> | ||
36 | * </ul> | ||
37 | * | ||
38 | * @generated | ||
39 | */ | ||
40 | public class CyberPhysicalSystemImpl extends MinimalEObjectImpl.Container implements CyberPhysicalSystem { | ||
41 | /** | ||
42 | * The cached value of the '{@link #getRequests() <em>Requests</em>}' containment reference list. | ||
43 | * <!-- begin-user-doc --> | ||
44 | * <!-- end-user-doc --> | ||
45 | * @see #getRequests() | ||
46 | * @generated | ||
47 | * @ordered | ||
48 | */ | ||
49 | protected EList<Request> requests; | ||
50 | |||
51 | /** | ||
52 | * The cached value of the '{@link #getApplicationTypes() <em>Application Types</em>}' containment reference list. | ||
53 | * <!-- begin-user-doc --> | ||
54 | * <!-- end-user-doc --> | ||
55 | * @see #getApplicationTypes() | ||
56 | * @generated | ||
57 | * @ordered | ||
58 | */ | ||
59 | protected EList<ApplicationType> applicationTypes; | ||
60 | |||
61 | /** | ||
62 | * The cached value of the '{@link #getHostTypes() <em>Host Types</em>}' containment reference list. | ||
63 | * <!-- begin-user-doc --> | ||
64 | * <!-- end-user-doc --> | ||
65 | * @see #getHostTypes() | ||
66 | * @generated | ||
67 | * @ordered | ||
68 | */ | ||
69 | protected EList<HostType> hostTypes; | ||
70 | |||
71 | /** | ||
72 | * <!-- begin-user-doc --> | ||
73 | * <!-- end-user-doc --> | ||
74 | * @generated | ||
75 | */ | ||
76 | protected CyberPhysicalSystemImpl() { | ||
77 | super(); | ||
78 | } | ||
79 | |||
80 | /** | ||
81 | * <!-- begin-user-doc --> | ||
82 | * <!-- end-user-doc --> | ||
83 | * @generated | ||
84 | */ | ||
85 | @Override | ||
86 | protected EClass eStaticClass() { | ||
87 | return CpsPackage.Literals.CYBER_PHYSICAL_SYSTEM; | ||
88 | } | ||
89 | |||
90 | /** | ||
91 | * <!-- begin-user-doc --> | ||
92 | * <!-- end-user-doc --> | ||
93 | * @generated | ||
94 | */ | ||
95 | @Override | ||
96 | public EList<Request> getRequests() { | ||
97 | if (requests == null) { | ||
98 | requests = new EObjectContainmentEList<Request>(Request.class, this, | ||
99 | CpsPackage.CYBER_PHYSICAL_SYSTEM__REQUESTS); | ||
100 | } | ||
101 | return requests; | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * <!-- begin-user-doc --> | ||
106 | * <!-- end-user-doc --> | ||
107 | * @generated | ||
108 | */ | ||
109 | @Override | ||
110 | public EList<ApplicationType> getApplicationTypes() { | ||
111 | if (applicationTypes == null) { | ||
112 | applicationTypes = new EObjectContainmentEList<ApplicationType>(ApplicationType.class, this, | ||
113 | CpsPackage.CYBER_PHYSICAL_SYSTEM__APPLICATION_TYPES); | ||
114 | } | ||
115 | return applicationTypes; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * <!-- begin-user-doc --> | ||
120 | * <!-- end-user-doc --> | ||
121 | * @generated | ||
122 | */ | ||
123 | @Override | ||
124 | public EList<HostType> getHostTypes() { | ||
125 | if (hostTypes == null) { | ||
126 | hostTypes = new EObjectContainmentEList<HostType>(HostType.class, this, | ||
127 | CpsPackage.CYBER_PHYSICAL_SYSTEM__HOST_TYPES); | ||
128 | } | ||
129 | return hostTypes; | ||
130 | } | ||
131 | |||
132 | /** | ||
133 | * <!-- begin-user-doc --> | ||
134 | * <!-- end-user-doc --> | ||
135 | * @generated | ||
136 | */ | ||
137 | @Override | ||
138 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
139 | switch (featureID) { | ||
140 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__REQUESTS: | ||
141 | return ((InternalEList<?>) getRequests()).basicRemove(otherEnd, msgs); | ||
142 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__APPLICATION_TYPES: | ||
143 | return ((InternalEList<?>) getApplicationTypes()).basicRemove(otherEnd, msgs); | ||
144 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__HOST_TYPES: | ||
145 | return ((InternalEList<?>) getHostTypes()).basicRemove(otherEnd, msgs); | ||
146 | } | ||
147 | return super.eInverseRemove(otherEnd, featureID, msgs); | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * <!-- begin-user-doc --> | ||
152 | * <!-- end-user-doc --> | ||
153 | * @generated | ||
154 | */ | ||
155 | @Override | ||
156 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
157 | switch (featureID) { | ||
158 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__REQUESTS: | ||
159 | return getRequests(); | ||
160 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__APPLICATION_TYPES: | ||
161 | return getApplicationTypes(); | ||
162 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__HOST_TYPES: | ||
163 | return getHostTypes(); | ||
164 | } | ||
165 | return super.eGet(featureID, resolve, coreType); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * <!-- begin-user-doc --> | ||
170 | * <!-- end-user-doc --> | ||
171 | * @generated | ||
172 | */ | ||
173 | @SuppressWarnings("unchecked") | ||
174 | @Override | ||
175 | public void eSet(int featureID, Object newValue) { | ||
176 | switch (featureID) { | ||
177 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__REQUESTS: | ||
178 | getRequests().clear(); | ||
179 | getRequests().addAll((Collection<? extends Request>) newValue); | ||
180 | return; | ||
181 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__APPLICATION_TYPES: | ||
182 | getApplicationTypes().clear(); | ||
183 | getApplicationTypes().addAll((Collection<? extends ApplicationType>) newValue); | ||
184 | return; | ||
185 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__HOST_TYPES: | ||
186 | getHostTypes().clear(); | ||
187 | getHostTypes().addAll((Collection<? extends HostType>) newValue); | ||
188 | return; | ||
189 | } | ||
190 | super.eSet(featureID, newValue); | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * <!-- begin-user-doc --> | ||
195 | * <!-- end-user-doc --> | ||
196 | * @generated | ||
197 | */ | ||
198 | @Override | ||
199 | public void eUnset(int featureID) { | ||
200 | switch (featureID) { | ||
201 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__REQUESTS: | ||
202 | getRequests().clear(); | ||
203 | return; | ||
204 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__APPLICATION_TYPES: | ||
205 | getApplicationTypes().clear(); | ||
206 | return; | ||
207 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__HOST_TYPES: | ||
208 | getHostTypes().clear(); | ||
209 | return; | ||
210 | } | ||
211 | super.eUnset(featureID); | ||
212 | } | ||
213 | |||
214 | /** | ||
215 | * <!-- begin-user-doc --> | ||
216 | * <!-- end-user-doc --> | ||
217 | * @generated | ||
218 | */ | ||
219 | @Override | ||
220 | public boolean eIsSet(int featureID) { | ||
221 | switch (featureID) { | ||
222 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__REQUESTS: | ||
223 | return requests != null && !requests.isEmpty(); | ||
224 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__APPLICATION_TYPES: | ||
225 | return applicationTypes != null && !applicationTypes.isEmpty(); | ||
226 | case CpsPackage.CYBER_PHYSICAL_SYSTEM__HOST_TYPES: | ||
227 | return hostTypes != null && !hostTypes.isEmpty(); | ||
228 | } | ||
229 | return super.eIsSet(featureID); | ||
230 | } | ||
231 | |||
232 | } //CyberPhysicalSystemImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/HostInstanceImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/HostInstanceImpl.java new file mode 100644 index 00000000..551f2ed6 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/HostInstanceImpl.java | |||
@@ -0,0 +1,250 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType; | ||
9 | |||
10 | import java.util.Collection; | ||
11 | |||
12 | import org.eclipse.emf.common.notify.Notification; | ||
13 | import org.eclipse.emf.common.notify.NotificationChain; | ||
14 | |||
15 | import org.eclipse.emf.common.util.EList; | ||
16 | |||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.emf.ecore.InternalEObject; | ||
19 | |||
20 | import org.eclipse.emf.ecore.impl.ENotificationImpl; | ||
21 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
22 | |||
23 | import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; | ||
24 | import org.eclipse.emf.ecore.util.EcoreUtil; | ||
25 | import org.eclipse.emf.ecore.util.InternalEList; | ||
26 | |||
27 | /** | ||
28 | * <!-- begin-user-doc --> | ||
29 | * An implementation of the model object '<em><b>Host Instance</b></em>'. | ||
30 | * <!-- end-user-doc --> | ||
31 | * <p> | ||
32 | * The following features are implemented: | ||
33 | * </p> | ||
34 | * <ul> | ||
35 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostInstanceImpl#getType <em>Type</em>}</li> | ||
36 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostInstanceImpl#getApplications <em>Applications</em>}</li> | ||
37 | * </ul> | ||
38 | * | ||
39 | * @generated | ||
40 | */ | ||
41 | public class HostInstanceImpl extends MinimalEObjectImpl.Container implements HostInstance { | ||
42 | /** | ||
43 | * The cached value of the '{@link #getApplications() <em>Applications</em>}' reference list. | ||
44 | * <!-- begin-user-doc --> | ||
45 | * <!-- end-user-doc --> | ||
46 | * @see #getApplications() | ||
47 | * @generated | ||
48 | * @ordered | ||
49 | */ | ||
50 | protected EList<ApplicationInstance> applications; | ||
51 | |||
52 | /** | ||
53 | * <!-- begin-user-doc --> | ||
54 | * <!-- end-user-doc --> | ||
55 | * @generated | ||
56 | */ | ||
57 | protected HostInstanceImpl() { | ||
58 | super(); | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * <!-- begin-user-doc --> | ||
63 | * <!-- end-user-doc --> | ||
64 | * @generated | ||
65 | */ | ||
66 | @Override | ||
67 | protected EClass eStaticClass() { | ||
68 | return CpsPackage.Literals.HOST_INSTANCE; | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * <!-- begin-user-doc --> | ||
73 | * <!-- end-user-doc --> | ||
74 | * @generated | ||
75 | */ | ||
76 | @Override | ||
77 | public HostType getType() { | ||
78 | if (eContainerFeatureID() != CpsPackage.HOST_INSTANCE__TYPE) | ||
79 | return null; | ||
80 | return (HostType) eInternalContainer(); | ||
81 | } | ||
82 | |||
83 | /** | ||
84 | * <!-- begin-user-doc --> | ||
85 | * <!-- end-user-doc --> | ||
86 | * @generated | ||
87 | */ | ||
88 | public NotificationChain basicSetType(HostType newType, NotificationChain msgs) { | ||
89 | msgs = eBasicSetContainer((InternalEObject) newType, CpsPackage.HOST_INSTANCE__TYPE, msgs); | ||
90 | return msgs; | ||
91 | } | ||
92 | |||
93 | /** | ||
94 | * <!-- begin-user-doc --> | ||
95 | * <!-- end-user-doc --> | ||
96 | * @generated | ||
97 | */ | ||
98 | @Override | ||
99 | public void setType(HostType newType) { | ||
100 | if (newType != eInternalContainer() | ||
101 | || (eContainerFeatureID() != CpsPackage.HOST_INSTANCE__TYPE && newType != null)) { | ||
102 | if (EcoreUtil.isAncestor(this, newType)) | ||
103 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); | ||
104 | NotificationChain msgs = null; | ||
105 | if (eInternalContainer() != null) | ||
106 | msgs = eBasicRemoveFromContainer(msgs); | ||
107 | if (newType != null) | ||
108 | msgs = ((InternalEObject) newType).eInverseAdd(this, CpsPackage.HOST_TYPE__INSTANCES, HostType.class, | ||
109 | msgs); | ||
110 | msgs = basicSetType(newType, msgs); | ||
111 | if (msgs != null) | ||
112 | msgs.dispatch(); | ||
113 | } else if (eNotificationRequired()) | ||
114 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.HOST_INSTANCE__TYPE, newType, newType)); | ||
115 | } | ||
116 | |||
117 | /** | ||
118 | * <!-- begin-user-doc --> | ||
119 | * <!-- end-user-doc --> | ||
120 | * @generated | ||
121 | */ | ||
122 | @Override | ||
123 | public EList<ApplicationInstance> getApplications() { | ||
124 | if (applications == null) { | ||
125 | applications = new EObjectWithInverseResolvingEList<ApplicationInstance>(ApplicationInstance.class, this, | ||
126 | CpsPackage.HOST_INSTANCE__APPLICATIONS, CpsPackage.APPLICATION_INSTANCE__ALLOCATED_TO); | ||
127 | } | ||
128 | return applications; | ||
129 | } | ||
130 | |||
131 | /** | ||
132 | * <!-- begin-user-doc --> | ||
133 | * <!-- end-user-doc --> | ||
134 | * @generated | ||
135 | */ | ||
136 | @SuppressWarnings("unchecked") | ||
137 | @Override | ||
138 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
139 | switch (featureID) { | ||
140 | case CpsPackage.HOST_INSTANCE__TYPE: | ||
141 | if (eInternalContainer() != null) | ||
142 | msgs = eBasicRemoveFromContainer(msgs); | ||
143 | return basicSetType((HostType) otherEnd, msgs); | ||
144 | case CpsPackage.HOST_INSTANCE__APPLICATIONS: | ||
145 | return ((InternalEList<InternalEObject>) (InternalEList<?>) getApplications()).basicAdd(otherEnd, msgs); | ||
146 | } | ||
147 | return super.eInverseAdd(otherEnd, featureID, msgs); | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * <!-- begin-user-doc --> | ||
152 | * <!-- end-user-doc --> | ||
153 | * @generated | ||
154 | */ | ||
155 | @Override | ||
156 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
157 | switch (featureID) { | ||
158 | case CpsPackage.HOST_INSTANCE__TYPE: | ||
159 | return basicSetType(null, msgs); | ||
160 | case CpsPackage.HOST_INSTANCE__APPLICATIONS: | ||
161 | return ((InternalEList<?>) getApplications()).basicRemove(otherEnd, msgs); | ||
162 | } | ||
163 | return super.eInverseRemove(otherEnd, featureID, msgs); | ||
164 | } | ||
165 | |||
166 | /** | ||
167 | * <!-- begin-user-doc --> | ||
168 | * <!-- end-user-doc --> | ||
169 | * @generated | ||
170 | */ | ||
171 | @Override | ||
172 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { | ||
173 | switch (eContainerFeatureID()) { | ||
174 | case CpsPackage.HOST_INSTANCE__TYPE: | ||
175 | return eInternalContainer().eInverseRemove(this, CpsPackage.HOST_TYPE__INSTANCES, HostType.class, msgs); | ||
176 | } | ||
177 | return super.eBasicRemoveFromContainerFeature(msgs); | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * <!-- begin-user-doc --> | ||
182 | * <!-- end-user-doc --> | ||
183 | * @generated | ||
184 | */ | ||
185 | @Override | ||
186 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
187 | switch (featureID) { | ||
188 | case CpsPackage.HOST_INSTANCE__TYPE: | ||
189 | return getType(); | ||
190 | case CpsPackage.HOST_INSTANCE__APPLICATIONS: | ||
191 | return getApplications(); | ||
192 | } | ||
193 | return super.eGet(featureID, resolve, coreType); | ||
194 | } | ||
195 | |||
196 | /** | ||
197 | * <!-- begin-user-doc --> | ||
198 | * <!-- end-user-doc --> | ||
199 | * @generated | ||
200 | */ | ||
201 | @SuppressWarnings("unchecked") | ||
202 | @Override | ||
203 | public void eSet(int featureID, Object newValue) { | ||
204 | switch (featureID) { | ||
205 | case CpsPackage.HOST_INSTANCE__TYPE: | ||
206 | setType((HostType) newValue); | ||
207 | return; | ||
208 | case CpsPackage.HOST_INSTANCE__APPLICATIONS: | ||
209 | getApplications().clear(); | ||
210 | getApplications().addAll((Collection<? extends ApplicationInstance>) newValue); | ||
211 | return; | ||
212 | } | ||
213 | super.eSet(featureID, newValue); | ||
214 | } | ||
215 | |||
216 | /** | ||
217 | * <!-- begin-user-doc --> | ||
218 | * <!-- end-user-doc --> | ||
219 | * @generated | ||
220 | */ | ||
221 | @Override | ||
222 | public void eUnset(int featureID) { | ||
223 | switch (featureID) { | ||
224 | case CpsPackage.HOST_INSTANCE__TYPE: | ||
225 | setType((HostType) null); | ||
226 | return; | ||
227 | case CpsPackage.HOST_INSTANCE__APPLICATIONS: | ||
228 | getApplications().clear(); | ||
229 | return; | ||
230 | } | ||
231 | super.eUnset(featureID); | ||
232 | } | ||
233 | |||
234 | /** | ||
235 | * <!-- begin-user-doc --> | ||
236 | * <!-- end-user-doc --> | ||
237 | * @generated | ||
238 | */ | ||
239 | @Override | ||
240 | public boolean eIsSet(int featureID) { | ||
241 | switch (featureID) { | ||
242 | case CpsPackage.HOST_INSTANCE__TYPE: | ||
243 | return getType() != null; | ||
244 | case CpsPackage.HOST_INSTANCE__APPLICATIONS: | ||
245 | return applications != null && !applications.isEmpty(); | ||
246 | } | ||
247 | return super.eIsSet(featureID); | ||
248 | } | ||
249 | |||
250 | } //HostInstanceImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/HostTypeImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/HostTypeImpl.java new file mode 100644 index 00000000..c3d5b3dc --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/HostTypeImpl.java | |||
@@ -0,0 +1,356 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType; | ||
8 | |||
9 | import java.util.Collection; | ||
10 | |||
11 | import org.eclipse.emf.common.notify.Notification; | ||
12 | import org.eclipse.emf.common.notify.NotificationChain; | ||
13 | |||
14 | import org.eclipse.emf.common.util.EList; | ||
15 | |||
16 | import org.eclipse.emf.ecore.EClass; | ||
17 | import org.eclipse.emf.ecore.InternalEObject; | ||
18 | |||
19 | import org.eclipse.emf.ecore.impl.ENotificationImpl; | ||
20 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
21 | |||
22 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; | ||
23 | import org.eclipse.emf.ecore.util.InternalEList; | ||
24 | |||
25 | /** | ||
26 | * <!-- begin-user-doc --> | ||
27 | * An implementation of the model object '<em><b>Host Type</b></em>'. | ||
28 | * <!-- end-user-doc --> | ||
29 | * <p> | ||
30 | * The following features are implemented: | ||
31 | * </p> | ||
32 | * <ul> | ||
33 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostTypeImpl#getDefaultMemory <em>Default Memory</em>}</li> | ||
34 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostTypeImpl#getDefaultHdd <em>Default Hdd</em>}</li> | ||
35 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostTypeImpl#getInstances <em>Instances</em>}</li> | ||
36 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.HostTypeImpl#getCost <em>Cost</em>}</li> | ||
37 | * </ul> | ||
38 | * | ||
39 | * @generated | ||
40 | */ | ||
41 | public class HostTypeImpl extends MinimalEObjectImpl.Container implements HostType { | ||
42 | /** | ||
43 | * The default value of the '{@link #getDefaultMemory() <em>Default Memory</em>}' attribute. | ||
44 | * <!-- begin-user-doc --> | ||
45 | * <!-- end-user-doc --> | ||
46 | * @see #getDefaultMemory() | ||
47 | * @generated | ||
48 | * @ordered | ||
49 | */ | ||
50 | protected static final int DEFAULT_MEMORY_EDEFAULT = 0; | ||
51 | |||
52 | /** | ||
53 | * The cached value of the '{@link #getDefaultMemory() <em>Default Memory</em>}' attribute. | ||
54 | * <!-- begin-user-doc --> | ||
55 | * <!-- end-user-doc --> | ||
56 | * @see #getDefaultMemory() | ||
57 | * @generated | ||
58 | * @ordered | ||
59 | */ | ||
60 | protected int defaultMemory = DEFAULT_MEMORY_EDEFAULT; | ||
61 | |||
62 | /** | ||
63 | * The default value of the '{@link #getDefaultHdd() <em>Default Hdd</em>}' attribute. | ||
64 | * <!-- begin-user-doc --> | ||
65 | * <!-- end-user-doc --> | ||
66 | * @see #getDefaultHdd() | ||
67 | * @generated | ||
68 | * @ordered | ||
69 | */ | ||
70 | protected static final int DEFAULT_HDD_EDEFAULT = 0; | ||
71 | |||
72 | /** | ||
73 | * The cached value of the '{@link #getDefaultHdd() <em>Default Hdd</em>}' attribute. | ||
74 | * <!-- begin-user-doc --> | ||
75 | * <!-- end-user-doc --> | ||
76 | * @see #getDefaultHdd() | ||
77 | * @generated | ||
78 | * @ordered | ||
79 | */ | ||
80 | protected int defaultHdd = DEFAULT_HDD_EDEFAULT; | ||
81 | |||
82 | /** | ||
83 | * The cached value of the '{@link #getInstances() <em>Instances</em>}' containment reference list. | ||
84 | * <!-- begin-user-doc --> | ||
85 | * <!-- end-user-doc --> | ||
86 | * @see #getInstances() | ||
87 | * @generated | ||
88 | * @ordered | ||
89 | */ | ||
90 | protected EList<HostInstance> instances; | ||
91 | |||
92 | /** | ||
93 | * The default value of the '{@link #getCost() <em>Cost</em>}' attribute. | ||
94 | * <!-- begin-user-doc --> | ||
95 | * <!-- end-user-doc --> | ||
96 | * @see #getCost() | ||
97 | * @generated | ||
98 | * @ordered | ||
99 | */ | ||
100 | protected static final int COST_EDEFAULT = 0; | ||
101 | |||
102 | /** | ||
103 | * The cached value of the '{@link #getCost() <em>Cost</em>}' attribute. | ||
104 | * <!-- begin-user-doc --> | ||
105 | * <!-- end-user-doc --> | ||
106 | * @see #getCost() | ||
107 | * @generated | ||
108 | * @ordered | ||
109 | */ | ||
110 | protected int cost = COST_EDEFAULT; | ||
111 | |||
112 | /** | ||
113 | * <!-- begin-user-doc --> | ||
114 | * <!-- end-user-doc --> | ||
115 | * @generated | ||
116 | */ | ||
117 | protected HostTypeImpl() { | ||
118 | super(); | ||
119 | } | ||
120 | |||
121 | /** | ||
122 | * <!-- begin-user-doc --> | ||
123 | * <!-- end-user-doc --> | ||
124 | * @generated | ||
125 | */ | ||
126 | @Override | ||
127 | protected EClass eStaticClass() { | ||
128 | return CpsPackage.Literals.HOST_TYPE; | ||
129 | } | ||
130 | |||
131 | /** | ||
132 | * <!-- begin-user-doc --> | ||
133 | * <!-- end-user-doc --> | ||
134 | * @generated | ||
135 | */ | ||
136 | @Override | ||
137 | public int getDefaultMemory() { | ||
138 | return defaultMemory; | ||
139 | } | ||
140 | |||
141 | /** | ||
142 | * <!-- begin-user-doc --> | ||
143 | * <!-- end-user-doc --> | ||
144 | * @generated | ||
145 | */ | ||
146 | @Override | ||
147 | public void setDefaultMemory(int newDefaultMemory) { | ||
148 | int oldDefaultMemory = defaultMemory; | ||
149 | defaultMemory = newDefaultMemory; | ||
150 | if (eNotificationRequired()) | ||
151 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.HOST_TYPE__DEFAULT_MEMORY, | ||
152 | oldDefaultMemory, defaultMemory)); | ||
153 | } | ||
154 | |||
155 | /** | ||
156 | * <!-- begin-user-doc --> | ||
157 | * <!-- end-user-doc --> | ||
158 | * @generated | ||
159 | */ | ||
160 | @Override | ||
161 | public int getDefaultHdd() { | ||
162 | return defaultHdd; | ||
163 | } | ||
164 | |||
165 | /** | ||
166 | * <!-- begin-user-doc --> | ||
167 | * <!-- end-user-doc --> | ||
168 | * @generated | ||
169 | */ | ||
170 | @Override | ||
171 | public void setDefaultHdd(int newDefaultHdd) { | ||
172 | int oldDefaultHdd = defaultHdd; | ||
173 | defaultHdd = newDefaultHdd; | ||
174 | if (eNotificationRequired()) | ||
175 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.HOST_TYPE__DEFAULT_HDD, oldDefaultHdd, | ||
176 | defaultHdd)); | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * <!-- begin-user-doc --> | ||
181 | * <!-- end-user-doc --> | ||
182 | * @generated | ||
183 | */ | ||
184 | @Override | ||
185 | public EList<HostInstance> getInstances() { | ||
186 | if (instances == null) { | ||
187 | instances = new EObjectContainmentWithInverseEList<HostInstance>(HostInstance.class, this, | ||
188 | CpsPackage.HOST_TYPE__INSTANCES, CpsPackage.HOST_INSTANCE__TYPE); | ||
189 | } | ||
190 | return instances; | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * <!-- begin-user-doc --> | ||
195 | * <!-- end-user-doc --> | ||
196 | * @generated | ||
197 | */ | ||
198 | @Override | ||
199 | public int getCost() { | ||
200 | return cost; | ||
201 | } | ||
202 | |||
203 | /** | ||
204 | * <!-- begin-user-doc --> | ||
205 | * <!-- end-user-doc --> | ||
206 | * @generated | ||
207 | */ | ||
208 | @Override | ||
209 | public void setCost(int newCost) { | ||
210 | int oldCost = cost; | ||
211 | cost = newCost; | ||
212 | if (eNotificationRequired()) | ||
213 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.HOST_TYPE__COST, oldCost, cost)); | ||
214 | } | ||
215 | |||
216 | /** | ||
217 | * <!-- begin-user-doc --> | ||
218 | * <!-- end-user-doc --> | ||
219 | * @generated | ||
220 | */ | ||
221 | @SuppressWarnings("unchecked") | ||
222 | @Override | ||
223 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
224 | switch (featureID) { | ||
225 | case CpsPackage.HOST_TYPE__INSTANCES: | ||
226 | return ((InternalEList<InternalEObject>) (InternalEList<?>) getInstances()).basicAdd(otherEnd, msgs); | ||
227 | } | ||
228 | return super.eInverseAdd(otherEnd, featureID, msgs); | ||
229 | } | ||
230 | |||
231 | /** | ||
232 | * <!-- begin-user-doc --> | ||
233 | * <!-- end-user-doc --> | ||
234 | * @generated | ||
235 | */ | ||
236 | @Override | ||
237 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
238 | switch (featureID) { | ||
239 | case CpsPackage.HOST_TYPE__INSTANCES: | ||
240 | return ((InternalEList<?>) getInstances()).basicRemove(otherEnd, msgs); | ||
241 | } | ||
242 | return super.eInverseRemove(otherEnd, featureID, msgs); | ||
243 | } | ||
244 | |||
245 | /** | ||
246 | * <!-- begin-user-doc --> | ||
247 | * <!-- end-user-doc --> | ||
248 | * @generated | ||
249 | */ | ||
250 | @Override | ||
251 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
252 | switch (featureID) { | ||
253 | case CpsPackage.HOST_TYPE__DEFAULT_MEMORY: | ||
254 | return getDefaultMemory(); | ||
255 | case CpsPackage.HOST_TYPE__DEFAULT_HDD: | ||
256 | return getDefaultHdd(); | ||
257 | case CpsPackage.HOST_TYPE__INSTANCES: | ||
258 | return getInstances(); | ||
259 | case CpsPackage.HOST_TYPE__COST: | ||
260 | return getCost(); | ||
261 | } | ||
262 | return super.eGet(featureID, resolve, coreType); | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * <!-- begin-user-doc --> | ||
267 | * <!-- end-user-doc --> | ||
268 | * @generated | ||
269 | */ | ||
270 | @SuppressWarnings("unchecked") | ||
271 | @Override | ||
272 | public void eSet(int featureID, Object newValue) { | ||
273 | switch (featureID) { | ||
274 | case CpsPackage.HOST_TYPE__DEFAULT_MEMORY: | ||
275 | setDefaultMemory((Integer) newValue); | ||
276 | return; | ||
277 | case CpsPackage.HOST_TYPE__DEFAULT_HDD: | ||
278 | setDefaultHdd((Integer) newValue); | ||
279 | return; | ||
280 | case CpsPackage.HOST_TYPE__INSTANCES: | ||
281 | getInstances().clear(); | ||
282 | getInstances().addAll((Collection<? extends HostInstance>) newValue); | ||
283 | return; | ||
284 | case CpsPackage.HOST_TYPE__COST: | ||
285 | setCost((Integer) newValue); | ||
286 | return; | ||
287 | } | ||
288 | super.eSet(featureID, newValue); | ||
289 | } | ||
290 | |||
291 | /** | ||
292 | * <!-- begin-user-doc --> | ||
293 | * <!-- end-user-doc --> | ||
294 | * @generated | ||
295 | */ | ||
296 | @Override | ||
297 | public void eUnset(int featureID) { | ||
298 | switch (featureID) { | ||
299 | case CpsPackage.HOST_TYPE__DEFAULT_MEMORY: | ||
300 | setDefaultMemory(DEFAULT_MEMORY_EDEFAULT); | ||
301 | return; | ||
302 | case CpsPackage.HOST_TYPE__DEFAULT_HDD: | ||
303 | setDefaultHdd(DEFAULT_HDD_EDEFAULT); | ||
304 | return; | ||
305 | case CpsPackage.HOST_TYPE__INSTANCES: | ||
306 | getInstances().clear(); | ||
307 | return; | ||
308 | case CpsPackage.HOST_TYPE__COST: | ||
309 | setCost(COST_EDEFAULT); | ||
310 | return; | ||
311 | } | ||
312 | super.eUnset(featureID); | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * <!-- begin-user-doc --> | ||
317 | * <!-- end-user-doc --> | ||
318 | * @generated | ||
319 | */ | ||
320 | @Override | ||
321 | public boolean eIsSet(int featureID) { | ||
322 | switch (featureID) { | ||
323 | case CpsPackage.HOST_TYPE__DEFAULT_MEMORY: | ||
324 | return defaultMemory != DEFAULT_MEMORY_EDEFAULT; | ||
325 | case CpsPackage.HOST_TYPE__DEFAULT_HDD: | ||
326 | return defaultHdd != DEFAULT_HDD_EDEFAULT; | ||
327 | case CpsPackage.HOST_TYPE__INSTANCES: | ||
328 | return instances != null && !instances.isEmpty(); | ||
329 | case CpsPackage.HOST_TYPE__COST: | ||
330 | return cost != COST_EDEFAULT; | ||
331 | } | ||
332 | return super.eIsSet(featureID); | ||
333 | } | ||
334 | |||
335 | /** | ||
336 | * <!-- begin-user-doc --> | ||
337 | * <!-- end-user-doc --> | ||
338 | * @generated | ||
339 | */ | ||
340 | @Override | ||
341 | public String toString() { | ||
342 | if (eIsProxy()) | ||
343 | return super.toString(); | ||
344 | |||
345 | StringBuilder result = new StringBuilder(super.toString()); | ||
346 | result.append(" (defaultMemory: "); | ||
347 | result.append(defaultMemory); | ||
348 | result.append(", defaultHdd: "); | ||
349 | result.append(defaultHdd); | ||
350 | result.append(", cost: "); | ||
351 | result.append(cost); | ||
352 | result.append(')'); | ||
353 | return result.toString(); | ||
354 | } | ||
355 | |||
356 | } //HostTypeImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/RequestImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/RequestImpl.java new file mode 100644 index 00000000..72b4c732 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/RequestImpl.java | |||
@@ -0,0 +1,169 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.Request; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.Requirement; | ||
8 | |||
9 | import java.util.Collection; | ||
10 | |||
11 | import org.eclipse.emf.common.notify.NotificationChain; | ||
12 | |||
13 | import org.eclipse.emf.common.util.EList; | ||
14 | |||
15 | import org.eclipse.emf.ecore.EClass; | ||
16 | import org.eclipse.emf.ecore.InternalEObject; | ||
17 | |||
18 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
19 | |||
20 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; | ||
21 | import org.eclipse.emf.ecore.util.InternalEList; | ||
22 | |||
23 | /** | ||
24 | * <!-- begin-user-doc --> | ||
25 | * An implementation of the model object '<em><b>Request</b></em>'. | ||
26 | * <!-- end-user-doc --> | ||
27 | * <p> | ||
28 | * The following features are implemented: | ||
29 | * </p> | ||
30 | * <ul> | ||
31 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequestImpl#getRequirements <em>Requirements</em>}</li> | ||
32 | * </ul> | ||
33 | * | ||
34 | * @generated | ||
35 | */ | ||
36 | public class RequestImpl extends MinimalEObjectImpl.Container implements Request { | ||
37 | /** | ||
38 | * The cached value of the '{@link #getRequirements() <em>Requirements</em>}' containment reference list. | ||
39 | * <!-- begin-user-doc --> | ||
40 | * <!-- end-user-doc --> | ||
41 | * @see #getRequirements() | ||
42 | * @generated | ||
43 | * @ordered | ||
44 | */ | ||
45 | protected EList<Requirement> requirements; | ||
46 | |||
47 | /** | ||
48 | * <!-- begin-user-doc --> | ||
49 | * <!-- end-user-doc --> | ||
50 | * @generated | ||
51 | */ | ||
52 | protected RequestImpl() { | ||
53 | super(); | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * <!-- begin-user-doc --> | ||
58 | * <!-- end-user-doc --> | ||
59 | * @generated | ||
60 | */ | ||
61 | @Override | ||
62 | protected EClass eStaticClass() { | ||
63 | return CpsPackage.Literals.REQUEST; | ||
64 | } | ||
65 | |||
66 | /** | ||
67 | * <!-- begin-user-doc --> | ||
68 | * <!-- end-user-doc --> | ||
69 | * @generated | ||
70 | */ | ||
71 | @Override | ||
72 | public EList<Requirement> getRequirements() { | ||
73 | if (requirements == null) { | ||
74 | requirements = new EObjectContainmentWithInverseEList<Requirement>(Requirement.class, this, | ||
75 | CpsPackage.REQUEST__REQUIREMENTS, CpsPackage.REQUIREMENT__REQUEST); | ||
76 | } | ||
77 | return requirements; | ||
78 | } | ||
79 | |||
80 | /** | ||
81 | * <!-- begin-user-doc --> | ||
82 | * <!-- end-user-doc --> | ||
83 | * @generated | ||
84 | */ | ||
85 | @SuppressWarnings("unchecked") | ||
86 | @Override | ||
87 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
88 | switch (featureID) { | ||
89 | case CpsPackage.REQUEST__REQUIREMENTS: | ||
90 | return ((InternalEList<InternalEObject>) (InternalEList<?>) getRequirements()).basicAdd(otherEnd, msgs); | ||
91 | } | ||
92 | return super.eInverseAdd(otherEnd, featureID, msgs); | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * <!-- begin-user-doc --> | ||
97 | * <!-- end-user-doc --> | ||
98 | * @generated | ||
99 | */ | ||
100 | @Override | ||
101 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
102 | switch (featureID) { | ||
103 | case CpsPackage.REQUEST__REQUIREMENTS: | ||
104 | return ((InternalEList<?>) getRequirements()).basicRemove(otherEnd, msgs); | ||
105 | } | ||
106 | return super.eInverseRemove(otherEnd, featureID, msgs); | ||
107 | } | ||
108 | |||
109 | /** | ||
110 | * <!-- begin-user-doc --> | ||
111 | * <!-- end-user-doc --> | ||
112 | * @generated | ||
113 | */ | ||
114 | @Override | ||
115 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
116 | switch (featureID) { | ||
117 | case CpsPackage.REQUEST__REQUIREMENTS: | ||
118 | return getRequirements(); | ||
119 | } | ||
120 | return super.eGet(featureID, resolve, coreType); | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * <!-- begin-user-doc --> | ||
125 | * <!-- end-user-doc --> | ||
126 | * @generated | ||
127 | */ | ||
128 | @SuppressWarnings("unchecked") | ||
129 | @Override | ||
130 | public void eSet(int featureID, Object newValue) { | ||
131 | switch (featureID) { | ||
132 | case CpsPackage.REQUEST__REQUIREMENTS: | ||
133 | getRequirements().clear(); | ||
134 | getRequirements().addAll((Collection<? extends Requirement>) newValue); | ||
135 | return; | ||
136 | } | ||
137 | super.eSet(featureID, newValue); | ||
138 | } | ||
139 | |||
140 | /** | ||
141 | * <!-- begin-user-doc --> | ||
142 | * <!-- end-user-doc --> | ||
143 | * @generated | ||
144 | */ | ||
145 | @Override | ||
146 | public void eUnset(int featureID) { | ||
147 | switch (featureID) { | ||
148 | case CpsPackage.REQUEST__REQUIREMENTS: | ||
149 | getRequirements().clear(); | ||
150 | return; | ||
151 | } | ||
152 | super.eUnset(featureID); | ||
153 | } | ||
154 | |||
155 | /** | ||
156 | * <!-- begin-user-doc --> | ||
157 | * <!-- end-user-doc --> | ||
158 | * @generated | ||
159 | */ | ||
160 | @Override | ||
161 | public boolean eIsSet(int featureID) { | ||
162 | switch (featureID) { | ||
163 | case CpsPackage.REQUEST__REQUIREMENTS: | ||
164 | return requirements != null && !requirements.isEmpty(); | ||
165 | } | ||
166 | return super.eIsSet(featureID); | ||
167 | } | ||
168 | |||
169 | } //RequestImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/RequirementImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/RequirementImpl.java new file mode 100644 index 00000000..79dc4f62 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/RequirementImpl.java | |||
@@ -0,0 +1,387 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.Request; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.cps.Requirement; | ||
10 | |||
11 | import java.util.Collection; | ||
12 | |||
13 | import org.eclipse.emf.common.notify.Notification; | ||
14 | import org.eclipse.emf.common.notify.NotificationChain; | ||
15 | |||
16 | import org.eclipse.emf.common.util.EList; | ||
17 | |||
18 | import org.eclipse.emf.ecore.EClass; | ||
19 | import org.eclipse.emf.ecore.InternalEObject; | ||
20 | |||
21 | import org.eclipse.emf.ecore.impl.ENotificationImpl; | ||
22 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
23 | |||
24 | import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; | ||
25 | import org.eclipse.emf.ecore.util.EcoreUtil; | ||
26 | import org.eclipse.emf.ecore.util.InternalEList; | ||
27 | |||
28 | /** | ||
29 | * <!-- begin-user-doc --> | ||
30 | * An implementation of the model object '<em><b>Requirement</b></em>'. | ||
31 | * <!-- end-user-doc --> | ||
32 | * <p> | ||
33 | * The following features are implemented: | ||
34 | * </p> | ||
35 | * <ul> | ||
36 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequirementImpl#getRequest <em>Request</em>}</li> | ||
37 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequirementImpl#getCount <em>Count</em>}</li> | ||
38 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequirementImpl#getType <em>Type</em>}</li> | ||
39 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.RequirementImpl#getInstances <em>Instances</em>}</li> | ||
40 | * </ul> | ||
41 | * | ||
42 | * @generated | ||
43 | */ | ||
44 | public class RequirementImpl extends MinimalEObjectImpl.Container implements Requirement { | ||
45 | /** | ||
46 | * The default value of the '{@link #getCount() <em>Count</em>}' attribute. | ||
47 | * <!-- begin-user-doc --> | ||
48 | * <!-- end-user-doc --> | ||
49 | * @see #getCount() | ||
50 | * @generated | ||
51 | * @ordered | ||
52 | */ | ||
53 | protected static final int COUNT_EDEFAULT = 0; | ||
54 | |||
55 | /** | ||
56 | * The cached value of the '{@link #getCount() <em>Count</em>}' attribute. | ||
57 | * <!-- begin-user-doc --> | ||
58 | * <!-- end-user-doc --> | ||
59 | * @see #getCount() | ||
60 | * @generated | ||
61 | * @ordered | ||
62 | */ | ||
63 | protected int count = COUNT_EDEFAULT; | ||
64 | |||
65 | /** | ||
66 | * The cached value of the '{@link #getType() <em>Type</em>}' reference. | ||
67 | * <!-- begin-user-doc --> | ||
68 | * <!-- end-user-doc --> | ||
69 | * @see #getType() | ||
70 | * @generated | ||
71 | * @ordered | ||
72 | */ | ||
73 | protected ApplicationType type; | ||
74 | |||
75 | /** | ||
76 | * The cached value of the '{@link #getInstances() <em>Instances</em>}' reference list. | ||
77 | * <!-- begin-user-doc --> | ||
78 | * <!-- end-user-doc --> | ||
79 | * @see #getInstances() | ||
80 | * @generated | ||
81 | * @ordered | ||
82 | */ | ||
83 | protected EList<ApplicationInstance> instances; | ||
84 | |||
85 | /** | ||
86 | * <!-- begin-user-doc --> | ||
87 | * <!-- end-user-doc --> | ||
88 | * @generated | ||
89 | */ | ||
90 | protected RequirementImpl() { | ||
91 | super(); | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * <!-- begin-user-doc --> | ||
96 | * <!-- end-user-doc --> | ||
97 | * @generated | ||
98 | */ | ||
99 | @Override | ||
100 | protected EClass eStaticClass() { | ||
101 | return CpsPackage.Literals.REQUIREMENT; | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * <!-- begin-user-doc --> | ||
106 | * <!-- end-user-doc --> | ||
107 | * @generated | ||
108 | */ | ||
109 | @Override | ||
110 | public Request getRequest() { | ||
111 | if (eContainerFeatureID() != CpsPackage.REQUIREMENT__REQUEST) | ||
112 | return null; | ||
113 | return (Request) eInternalContainer(); | ||
114 | } | ||
115 | |||
116 | /** | ||
117 | * <!-- begin-user-doc --> | ||
118 | * <!-- end-user-doc --> | ||
119 | * @generated | ||
120 | */ | ||
121 | public NotificationChain basicSetRequest(Request newRequest, NotificationChain msgs) { | ||
122 | msgs = eBasicSetContainer((InternalEObject) newRequest, CpsPackage.REQUIREMENT__REQUEST, msgs); | ||
123 | return msgs; | ||
124 | } | ||
125 | |||
126 | /** | ||
127 | * <!-- begin-user-doc --> | ||
128 | * <!-- end-user-doc --> | ||
129 | * @generated | ||
130 | */ | ||
131 | @Override | ||
132 | public void setRequest(Request newRequest) { | ||
133 | if (newRequest != eInternalContainer() | ||
134 | || (eContainerFeatureID() != CpsPackage.REQUIREMENT__REQUEST && newRequest != null)) { | ||
135 | if (EcoreUtil.isAncestor(this, newRequest)) | ||
136 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); | ||
137 | NotificationChain msgs = null; | ||
138 | if (eInternalContainer() != null) | ||
139 | msgs = eBasicRemoveFromContainer(msgs); | ||
140 | if (newRequest != null) | ||
141 | msgs = ((InternalEObject) newRequest).eInverseAdd(this, CpsPackage.REQUEST__REQUIREMENTS, Request.class, | ||
142 | msgs); | ||
143 | msgs = basicSetRequest(newRequest, msgs); | ||
144 | if (msgs != null) | ||
145 | msgs.dispatch(); | ||
146 | } else if (eNotificationRequired()) | ||
147 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.REQUIREMENT__REQUEST, newRequest, | ||
148 | newRequest)); | ||
149 | } | ||
150 | |||
151 | /** | ||
152 | * <!-- begin-user-doc --> | ||
153 | * <!-- end-user-doc --> | ||
154 | * @generated | ||
155 | */ | ||
156 | @Override | ||
157 | public int getCount() { | ||
158 | return count; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * <!-- begin-user-doc --> | ||
163 | * <!-- end-user-doc --> | ||
164 | * @generated | ||
165 | */ | ||
166 | @Override | ||
167 | public void setCount(int newCount) { | ||
168 | int oldCount = count; | ||
169 | count = newCount; | ||
170 | if (eNotificationRequired()) | ||
171 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.REQUIREMENT__COUNT, oldCount, count)); | ||
172 | } | ||
173 | |||
174 | /** | ||
175 | * <!-- begin-user-doc --> | ||
176 | * <!-- end-user-doc --> | ||
177 | * @generated | ||
178 | */ | ||
179 | @Override | ||
180 | public ApplicationType getType() { | ||
181 | if (type != null && type.eIsProxy()) { | ||
182 | InternalEObject oldType = (InternalEObject) type; | ||
183 | type = (ApplicationType) eResolveProxy(oldType); | ||
184 | if (type != oldType) { | ||
185 | if (eNotificationRequired()) | ||
186 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, CpsPackage.REQUIREMENT__TYPE, oldType, | ||
187 | type)); | ||
188 | } | ||
189 | } | ||
190 | return type; | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * <!-- begin-user-doc --> | ||
195 | * <!-- end-user-doc --> | ||
196 | * @generated | ||
197 | */ | ||
198 | public ApplicationType basicGetType() { | ||
199 | return type; | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * <!-- begin-user-doc --> | ||
204 | * <!-- end-user-doc --> | ||
205 | * @generated | ||
206 | */ | ||
207 | @Override | ||
208 | public void setType(ApplicationType newType) { | ||
209 | ApplicationType oldType = type; | ||
210 | type = newType; | ||
211 | if (eNotificationRequired()) | ||
212 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.REQUIREMENT__TYPE, oldType, type)); | ||
213 | } | ||
214 | |||
215 | /** | ||
216 | * <!-- begin-user-doc --> | ||
217 | * <!-- end-user-doc --> | ||
218 | * @generated | ||
219 | */ | ||
220 | @Override | ||
221 | public EList<ApplicationInstance> getInstances() { | ||
222 | if (instances == null) { | ||
223 | instances = new EObjectWithInverseResolvingEList<ApplicationInstance>(ApplicationInstance.class, this, | ||
224 | CpsPackage.REQUIREMENT__INSTANCES, CpsPackage.APPLICATION_INSTANCE__REQUIREMENT); | ||
225 | } | ||
226 | return instances; | ||
227 | } | ||
228 | |||
229 | /** | ||
230 | * <!-- begin-user-doc --> | ||
231 | * <!-- end-user-doc --> | ||
232 | * @generated | ||
233 | */ | ||
234 | @SuppressWarnings("unchecked") | ||
235 | @Override | ||
236 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
237 | switch (featureID) { | ||
238 | case CpsPackage.REQUIREMENT__REQUEST: | ||
239 | if (eInternalContainer() != null) | ||
240 | msgs = eBasicRemoveFromContainer(msgs); | ||
241 | return basicSetRequest((Request) otherEnd, msgs); | ||
242 | case CpsPackage.REQUIREMENT__INSTANCES: | ||
243 | return ((InternalEList<InternalEObject>) (InternalEList<?>) getInstances()).basicAdd(otherEnd, msgs); | ||
244 | } | ||
245 | return super.eInverseAdd(otherEnd, featureID, msgs); | ||
246 | } | ||
247 | |||
248 | /** | ||
249 | * <!-- begin-user-doc --> | ||
250 | * <!-- end-user-doc --> | ||
251 | * @generated | ||
252 | */ | ||
253 | @Override | ||
254 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
255 | switch (featureID) { | ||
256 | case CpsPackage.REQUIREMENT__REQUEST: | ||
257 | return basicSetRequest(null, msgs); | ||
258 | case CpsPackage.REQUIREMENT__INSTANCES: | ||
259 | return ((InternalEList<?>) getInstances()).basicRemove(otherEnd, msgs); | ||
260 | } | ||
261 | return super.eInverseRemove(otherEnd, featureID, msgs); | ||
262 | } | ||
263 | |||
264 | /** | ||
265 | * <!-- begin-user-doc --> | ||
266 | * <!-- end-user-doc --> | ||
267 | * @generated | ||
268 | */ | ||
269 | @Override | ||
270 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { | ||
271 | switch (eContainerFeatureID()) { | ||
272 | case CpsPackage.REQUIREMENT__REQUEST: | ||
273 | return eInternalContainer().eInverseRemove(this, CpsPackage.REQUEST__REQUIREMENTS, Request.class, msgs); | ||
274 | } | ||
275 | return super.eBasicRemoveFromContainerFeature(msgs); | ||
276 | } | ||
277 | |||
278 | /** | ||
279 | * <!-- begin-user-doc --> | ||
280 | * <!-- end-user-doc --> | ||
281 | * @generated | ||
282 | */ | ||
283 | @Override | ||
284 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
285 | switch (featureID) { | ||
286 | case CpsPackage.REQUIREMENT__REQUEST: | ||
287 | return getRequest(); | ||
288 | case CpsPackage.REQUIREMENT__COUNT: | ||
289 | return getCount(); | ||
290 | case CpsPackage.REQUIREMENT__TYPE: | ||
291 | if (resolve) | ||
292 | return getType(); | ||
293 | return basicGetType(); | ||
294 | case CpsPackage.REQUIREMENT__INSTANCES: | ||
295 | return getInstances(); | ||
296 | } | ||
297 | return super.eGet(featureID, resolve, coreType); | ||
298 | } | ||
299 | |||
300 | /** | ||
301 | * <!-- begin-user-doc --> | ||
302 | * <!-- end-user-doc --> | ||
303 | * @generated | ||
304 | */ | ||
305 | @SuppressWarnings("unchecked") | ||
306 | @Override | ||
307 | public void eSet(int featureID, Object newValue) { | ||
308 | switch (featureID) { | ||
309 | case CpsPackage.REQUIREMENT__REQUEST: | ||
310 | setRequest((Request) newValue); | ||
311 | return; | ||
312 | case CpsPackage.REQUIREMENT__COUNT: | ||
313 | setCount((Integer) newValue); | ||
314 | return; | ||
315 | case CpsPackage.REQUIREMENT__TYPE: | ||
316 | setType((ApplicationType) newValue); | ||
317 | return; | ||
318 | case CpsPackage.REQUIREMENT__INSTANCES: | ||
319 | getInstances().clear(); | ||
320 | getInstances().addAll((Collection<? extends ApplicationInstance>) newValue); | ||
321 | return; | ||
322 | } | ||
323 | super.eSet(featureID, newValue); | ||
324 | } | ||
325 | |||
326 | /** | ||
327 | * <!-- begin-user-doc --> | ||
328 | * <!-- end-user-doc --> | ||
329 | * @generated | ||
330 | */ | ||
331 | @Override | ||
332 | public void eUnset(int featureID) { | ||
333 | switch (featureID) { | ||
334 | case CpsPackage.REQUIREMENT__REQUEST: | ||
335 | setRequest((Request) null); | ||
336 | return; | ||
337 | case CpsPackage.REQUIREMENT__COUNT: | ||
338 | setCount(COUNT_EDEFAULT); | ||
339 | return; | ||
340 | case CpsPackage.REQUIREMENT__TYPE: | ||
341 | setType((ApplicationType) null); | ||
342 | return; | ||
343 | case CpsPackage.REQUIREMENT__INSTANCES: | ||
344 | getInstances().clear(); | ||
345 | return; | ||
346 | } | ||
347 | super.eUnset(featureID); | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * <!-- begin-user-doc --> | ||
352 | * <!-- end-user-doc --> | ||
353 | * @generated | ||
354 | */ | ||
355 | @Override | ||
356 | public boolean eIsSet(int featureID) { | ||
357 | switch (featureID) { | ||
358 | case CpsPackage.REQUIREMENT__REQUEST: | ||
359 | return getRequest() != null; | ||
360 | case CpsPackage.REQUIREMENT__COUNT: | ||
361 | return count != COUNT_EDEFAULT; | ||
362 | case CpsPackage.REQUIREMENT__TYPE: | ||
363 | return type != null; | ||
364 | case CpsPackage.REQUIREMENT__INSTANCES: | ||
365 | return instances != null && !instances.isEmpty(); | ||
366 | } | ||
367 | return super.eIsSet(featureID); | ||
368 | } | ||
369 | |||
370 | /** | ||
371 | * <!-- begin-user-doc --> | ||
372 | * <!-- end-user-doc --> | ||
373 | * @generated | ||
374 | */ | ||
375 | @Override | ||
376 | public String toString() { | ||
377 | if (eIsProxy()) | ||
378 | return super.toString(); | ||
379 | |||
380 | StringBuilder result = new StringBuilder(super.toString()); | ||
381 | result.append(" (count: "); | ||
382 | result.append(count); | ||
383 | result.append(')'); | ||
384 | return result.toString(); | ||
385 | } | ||
386 | |||
387 | } //RequirementImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/ResourceRequirementImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/ResourceRequirementImpl.java new file mode 100644 index 00000000..f4deb575 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/impl/ResourceRequirementImpl.java | |||
@@ -0,0 +1,291 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement; | ||
8 | |||
9 | import org.eclipse.emf.common.notify.Notification; | ||
10 | |||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.emf.ecore.InternalEObject; | ||
13 | |||
14 | import org.eclipse.emf.ecore.impl.ENotificationImpl; | ||
15 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
16 | |||
17 | /** | ||
18 | * <!-- begin-user-doc --> | ||
19 | * An implementation of the model object '<em><b>Resource Requirement</b></em>'. | ||
20 | * <!-- end-user-doc --> | ||
21 | * <p> | ||
22 | * The following features are implemented: | ||
23 | * </p> | ||
24 | * <ul> | ||
25 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ResourceRequirementImpl#getRequiredMemory <em>Required Memory</em>}</li> | ||
26 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ResourceRequirementImpl#getRequiredHdd <em>Required Hdd</em>}</li> | ||
27 | * <li>{@link hu.bme.mit.inf.dslreasoner.domains.cps.impl.ResourceRequirementImpl#getHostType <em>Host Type</em>}</li> | ||
28 | * </ul> | ||
29 | * | ||
30 | * @generated | ||
31 | */ | ||
32 | public class ResourceRequirementImpl extends MinimalEObjectImpl.Container implements ResourceRequirement { | ||
33 | /** | ||
34 | * The default value of the '{@link #getRequiredMemory() <em>Required Memory</em>}' attribute. | ||
35 | * <!-- begin-user-doc --> | ||
36 | * <!-- end-user-doc --> | ||
37 | * @see #getRequiredMemory() | ||
38 | * @generated | ||
39 | * @ordered | ||
40 | */ | ||
41 | protected static final int REQUIRED_MEMORY_EDEFAULT = 0; | ||
42 | |||
43 | /** | ||
44 | * The cached value of the '{@link #getRequiredMemory() <em>Required Memory</em>}' attribute. | ||
45 | * <!-- begin-user-doc --> | ||
46 | * <!-- end-user-doc --> | ||
47 | * @see #getRequiredMemory() | ||
48 | * @generated | ||
49 | * @ordered | ||
50 | */ | ||
51 | protected int requiredMemory = REQUIRED_MEMORY_EDEFAULT; | ||
52 | |||
53 | /** | ||
54 | * The default value of the '{@link #getRequiredHdd() <em>Required Hdd</em>}' attribute. | ||
55 | * <!-- begin-user-doc --> | ||
56 | * <!-- end-user-doc --> | ||
57 | * @see #getRequiredHdd() | ||
58 | * @generated | ||
59 | * @ordered | ||
60 | */ | ||
61 | protected static final int REQUIRED_HDD_EDEFAULT = 0; | ||
62 | |||
63 | /** | ||
64 | * The cached value of the '{@link #getRequiredHdd() <em>Required Hdd</em>}' attribute. | ||
65 | * <!-- begin-user-doc --> | ||
66 | * <!-- end-user-doc --> | ||
67 | * @see #getRequiredHdd() | ||
68 | * @generated | ||
69 | * @ordered | ||
70 | */ | ||
71 | protected int requiredHdd = REQUIRED_HDD_EDEFAULT; | ||
72 | |||
73 | /** | ||
74 | * The cached value of the '{@link #getHostType() <em>Host Type</em>}' reference. | ||
75 | * <!-- begin-user-doc --> | ||
76 | * <!-- end-user-doc --> | ||
77 | * @see #getHostType() | ||
78 | * @generated | ||
79 | * @ordered | ||
80 | */ | ||
81 | protected HostType hostType; | ||
82 | |||
83 | /** | ||
84 | * <!-- begin-user-doc --> | ||
85 | * <!-- end-user-doc --> | ||
86 | * @generated | ||
87 | */ | ||
88 | protected ResourceRequirementImpl() { | ||
89 | super(); | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * <!-- begin-user-doc --> | ||
94 | * <!-- end-user-doc --> | ||
95 | * @generated | ||
96 | */ | ||
97 | @Override | ||
98 | protected EClass eStaticClass() { | ||
99 | return CpsPackage.Literals.RESOURCE_REQUIREMENT; | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * <!-- begin-user-doc --> | ||
104 | * <!-- end-user-doc --> | ||
105 | * @generated | ||
106 | */ | ||
107 | @Override | ||
108 | public int getRequiredMemory() { | ||
109 | return requiredMemory; | ||
110 | } | ||
111 | |||
112 | /** | ||
113 | * <!-- begin-user-doc --> | ||
114 | * <!-- end-user-doc --> | ||
115 | * @generated | ||
116 | */ | ||
117 | @Override | ||
118 | public void setRequiredMemory(int newRequiredMemory) { | ||
119 | int oldRequiredMemory = requiredMemory; | ||
120 | requiredMemory = newRequiredMemory; | ||
121 | if (eNotificationRequired()) | ||
122 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_MEMORY, | ||
123 | oldRequiredMemory, requiredMemory)); | ||
124 | } | ||
125 | |||
126 | /** | ||
127 | * <!-- begin-user-doc --> | ||
128 | * <!-- end-user-doc --> | ||
129 | * @generated | ||
130 | */ | ||
131 | @Override | ||
132 | public int getRequiredHdd() { | ||
133 | return requiredHdd; | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * <!-- begin-user-doc --> | ||
138 | * <!-- end-user-doc --> | ||
139 | * @generated | ||
140 | */ | ||
141 | @Override | ||
142 | public void setRequiredHdd(int newRequiredHdd) { | ||
143 | int oldRequiredHdd = requiredHdd; | ||
144 | requiredHdd = newRequiredHdd; | ||
145 | if (eNotificationRequired()) | ||
146 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_HDD, | ||
147 | oldRequiredHdd, requiredHdd)); | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * <!-- begin-user-doc --> | ||
152 | * <!-- end-user-doc --> | ||
153 | * @generated | ||
154 | */ | ||
155 | @Override | ||
156 | public HostType getHostType() { | ||
157 | if (hostType != null && hostType.eIsProxy()) { | ||
158 | InternalEObject oldHostType = (InternalEObject) hostType; | ||
159 | hostType = (HostType) eResolveProxy(oldHostType); | ||
160 | if (hostType != oldHostType) { | ||
161 | if (eNotificationRequired()) | ||
162 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, | ||
163 | CpsPackage.RESOURCE_REQUIREMENT__HOST_TYPE, oldHostType, hostType)); | ||
164 | } | ||
165 | } | ||
166 | return hostType; | ||
167 | } | ||
168 | |||
169 | /** | ||
170 | * <!-- begin-user-doc --> | ||
171 | * <!-- end-user-doc --> | ||
172 | * @generated | ||
173 | */ | ||
174 | public HostType basicGetHostType() { | ||
175 | return hostType; | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * <!-- begin-user-doc --> | ||
180 | * <!-- end-user-doc --> | ||
181 | * @generated | ||
182 | */ | ||
183 | @Override | ||
184 | public void setHostType(HostType newHostType) { | ||
185 | HostType oldHostType = hostType; | ||
186 | hostType = newHostType; | ||
187 | if (eNotificationRequired()) | ||
188 | eNotify(new ENotificationImpl(this, Notification.SET, CpsPackage.RESOURCE_REQUIREMENT__HOST_TYPE, | ||
189 | oldHostType, hostType)); | ||
190 | } | ||
191 | |||
192 | /** | ||
193 | * <!-- begin-user-doc --> | ||
194 | * <!-- end-user-doc --> | ||
195 | * @generated | ||
196 | */ | ||
197 | @Override | ||
198 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
199 | switch (featureID) { | ||
200 | case CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_MEMORY: | ||
201 | return getRequiredMemory(); | ||
202 | case CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_HDD: | ||
203 | return getRequiredHdd(); | ||
204 | case CpsPackage.RESOURCE_REQUIREMENT__HOST_TYPE: | ||
205 | if (resolve) | ||
206 | return getHostType(); | ||
207 | return basicGetHostType(); | ||
208 | } | ||
209 | return super.eGet(featureID, resolve, coreType); | ||
210 | } | ||
211 | |||
212 | /** | ||
213 | * <!-- begin-user-doc --> | ||
214 | * <!-- end-user-doc --> | ||
215 | * @generated | ||
216 | */ | ||
217 | @Override | ||
218 | public void eSet(int featureID, Object newValue) { | ||
219 | switch (featureID) { | ||
220 | case CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_MEMORY: | ||
221 | setRequiredMemory((Integer) newValue); | ||
222 | return; | ||
223 | case CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_HDD: | ||
224 | setRequiredHdd((Integer) newValue); | ||
225 | return; | ||
226 | case CpsPackage.RESOURCE_REQUIREMENT__HOST_TYPE: | ||
227 | setHostType((HostType) newValue); | ||
228 | return; | ||
229 | } | ||
230 | super.eSet(featureID, newValue); | ||
231 | } | ||
232 | |||
233 | /** | ||
234 | * <!-- begin-user-doc --> | ||
235 | * <!-- end-user-doc --> | ||
236 | * @generated | ||
237 | */ | ||
238 | @Override | ||
239 | public void eUnset(int featureID) { | ||
240 | switch (featureID) { | ||
241 | case CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_MEMORY: | ||
242 | setRequiredMemory(REQUIRED_MEMORY_EDEFAULT); | ||
243 | return; | ||
244 | case CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_HDD: | ||
245 | setRequiredHdd(REQUIRED_HDD_EDEFAULT); | ||
246 | return; | ||
247 | case CpsPackage.RESOURCE_REQUIREMENT__HOST_TYPE: | ||
248 | setHostType((HostType) null); | ||
249 | return; | ||
250 | } | ||
251 | super.eUnset(featureID); | ||
252 | } | ||
253 | |||
254 | /** | ||
255 | * <!-- begin-user-doc --> | ||
256 | * <!-- end-user-doc --> | ||
257 | * @generated | ||
258 | */ | ||
259 | @Override | ||
260 | public boolean eIsSet(int featureID) { | ||
261 | switch (featureID) { | ||
262 | case CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_MEMORY: | ||
263 | return requiredMemory != REQUIRED_MEMORY_EDEFAULT; | ||
264 | case CpsPackage.RESOURCE_REQUIREMENT__REQUIRED_HDD: | ||
265 | return requiredHdd != REQUIRED_HDD_EDEFAULT; | ||
266 | case CpsPackage.RESOURCE_REQUIREMENT__HOST_TYPE: | ||
267 | return hostType != null; | ||
268 | } | ||
269 | return super.eIsSet(featureID); | ||
270 | } | ||
271 | |||
272 | /** | ||
273 | * <!-- begin-user-doc --> | ||
274 | * <!-- end-user-doc --> | ||
275 | * @generated | ||
276 | */ | ||
277 | @Override | ||
278 | public String toString() { | ||
279 | if (eIsProxy()) | ||
280 | return super.toString(); | ||
281 | |||
282 | StringBuilder result = new StringBuilder(super.toString()); | ||
283 | result.append(" (requiredMemory: "); | ||
284 | result.append(requiredMemory); | ||
285 | result.append(", requiredHdd: "); | ||
286 | result.append(requiredHdd); | ||
287 | result.append(')'); | ||
288 | return result.toString(); | ||
289 | } | ||
290 | |||
291 | } //ResourceRequirementImpl | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/util/CpsAdapterFactory.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/util/CpsAdapterFactory.java new file mode 100644 index 00000000..83e984a6 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/util/CpsAdapterFactory.java | |||
@@ -0,0 +1,252 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.util; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.*; | ||
6 | |||
7 | import org.eclipse.emf.common.notify.Adapter; | ||
8 | import org.eclipse.emf.common.notify.Notifier; | ||
9 | |||
10 | import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; | ||
11 | |||
12 | import org.eclipse.emf.ecore.EObject; | ||
13 | |||
14 | /** | ||
15 | * <!-- begin-user-doc --> | ||
16 | * The <b>Adapter Factory</b> for the model. | ||
17 | * It provides an adapter <code>createXXX</code> method for each class of the model. | ||
18 | * <!-- end-user-doc --> | ||
19 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage | ||
20 | * @generated | ||
21 | */ | ||
22 | public class CpsAdapterFactory extends AdapterFactoryImpl { | ||
23 | /** | ||
24 | * The cached model package. | ||
25 | * <!-- begin-user-doc --> | ||
26 | * <!-- end-user-doc --> | ||
27 | * @generated | ||
28 | */ | ||
29 | protected static CpsPackage modelPackage; | ||
30 | |||
31 | /** | ||
32 | * Creates an instance of the adapter factory. | ||
33 | * <!-- begin-user-doc --> | ||
34 | * <!-- end-user-doc --> | ||
35 | * @generated | ||
36 | */ | ||
37 | public CpsAdapterFactory() { | ||
38 | if (modelPackage == null) { | ||
39 | modelPackage = CpsPackage.eINSTANCE; | ||
40 | } | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Returns whether this factory is applicable for the type of the object. | ||
45 | * <!-- begin-user-doc --> | ||
46 | * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. | ||
47 | * <!-- end-user-doc --> | ||
48 | * @return whether this factory is applicable for the type of the object. | ||
49 | * @generated | ||
50 | */ | ||
51 | @Override | ||
52 | public boolean isFactoryForType(Object object) { | ||
53 | if (object == modelPackage) { | ||
54 | return true; | ||
55 | } | ||
56 | if (object instanceof EObject) { | ||
57 | return ((EObject) object).eClass().getEPackage() == modelPackage; | ||
58 | } | ||
59 | return false; | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * The switch that delegates to the <code>createXXX</code> methods. | ||
64 | * <!-- begin-user-doc --> | ||
65 | * <!-- end-user-doc --> | ||
66 | * @generated | ||
67 | */ | ||
68 | protected CpsSwitch<Adapter> modelSwitch = new CpsSwitch<Adapter>() { | ||
69 | @Override | ||
70 | public Adapter caseCyberPhysicalSystem(CyberPhysicalSystem object) { | ||
71 | return createCyberPhysicalSystemAdapter(); | ||
72 | } | ||
73 | |||
74 | @Override | ||
75 | public Adapter caseApplicationType(ApplicationType object) { | ||
76 | return createApplicationTypeAdapter(); | ||
77 | } | ||
78 | |||
79 | @Override | ||
80 | public Adapter caseHostType(HostType object) { | ||
81 | return createHostTypeAdapter(); | ||
82 | } | ||
83 | |||
84 | @Override | ||
85 | public Adapter caseRequest(Request object) { | ||
86 | return createRequestAdapter(); | ||
87 | } | ||
88 | |||
89 | @Override | ||
90 | public Adapter caseRequirement(Requirement object) { | ||
91 | return createRequirementAdapter(); | ||
92 | } | ||
93 | |||
94 | @Override | ||
95 | public Adapter caseApplicationInstance(ApplicationInstance object) { | ||
96 | return createApplicationInstanceAdapter(); | ||
97 | } | ||
98 | |||
99 | @Override | ||
100 | public Adapter caseResourceRequirement(ResourceRequirement object) { | ||
101 | return createResourceRequirementAdapter(); | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public Adapter caseHostInstance(HostInstance object) { | ||
106 | return createHostInstanceAdapter(); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public Adapter defaultCase(EObject object) { | ||
111 | return createEObjectAdapter(); | ||
112 | } | ||
113 | }; | ||
114 | |||
115 | /** | ||
116 | * Creates an adapter for the <code>target</code>. | ||
117 | * <!-- begin-user-doc --> | ||
118 | * <!-- end-user-doc --> | ||
119 | * @param target the object to adapt. | ||
120 | * @return the adapter for the <code>target</code>. | ||
121 | * @generated | ||
122 | */ | ||
123 | @Override | ||
124 | public Adapter createAdapter(Notifier target) { | ||
125 | return modelSwitch.doSwitch((EObject) target); | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem <em>Cyber Physical System</em>}'. | ||
130 | * <!-- begin-user-doc --> | ||
131 | * This default implementation returns null so that we can easily ignore cases; | ||
132 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
133 | * <!-- end-user-doc --> | ||
134 | * @return the new adapter. | ||
135 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
136 | * @generated | ||
137 | */ | ||
138 | public Adapter createCyberPhysicalSystemAdapter() { | ||
139 | return null; | ||
140 | } | ||
141 | |||
142 | /** | ||
143 | * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType <em>Application Type</em>}'. | ||
144 | * <!-- begin-user-doc --> | ||
145 | * This default implementation returns null so that we can easily ignore cases; | ||
146 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
147 | * <!-- end-user-doc --> | ||
148 | * @return the new adapter. | ||
149 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType | ||
150 | * @generated | ||
151 | */ | ||
152 | public Adapter createApplicationTypeAdapter() { | ||
153 | return null; | ||
154 | } | ||
155 | |||
156 | /** | ||
157 | * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostType <em>Host Type</em>}'. | ||
158 | * <!-- begin-user-doc --> | ||
159 | * This default implementation returns null so that we can easily ignore cases; | ||
160 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
161 | * <!-- end-user-doc --> | ||
162 | * @return the new adapter. | ||
163 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostType | ||
164 | * @generated | ||
165 | */ | ||
166 | public Adapter createHostTypeAdapter() { | ||
167 | return null; | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Request <em>Request</em>}'. | ||
172 | * <!-- begin-user-doc --> | ||
173 | * This default implementation returns null so that we can easily ignore cases; | ||
174 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
175 | * <!-- end-user-doc --> | ||
176 | * @return the new adapter. | ||
177 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Request | ||
178 | * @generated | ||
179 | */ | ||
180 | public Adapter createRequestAdapter() { | ||
181 | return null; | ||
182 | } | ||
183 | |||
184 | /** | ||
185 | * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.Requirement <em>Requirement</em>}'. | ||
186 | * <!-- begin-user-doc --> | ||
187 | * This default implementation returns null so that we can easily ignore cases; | ||
188 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
189 | * <!-- end-user-doc --> | ||
190 | * @return the new adapter. | ||
191 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.Requirement | ||
192 | * @generated | ||
193 | */ | ||
194 | public Adapter createRequirementAdapter() { | ||
195 | return null; | ||
196 | } | ||
197 | |||
198 | /** | ||
199 | * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance <em>Application Instance</em>}'. | ||
200 | * <!-- begin-user-doc --> | ||
201 | * This default implementation returns null so that we can easily ignore cases; | ||
202 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
203 | * <!-- end-user-doc --> | ||
204 | * @return the new adapter. | ||
205 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance | ||
206 | * @generated | ||
207 | */ | ||
208 | public Adapter createApplicationInstanceAdapter() { | ||
209 | return null; | ||
210 | } | ||
211 | |||
212 | /** | ||
213 | * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement <em>Resource Requirement</em>}'. | ||
214 | * <!-- begin-user-doc --> | ||
215 | * This default implementation returns null so that we can easily ignore cases; | ||
216 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
217 | * <!-- end-user-doc --> | ||
218 | * @return the new adapter. | ||
219 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement | ||
220 | * @generated | ||
221 | */ | ||
222 | public Adapter createResourceRequirementAdapter() { | ||
223 | return null; | ||
224 | } | ||
225 | |||
226 | /** | ||
227 | * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance <em>Host Instance</em>}'. | ||
228 | * <!-- begin-user-doc --> | ||
229 | * This default implementation returns null so that we can easily ignore cases; | ||
230 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
231 | * <!-- end-user-doc --> | ||
232 | * @return the new adapter. | ||
233 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance | ||
234 | * @generated | ||
235 | */ | ||
236 | public Adapter createHostInstanceAdapter() { | ||
237 | return null; | ||
238 | } | ||
239 | |||
240 | /** | ||
241 | * Creates a new adapter for the default case. | ||
242 | * <!-- begin-user-doc --> | ||
243 | * This default implementation returns null. | ||
244 | * <!-- end-user-doc --> | ||
245 | * @return the new adapter. | ||
246 | * @generated | ||
247 | */ | ||
248 | public Adapter createEObjectAdapter() { | ||
249 | return null; | ||
250 | } | ||
251 | |||
252 | } //CpsAdapterFactory | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/util/CpsSwitch.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/util/CpsSwitch.java new file mode 100644 index 00000000..28b630a9 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen/hu/bme/mit/inf/dslreasoner/domains/cps/util/CpsSwitch.java | |||
@@ -0,0 +1,266 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.domains.cps.util; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.*; | ||
6 | |||
7 | import org.eclipse.emf.ecore.EObject; | ||
8 | import org.eclipse.emf.ecore.EPackage; | ||
9 | |||
10 | import org.eclipse.emf.ecore.util.Switch; | ||
11 | |||
12 | /** | ||
13 | * <!-- begin-user-doc --> | ||
14 | * The <b>Switch</b> for the model's inheritance hierarchy. | ||
15 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} | ||
16 | * to invoke the <code>caseXXX</code> method for each class of the model, | ||
17 | * starting with the actual class of the object | ||
18 | * and proceeding up the inheritance hierarchy | ||
19 | * until a non-null result is returned, | ||
20 | * which is the result of the switch. | ||
21 | * <!-- end-user-doc --> | ||
22 | * @see hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage | ||
23 | * @generated | ||
24 | */ | ||
25 | public class CpsSwitch<T> extends Switch<T> { | ||
26 | /** | ||
27 | * The cached model package | ||
28 | * <!-- begin-user-doc --> | ||
29 | * <!-- end-user-doc --> | ||
30 | * @generated | ||
31 | */ | ||
32 | protected static CpsPackage modelPackage; | ||
33 | |||
34 | /** | ||
35 | * Creates an instance of the switch. | ||
36 | * <!-- begin-user-doc --> | ||
37 | * <!-- end-user-doc --> | ||
38 | * @generated | ||
39 | */ | ||
40 | public CpsSwitch() { | ||
41 | if (modelPackage == null) { | ||
42 | modelPackage = CpsPackage.eINSTANCE; | ||
43 | } | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * Checks whether this is a switch for the given package. | ||
48 | * <!-- begin-user-doc --> | ||
49 | * <!-- end-user-doc --> | ||
50 | * @param ePackage the package in question. | ||
51 | * @return whether this is a switch for the given package. | ||
52 | * @generated | ||
53 | */ | ||
54 | @Override | ||
55 | protected boolean isSwitchFor(EPackage ePackage) { | ||
56 | return ePackage == modelPackage; | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. | ||
61 | * <!-- begin-user-doc --> | ||
62 | * <!-- end-user-doc --> | ||
63 | * @return the first non-null result returned by a <code>caseXXX</code> call. | ||
64 | * @generated | ||
65 | */ | ||
66 | @Override | ||
67 | protected T doSwitch(int classifierID, EObject theEObject) { | ||
68 | switch (classifierID) { | ||
69 | case CpsPackage.CYBER_PHYSICAL_SYSTEM: { | ||
70 | CyberPhysicalSystem cyberPhysicalSystem = (CyberPhysicalSystem) theEObject; | ||
71 | T result = caseCyberPhysicalSystem(cyberPhysicalSystem); | ||
72 | if (result == null) | ||
73 | result = defaultCase(theEObject); | ||
74 | return result; | ||
75 | } | ||
76 | case CpsPackage.APPLICATION_TYPE: { | ||
77 | ApplicationType applicationType = (ApplicationType) theEObject; | ||
78 | T result = caseApplicationType(applicationType); | ||
79 | if (result == null) | ||
80 | result = defaultCase(theEObject); | ||
81 | return result; | ||
82 | } | ||
83 | case CpsPackage.HOST_TYPE: { | ||
84 | HostType hostType = (HostType) theEObject; | ||
85 | T result = caseHostType(hostType); | ||
86 | if (result == null) | ||
87 | result = defaultCase(theEObject); | ||
88 | return result; | ||
89 | } | ||
90 | case CpsPackage.REQUEST: { | ||
91 | Request request = (Request) theEObject; | ||
92 | T result = caseRequest(request); | ||
93 | if (result == null) | ||
94 | result = defaultCase(theEObject); | ||
95 | return result; | ||
96 | } | ||
97 | case CpsPackage.REQUIREMENT: { | ||
98 | Requirement requirement = (Requirement) theEObject; | ||
99 | T result = caseRequirement(requirement); | ||
100 | if (result == null) | ||
101 | result = defaultCase(theEObject); | ||
102 | return result; | ||
103 | } | ||
104 | case CpsPackage.APPLICATION_INSTANCE: { | ||
105 | ApplicationInstance applicationInstance = (ApplicationInstance) theEObject; | ||
106 | T result = caseApplicationInstance(applicationInstance); | ||
107 | if (result == null) | ||
108 | result = defaultCase(theEObject); | ||
109 | return result; | ||
110 | } | ||
111 | case CpsPackage.RESOURCE_REQUIREMENT: { | ||
112 | ResourceRequirement resourceRequirement = (ResourceRequirement) theEObject; | ||
113 | T result = caseResourceRequirement(resourceRequirement); | ||
114 | if (result == null) | ||
115 | result = defaultCase(theEObject); | ||
116 | return result; | ||
117 | } | ||
118 | case CpsPackage.HOST_INSTANCE: { | ||
119 | HostInstance hostInstance = (HostInstance) theEObject; | ||
120 | T result = caseHostInstance(hostInstance); | ||
121 | if (result == null) | ||
122 | result = defaultCase(theEObject); | ||
123 | return result; | ||
124 | } | ||
125 | default: | ||
126 | return defaultCase(theEObject); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | /** | ||
131 | * Returns the result of interpreting the object as an instance of '<em>Cyber Physical System</em>'. | ||
132 | * <!-- begin-user-doc --> | ||
133 | * This implementation returns null; | ||
134 | * returning a non-null result will terminate the switch. | ||
135 | * <!-- end-user-doc --> | ||
136 | * @param object the target of the switch. | ||
137 | * @return the result of interpreting the object as an instance of '<em>Cyber Physical System</em>'. | ||
138 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
139 | * @generated | ||
140 | */ | ||
141 | public T caseCyberPhysicalSystem(CyberPhysicalSystem object) { | ||
142 | return null; | ||
143 | } | ||
144 | |||
145 | /** | ||
146 | * Returns the result of interpreting the object as an instance of '<em>Application Type</em>'. | ||
147 | * <!-- begin-user-doc --> | ||
148 | * This implementation returns null; | ||
149 | * returning a non-null result will terminate the switch. | ||
150 | * <!-- end-user-doc --> | ||
151 | * @param object the target of the switch. | ||
152 | * @return the result of interpreting the object as an instance of '<em>Application Type</em>'. | ||
153 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
154 | * @generated | ||
155 | */ | ||
156 | public T caseApplicationType(ApplicationType object) { | ||
157 | return null; | ||
158 | } | ||
159 | |||
160 | /** | ||
161 | * Returns the result of interpreting the object as an instance of '<em>Host Type</em>'. | ||
162 | * <!-- begin-user-doc --> | ||
163 | * This implementation returns null; | ||
164 | * returning a non-null result will terminate the switch. | ||
165 | * <!-- end-user-doc --> | ||
166 | * @param object the target of the switch. | ||
167 | * @return the result of interpreting the object as an instance of '<em>Host Type</em>'. | ||
168 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
169 | * @generated | ||
170 | */ | ||
171 | public T caseHostType(HostType object) { | ||
172 | return null; | ||
173 | } | ||
174 | |||
175 | /** | ||
176 | * Returns the result of interpreting the object as an instance of '<em>Request</em>'. | ||
177 | * <!-- begin-user-doc --> | ||
178 | * This implementation returns null; | ||
179 | * returning a non-null result will terminate the switch. | ||
180 | * <!-- end-user-doc --> | ||
181 | * @param object the target of the switch. | ||
182 | * @return the result of interpreting the object as an instance of '<em>Request</em>'. | ||
183 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
184 | * @generated | ||
185 | */ | ||
186 | public T caseRequest(Request object) { | ||
187 | return null; | ||
188 | } | ||
189 | |||
190 | /** | ||
191 | * Returns the result of interpreting the object as an instance of '<em>Requirement</em>'. | ||
192 | * <!-- begin-user-doc --> | ||
193 | * This implementation returns null; | ||
194 | * returning a non-null result will terminate the switch. | ||
195 | * <!-- end-user-doc --> | ||
196 | * @param object the target of the switch. | ||
197 | * @return the result of interpreting the object as an instance of '<em>Requirement</em>'. | ||
198 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
199 | * @generated | ||
200 | */ | ||
201 | public T caseRequirement(Requirement object) { | ||
202 | return null; | ||
203 | } | ||
204 | |||
205 | /** | ||
206 | * Returns the result of interpreting the object as an instance of '<em>Application Instance</em>'. | ||
207 | * <!-- begin-user-doc --> | ||
208 | * This implementation returns null; | ||
209 | * returning a non-null result will terminate the switch. | ||
210 | * <!-- end-user-doc --> | ||
211 | * @param object the target of the switch. | ||
212 | * @return the result of interpreting the object as an instance of '<em>Application Instance</em>'. | ||
213 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
214 | * @generated | ||
215 | */ | ||
216 | public T caseApplicationInstance(ApplicationInstance object) { | ||
217 | return null; | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * Returns the result of interpreting the object as an instance of '<em>Resource Requirement</em>'. | ||
222 | * <!-- begin-user-doc --> | ||
223 | * This implementation returns null; | ||
224 | * returning a non-null result will terminate the switch. | ||
225 | * <!-- end-user-doc --> | ||
226 | * @param object the target of the switch. | ||
227 | * @return the result of interpreting the object as an instance of '<em>Resource Requirement</em>'. | ||
228 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
229 | * @generated | ||
230 | */ | ||
231 | public T caseResourceRequirement(ResourceRequirement object) { | ||
232 | return null; | ||
233 | } | ||
234 | |||
235 | /** | ||
236 | * Returns the result of interpreting the object as an instance of '<em>Host Instance</em>'. | ||
237 | * <!-- begin-user-doc --> | ||
238 | * This implementation returns null; | ||
239 | * returning a non-null result will terminate the switch. | ||
240 | * <!-- end-user-doc --> | ||
241 | * @param object the target of the switch. | ||
242 | * @return the result of interpreting the object as an instance of '<em>Host Instance</em>'. | ||
243 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
244 | * @generated | ||
245 | */ | ||
246 | public T caseHostInstance(HostInstance object) { | ||
247 | return null; | ||
248 | } | ||
249 | |||
250 | /** | ||
251 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. | ||
252 | * <!-- begin-user-doc --> | ||
253 | * This implementation returns null; | ||
254 | * returning a non-null result will terminate the switch, but this is the last case anyway. | ||
255 | * <!-- end-user-doc --> | ||
256 | * @param object the target of the switch. | ||
257 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. | ||
258 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) | ||
259 | * @generated | ||
260 | */ | ||
261 | @Override | ||
262 | public T defaultCase(EObject object) { | ||
263 | return null; | ||
264 | } | ||
265 | |||
266 | } //CpsSwitch | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.ecore b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.ecore new file mode 100644 index 00000000..0f52d8ee --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.ecore | |||
@@ -0,0 +1,61 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="cps" nsURI="http://www.example.org/cps" nsPrefix="cps"> | ||
4 | <eClassifiers xsi:type="ecore:EClass" name="CyberPhysicalSystem"> | ||
5 | <eStructuralFeatures xsi:type="ecore:EReference" name="requests" upperBound="-1" | ||
6 | eType="#//Request" containment="true"/> | ||
7 | <eStructuralFeatures xsi:type="ecore:EReference" name="applicationTypes" upperBound="-1" | ||
8 | eType="#//ApplicationType" containment="true"/> | ||
9 | <eStructuralFeatures xsi:type="ecore:EReference" name="hostTypes" upperBound="-1" | ||
10 | eType="#//HostType" containment="true"/> | ||
11 | </eClassifiers> | ||
12 | <eClassifiers xsi:type="ecore:EClass" name="ApplicationType"> | ||
13 | <eStructuralFeatures xsi:type="ecore:EReference" name="instances" upperBound="-1" | ||
14 | eType="#//ApplicationInstance" containment="true" eOpposite="#//ApplicationInstance/type"/> | ||
15 | <eStructuralFeatures xsi:type="ecore:EReference" name="requirements" upperBound="-1" | ||
16 | eType="#//ResourceRequirement" containment="true"/> | ||
17 | </eClassifiers> | ||
18 | <eClassifiers xsi:type="ecore:EClass" name="HostType"> | ||
19 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultMemory" lowerBound="1" | ||
20 | eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | ||
21 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultHdd" lowerBound="1" | ||
22 | eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | ||
23 | <eStructuralFeatures xsi:type="ecore:EReference" name="instances" upperBound="-1" | ||
24 | eType="#//HostInstance" containment="true" eOpposite="#//HostInstance/type"/> | ||
25 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | ||
26 | </eClassifiers> | ||
27 | <eClassifiers xsi:type="ecore:EClass" name="Request"> | ||
28 | <eStructuralFeatures xsi:type="ecore:EReference" name="requirements" upperBound="-1" | ||
29 | eType="#//Requirement" containment="true" eOpposite="#//Requirement/request"/> | ||
30 | </eClassifiers> | ||
31 | <eClassifiers xsi:type="ecore:EClass" name="Requirement"> | ||
32 | <eStructuralFeatures xsi:type="ecore:EReference" name="request" lowerBound="1" | ||
33 | eType="#//Request" eOpposite="#//Request/requirements"/> | ||
34 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="count" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | ||
35 | <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="#//ApplicationType"/> | ||
36 | <eStructuralFeatures xsi:type="ecore:EReference" name="instances" upperBound="-1" | ||
37 | eType="#//ApplicationInstance" eOpposite="#//ApplicationInstance/requirement"/> | ||
38 | </eClassifiers> | ||
39 | <eClassifiers xsi:type="ecore:EClass" name="ApplicationInstance"> | ||
40 | <eStructuralFeatures xsi:type="ecore:EReference" name="requirement" eType="#//Requirement" | ||
41 | eOpposite="#//Requirement/instances"/> | ||
42 | <eStructuralFeatures xsi:type="ecore:EReference" name="type" lowerBound="1" eType="#//ApplicationType" | ||
43 | eOpposite="#//ApplicationType/instances"/> | ||
44 | <eStructuralFeatures xsi:type="ecore:EReference" name="allocatedTo" lowerBound="1" | ||
45 | eType="#//HostInstance" eOpposite="#//HostInstance/applications"/> | ||
46 | </eClassifiers> | ||
47 | <eClassifiers xsi:type="ecore:EClass" name="ResourceRequirement"> | ||
48 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="requiredMemory" lowerBound="1" | ||
49 | eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | ||
50 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="requiredHdd" lowerBound="1" | ||
51 | eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | ||
52 | <eStructuralFeatures xsi:type="ecore:EReference" name="hostType" lowerBound="1" | ||
53 | eType="#//HostType"/> | ||
54 | </eClassifiers> | ||
55 | <eClassifiers xsi:type="ecore:EClass" name="HostInstance"> | ||
56 | <eStructuralFeatures xsi:type="ecore:EReference" name="type" lowerBound="1" eType="#//HostType" | ||
57 | eOpposite="#//HostType/instances"/> | ||
58 | <eStructuralFeatures xsi:type="ecore:EReference" name="applications" upperBound="-1" | ||
59 | eType="#//ApplicationInstance" eOpposite="#//ApplicationInstance/allocatedTo"/> | ||
60 | </eClassifiers> | ||
61 | </ecore:EPackage> | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.genmodel b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.genmodel new file mode 100644 index 00000000..09ed2e0c --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.genmodel | |||
@@ -0,0 +1,53 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" | ||
4 | modelDirectory="/hu.bme.mit.inf.dslreasoner.domains.cps/ecore-gen" | ||
5 | creationIcons="false" editDirectory="/hu.bme.mit.inf.dslreasoner.domains.cps.edit/src-gen" | ||
6 | editorDirectory="/hu.bme.mit.inf.dslreasoner.domains.cps.editor/src-gen" modelPluginID="hu.bme.mit.inf.dslreasoner.domains.cps" | ||
7 | modelName="Cps" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" | ||
8 | codeFormatting="true" importerID="org.eclipse.emf.importer.ecore" complianceLevel="8.0" | ||
9 | copyrightFields="false" operationReflection="true" importOrganizing="true"> | ||
10 | <foreignModel>cps.ecore</foreignModel> | ||
11 | <testsDirectory xsi:nil="true"/> | ||
12 | <genPackages prefix="Cps" basePackage="hu.bme.mit.inf.dslreasoner.domains" disposableProviderFactory="true" | ||
13 | ecorePackage="cps.ecore#/"> | ||
14 | <genClasses ecoreClass="cps.ecore#//CyberPhysicalSystem"> | ||
15 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cps.ecore#//CyberPhysicalSystem/requests"/> | ||
16 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cps.ecore#//CyberPhysicalSystem/applicationTypes"/> | ||
17 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cps.ecore#//CyberPhysicalSystem/hostTypes"/> | ||
18 | </genClasses> | ||
19 | <genClasses ecoreClass="cps.ecore#//ApplicationType"> | ||
20 | <genFeatures children="true" createChild="true" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//ApplicationType/instances"/> | ||
21 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cps.ecore#//ApplicationType/requirements"/> | ||
22 | </genClasses> | ||
23 | <genClasses ecoreClass="cps.ecore#//HostType"> | ||
24 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute cps.ecore#//HostType/defaultMemory"/> | ||
25 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute cps.ecore#//HostType/defaultHdd"/> | ||
26 | <genFeatures children="true" createChild="true" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//HostType/instances"/> | ||
27 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute cps.ecore#//HostType/cost"/> | ||
28 | </genClasses> | ||
29 | <genClasses ecoreClass="cps.ecore#//Request"> | ||
30 | <genFeatures children="true" createChild="true" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//Request/requirements"/> | ||
31 | </genClasses> | ||
32 | <genClasses ecoreClass="cps.ecore#//Requirement"> | ||
33 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//Requirement/request"/> | ||
34 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute cps.ecore#//Requirement/count"/> | ||
35 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//Requirement/type"/> | ||
36 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//Requirement/instances"/> | ||
37 | </genClasses> | ||
38 | <genClasses ecoreClass="cps.ecore#//ApplicationInstance"> | ||
39 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//ApplicationInstance/requirement"/> | ||
40 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//ApplicationInstance/type"/> | ||
41 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
42 | </genClasses> | ||
43 | <genClasses ecoreClass="cps.ecore#//ResourceRequirement"> | ||
44 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute cps.ecore#//ResourceRequirement/requiredMemory"/> | ||
45 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute cps.ecore#//ResourceRequirement/requiredHdd"/> | ||
46 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//ResourceRequirement/hostType"/> | ||
47 | </genClasses> | ||
48 | <genClasses ecoreClass="cps.ecore#//HostInstance"> | ||
49 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//HostInstance/type"/> | ||
50 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference cps.ecore#//HostInstance/applications"/> | ||
51 | </genClasses> | ||
52 | </genPackages> | ||
53 | </genmodel:GenModel> | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.henshin b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.henshin new file mode 100644 index 00000000..a4f4f576 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.henshin | |||
@@ -0,0 +1,498 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <henshin:Module xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:henshin="http://www.eclipse.org/emf/2011/Henshin" xmi:id="_rUcIgHyxEemI79hpD-o6pA"> | ||
3 | <imports href="cps.ecore#/"/> | ||
4 | <units xsi:type="henshin:Rule" xmi:id="_ttviMHyxEemI79hpD-o6pA" name="createAppInstance"> | ||
5 | <lhs xmi:id="_tuVYEHyxEemI79hpD-o6pA" name="Lhs"> | ||
6 | <nodes xmi:id="_8OoYwHyxEemI79hpD-o6pA" name="req" outgoing="_APd7gHyzEemI79hpD-o6pA"> | ||
7 | <type href="cps.ecore#//Requirement"/> | ||
8 | </nodes> | ||
9 | <nodes xmi:id="__cBFUHyyEemI79hpD-o6pA" incoming="_APd7gHyzEemI79hpD-o6pA"> | ||
10 | <type href="cps.ecore#//ApplicationType"/> | ||
11 | </nodes> | ||
12 | <edges xmi:id="_APd7gHyzEemI79hpD-o6pA" source="_8OoYwHyxEemI79hpD-o6pA" target="__cBFUHyyEemI79hpD-o6pA"> | ||
13 | <type href="cps.ecore#//Requirement/type"/> | ||
14 | </edges> | ||
15 | </lhs> | ||
16 | <rhs xmi:id="_txSlcHyxEemI79hpD-o6pA" name="Rhs"> | ||
17 | <nodes xmi:id="_8OufYHyxEemI79hpD-o6pA" name="req" outgoing="_6YaokHyyEemI79hpD-o6pA _APd7gXyzEemI79hpD-o6pA"> | ||
18 | <type href="cps.ecore#//Requirement"/> | ||
19 | </nodes> | ||
20 | <nodes xmi:id="_KIXvwHyyEemI79hpD-o6pA" incoming="_6YaokHyyEemI79hpD-o6pA _AoFP0HyzEemI79hpD-o6pA"> | ||
21 | <type href="cps.ecore#//ApplicationInstance"/> | ||
22 | </nodes> | ||
23 | <nodes xmi:id="__cBFUXyyEemI79hpD-o6pA" incoming="_APd7gXyzEemI79hpD-o6pA" outgoing="_AoFP0HyzEemI79hpD-o6pA"> | ||
24 | <type href="cps.ecore#//ApplicationType"/> | ||
25 | </nodes> | ||
26 | <edges xmi:id="_6YaokHyyEemI79hpD-o6pA" source="_8OufYHyxEemI79hpD-o6pA" target="_KIXvwHyyEemI79hpD-o6pA"> | ||
27 | <type href="cps.ecore#//Requirement/instances"/> | ||
28 | </edges> | ||
29 | <edges xmi:id="_APd7gXyzEemI79hpD-o6pA" source="_8OufYHyxEemI79hpD-o6pA" target="__cBFUXyyEemI79hpD-o6pA"> | ||
30 | <type href="cps.ecore#//Requirement/type"/> | ||
31 | </edges> | ||
32 | <edges xmi:id="_AoFP0HyzEemI79hpD-o6pA" source="__cBFUXyyEemI79hpD-o6pA" target="_KIXvwHyyEemI79hpD-o6pA"> | ||
33 | <type href="cps.ecore#//ApplicationType/instances"/> | ||
34 | </edges> | ||
35 | </rhs> | ||
36 | <mappings xmi:id="_8OufYXyxEemI79hpD-o6pA" origin="_8OoYwHyxEemI79hpD-o6pA" image="_8OufYHyxEemI79hpD-o6pA"/> | ||
37 | <mappings xmi:id="__cBsYHyyEemI79hpD-o6pA" origin="__cBFUHyyEemI79hpD-o6pA" image="__cBFUXyyEemI79hpD-o6pA"/> | ||
38 | </units> | ||
39 | <units xsi:type="henshin:Rule" xmi:id="_M36NQHy0EemI79hpD-o6pA" name="createHostInstance"> | ||
40 | <lhs xmi:id="_M4D-QHy0EemI79hpD-o6pA" name="Lhs"> | ||
41 | <nodes xmi:id="_ZpwIEHy0EemI79hpD-o6pA"> | ||
42 | <type href="cps.ecore#//HostType"/> | ||
43 | </nodes> | ||
44 | </lhs> | ||
45 | <rhs xmi:id="_M4HBkHy0EemI79hpD-o6pA" name="Rhs"> | ||
46 | <nodes xmi:id="_Zp2OsHy0EemI79hpD-o6pA" outgoing="_faZ4EHy0EemI79hpD-o6pA"> | ||
47 | <type href="cps.ecore#//HostType"/> | ||
48 | </nodes> | ||
49 | <nodes xmi:id="_bFDBYHy0EemI79hpD-o6pA" incoming="_faZ4EHy0EemI79hpD-o6pA"> | ||
50 | <type href="cps.ecore#//HostInstance"/> | ||
51 | </nodes> | ||
52 | <edges xmi:id="_faZ4EHy0EemI79hpD-o6pA" source="_Zp2OsHy0EemI79hpD-o6pA" target="_bFDBYHy0EemI79hpD-o6pA"> | ||
53 | <type href="cps.ecore#//HostType/instances"/> | ||
54 | </edges> | ||
55 | </rhs> | ||
56 | <mappings xmi:id="_Zp2OsXy0EemI79hpD-o6pA" origin="_ZpwIEHy0EemI79hpD-o6pA" image="_Zp2OsHy0EemI79hpD-o6pA"/> | ||
57 | </units> | ||
58 | <units xsi:type="henshin:Rule" xmi:id="_2yQIQHy0EemI79hpD-o6pA" name="deleteHostInstance"> | ||
59 | <lhs xmi:id="_2yTLkHy0EemI79hpD-o6pA" name="Lhs"> | ||
60 | <nodes xmi:id="_5jfg0Hy0EemI79hpD-o6pA" outgoing="_7KrhEHy0EemI79hpD-o6pA"> | ||
61 | <type href="cps.ecore#//HostType"/> | ||
62 | </nodes> | ||
63 | <nodes xmi:id="_6FqZwHy0EemI79hpD-o6pA" incoming="_7KrhEHy0EemI79hpD-o6pA"> | ||
64 | <type href="cps.ecore#//HostInstance"/> | ||
65 | </nodes> | ||
66 | <edges xmi:id="_7KrhEHy0EemI79hpD-o6pA" source="_5jfg0Hy0EemI79hpD-o6pA" target="_6FqZwHy0EemI79hpD-o6pA"> | ||
67 | <type href="cps.ecore#//HostType/instances"/> | ||
68 | </edges> | ||
69 | <formula xsi:type="henshin:Not" xmi:id="__tHxgHy0EemI79hpD-o6pA"> | ||
70 | <child xsi:type="henshin:NestedCondition" xmi:id="__tIYkHy0EemI79hpD-o6pA"> | ||
71 | <conclusion xmi:id="__tIYkXy0EemI79hpD-o6pA"> | ||
72 | <nodes xmi:id="_8lTsAHy0EemI79hpD-o6pA" outgoing="__HvMgHy0EemI79hpD-o6pA"> | ||
73 | <type href="cps.ecore#//ApplicationInstance"/> | ||
74 | </nodes> | ||
75 | <nodes xmi:id="__tI_oHy0EemI79hpD-o6pA" incoming="__HvMgHy0EemI79hpD-o6pA _AuDqEHy1EemI79hpD-o6pA"> | ||
76 | <type href="cps.ecore#//HostInstance"/> | ||
77 | </nodes> | ||
78 | <nodes xmi:id="_AuDDAHy1EemI79hpD-o6pA" outgoing="_AuDqEHy1EemI79hpD-o6pA"> | ||
79 | <type href="cps.ecore#//HostType"/> | ||
80 | </nodes> | ||
81 | <edges xmi:id="__HvMgHy0EemI79hpD-o6pA" source="_8lTsAHy0EemI79hpD-o6pA" target="__tI_oHy0EemI79hpD-o6pA"> | ||
82 | <type href="cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
83 | </edges> | ||
84 | <edges xmi:id="_AuDqEHy1EemI79hpD-o6pA" source="_AuDDAHy1EemI79hpD-o6pA" target="__tI_oHy0EemI79hpD-o6pA"> | ||
85 | <type href="cps.ecore#//HostType/instances"/> | ||
86 | </edges> | ||
87 | </conclusion> | ||
88 | <mappings xmi:id="__tI_oXy0EemI79hpD-o6pA" origin="_6FqZwHy0EemI79hpD-o6pA" image="__tI_oHy0EemI79hpD-o6pA"/> | ||
89 | <mappings xmi:id="_AuDDAXy1EemI79hpD-o6pA" origin="_5jfg0Hy0EemI79hpD-o6pA" image="_AuDDAHy1EemI79hpD-o6pA"/> | ||
90 | </child> | ||
91 | </formula> | ||
92 | </lhs> | ||
93 | <rhs xmi:id="_2yUZsHy0EemI79hpD-o6pA" name="Rhs"> | ||
94 | <nodes xmi:id="_5jfg0Xy0EemI79hpD-o6pA"> | ||
95 | <type href="cps.ecore#//HostType"/> | ||
96 | </nodes> | ||
97 | </rhs> | ||
98 | <mappings xmi:id="_5jfg0ny0EemI79hpD-o6pA" origin="_5jfg0Hy0EemI79hpD-o6pA" image="_5jfg0Xy0EemI79hpD-o6pA"/> | ||
99 | </units> | ||
100 | <units xsi:type="henshin:Rule" xmi:id="_W9WPYHy4EemI79hpD-o6pA" name="allocate"> | ||
101 | <lhs xmi:id="_W9ag0Hy4EemI79hpD-o6pA" name="Lhs"> | ||
102 | <nodes xmi:id="_QzQ2QHy5EemI79hpD-o6pA" outgoing="_hW5nsHy5EemI79hpD-o6pA"> | ||
103 | <type href="cps.ecore#//Requirement"/> | ||
104 | </nodes> | ||
105 | <nodes xmi:id="_U88ocHy5EemI79hpD-o6pA" outgoing="_epK2IHy5EemI79hpD-o6pA _f_l2gHy5EemI79hpD-o6pA"> | ||
106 | <type href="cps.ecore#//ApplicationType"/> | ||
107 | </nodes> | ||
108 | <nodes xmi:id="_WEdqIHy5EemI79hpD-o6pA" incoming="_f_l2gHy5EemI79hpD-o6pA _hW5nsHy5EemI79hpD-o6pA"> | ||
109 | <type href="cps.ecore#//ApplicationInstance"/> | ||
110 | </nodes> | ||
111 | <nodes xmi:id="_XGRscHy5EemI79hpD-o6pA" incoming="_fGY9oHy5EemI79hpD-o6pA" outgoing="_fggGwHy5EemI79hpD-o6pA"> | ||
112 | <type href="cps.ecore#//HostType"/> | ||
113 | </nodes> | ||
114 | <nodes xmi:id="_XfSpYHy5EemI79hpD-o6pA" incoming="_fggGwHy5EemI79hpD-o6pA"> | ||
115 | <type href="cps.ecore#//HostInstance"/> | ||
116 | </nodes> | ||
117 | <nodes xmi:id="_YuZg0Hy5EemI79hpD-o6pA" incoming="_epK2IHy5EemI79hpD-o6pA" outgoing="_fGY9oHy5EemI79hpD-o6pA"> | ||
118 | <type href="cps.ecore#//ResourceRequirement"/> | ||
119 | </nodes> | ||
120 | <edges xmi:id="_epK2IHy5EemI79hpD-o6pA" source="_U88ocHy5EemI79hpD-o6pA" target="_YuZg0Hy5EemI79hpD-o6pA"> | ||
121 | <type href="cps.ecore#//ApplicationType/requirements"/> | ||
122 | </edges> | ||
123 | <edges xmi:id="_fGY9oHy5EemI79hpD-o6pA" source="_YuZg0Hy5EemI79hpD-o6pA" target="_XGRscHy5EemI79hpD-o6pA"> | ||
124 | <type href="cps.ecore#//ResourceRequirement/hostType"/> | ||
125 | </edges> | ||
126 | <edges xmi:id="_fggGwHy5EemI79hpD-o6pA" source="_XGRscHy5EemI79hpD-o6pA" target="_XfSpYHy5EemI79hpD-o6pA"> | ||
127 | <type href="cps.ecore#//HostType/instances"/> | ||
128 | </edges> | ||
129 | <edges xmi:id="_f_l2gHy5EemI79hpD-o6pA" source="_U88ocHy5EemI79hpD-o6pA" target="_WEdqIHy5EemI79hpD-o6pA"> | ||
130 | <type href="cps.ecore#//ApplicationType/instances"/> | ||
131 | </edges> | ||
132 | <edges xmi:id="_hW5nsHy5EemI79hpD-o6pA" source="_QzQ2QHy5EemI79hpD-o6pA" target="_WEdqIHy5EemI79hpD-o6pA"> | ||
133 | <type href="cps.ecore#//Requirement/instances"/> | ||
134 | </edges> | ||
135 | <formula xsi:type="henshin:And" xmi:id="_JNyfMH8VEemiUoPdWqOlQg"> | ||
136 | <left xsi:type="henshin:Not" xmi:id="_GpwcMX8VEemiUoPdWqOlQg"> | ||
137 | <child xsi:type="henshin:NestedCondition" xmi:id="_GpwcMn8VEemiUoPdWqOlQg"> | ||
138 | <conclusion xmi:id="_GpwcM38VEemiUoPdWqOlQg" name="2"> | ||
139 | <nodes xmi:id="_GpwcNH8VEemiUoPdWqOlQg" outgoing="_GpxDQn8VEemiUoPdWqOlQg"> | ||
140 | <type href="cps.ecore#//Requirement"/> | ||
141 | </nodes> | ||
142 | <nodes xmi:id="_GpxDQH8VEemiUoPdWqOlQg" incoming="_GpxDQn8VEemiUoPdWqOlQg _GpxDSH8VEemiUoPdWqOlQg" outgoing="_LOADcH8VEemiUoPdWqOlQg"> | ||
143 | <type href="cps.ecore#//ApplicationInstance"/> | ||
144 | </nodes> | ||
145 | <nodes xmi:id="_GpxDQ38VEemiUoPdWqOlQg" outgoing="_GpxDR38VEemiUoPdWqOlQg _GpxDSH8VEemiUoPdWqOlQg"> | ||
146 | <type href="cps.ecore#//ApplicationType"/> | ||
147 | </nodes> | ||
148 | <nodes xmi:id="_GpxDRX8VEemiUoPdWqOlQg" incoming="_GpxDR38VEemiUoPdWqOlQg" outgoing="_GpxqUH8VEemiUoPdWqOlQg"> | ||
149 | <type href="cps.ecore#//ResourceRequirement"/> | ||
150 | </nodes> | ||
151 | <nodes xmi:id="_GpxDSX8VEemiUoPdWqOlQg" incoming="_GpxqUH8VEemiUoPdWqOlQg" outgoing="_GpxqU38VEemiUoPdWqOlQg"> | ||
152 | <type href="cps.ecore#//HostType"/> | ||
153 | </nodes> | ||
154 | <nodes xmi:id="_GpxqUX8VEemiUoPdWqOlQg" incoming="_GpxqU38VEemiUoPdWqOlQg"> | ||
155 | <type href="cps.ecore#//HostInstance"/> | ||
156 | </nodes> | ||
157 | <nodes xmi:id="_DK7k4H8VEemiUoPdWqOlQg" description="" incoming="_LOADcH8VEemiUoPdWqOlQg"> | ||
158 | <type href="cps.ecore#//HostInstance"/> | ||
159 | </nodes> | ||
160 | <edges xmi:id="_GpxDQn8VEemiUoPdWqOlQg" source="_GpwcNH8VEemiUoPdWqOlQg" target="_GpxDQH8VEemiUoPdWqOlQg"> | ||
161 | <type href="cps.ecore#//Requirement/instances"/> | ||
162 | </edges> | ||
163 | <edges xmi:id="_GpxDR38VEemiUoPdWqOlQg" source="_GpxDQ38VEemiUoPdWqOlQg" target="_GpxDRX8VEemiUoPdWqOlQg"> | ||
164 | <type href="cps.ecore#//ApplicationType/requirements"/> | ||
165 | </edges> | ||
166 | <edges xmi:id="_GpxDSH8VEemiUoPdWqOlQg" source="_GpxDQ38VEemiUoPdWqOlQg" target="_GpxDQH8VEemiUoPdWqOlQg"> | ||
167 | <type href="cps.ecore#//ApplicationType/instances"/> | ||
168 | </edges> | ||
169 | <edges xmi:id="_GpxqUH8VEemiUoPdWqOlQg" source="_GpxDRX8VEemiUoPdWqOlQg" target="_GpxDSX8VEemiUoPdWqOlQg"> | ||
170 | <type href="cps.ecore#//ResourceRequirement/hostType"/> | ||
171 | </edges> | ||
172 | <edges xmi:id="_GpxqU38VEemiUoPdWqOlQg" source="_GpxDSX8VEemiUoPdWqOlQg" target="_GpxqUX8VEemiUoPdWqOlQg"> | ||
173 | <type href="cps.ecore#//HostType/instances"/> | ||
174 | </edges> | ||
175 | <edges xmi:id="_LOADcH8VEemiUoPdWqOlQg" source="_GpxDQH8VEemiUoPdWqOlQg" target="_DK7k4H8VEemiUoPdWqOlQg"> | ||
176 | <type href="cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
177 | </edges> | ||
178 | </conclusion> | ||
179 | <mappings xmi:id="_GpwcNX8VEemiUoPdWqOlQg" origin="_QzQ2QHy5EemI79hpD-o6pA" image="_GpwcNH8VEemiUoPdWqOlQg"/> | ||
180 | <mappings xmi:id="_GpxDQX8VEemiUoPdWqOlQg" origin="_WEdqIHy5EemI79hpD-o6pA" image="_GpxDQH8VEemiUoPdWqOlQg"/> | ||
181 | <mappings xmi:id="_GpxDRH8VEemiUoPdWqOlQg" origin="_U88ocHy5EemI79hpD-o6pA" image="_GpxDQ38VEemiUoPdWqOlQg"/> | ||
182 | <mappings xmi:id="_GpxDRn8VEemiUoPdWqOlQg" origin="_YuZg0Hy5EemI79hpD-o6pA" image="_GpxDRX8VEemiUoPdWqOlQg"/> | ||
183 | <mappings xmi:id="_GpxDSn8VEemiUoPdWqOlQg" origin="_XGRscHy5EemI79hpD-o6pA" image="_GpxDSX8VEemiUoPdWqOlQg"/> | ||
184 | <mappings xmi:id="_GpxqUn8VEemiUoPdWqOlQg" origin="_XfSpYHy5EemI79hpD-o6pA" image="_GpxqUX8VEemiUoPdWqOlQg"/> | ||
185 | </child> | ||
186 | </left> | ||
187 | <right xsi:type="henshin:Not" xmi:id="_JNyfMX8VEemiUoPdWqOlQg"> | ||
188 | <child xsi:type="henshin:NestedCondition" xmi:id="_JNzGQH8VEemiUoPdWqOlQg"> | ||
189 | <conclusion xmi:id="_JNzGQX8VEemiUoPdWqOlQg" name="1"> | ||
190 | <nodes xmi:id="_JNzGQn8VEemiUoPdWqOlQg" outgoing="_JNztUH8VEemiUoPdWqOlQg _mLtagHy5EemI79hpD-o6pA"> | ||
191 | <type href="cps.ecore#//Requirement"/> | ||
192 | </nodes> | ||
193 | <nodes xmi:id="_JNzGRH8VEemiUoPdWqOlQg" incoming="_JNztUH8VEemiUoPdWqOlQg _JN0UY38VEemiUoPdWqOlQg"> | ||
194 | <type href="cps.ecore#//ApplicationInstance"/> | ||
195 | </nodes> | ||
196 | <nodes xmi:id="_iu3gMHy5EemI79hpD-o6pA" incoming="_mLtagHy5EemI79hpD-o6pA" outgoing="_l0ud4Hy5EemI79hpD-o6pA"> | ||
197 | <type href="cps.ecore#//ApplicationInstance"/> | ||
198 | </nodes> | ||
199 | <nodes xmi:id="_JNztVH8VEemiUoPdWqOlQg" outgoing="_JN0UYn8VEemiUoPdWqOlQg _JN0UY38VEemiUoPdWqOlQg"> | ||
200 | <type href="cps.ecore#//ApplicationType"/> | ||
201 | </nodes> | ||
202 | <nodes xmi:id="_JN0UYH8VEemiUoPdWqOlQg" incoming="_JN0UYn8VEemiUoPdWqOlQg" outgoing="_JN07cn8VEemiUoPdWqOlQg"> | ||
203 | <type href="cps.ecore#//ResourceRequirement"/> | ||
204 | </nodes> | ||
205 | <nodes xmi:id="_JN07cH8VEemiUoPdWqOlQg" incoming="_JN07cn8VEemiUoPdWqOlQg" outgoing="_JN1igX8VEemiUoPdWqOlQg"> | ||
206 | <type href="cps.ecore#//HostType"/> | ||
207 | </nodes> | ||
208 | <nodes xmi:id="_JN07c38VEemiUoPdWqOlQg" incoming="_JN1igX8VEemiUoPdWqOlQg _l0ud4Hy5EemI79hpD-o6pA"> | ||
209 | <type href="cps.ecore#//HostInstance"/> | ||
210 | </nodes> | ||
211 | <edges xmi:id="_JNztUH8VEemiUoPdWqOlQg" source="_JNzGQn8VEemiUoPdWqOlQg" target="_JNzGRH8VEemiUoPdWqOlQg"> | ||
212 | <type href="cps.ecore#//Requirement/instances"/> | ||
213 | </edges> | ||
214 | <edges xmi:id="_JN0UYn8VEemiUoPdWqOlQg" source="_JNztVH8VEemiUoPdWqOlQg" target="_JN0UYH8VEemiUoPdWqOlQg"> | ||
215 | <type href="cps.ecore#//ApplicationType/requirements"/> | ||
216 | </edges> | ||
217 | <edges xmi:id="_JN0UY38VEemiUoPdWqOlQg" source="_JNztVH8VEemiUoPdWqOlQg" target="_JNzGRH8VEemiUoPdWqOlQg"> | ||
218 | <type href="cps.ecore#//ApplicationType/instances"/> | ||
219 | </edges> | ||
220 | <edges xmi:id="_JN07cn8VEemiUoPdWqOlQg" source="_JN0UYH8VEemiUoPdWqOlQg" target="_JN07cH8VEemiUoPdWqOlQg"> | ||
221 | <type href="cps.ecore#//ResourceRequirement/hostType"/> | ||
222 | </edges> | ||
223 | <edges xmi:id="_JN1igX8VEemiUoPdWqOlQg" source="_JN07cH8VEemiUoPdWqOlQg" target="_JN07c38VEemiUoPdWqOlQg"> | ||
224 | <type href="cps.ecore#//HostType/instances"/> | ||
225 | </edges> | ||
226 | <edges xmi:id="_mLtagHy5EemI79hpD-o6pA" source="_JNzGQn8VEemiUoPdWqOlQg" target="_iu3gMHy5EemI79hpD-o6pA"> | ||
227 | <type href="cps.ecore#//Requirement/instances"/> | ||
228 | </edges> | ||
229 | <edges xmi:id="_l0ud4Hy5EemI79hpD-o6pA" source="_iu3gMHy5EemI79hpD-o6pA" target="_JN07c38VEemiUoPdWqOlQg"> | ||
230 | <type href="cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
231 | </edges> | ||
232 | </conclusion> | ||
233 | <mappings xmi:id="_JNzGQ38VEemiUoPdWqOlQg" origin="_QzQ2QHy5EemI79hpD-o6pA" image="_JNzGQn8VEemiUoPdWqOlQg"/> | ||
234 | <mappings xmi:id="_JNzGRX8VEemiUoPdWqOlQg" origin="_WEdqIHy5EemI79hpD-o6pA" image="_JNzGRH8VEemiUoPdWqOlQg"/> | ||
235 | <mappings xmi:id="_JNztVX8VEemiUoPdWqOlQg" origin="_U88ocHy5EemI79hpD-o6pA" image="_JNztVH8VEemiUoPdWqOlQg"/> | ||
236 | <mappings xmi:id="_JN0UYX8VEemiUoPdWqOlQg" origin="_YuZg0Hy5EemI79hpD-o6pA" image="_JN0UYH8VEemiUoPdWqOlQg"/> | ||
237 | <mappings xmi:id="_JN07cX8VEemiUoPdWqOlQg" origin="_XGRscHy5EemI79hpD-o6pA" image="_JN07cH8VEemiUoPdWqOlQg"/> | ||
238 | <mappings xmi:id="_JN1igH8VEemiUoPdWqOlQg" origin="_XfSpYHy5EemI79hpD-o6pA" image="_JN07c38VEemiUoPdWqOlQg"/> | ||
239 | </child> | ||
240 | </right> | ||
241 | </formula> | ||
242 | </lhs> | ||
243 | <rhs xmi:id="_W9bH4Hy4EemI79hpD-o6pA" name="Rhs"> | ||
244 | <nodes xmi:id="_QzT5kHy5EemI79hpD-o6pA" outgoing="_hW5nsXy5EemI79hpD-o6pA"> | ||
245 | <type href="cps.ecore#//Requirement"/> | ||
246 | </nodes> | ||
247 | <nodes xmi:id="_U89PgHy5EemI79hpD-o6pA" outgoing="_epK2IXy5EemI79hpD-o6pA _f_l2gXy5EemI79hpD-o6pA"> | ||
248 | <type href="cps.ecore#//ApplicationType"/> | ||
249 | </nodes> | ||
250 | <nodes xmi:id="_WEdqIXy5EemI79hpD-o6pA" incoming="_f_l2gXy5EemI79hpD-o6pA _hW5nsXy5EemI79hpD-o6pA" outgoing="_gh0Z0Hy5EemI79hpD-o6pA"> | ||
251 | <type href="cps.ecore#//ApplicationInstance"/> | ||
252 | </nodes> | ||
253 | <nodes xmi:id="_XGRscXy5EemI79hpD-o6pA" incoming="_fGY9oXy5EemI79hpD-o6pA" outgoing="_fggGwXy5EemI79hpD-o6pA"> | ||
254 | <type href="cps.ecore#//HostType"/> | ||
255 | </nodes> | ||
256 | <nodes xmi:id="_XfSpYXy5EemI79hpD-o6pA" incoming="_fggGwXy5EemI79hpD-o6pA _gh0Z0Hy5EemI79hpD-o6pA"> | ||
257 | <type href="cps.ecore#//HostInstance"/> | ||
258 | </nodes> | ||
259 | <nodes xmi:id="_YuZg0Xy5EemI79hpD-o6pA" incoming="_epK2IXy5EemI79hpD-o6pA" outgoing="_fGY9oXy5EemI79hpD-o6pA"> | ||
260 | <type href="cps.ecore#//ResourceRequirement"/> | ||
261 | </nodes> | ||
262 | <edges xmi:id="_epK2IXy5EemI79hpD-o6pA" source="_U89PgHy5EemI79hpD-o6pA" target="_YuZg0Xy5EemI79hpD-o6pA"> | ||
263 | <type href="cps.ecore#//ApplicationType/requirements"/> | ||
264 | </edges> | ||
265 | <edges xmi:id="_fGY9oXy5EemI79hpD-o6pA" source="_YuZg0Xy5EemI79hpD-o6pA" target="_XGRscXy5EemI79hpD-o6pA"> | ||
266 | <type href="cps.ecore#//ResourceRequirement/hostType"/> | ||
267 | </edges> | ||
268 | <edges xmi:id="_fggGwXy5EemI79hpD-o6pA" source="_XGRscXy5EemI79hpD-o6pA" target="_XfSpYXy5EemI79hpD-o6pA"> | ||
269 | <type href="cps.ecore#//HostType/instances"/> | ||
270 | </edges> | ||
271 | <edges xmi:id="_f_l2gXy5EemI79hpD-o6pA" source="_U89PgHy5EemI79hpD-o6pA" target="_WEdqIXy5EemI79hpD-o6pA"> | ||
272 | <type href="cps.ecore#//ApplicationType/instances"/> | ||
273 | </edges> | ||
274 | <edges xmi:id="_gh0Z0Hy5EemI79hpD-o6pA" source="_WEdqIXy5EemI79hpD-o6pA" target="_XfSpYXy5EemI79hpD-o6pA"> | ||
275 | <type href="cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
276 | </edges> | ||
277 | <edges xmi:id="_hW5nsXy5EemI79hpD-o6pA" source="_QzT5kHy5EemI79hpD-o6pA" target="_WEdqIXy5EemI79hpD-o6pA"> | ||
278 | <type href="cps.ecore#//Requirement/instances"/> | ||
279 | </edges> | ||
280 | </rhs> | ||
281 | <mappings xmi:id="_QzUgoHy5EemI79hpD-o6pA" origin="_QzQ2QHy5EemI79hpD-o6pA" image="_QzT5kHy5EemI79hpD-o6pA"/> | ||
282 | <mappings xmi:id="_U89PgXy5EemI79hpD-o6pA" origin="_U88ocHy5EemI79hpD-o6pA" image="_U89PgHy5EemI79hpD-o6pA"/> | ||
283 | <mappings xmi:id="_WEdqIny5EemI79hpD-o6pA" origin="_WEdqIHy5EemI79hpD-o6pA" image="_WEdqIXy5EemI79hpD-o6pA"/> | ||
284 | <mappings xmi:id="_XGRscny5EemI79hpD-o6pA" origin="_XGRscHy5EemI79hpD-o6pA" image="_XGRscXy5EemI79hpD-o6pA"/> | ||
285 | <mappings xmi:id="_XfSpYny5EemI79hpD-o6pA" origin="_XfSpYHy5EemI79hpD-o6pA" image="_XfSpYXy5EemI79hpD-o6pA"/> | ||
286 | <mappings xmi:id="_YuZg0ny5EemI79hpD-o6pA" origin="_YuZg0Hy5EemI79hpD-o6pA" image="_YuZg0Xy5EemI79hpD-o6pA"/> | ||
287 | </units> | ||
288 | <units xsi:type="henshin:Rule" xmi:id="_1VgrMHy5EemI79hpD-o6pA" name="unallocate"> | ||
289 | <lhs xmi:id="_1Vk8oHy5EemI79hpD-o6pA" name="Lhs"> | ||
290 | <nodes xmi:id="_OdtesHy6EemI79hpD-o6pA" outgoing="_UpBxcHy6EemI79hpD-o6pA"> | ||
291 | <type href="cps.ecore#//ApplicationInstance"/> | ||
292 | </nodes> | ||
293 | <nodes xmi:id="_PGadcHy6EemI79hpD-o6pA" incoming="_UpBxcHy6EemI79hpD-o6pA"> | ||
294 | <type href="cps.ecore#//HostInstance"/> | ||
295 | </nodes> | ||
296 | <edges xmi:id="_UpBxcHy6EemI79hpD-o6pA" source="_OdtesHy6EemI79hpD-o6pA" target="_PGadcHy6EemI79hpD-o6pA"> | ||
297 | <type href="cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
298 | </edges> | ||
299 | </lhs> | ||
300 | <rhs xmi:id="_1VmKwHy5EemI79hpD-o6pA" name="Rhs"> | ||
301 | <nodes xmi:id="_OdwiAHy6EemI79hpD-o6pA"> | ||
302 | <type href="cps.ecore#//ApplicationInstance"/> | ||
303 | </nodes> | ||
304 | <nodes xmi:id="_PGadcXy6EemI79hpD-o6pA"> | ||
305 | <type href="cps.ecore#//HostInstance"/> | ||
306 | </nodes> | ||
307 | </rhs> | ||
308 | <mappings xmi:id="_OdwiAXy6EemI79hpD-o6pA" origin="_OdtesHy6EemI79hpD-o6pA" image="_OdwiAHy6EemI79hpD-o6pA"/> | ||
309 | <mappings xmi:id="_PGadcny6EemI79hpD-o6pA" origin="_PGadcHy6EemI79hpD-o6pA" image="_PGadcXy6EemI79hpD-o6pA"/> | ||
310 | </units> | ||
311 | <units xsi:type="henshin:Rule" xmi:id="_4lbl0H8UEemiUoPdWqOlQg" name="reallocate"> | ||
312 | <lhs xmi:id="_4lkvwH8UEemiUoPdWqOlQg" name="Lhs"> | ||
313 | <nodes xmi:id="_VfKxQH8VEemiUoPdWqOlQg" outgoing="_uW8jIH8VEemiUoPdWqOlQg"> | ||
314 | <type href="cps.ecore#//Requirement"/> | ||
315 | </nodes> | ||
316 | <nodes xmi:id="_WJkZIH8VEemiUoPdWqOlQg" outgoing="_4SqlYH8VEemiUoPdWqOlQg _44kHwH8VEemiUoPdWqOlQg"> | ||
317 | <type href="cps.ecore#//ApplicationType"/> | ||
318 | </nodes> | ||
319 | <nodes xmi:id="_Yz9i0H8VEemiUoPdWqOlQg" incoming="_5r5CIH8VEemiUoPdWqOlQg"> | ||
320 | <type href="cps.ecore#//HostInstance"/> | ||
321 | </nodes> | ||
322 | <nodes xmi:id="_cTchcH8VEemiUoPdWqOlQg" incoming="_uW8jIH8VEemiUoPdWqOlQg _4SqlYH8VEemiUoPdWqOlQg" outgoing="_3NH5oH8VEemiUoPdWqOlQg"> | ||
323 | <type href="cps.ecore#//ApplicationInstance"/> | ||
324 | </nodes> | ||
325 | <nodes xmi:id="_fYauUH8VEemiUoPdWqOlQg" incoming="_44kHwH8VEemiUoPdWqOlQg" outgoing="_5Rch0H8VEemiUoPdWqOlQg"> | ||
326 | <type href="cps.ecore#//ResourceRequirement"/> | ||
327 | </nodes> | ||
328 | <nodes xmi:id="_kl-_YH8VEemiUoPdWqOlQg" incoming="_5Rch0H8VEemiUoPdWqOlQg" outgoing="_5r5CIH8VEemiUoPdWqOlQg"> | ||
329 | <type href="cps.ecore#//HostType"/> | ||
330 | </nodes> | ||
331 | <nodes xmi:id="_wZrP4H8VEemiUoPdWqOlQg" incoming="_3NH5oH8VEemiUoPdWqOlQg"> | ||
332 | <type href="cps.ecore#//HostInstance"/> | ||
333 | </nodes> | ||
334 | <edges xmi:id="_uW8jIH8VEemiUoPdWqOlQg" source="_VfKxQH8VEemiUoPdWqOlQg" target="_cTchcH8VEemiUoPdWqOlQg"> | ||
335 | <type href="cps.ecore#//Requirement/instances"/> | ||
336 | </edges> | ||
337 | <edges xmi:id="_4SqlYH8VEemiUoPdWqOlQg" source="_WJkZIH8VEemiUoPdWqOlQg" target="_cTchcH8VEemiUoPdWqOlQg"> | ||
338 | <type href="cps.ecore#//ApplicationType/instances"/> | ||
339 | </edges> | ||
340 | <edges xmi:id="_44kHwH8VEemiUoPdWqOlQg" source="_WJkZIH8VEemiUoPdWqOlQg" target="_fYauUH8VEemiUoPdWqOlQg"> | ||
341 | <type href="cps.ecore#//ApplicationType/requirements"/> | ||
342 | </edges> | ||
343 | <edges xmi:id="_5Rch0H8VEemiUoPdWqOlQg" source="_fYauUH8VEemiUoPdWqOlQg" target="_kl-_YH8VEemiUoPdWqOlQg"> | ||
344 | <type href="cps.ecore#//ResourceRequirement/hostType"/> | ||
345 | </edges> | ||
346 | <edges xmi:id="_5r5CIH8VEemiUoPdWqOlQg" source="_kl-_YH8VEemiUoPdWqOlQg" target="_Yz9i0H8VEemiUoPdWqOlQg"> | ||
347 | <type href="cps.ecore#//HostType/instances"/> | ||
348 | </edges> | ||
349 | <edges xmi:id="_3NH5oH8VEemiUoPdWqOlQg" source="_cTchcH8VEemiUoPdWqOlQg" target="_wZrP4H8VEemiUoPdWqOlQg"> | ||
350 | <type href="cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
351 | </edges> | ||
352 | <formula xsi:type="henshin:Not" xmi:id="_9Q-5gH8VEemiUoPdWqOlQg"> | ||
353 | <child xsi:type="henshin:NestedCondition" xmi:id="_9Q-5gX8VEemiUoPdWqOlQg"> | ||
354 | <conclusion xmi:id="_9Q-5gn8VEemiUoPdWqOlQg"> | ||
355 | <nodes xmi:id="_9Q-5g38VEemiUoPdWqOlQg" outgoing="_9Q-5h38VEemiUoPdWqOlQg _ulPd0H8VEemiUoPdWqOlQg"> | ||
356 | <type href="cps.ecore#//Requirement"/> | ||
357 | </nodes> | ||
358 | <nodes xmi:id="_9Q-5hX8VEemiUoPdWqOlQg" incoming="_9Q-5h38VEemiUoPdWqOlQg _9Q-5jX8VEemiUoPdWqOlQg" outgoing="_9Q-5mH8VEemiUoPdWqOlQg"> | ||
359 | <type href="cps.ecore#//ApplicationInstance"/> | ||
360 | </nodes> | ||
361 | <nodes xmi:id="_Xr-AAH8VEemiUoPdWqOlQg" incoming="_ulPd0H8VEemiUoPdWqOlQg" outgoing="_-vrFEH8VEemiUoPdWqOlQg"> | ||
362 | <type href="cps.ecore#//ApplicationInstance"/> | ||
363 | </nodes> | ||
364 | <nodes xmi:id="_9Q-5i38VEemiUoPdWqOlQg" outgoing="_9Q-5jX8VEemiUoPdWqOlQg _9Q-5kH8VEemiUoPdWqOlQg"> | ||
365 | <type href="cps.ecore#//ApplicationType"/> | ||
366 | </nodes> | ||
367 | <nodes xmi:id="_9Q-5jn8VEemiUoPdWqOlQg" incoming="_9Q-5kH8VEemiUoPdWqOlQg" outgoing="_9Q-5mX8VEemiUoPdWqOlQg"> | ||
368 | <type href="cps.ecore#//ResourceRequirement"/> | ||
369 | </nodes> | ||
370 | <nodes xmi:id="_9Q-5kX8VEemiUoPdWqOlQg" incoming="_9Q-5lX8VEemiUoPdWqOlQg _-vrFEH8VEemiUoPdWqOlQg"> | ||
371 | <type href="cps.ecore#//HostInstance"/> | ||
372 | </nodes> | ||
373 | <nodes xmi:id="_9Q-5k38VEemiUoPdWqOlQg" incoming="_9Q-5mX8VEemiUoPdWqOlQg" outgoing="_9Q-5lX8VEemiUoPdWqOlQg"> | ||
374 | <type href="cps.ecore#//HostType"/> | ||
375 | </nodes> | ||
376 | <nodes xmi:id="_9Q-5ln8VEemiUoPdWqOlQg" incoming="_9Q-5mH8VEemiUoPdWqOlQg"> | ||
377 | <type href="cps.ecore#//HostInstance"/> | ||
378 | </nodes> | ||
379 | <edges xmi:id="_9Q-5h38VEemiUoPdWqOlQg" source="_9Q-5g38VEemiUoPdWqOlQg" target="_9Q-5hX8VEemiUoPdWqOlQg"> | ||
380 | <type href="cps.ecore#//Requirement/instances"/> | ||
381 | </edges> | ||
382 | <edges xmi:id="_9Q-5jX8VEemiUoPdWqOlQg" source="_9Q-5i38VEemiUoPdWqOlQg" target="_9Q-5hX8VEemiUoPdWqOlQg"> | ||
383 | <type href="cps.ecore#//ApplicationType/instances"/> | ||
384 | </edges> | ||
385 | <edges xmi:id="_9Q-5kH8VEemiUoPdWqOlQg" source="_9Q-5i38VEemiUoPdWqOlQg" target="_9Q-5jn8VEemiUoPdWqOlQg"> | ||
386 | <type href="cps.ecore#//ApplicationType/requirements"/> | ||
387 | </edges> | ||
388 | <edges xmi:id="_9Q-5lX8VEemiUoPdWqOlQg" source="_9Q-5k38VEemiUoPdWqOlQg" target="_9Q-5kX8VEemiUoPdWqOlQg"> | ||
389 | <type href="cps.ecore#//HostType/instances"/> | ||
390 | </edges> | ||
391 | <edges xmi:id="_9Q-5mH8VEemiUoPdWqOlQg" source="_9Q-5hX8VEemiUoPdWqOlQg" target="_9Q-5ln8VEemiUoPdWqOlQg"> | ||
392 | <type href="cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
393 | </edges> | ||
394 | <edges xmi:id="_9Q-5mX8VEemiUoPdWqOlQg" source="_9Q-5jn8VEemiUoPdWqOlQg" target="_9Q-5k38VEemiUoPdWqOlQg"> | ||
395 | <type href="cps.ecore#//ResourceRequirement/hostType"/> | ||
396 | </edges> | ||
397 | <edges xmi:id="_ulPd0H8VEemiUoPdWqOlQg" source="_9Q-5g38VEemiUoPdWqOlQg" target="_Xr-AAH8VEemiUoPdWqOlQg"> | ||
398 | <type href="cps.ecore#//Requirement/instances"/> | ||
399 | </edges> | ||
400 | <edges xmi:id="_-vrFEH8VEemiUoPdWqOlQg" source="_Xr-AAH8VEemiUoPdWqOlQg" target="_9Q-5kX8VEemiUoPdWqOlQg"> | ||
401 | <type href="cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
402 | </edges> | ||
403 | </conclusion> | ||
404 | <mappings xmi:id="_9Q-5hH8VEemiUoPdWqOlQg" origin="_VfKxQH8VEemiUoPdWqOlQg" image="_9Q-5g38VEemiUoPdWqOlQg"/> | ||
405 | <mappings xmi:id="_9Q-5hn8VEemiUoPdWqOlQg" origin="_cTchcH8VEemiUoPdWqOlQg" image="_9Q-5hX8VEemiUoPdWqOlQg"/> | ||
406 | <mappings xmi:id="_9Q-5jH8VEemiUoPdWqOlQg" origin="_WJkZIH8VEemiUoPdWqOlQg" image="_9Q-5i38VEemiUoPdWqOlQg"/> | ||
407 | <mappings xmi:id="_9Q-5j38VEemiUoPdWqOlQg" origin="_fYauUH8VEemiUoPdWqOlQg" image="_9Q-5jn8VEemiUoPdWqOlQg"/> | ||
408 | <mappings xmi:id="_9Q-5kn8VEemiUoPdWqOlQg" origin="_Yz9i0H8VEemiUoPdWqOlQg" image="_9Q-5kX8VEemiUoPdWqOlQg"/> | ||
409 | <mappings xmi:id="_9Q-5lH8VEemiUoPdWqOlQg" origin="_kl-_YH8VEemiUoPdWqOlQg" image="_9Q-5k38VEemiUoPdWqOlQg"/> | ||
410 | <mappings xmi:id="_9Q-5l38VEemiUoPdWqOlQg" origin="_wZrP4H8VEemiUoPdWqOlQg" image="_9Q-5ln8VEemiUoPdWqOlQg"/> | ||
411 | </child> | ||
412 | </formula> | ||
413 | </lhs> | ||
414 | <rhs xmi:id="_4lnMAH8UEemiUoPdWqOlQg" name="Rhs"> | ||
415 | <nodes xmi:id="_VfNNgH8VEemiUoPdWqOlQg" outgoing="_uW9KMH8VEemiUoPdWqOlQg"> | ||
416 | <type href="cps.ecore#//Requirement"/> | ||
417 | </nodes> | ||
418 | <nodes xmi:id="_WJkZIX8VEemiUoPdWqOlQg" outgoing="_4SqlYX8VEemiUoPdWqOlQg _44kHwX8VEemiUoPdWqOlQg"> | ||
419 | <type href="cps.ecore#//ApplicationType"/> | ||
420 | </nodes> | ||
421 | <nodes xmi:id="_Y0DCYH8VEemiUoPdWqOlQg" incoming="_5r5CIX8VEemiUoPdWqOlQg __Te8wH8VEemiUoPdWqOlQg"> | ||
422 | <type href="cps.ecore#//HostInstance"/> | ||
423 | </nodes> | ||
424 | <nodes xmi:id="_cTchcX8VEemiUoPdWqOlQg" incoming="_uW9KMH8VEemiUoPdWqOlQg _4SqlYX8VEemiUoPdWqOlQg" outgoing="__Te8wH8VEemiUoPdWqOlQg"> | ||
425 | <type href="cps.ecore#//ApplicationInstance"/> | ||
426 | </nodes> | ||
427 | <nodes xmi:id="_fYbVYH8VEemiUoPdWqOlQg" incoming="_44kHwX8VEemiUoPdWqOlQg" outgoing="_5Rch0X8VEemiUoPdWqOlQg"> | ||
428 | <type href="cps.ecore#//ResourceRequirement"/> | ||
429 | </nodes> | ||
430 | <nodes xmi:id="_kl-_YX8VEemiUoPdWqOlQg" incoming="_5Rch0X8VEemiUoPdWqOlQg" outgoing="_5r5CIX8VEemiUoPdWqOlQg"> | ||
431 | <type href="cps.ecore#//HostType"/> | ||
432 | </nodes> | ||
433 | <nodes xmi:id="_6wB_sH8VEemiUoPdWqOlQg"> | ||
434 | <type href="cps.ecore#//HostInstance"/> | ||
435 | </nodes> | ||
436 | <edges xmi:id="_uW9KMH8VEemiUoPdWqOlQg" source="_VfNNgH8VEemiUoPdWqOlQg" target="_cTchcX8VEemiUoPdWqOlQg"> | ||
437 | <type href="cps.ecore#//Requirement/instances"/> | ||
438 | </edges> | ||
439 | <edges xmi:id="_4SqlYX8VEemiUoPdWqOlQg" source="_WJkZIX8VEemiUoPdWqOlQg" target="_cTchcX8VEemiUoPdWqOlQg"> | ||
440 | <type href="cps.ecore#//ApplicationType/instances"/> | ||
441 | </edges> | ||
442 | <edges xmi:id="_44kHwX8VEemiUoPdWqOlQg" source="_WJkZIX8VEemiUoPdWqOlQg" target="_fYbVYH8VEemiUoPdWqOlQg"> | ||
443 | <type href="cps.ecore#//ApplicationType/requirements"/> | ||
444 | </edges> | ||
445 | <edges xmi:id="_5Rch0X8VEemiUoPdWqOlQg" source="_fYbVYH8VEemiUoPdWqOlQg" target="_kl-_YX8VEemiUoPdWqOlQg"> | ||
446 | <type href="cps.ecore#//ResourceRequirement/hostType"/> | ||
447 | </edges> | ||
448 | <edges xmi:id="_5r5CIX8VEemiUoPdWqOlQg" source="_kl-_YX8VEemiUoPdWqOlQg" target="_Y0DCYH8VEemiUoPdWqOlQg"> | ||
449 | <type href="cps.ecore#//HostType/instances"/> | ||
450 | </edges> | ||
451 | <edges xmi:id="__Te8wH8VEemiUoPdWqOlQg" source="_cTchcX8VEemiUoPdWqOlQg" target="_Y0DCYH8VEemiUoPdWqOlQg"> | ||
452 | <type href="cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
453 | </edges> | ||
454 | </rhs> | ||
455 | <mappings xmi:id="_VfNNgX8VEemiUoPdWqOlQg" origin="_VfKxQH8VEemiUoPdWqOlQg" image="_VfNNgH8VEemiUoPdWqOlQg"/> | ||
456 | <mappings xmi:id="_WJkZIn8VEemiUoPdWqOlQg" origin="_WJkZIH8VEemiUoPdWqOlQg" image="_WJkZIX8VEemiUoPdWqOlQg"/> | ||
457 | <mappings xmi:id="_Y0DCYX8VEemiUoPdWqOlQg" origin="_Yz9i0H8VEemiUoPdWqOlQg" image="_Y0DCYH8VEemiUoPdWqOlQg"/> | ||
458 | <mappings xmi:id="_cTchcn8VEemiUoPdWqOlQg" origin="_cTchcH8VEemiUoPdWqOlQg" image="_cTchcX8VEemiUoPdWqOlQg"/> | ||
459 | <mappings xmi:id="_fYbVYX8VEemiUoPdWqOlQg" origin="_fYauUH8VEemiUoPdWqOlQg" image="_fYbVYH8VEemiUoPdWqOlQg"/> | ||
460 | <mappings xmi:id="_kl_mcH8VEemiUoPdWqOlQg" origin="_kl-_YH8VEemiUoPdWqOlQg" image="_kl-_YX8VEemiUoPdWqOlQg"/> | ||
461 | <mappings xmi:id="_6wB_sX8VEemiUoPdWqOlQg" origin="_wZrP4H8VEemiUoPdWqOlQg" image="_6wB_sH8VEemiUoPdWqOlQg"/> | ||
462 | </units> | ||
463 | <units xsi:type="henshin:Rule" xmi:id="_7SLYkH8XEemiUoPdWqOlQg" name="deleteAppInstance"> | ||
464 | <lhs xmi:id="_7SQREH8XEemiUoPdWqOlQg" name="Lhs"> | ||
465 | <nodes xmi:id="_AUFMMH8YEemiUoPdWqOlQg" outgoing="_IR7MgH8YEemiUoPdWqOlQg _InEWEH8YEemiUoPdWqOlQg"> | ||
466 | <type href="cps.ecore#//Requirement"/> | ||
467 | </nodes> | ||
468 | <nodes xmi:id="_A8eo8H8YEemiUoPdWqOlQg" incoming="_InEWEH8YEemiUoPdWqOlQg" outgoing="_H6p8AH8YEemiUoPdWqOlQg"> | ||
469 | <type href="cps.ecore#//ApplicationType"/> | ||
470 | </nodes> | ||
471 | <nodes xmi:id="_Dova4H8YEemiUoPdWqOlQg" incoming="_H6p8AH8YEemiUoPdWqOlQg _IR7MgH8YEemiUoPdWqOlQg"> | ||
472 | <type href="cps.ecore#//ApplicationInstance"/> | ||
473 | </nodes> | ||
474 | <edges xmi:id="_H6p8AH8YEemiUoPdWqOlQg" source="_A8eo8H8YEemiUoPdWqOlQg" target="_Dova4H8YEemiUoPdWqOlQg"> | ||
475 | <type href="cps.ecore#//ApplicationType/instances"/> | ||
476 | </edges> | ||
477 | <edges xmi:id="_IR7MgH8YEemiUoPdWqOlQg" source="_AUFMMH8YEemiUoPdWqOlQg" target="_Dova4H8YEemiUoPdWqOlQg"> | ||
478 | <type href="cps.ecore#//Requirement/instances"/> | ||
479 | </edges> | ||
480 | <edges xmi:id="_InEWEH8YEemiUoPdWqOlQg" source="_AUFMMH8YEemiUoPdWqOlQg" target="_A8eo8H8YEemiUoPdWqOlQg"> | ||
481 | <type href="cps.ecore#//Requirement/type"/> | ||
482 | </edges> | ||
483 | </lhs> | ||
484 | <rhs xmi:id="_7SQ4IH8XEemiUoPdWqOlQg" name="Rhs"> | ||
485 | <nodes xmi:id="_AUFMMX8YEemiUoPdWqOlQg" outgoing="_InEWEX8YEemiUoPdWqOlQg"> | ||
486 | <type href="cps.ecore#//Requirement"/> | ||
487 | </nodes> | ||
488 | <nodes xmi:id="_A8eo8X8YEemiUoPdWqOlQg" incoming="_InEWEX8YEemiUoPdWqOlQg"> | ||
489 | <type href="cps.ecore#//ApplicationType"/> | ||
490 | </nodes> | ||
491 | <edges xmi:id="_InEWEX8YEemiUoPdWqOlQg" source="_AUFMMX8YEemiUoPdWqOlQg" target="_A8eo8X8YEemiUoPdWqOlQg"> | ||
492 | <type href="cps.ecore#//Requirement/type"/> | ||
493 | </edges> | ||
494 | </rhs> | ||
495 | <mappings xmi:id="_AUFMMn8YEemiUoPdWqOlQg" origin="_AUFMMH8YEemiUoPdWqOlQg" image="_AUFMMX8YEemiUoPdWqOlQg"/> | ||
496 | <mappings xmi:id="_A8eo8n8YEemiUoPdWqOlQg" origin="_A8eo8H8YEemiUoPdWqOlQg" image="_A8eo8X8YEemiUoPdWqOlQg"/> | ||
497 | </units> | ||
498 | </henshin:Module> | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.henshin_diagram b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.henshin_diagram new file mode 100644 index 00000000..985ff350 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/model/cps.henshin_diagram | |||
@@ -0,0 +1,699 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:henshin="http://www.eclipse.org/emf/2011/Henshin" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_rVAwQHyxEemI79hpD-o6pA" type="Henshin" name="cps.henshin_diagram" measurementUnit="Pixel"> | ||
3 | <children xmi:type="notation:Shape" xmi:id="_0PszUHyxEemI79hpD-o6pA" type="2001" fontName="Noto Sans" italic="true" lineColor="0"> | ||
4 | <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_5CPVQHyxEemI79hpD-o6pA" source="defaultAction"> | ||
5 | <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_5CP8UHyxEemI79hpD-o6pA" key="value" value="preserve"/> | ||
6 | </eAnnotations> | ||
7 | <children xmi:type="notation:DecorationNode" xmi:id="_0PszUnyxEemI79hpD-o6pA" type="5001"/> | ||
8 | <children xmi:type="notation:DecorationNode" xmi:id="_0PtaYHyxEemI79hpD-o6pA" type="7001"> | ||
9 | <children xmi:type="notation:Shape" xmi:id="_8Ow7oHyxEemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
10 | <children xmi:type="notation:DecorationNode" xmi:id="_8OxisXyxEemI79hpD-o6pA" type="5002"/> | ||
11 | <children xmi:type="notation:DecorationNode" xmi:id="_8OxisnyxEemI79hpD-o6pA" type="5003"/> | ||
12 | <children xmi:type="notation:DecorationNode" xmi:id="_8OyJwHyxEemI79hpD-o6pA" type="7002"> | ||
13 | <styles xmi:type="notation:SortingStyle" xmi:id="_8OyJwXyxEemI79hpD-o6pA"/> | ||
14 | <styles xmi:type="notation:FilteringStyle" xmi:id="_8OyJwnyxEemI79hpD-o6pA"/> | ||
15 | </children> | ||
16 | <element xmi:type="henshin:Node" href="cps.henshin#_8OoYwHyxEemI79hpD-o6pA"/> | ||
17 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_8OxisHyxEemI79hpD-o6pA" x="28" y="27"/> | ||
18 | </children> | ||
19 | <children xmi:type="notation:Shape" xmi:id="_KIaMAHyyEemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
20 | <children xmi:type="notation:DecorationNode" xmi:id="_KIaMAnyyEemI79hpD-o6pA" type="5002"/> | ||
21 | <children xmi:type="notation:DecorationNode" xmi:id="_KIaMA3yyEemI79hpD-o6pA" type="5003"/> | ||
22 | <children xmi:type="notation:DecorationNode" xmi:id="_KIaMBHyyEemI79hpD-o6pA" type="7002"> | ||
23 | <styles xmi:type="notation:SortingStyle" xmi:id="_KIaMBXyyEemI79hpD-o6pA"/> | ||
24 | <styles xmi:type="notation:FilteringStyle" xmi:id="_KIaMBnyyEemI79hpD-o6pA"/> | ||
25 | </children> | ||
26 | <element xmi:type="henshin:Node" href="cps.henshin#_KIXvwHyyEemI79hpD-o6pA"/> | ||
27 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_KIaMAXyyEemI79hpD-o6pA" x="248" y="169"/> | ||
28 | </children> | ||
29 | <children xmi:type="notation:Shape" xmi:id="__cDhkHyyEemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
30 | <children xmi:type="notation:DecorationNode" xmi:id="__cEIoXyyEemI79hpD-o6pA" type="5002"/> | ||
31 | <children xmi:type="notation:DecorationNode" xmi:id="__cEIonyyEemI79hpD-o6pA" type="5003"/> | ||
32 | <children xmi:type="notation:DecorationNode" xmi:id="__cEIo3yyEemI79hpD-o6pA" type="7002"> | ||
33 | <styles xmi:type="notation:SortingStyle" xmi:id="__cEIpHyyEemI79hpD-o6pA"/> | ||
34 | <styles xmi:type="notation:FilteringStyle" xmi:id="__cEIpXyyEemI79hpD-o6pA"/> | ||
35 | </children> | ||
36 | <element xmi:type="henshin:Node" href="cps.henshin#__cBFUHyyEemI79hpD-o6pA"/> | ||
37 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="__cEIoHyyEemI79hpD-o6pA" x="259" y="17"/> | ||
38 | </children> | ||
39 | </children> | ||
40 | <element xmi:type="henshin:Rule" href="cps.henshin#_ttviMHyxEemI79hpD-o6pA"/> | ||
41 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_0PszUXyxEemI79hpD-o6pA" x="22" y="22" width="407" height="284"/> | ||
42 | </children> | ||
43 | <children xmi:type="notation:Shape" xmi:id="_M4A68Hy0EemI79hpD-o6pA" type="2001" fontName="Noto Sans" italic="true" lineColor="0"> | ||
44 | <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_Zp21wHy0EemI79hpD-o6pA" source="defaultAction"> | ||
45 | <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Zp21wXy0EemI79hpD-o6pA" key="value" value="preserve"/> | ||
46 | </eAnnotations> | ||
47 | <children xmi:type="notation:DecorationNode" xmi:id="_M4BiAHy0EemI79hpD-o6pA" type="5001"/> | ||
48 | <children xmi:type="notation:DecorationNode" xmi:id="_M4CJEHy0EemI79hpD-o6pA" type="7001"> | ||
49 | <children xmi:type="notation:Shape" xmi:id="_Zp4q8Hy0EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
50 | <children xmi:type="notation:DecorationNode" xmi:id="_Zp4q8ny0EemI79hpD-o6pA" type="5002"/> | ||
51 | <children xmi:type="notation:DecorationNode" xmi:id="_Zp4q83y0EemI79hpD-o6pA" type="5003"/> | ||
52 | <children xmi:type="notation:DecorationNode" xmi:id="_Zp4q9Hy0EemI79hpD-o6pA" type="7002"> | ||
53 | <styles xmi:type="notation:SortingStyle" xmi:id="_Zp4q9Xy0EemI79hpD-o6pA"/> | ||
54 | <styles xmi:type="notation:FilteringStyle" xmi:id="_Zp4q9ny0EemI79hpD-o6pA"/> | ||
55 | </children> | ||
56 | <element xmi:type="henshin:Node" href="cps.henshin#_ZpwIEHy0EemI79hpD-o6pA"/> | ||
57 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Zp4q8Xy0EemI79hpD-o6pA" x="55" y="8"/> | ||
58 | </children> | ||
59 | <children xmi:type="notation:Shape" xmi:id="_bFEPgHy0EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
60 | <children xmi:type="notation:DecorationNode" xmi:id="_bFEPgny0EemI79hpD-o6pA" type="5002"/> | ||
61 | <children xmi:type="notation:DecorationNode" xmi:id="_bFEPg3y0EemI79hpD-o6pA" type="5003"/> | ||
62 | <children xmi:type="notation:DecorationNode" xmi:id="_bFEPhHy0EemI79hpD-o6pA" type="7002"> | ||
63 | <styles xmi:type="notation:SortingStyle" xmi:id="_bFEPhXy0EemI79hpD-o6pA"/> | ||
64 | <styles xmi:type="notation:FilteringStyle" xmi:id="_bFEPhny0EemI79hpD-o6pA"/> | ||
65 | </children> | ||
66 | <element xmi:type="henshin:Node" href="cps.henshin#_bFDBYHy0EemI79hpD-o6pA"/> | ||
67 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bFEPgXy0EemI79hpD-o6pA" x="47" y="102"/> | ||
68 | </children> | ||
69 | </children> | ||
70 | <element xmi:type="henshin:Rule" href="cps.henshin#_M36NQHy0EemI79hpD-o6pA"/> | ||
71 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_M4A68Xy0EemI79hpD-o6pA" x="22" y="327" width="191" height="199"/> | ||
72 | </children> | ||
73 | <children xmi:type="notation:Shape" xmi:id="_2ySkgHy0EemI79hpD-o6pA" type="2001" fontName="Noto Sans" italic="true" lineColor="0"> | ||
74 | <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_5jgH4Hy0EemI79hpD-o6pA" source="defaultAction"> | ||
75 | <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_5jgH4Xy0EemI79hpD-o6pA" key="value" value="preserve"/> | ||
76 | </eAnnotations> | ||
77 | <children xmi:type="notation:DecorationNode" xmi:id="_2ySkgny0EemI79hpD-o6pA" type="5001"/> | ||
78 | <children xmi:type="notation:DecorationNode" xmi:id="_2ySkg3y0EemI79hpD-o6pA" type="7001"> | ||
79 | <children xmi:type="notation:Shape" xmi:id="_5jh9EHy0EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
80 | <children xmi:type="notation:DecorationNode" xmi:id="_5jikIHy0EemI79hpD-o6pA" type="5002"/> | ||
81 | <children xmi:type="notation:DecorationNode" xmi:id="_5jikIXy0EemI79hpD-o6pA" type="5003"/> | ||
82 | <children xmi:type="notation:DecorationNode" xmi:id="_5jikIny0EemI79hpD-o6pA" type="7002"> | ||
83 | <styles xmi:type="notation:SortingStyle" xmi:id="_5jikI3y0EemI79hpD-o6pA"/> | ||
84 | <styles xmi:type="notation:FilteringStyle" xmi:id="_5jikJHy0EemI79hpD-o6pA"/> | ||
85 | </children> | ||
86 | <element xmi:type="henshin:Node" href="cps.henshin#_5jfg0Hy0EemI79hpD-o6pA"/> | ||
87 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_5jh9EXy0EemI79hpD-o6pA" x="46" y="17"/> | ||
88 | </children> | ||
89 | <children xmi:type="notation:Shape" xmi:id="_6FsO8Hy0EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
90 | <children xmi:type="notation:DecorationNode" xmi:id="_6Fs2AHy0EemI79hpD-o6pA" type="5002"/> | ||
91 | <children xmi:type="notation:DecorationNode" xmi:id="_6Fs2AXy0EemI79hpD-o6pA" type="5003"/> | ||
92 | <children xmi:type="notation:DecorationNode" xmi:id="_6Fs2Any0EemI79hpD-o6pA" type="7002"> | ||
93 | <styles xmi:type="notation:SortingStyle" xmi:id="_6Fs2A3y0EemI79hpD-o6pA"/> | ||
94 | <styles xmi:type="notation:FilteringStyle" xmi:id="_6Fs2BHy0EemI79hpD-o6pA"/> | ||
95 | </children> | ||
96 | <element xmi:type="henshin:Node" href="cps.henshin#_6FqZwHy0EemI79hpD-o6pA"/> | ||
97 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6FsO8Xy0EemI79hpD-o6pA" x="47" y="102"/> | ||
98 | </children> | ||
99 | <children xmi:type="notation:Shape" xmi:id="_8lWIQHy0EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
100 | <children xmi:type="notation:DecorationNode" xmi:id="_8lWIQny0EemI79hpD-o6pA" type="5002"/> | ||
101 | <children xmi:type="notation:DecorationNode" xmi:id="_8lWIQ3y0EemI79hpD-o6pA" type="5003"/> | ||
102 | <children xmi:type="notation:DecorationNode" xmi:id="_8lWvUHy0EemI79hpD-o6pA" type="7002"> | ||
103 | <styles xmi:type="notation:SortingStyle" xmi:id="_8lWvUXy0EemI79hpD-o6pA"/> | ||
104 | <styles xmi:type="notation:FilteringStyle" xmi:id="_8lWvUny0EemI79hpD-o6pA"/> | ||
105 | </children> | ||
106 | <element xmi:type="henshin:Node" href="cps.henshin#_8lTsAHy0EemI79hpD-o6pA"/> | ||
107 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_8lWIQXy0EemI79hpD-o6pA" x="202" y="102"/> | ||
108 | </children> | ||
109 | </children> | ||
110 | <element xmi:type="henshin:Rule" href="cps.henshin#_2yQIQHy0EemI79hpD-o6pA"/> | ||
111 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2ySkgXy0EemI79hpD-o6pA" x="236" y="327" width="345" height="199"/> | ||
112 | </children> | ||
113 | <children xmi:type="notation:Shape" xmi:id="_W9ZSsHy4EemI79hpD-o6pA" type="2001" fontName="Noto Sans" italic="true" lineColor="0"> | ||
114 | <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_QzUgoXy5EemI79hpD-o6pA" source="defaultAction"> | ||
115 | <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QzUgony5EemI79hpD-o6pA" key="value" value="preserve"/> | ||
116 | </eAnnotations> | ||
117 | <children xmi:type="notation:DecorationNode" xmi:id="_W9ZSsny4EemI79hpD-o6pA" type="5001"/> | ||
118 | <children xmi:type="notation:DecorationNode" xmi:id="_W9ZSs3y4EemI79hpD-o6pA" type="7001"> | ||
119 | <children xmi:type="notation:Shape" xmi:id="_QzVuwHy5EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
120 | <children xmi:type="notation:DecorationNode" xmi:id="_QzVuwny5EemI79hpD-o6pA" type="5002"/> | ||
121 | <children xmi:type="notation:DecorationNode" xmi:id="_QzVuw3y5EemI79hpD-o6pA" type="5003"/> | ||
122 | <children xmi:type="notation:DecorationNode" xmi:id="_QzVuxHy5EemI79hpD-o6pA" type="7002"> | ||
123 | <styles xmi:type="notation:SortingStyle" xmi:id="_QzVuxXy5EemI79hpD-o6pA"/> | ||
124 | <styles xmi:type="notation:FilteringStyle" xmi:id="_QzVuxny5EemI79hpD-o6pA"/> | ||
125 | </children> | ||
126 | <element xmi:type="henshin:Node" href="cps.henshin#_QzQ2QHy5EemI79hpD-o6pA"/> | ||
127 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QzVuwXy5EemI79hpD-o6pA" x="16" y="162"/> | ||
128 | </children> | ||
129 | <children xmi:type="notation:Shape" xmi:id="_U8_rwHy5EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
130 | <children xmi:type="notation:DecorationNode" xmi:id="_U9AS0Hy5EemI79hpD-o6pA" type="5002"/> | ||
131 | <children xmi:type="notation:DecorationNode" xmi:id="_U9AS0Xy5EemI79hpD-o6pA" type="5003"/> | ||
132 | <children xmi:type="notation:DecorationNode" xmi:id="_U9AS0ny5EemI79hpD-o6pA" type="7002"> | ||
133 | <styles xmi:type="notation:SortingStyle" xmi:id="_U9AS03y5EemI79hpD-o6pA"/> | ||
134 | <styles xmi:type="notation:FilteringStyle" xmi:id="_U9AS1Hy5EemI79hpD-o6pA"/> | ||
135 | </children> | ||
136 | <element xmi:type="henshin:Node" href="cps.henshin#_U88ocHy5EemI79hpD-o6pA"/> | ||
137 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_U8_rwXy5EemI79hpD-o6pA" x="177" y="11"/> | ||
138 | </children> | ||
139 | <children xmi:type="notation:Shape" xmi:id="_WEe4QHy5EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
140 | <children xmi:type="notation:DecorationNode" xmi:id="_WEe4Qny5EemI79hpD-o6pA" type="5002"/> | ||
141 | <children xmi:type="notation:DecorationNode" xmi:id="_WEe4Q3y5EemI79hpD-o6pA" type="5003"/> | ||
142 | <children xmi:type="notation:DecorationNode" xmi:id="_WEe4RHy5EemI79hpD-o6pA" type="7002"> | ||
143 | <styles xmi:type="notation:SortingStyle" xmi:id="_WEe4RXy5EemI79hpD-o6pA"/> | ||
144 | <styles xmi:type="notation:FilteringStyle" xmi:id="_WEe4Rny5EemI79hpD-o6pA"/> | ||
145 | </children> | ||
146 | <element xmi:type="henshin:Node" href="cps.henshin#_WEdqIHy5EemI79hpD-o6pA"/> | ||
147 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WEe4QXy5EemI79hpD-o6pA" x="166" y="117"/> | ||
148 | </children> | ||
149 | <children xmi:type="notation:Shape" xmi:id="_XGUIsHy5EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
150 | <children xmi:type="notation:DecorationNode" xmi:id="_XGUIsny5EemI79hpD-o6pA" type="5002"/> | ||
151 | <children xmi:type="notation:DecorationNode" xmi:id="_XGUvwHy5EemI79hpD-o6pA" type="5003"/> | ||
152 | <children xmi:type="notation:DecorationNode" xmi:id="_XGUvwXy5EemI79hpD-o6pA" type="7002"> | ||
153 | <styles xmi:type="notation:SortingStyle" xmi:id="_XGUvwny5EemI79hpD-o6pA"/> | ||
154 | <styles xmi:type="notation:FilteringStyle" xmi:id="_XGUvw3y5EemI79hpD-o6pA"/> | ||
155 | </children> | ||
156 | <element xmi:type="henshin:Node" href="cps.henshin#_XGRscHy5EemI79hpD-o6pA"/> | ||
157 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XGUIsXy5EemI79hpD-o6pA" x="527" y="11"/> | ||
158 | </children> | ||
159 | <children xmi:type="notation:Shape" xmi:id="_XfT3gHy5EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
160 | <children xmi:type="notation:DecorationNode" xmi:id="_XfT3gny5EemI79hpD-o6pA" type="5002"/> | ||
161 | <children xmi:type="notation:DecorationNode" xmi:id="_XfT3g3y5EemI79hpD-o6pA" type="5003"/> | ||
162 | <children xmi:type="notation:DecorationNode" xmi:id="_XfT3hHy5EemI79hpD-o6pA" type="7002"> | ||
163 | <styles xmi:type="notation:SortingStyle" xmi:id="_XfT3hXy5EemI79hpD-o6pA"/> | ||
164 | <styles xmi:type="notation:FilteringStyle" xmi:id="_XfT3hny5EemI79hpD-o6pA"/> | ||
165 | </children> | ||
166 | <element xmi:type="henshin:Node" href="cps.henshin#_XfSpYHy5EemI79hpD-o6pA"/> | ||
167 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XfT3gXy5EemI79hpD-o6pA" x="527" y="162"/> | ||
168 | </children> | ||
169 | <children xmi:type="notation:Shape" xmi:id="_YuaH4Hy5EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
170 | <children xmi:type="notation:DecorationNode" xmi:id="_YuaH4ny5EemI79hpD-o6pA" type="5002"/> | ||
171 | <children xmi:type="notation:DecorationNode" xmi:id="_YuaH43y5EemI79hpD-o6pA" type="5003"/> | ||
172 | <children xmi:type="notation:DecorationNode" xmi:id="_YuaH5Hy5EemI79hpD-o6pA" type="7002"> | ||
173 | <styles xmi:type="notation:SortingStyle" xmi:id="_YuaH5Xy5EemI79hpD-o6pA"/> | ||
174 | <styles xmi:type="notation:FilteringStyle" xmi:id="_YuaH5ny5EemI79hpD-o6pA"/> | ||
175 | </children> | ||
176 | <element xmi:type="henshin:Node" href="cps.henshin#_YuZg0Hy5EemI79hpD-o6pA"/> | ||
177 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_YuaH4Xy5EemI79hpD-o6pA" x="337" y="11"/> | ||
178 | </children> | ||
179 | <children xmi:type="notation:Shape" xmi:id="_iu5VYHy5EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
180 | <children xmi:type="notation:DecorationNode" xmi:id="_iu5VYny5EemI79hpD-o6pA" type="5002"/> | ||
181 | <children xmi:type="notation:DecorationNode" xmi:id="_iu5VY3y5EemI79hpD-o6pA" type="5003"/> | ||
182 | <children xmi:type="notation:DecorationNode" xmi:id="_iu5VZHy5EemI79hpD-o6pA" type="7002"> | ||
183 | <styles xmi:type="notation:SortingStyle" xmi:id="_iu5VZXy5EemI79hpD-o6pA"/> | ||
184 | <styles xmi:type="notation:FilteringStyle" xmi:id="_iu5VZny5EemI79hpD-o6pA"/> | ||
185 | </children> | ||
186 | <element xmi:type="henshin:Node" href="cps.henshin#_iu3gMHy5EemI79hpD-o6pA"/> | ||
187 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_iu5VYXy5EemI79hpD-o6pA" x="166" y="214"/> | ||
188 | </children> | ||
189 | <children xmi:type="notation:Shape" xmi:id="_DK8L8H8VEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
190 | <children xmi:type="notation:DecorationNode" xmi:id="_DK8zAH8VEemiUoPdWqOlQg" type="5002"/> | ||
191 | <children xmi:type="notation:DecorationNode" xmi:id="_DK8zAX8VEemiUoPdWqOlQg" type="5003"/> | ||
192 | <children xmi:type="notation:DecorationNode" xmi:id="_DK8zAn8VEemiUoPdWqOlQg" type="7002"> | ||
193 | <styles xmi:type="notation:SortingStyle" xmi:id="_DK8zA38VEemiUoPdWqOlQg"/> | ||
194 | <styles xmi:type="notation:FilteringStyle" xmi:id="_DK8zBH8VEemiUoPdWqOlQg"/> | ||
195 | </children> | ||
196 | <element xmi:type="henshin:Node" href="cps.henshin#_DK7k4H8VEemiUoPdWqOlQg"/> | ||
197 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_DK8L8X8VEemiUoPdWqOlQg" x="15" y="11"/> | ||
198 | </children> | ||
199 | </children> | ||
200 | <element xmi:type="henshin:Rule" href="cps.henshin#_W9WPYHy4EemI79hpD-o6pA"/> | ||
201 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_W9ZSsXy4EemI79hpD-o6pA" x="22" y="549" width="637" height="322"/> | ||
202 | </children> | ||
203 | <children xmi:type="notation:Shape" xmi:id="_1VkVkHy5EemI79hpD-o6pA" type="2001" fontName="Noto Sans" italic="true" lineColor="0"> | ||
204 | <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_OdwiAny6EemI79hpD-o6pA" source="defaultAction"> | ||
205 | <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_OdwiA3y6EemI79hpD-o6pA" key="value" value="preserve"/> | ||
206 | </eAnnotations> | ||
207 | <children xmi:type="notation:DecorationNode" xmi:id="_1VkVkny5EemI79hpD-o6pA" type="5001"/> | ||
208 | <children xmi:type="notation:DecorationNode" xmi:id="_1VkVk3y5EemI79hpD-o6pA" type="7001"> | ||
209 | <children xmi:type="notation:Shape" xmi:id="_OdxwIHy6EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
210 | <children xmi:type="notation:DecorationNode" xmi:id="_OdxwIny6EemI79hpD-o6pA" type="5002"/> | ||
211 | <children xmi:type="notation:DecorationNode" xmi:id="_OdxwI3y6EemI79hpD-o6pA" type="5003"/> | ||
212 | <children xmi:type="notation:DecorationNode" xmi:id="_OdxwJHy6EemI79hpD-o6pA" type="7002"> | ||
213 | <styles xmi:type="notation:SortingStyle" xmi:id="_OdxwJXy6EemI79hpD-o6pA"/> | ||
214 | <styles xmi:type="notation:FilteringStyle" xmi:id="_OdxwJny6EemI79hpD-o6pA"/> | ||
215 | </children> | ||
216 | <element xmi:type="henshin:Node" href="cps.henshin#_OdtesHy6EemI79hpD-o6pA"/> | ||
217 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OdxwIXy6EemI79hpD-o6pA" x="21" y="12"/> | ||
218 | </children> | ||
219 | <children xmi:type="notation:Shape" xmi:id="_PGbrkHy6EemI79hpD-o6pA" type="3001" fontName="Noto Sans"> | ||
220 | <children xmi:type="notation:DecorationNode" xmi:id="_PGcSoHy6EemI79hpD-o6pA" type="5002"/> | ||
221 | <children xmi:type="notation:DecorationNode" xmi:id="_PGcSoXy6EemI79hpD-o6pA" type="5003"/> | ||
222 | <children xmi:type="notation:DecorationNode" xmi:id="_PGcSony6EemI79hpD-o6pA" type="7002"> | ||
223 | <styles xmi:type="notation:SortingStyle" xmi:id="_PGcSo3y6EemI79hpD-o6pA"/> | ||
224 | <styles xmi:type="notation:FilteringStyle" xmi:id="_PGcSpHy6EemI79hpD-o6pA"/> | ||
225 | </children> | ||
226 | <element xmi:type="henshin:Node" href="cps.henshin#_PGadcHy6EemI79hpD-o6pA"/> | ||
227 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PGbrkXy6EemI79hpD-o6pA" x="39" y="163"/> | ||
228 | </children> | ||
229 | </children> | ||
230 | <element xmi:type="henshin:Rule" href="cps.henshin#_1VgrMHy5EemI79hpD-o6pA"/> | ||
231 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1VkVkXy5EemI79hpD-o6pA" x="684" y="549" width="177" height="259"/> | ||
232 | </children> | ||
233 | <children xmi:type="notation:Shape" xmi:id="_4li6kH8UEemiUoPdWqOlQg" type="2001" fontName="Noto Sans" italic="true" lineColor="0"> | ||
234 | <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VfNNgn8VEemiUoPdWqOlQg" source="defaultAction"> | ||
235 | <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VfNNg38VEemiUoPdWqOlQg" key="value" value="preserve"/> | ||
236 | </eAnnotations> | ||
237 | <children xmi:type="notation:DecorationNode" xmi:id="_4ljhoH8UEemiUoPdWqOlQg" type="5001"/> | ||
238 | <children xmi:type="notation:DecorationNode" xmi:id="_4ljhoX8UEemiUoPdWqOlQg" type="7001"> | ||
239 | <children xmi:type="notation:Shape" xmi:id="_VfOboH8VEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
240 | <children xmi:type="notation:DecorationNode" xmi:id="_VfPCsH8VEemiUoPdWqOlQg" type="5002"/> | ||
241 | <children xmi:type="notation:DecorationNode" xmi:id="_VfPCsX8VEemiUoPdWqOlQg" type="5003"/> | ||
242 | <children xmi:type="notation:DecorationNode" xmi:id="_VfPCsn8VEemiUoPdWqOlQg" type="7002"> | ||
243 | <styles xmi:type="notation:SortingStyle" xmi:id="_VfPCs38VEemiUoPdWqOlQg"/> | ||
244 | <styles xmi:type="notation:FilteringStyle" xmi:id="_VfPCtH8VEemiUoPdWqOlQg"/> | ||
245 | </children> | ||
246 | <element xmi:type="henshin:Node" href="cps.henshin#_VfKxQH8VEemiUoPdWqOlQg"/> | ||
247 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VfOboX8VEemiUoPdWqOlQg" x="19" y="196"/> | ||
248 | </children> | ||
249 | <children xmi:type="notation:Shape" xmi:id="_WJm1YH8VEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
250 | <children xmi:type="notation:DecorationNode" xmi:id="_WJnccH8VEemiUoPdWqOlQg" type="5002"/> | ||
251 | <children xmi:type="notation:DecorationNode" xmi:id="_WJnccX8VEemiUoPdWqOlQg" type="5003"/> | ||
252 | <children xmi:type="notation:DecorationNode" xmi:id="_WJnccn8VEemiUoPdWqOlQg" type="7002"> | ||
253 | <styles xmi:type="notation:SortingStyle" xmi:id="_WJncc38VEemiUoPdWqOlQg"/> | ||
254 | <styles xmi:type="notation:FilteringStyle" xmi:id="_WJncdH8VEemiUoPdWqOlQg"/> | ||
255 | </children> | ||
256 | <element xmi:type="henshin:Node" href="cps.henshin#_WJkZIH8VEemiUoPdWqOlQg"/> | ||
257 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WJm1YX8VEemiUoPdWqOlQg" x="172" y="16"/> | ||
258 | </children> | ||
259 | <children xmi:type="notation:Shape" xmi:id="_Xr_OIH8VEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
260 | <children xmi:type="notation:DecorationNode" xmi:id="_Xr_OIn8VEemiUoPdWqOlQg" type="5002"/> | ||
261 | <children xmi:type="notation:DecorationNode" xmi:id="_Xr_OI38VEemiUoPdWqOlQg" type="5003"/> | ||
262 | <children xmi:type="notation:DecorationNode" xmi:id="_Xr_OJH8VEemiUoPdWqOlQg" type="7002"> | ||
263 | <styles xmi:type="notation:SortingStyle" xmi:id="_Xr_OJX8VEemiUoPdWqOlQg"/> | ||
264 | <styles xmi:type="notation:FilteringStyle" xmi:id="_Xr_OJn8VEemiUoPdWqOlQg"/> | ||
265 | </children> | ||
266 | <element xmi:type="henshin:Node" href="cps.henshin#_Xr-AAH8VEemiUoPdWqOlQg"/> | ||
267 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Xr_OIX8VEemiUoPdWqOlQg" x="161" y="263"/> | ||
268 | </children> | ||
269 | <children xmi:type="notation:Shape" xmi:id="_Y0FeoH8VEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
270 | <children xmi:type="notation:DecorationNode" xmi:id="_Y0GFsX8VEemiUoPdWqOlQg" type="5002"/> | ||
271 | <children xmi:type="notation:DecorationNode" xmi:id="_Y0GFsn8VEemiUoPdWqOlQg" type="5003"/> | ||
272 | <children xmi:type="notation:DecorationNode" xmi:id="_Y0GFs38VEemiUoPdWqOlQg" type="7002"> | ||
273 | <styles xmi:type="notation:SortingStyle" xmi:id="_Y0GFtH8VEemiUoPdWqOlQg"/> | ||
274 | <styles xmi:type="notation:FilteringStyle" xmi:id="_Y0GFtX8VEemiUoPdWqOlQg"/> | ||
275 | </children> | ||
276 | <element xmi:type="henshin:Node" href="cps.henshin#_Yz9i0H8VEemiUoPdWqOlQg"/> | ||
277 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Y0GFsH8VEemiUoPdWqOlQg" x="533" y="196"/> | ||
278 | </children> | ||
279 | <children xmi:type="notation:Shape" xmi:id="_cTdIgH8VEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
280 | <children xmi:type="notation:DecorationNode" xmi:id="_cTdIgn8VEemiUoPdWqOlQg" type="5002"/> | ||
281 | <children xmi:type="notation:DecorationNode" xmi:id="_cTdIg38VEemiUoPdWqOlQg" type="5003"/> | ||
282 | <children xmi:type="notation:DecorationNode" xmi:id="_cTdIhH8VEemiUoPdWqOlQg" type="7002"> | ||
283 | <styles xmi:type="notation:SortingStyle" xmi:id="_cTdIhX8VEemiUoPdWqOlQg"/> | ||
284 | <styles xmi:type="notation:FilteringStyle" xmi:id="_cTdIhn8VEemiUoPdWqOlQg"/> | ||
285 | </children> | ||
286 | <element xmi:type="henshin:Node" href="cps.henshin#_cTchcH8VEemiUoPdWqOlQg"/> | ||
287 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cTdIgX8VEemiUoPdWqOlQg" x="161" y="133"/> | ||
288 | </children> | ||
289 | <children xmi:type="notation:Shape" xmi:id="_fYb8cH8VEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
290 | <children xmi:type="notation:DecorationNode" xmi:id="_fYb8cn8VEemiUoPdWqOlQg" type="5002"/> | ||
291 | <children xmi:type="notation:DecorationNode" xmi:id="_fYb8c38VEemiUoPdWqOlQg" type="5003"/> | ||
292 | <children xmi:type="notation:DecorationNode" xmi:id="_fYb8dH8VEemiUoPdWqOlQg" type="7002"> | ||
293 | <styles xmi:type="notation:SortingStyle" xmi:id="_fYb8dX8VEemiUoPdWqOlQg"/> | ||
294 | <styles xmi:type="notation:FilteringStyle" xmi:id="_fYb8dn8VEemiUoPdWqOlQg"/> | ||
295 | </children> | ||
296 | <element xmi:type="henshin:Node" href="cps.henshin#_fYauUH8VEemiUoPdWqOlQg"/> | ||
297 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fYb8cX8VEemiUoPdWqOlQg" x="347" y="16"/> | ||
298 | </children> | ||
299 | <children xmi:type="notation:Shape" xmi:id="_kmA0kH8VEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
300 | <children xmi:type="notation:DecorationNode" xmi:id="_kmA0kn8VEemiUoPdWqOlQg" type="5002"/> | ||
301 | <children xmi:type="notation:DecorationNode" xmi:id="_kmA0k38VEemiUoPdWqOlQg" type="5003"/> | ||
302 | <children xmi:type="notation:DecorationNode" xmi:id="_kmA0lH8VEemiUoPdWqOlQg" type="7002"> | ||
303 | <styles xmi:type="notation:SortingStyle" xmi:id="_kmA0lX8VEemiUoPdWqOlQg"/> | ||
304 | <styles xmi:type="notation:FilteringStyle" xmi:id="_kmA0ln8VEemiUoPdWqOlQg"/> | ||
305 | </children> | ||
306 | <element xmi:type="henshin:Node" href="cps.henshin#_kl-_YH8VEemiUoPdWqOlQg"/> | ||
307 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kmA0kX8VEemiUoPdWqOlQg" x="540" y="16"/> | ||
308 | </children> | ||
309 | <children xmi:type="notation:Shape" xmi:id="_wZseAH8VEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
310 | <children xmi:type="notation:DecorationNode" xmi:id="_wZseAn8VEemiUoPdWqOlQg" type="5002"/> | ||
311 | <children xmi:type="notation:DecorationNode" xmi:id="_wZseA38VEemiUoPdWqOlQg" type="5003"/> | ||
312 | <children xmi:type="notation:DecorationNode" xmi:id="_wZseBH8VEemiUoPdWqOlQg" type="7002"> | ||
313 | <styles xmi:type="notation:SortingStyle" xmi:id="_wZseBX8VEemiUoPdWqOlQg"/> | ||
314 | <styles xmi:type="notation:FilteringStyle" xmi:id="_wZseBn8VEemiUoPdWqOlQg"/> | ||
315 | </children> | ||
316 | <element xmi:type="henshin:Node" href="cps.henshin#_wZrP4H8VEemiUoPdWqOlQg"/> | ||
317 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_wZseAX8VEemiUoPdWqOlQg" x="18" y="16"/> | ||
318 | </children> | ||
319 | </children> | ||
320 | <element xmi:type="henshin:Rule" href="cps.henshin#_4lbl0H8UEemiUoPdWqOlQg"/> | ||
321 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4li6kX8UEemiUoPdWqOlQg" x="22" y="894" width="637" height="360"/> | ||
322 | </children> | ||
323 | <children xmi:type="notation:Shape" xmi:id="_7SPC8H8XEemiUoPdWqOlQg" type="2001" fontName="Noto Sans" italic="true" lineColor="0"> | ||
324 | <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_AUFzQH8YEemiUoPdWqOlQg" source="defaultAction"> | ||
325 | <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_AUFzQX8YEemiUoPdWqOlQg" key="value" value="preserve"/> | ||
326 | </eAnnotations> | ||
327 | <children xmi:type="notation:DecorationNode" xmi:id="_7SPqAH8XEemiUoPdWqOlQg" type="5001"/> | ||
328 | <children xmi:type="notation:DecorationNode" xmi:id="_7SPqAX8XEemiUoPdWqOlQg" type="7001"> | ||
329 | <children xmi:type="notation:Shape" xmi:id="_AUGaUH8YEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
330 | <children xmi:type="notation:DecorationNode" xmi:id="_AUGaUn8YEemiUoPdWqOlQg" type="5002"/> | ||
331 | <children xmi:type="notation:DecorationNode" xmi:id="_AUGaU38YEemiUoPdWqOlQg" type="5003"/> | ||
332 | <children xmi:type="notation:DecorationNode" xmi:id="_AUGaVH8YEemiUoPdWqOlQg" type="7002"> | ||
333 | <styles xmi:type="notation:SortingStyle" xmi:id="_AUGaVX8YEemiUoPdWqOlQg"/> | ||
334 | <styles xmi:type="notation:FilteringStyle" xmi:id="_AUGaVn8YEemiUoPdWqOlQg"/> | ||
335 | </children> | ||
336 | <element xmi:type="henshin:Node" href="cps.henshin#_AUFMMH8YEemiUoPdWqOlQg"/> | ||
337 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_AUGaUX8YEemiUoPdWqOlQg" x="28" y="19"/> | ||
338 | </children> | ||
339 | <children xmi:type="notation:Shape" xmi:id="_A8fQAH8YEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
340 | <children xmi:type="notation:DecorationNode" xmi:id="_A8fQAn8YEemiUoPdWqOlQg" type="5002"/> | ||
341 | <children xmi:type="notation:DecorationNode" xmi:id="_A8fQA38YEemiUoPdWqOlQg" type="5003"/> | ||
342 | <children xmi:type="notation:DecorationNode" xmi:id="_A8fQBH8YEemiUoPdWqOlQg" type="7002"> | ||
343 | <styles xmi:type="notation:SortingStyle" xmi:id="_A8fQBX8YEemiUoPdWqOlQg"/> | ||
344 | <styles xmi:type="notation:FilteringStyle" xmi:id="_A8fQBn8YEemiUoPdWqOlQg"/> | ||
345 | </children> | ||
346 | <element xmi:type="henshin:Node" href="cps.henshin#_A8eo8H8YEemiUoPdWqOlQg"/> | ||
347 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_A8fQAX8YEemiUoPdWqOlQg" x="238" y="19"/> | ||
348 | </children> | ||
349 | <children xmi:type="notation:Shape" xmi:id="_DowB8H8YEemiUoPdWqOlQg" type="3001" fontName="Noto Sans"> | ||
350 | <children xmi:type="notation:DecorationNode" xmi:id="_DowB8n8YEemiUoPdWqOlQg" type="5002"/> | ||
351 | <children xmi:type="notation:DecorationNode" xmi:id="_DowB838YEemiUoPdWqOlQg" type="5003"/> | ||
352 | <children xmi:type="notation:DecorationNode" xmi:id="_DowB9H8YEemiUoPdWqOlQg" type="7002"> | ||
353 | <styles xmi:type="notation:SortingStyle" xmi:id="_DowB9X8YEemiUoPdWqOlQg"/> | ||
354 | <styles xmi:type="notation:FilteringStyle" xmi:id="_DowB9n8YEemiUoPdWqOlQg"/> | ||
355 | </children> | ||
356 | <element xmi:type="henshin:Node" href="cps.henshin#_Dova4H8YEemiUoPdWqOlQg"/> | ||
357 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_DowB8X8YEemiUoPdWqOlQg" x="227" y="171"/> | ||
358 | </children> | ||
359 | </children> | ||
360 | <element xmi:type="henshin:Rule" href="cps.henshin#_7SLYkH8XEemiUoPdWqOlQg"/> | ||
361 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7SPC8X8XEemiUoPdWqOlQg" x="453" y="22" width="376" height="284"/> | ||
362 | </children> | ||
363 | <styles xmi:type="notation:DiagramStyle" xmi:id="_rVAwQXyxEemI79hpD-o6pA"/> | ||
364 | <element xmi:type="henshin:Module" href="cps.henshin#_rUcIgHyxEemI79hpD-o6pA"/> | ||
365 | <edges xmi:type="notation:Connector" xmi:id="_6Yb2sHyyEemI79hpD-o6pA" type="4001" source="_8Ow7oHyxEemI79hpD-o6pA" target="_KIaMAHyyEemI79hpD-o6pA"> | ||
366 | <children xmi:type="notation:DecorationNode" xmi:id="_6Yb2s3yyEemI79hpD-o6pA" type="6001"> | ||
367 | <layoutConstraint xmi:type="notation:Location" xmi:id="_6Yb2tHyyEemI79hpD-o6pA" y="40"/> | ||
368 | </children> | ||
369 | <children xmi:type="notation:DecorationNode" xmi:id="_6Yb2tXyyEemI79hpD-o6pA" type="6002"> | ||
370 | <layoutConstraint xmi:type="notation:Location" xmi:id="_6Yb2tnyyEemI79hpD-o6pA" y="60"/> | ||
371 | </children> | ||
372 | <styles xmi:type="notation:FontStyle" xmi:id="_6Yb2sXyyEemI79hpD-o6pA" fontName="Noto Sans"/> | ||
373 | <element xmi:type="henshin:Edge" href="cps.henshin#_6YaokHyyEemI79hpD-o6pA"/> | ||
374 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_6Yb2snyyEemI79hpD-o6pA" points="[49, -7, -165, 20]$[190, -30, -24, -3]"/> | ||
375 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_6YdE0HyyEemI79hpD-o6pA" id="(0.20512820512820512,0.41304347826086957)"/> | ||
376 | </edges> | ||
377 | <edges xmi:type="notation:Connector" xmi:id="_APeikHyzEemI79hpD-o6pA" type="4001" source="_8Ow7oHyxEemI79hpD-o6pA" target="__cDhkHyyEemI79hpD-o6pA"> | ||
378 | <children xmi:type="notation:DecorationNode" xmi:id="_APeik3yzEemI79hpD-o6pA" type="6001"> | ||
379 | <layoutConstraint xmi:type="notation:Location" xmi:id="_APeilHyzEemI79hpD-o6pA" y="40"/> | ||
380 | </children> | ||
381 | <children xmi:type="notation:DecorationNode" xmi:id="_APeilXyzEemI79hpD-o6pA" type="6002"> | ||
382 | <layoutConstraint xmi:type="notation:Location" xmi:id="_APeilnyzEemI79hpD-o6pA" y="60"/> | ||
383 | </children> | ||
384 | <styles xmi:type="notation:FontStyle" xmi:id="_APeikXyzEemI79hpD-o6pA" fontName="Noto Sans"/> | ||
385 | <element xmi:type="henshin:Edge" href="cps.henshin#_APd7gHyzEemI79hpD-o6pA"/> | ||
386 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_APeiknyzEemI79hpD-o6pA" points="[14, -1, -203, 1]$[215, -25, -2, -23]"/> | ||
387 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_APfwsHyzEemI79hpD-o6pA" id="(0.8571428571428571,0.17391304347826086)"/> | ||
388 | </edges> | ||
389 | <edges xmi:type="notation:Connector" xmi:id="_AoHFAHyzEemI79hpD-o6pA" type="4001" source="__cDhkHyyEemI79hpD-o6pA" target="_KIaMAHyyEemI79hpD-o6pA"> | ||
390 | <children xmi:type="notation:DecorationNode" xmi:id="_AoHsEHyzEemI79hpD-o6pA" type="6001"> | ||
391 | <layoutConstraint xmi:type="notation:Location" xmi:id="_AoHsEXyzEemI79hpD-o6pA" x="20" y="37"/> | ||
392 | </children> | ||
393 | <children xmi:type="notation:DecorationNode" xmi:id="_AoHsEnyzEemI79hpD-o6pA" type="6002"> | ||
394 | <layoutConstraint xmi:type="notation:Location" xmi:id="_AoHsE3yzEemI79hpD-o6pA" y="60"/> | ||
395 | </children> | ||
396 | <styles xmi:type="notation:FontStyle" xmi:id="_AoHFAXyzEemI79hpD-o6pA" fontName="Noto Sans"/> | ||
397 | <element xmi:type="henshin:Edge" href="cps.henshin#_AoFP0HyzEemI79hpD-o6pA"/> | ||
398 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_AoHFAnyzEemI79hpD-o6pA" points="[-2, 23, 10, -119]$[-9, 136, 3, -6]"/> | ||
399 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_AoMkkHyzEemI79hpD-o6pA" id="(0.5897435897435898,0.13043478260869565)"/> | ||
400 | </edges> | ||
401 | <edges xmi:type="notation:Connector" xmi:id="_fabGMHy0EemI79hpD-o6pA" type="4001" source="_Zp4q8Hy0EemI79hpD-o6pA" target="_bFEPgHy0EemI79hpD-o6pA"> | ||
402 | <children xmi:type="notation:DecorationNode" xmi:id="_fabtQHy0EemI79hpD-o6pA" type="6001"> | ||
403 | <layoutConstraint xmi:type="notation:Location" xmi:id="_fabtQXy0EemI79hpD-o6pA" y="40"/> | ||
404 | </children> | ||
405 | <children xmi:type="notation:DecorationNode" xmi:id="_fabtQny0EemI79hpD-o6pA" type="6002"> | ||
406 | <layoutConstraint xmi:type="notation:Location" xmi:id="_facUUHy0EemI79hpD-o6pA" y="60"/> | ||
407 | </children> | ||
408 | <styles xmi:type="notation:FontStyle" xmi:id="_fabGMXy0EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
409 | <element xmi:type="henshin:Edge" href="cps.henshin#_faZ4EHy0EemI79hpD-o6pA"/> | ||
410 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_fabGMny0EemI79hpD-o6pA" points="[-1, 23, 0, -56]$[-2, 71, -1, -8]"/> | ||
411 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_faglwHy0EemI79hpD-o6pA" id="(0.49382716049382713,0.17391304347826086)"/> | ||
412 | </edges> | ||
413 | <edges xmi:type="notation:Connector" xmi:id="_7KsvMHy0EemI79hpD-o6pA" type="4001" source="_5jh9EHy0EemI79hpD-o6pA" target="_6FsO8Hy0EemI79hpD-o6pA"> | ||
414 | <children xmi:type="notation:DecorationNode" xmi:id="_7KtWQHy0EemI79hpD-o6pA" type="6001"> | ||
415 | <layoutConstraint xmi:type="notation:Location" xmi:id="_7KtWQXy0EemI79hpD-o6pA" y="40"/> | ||
416 | </children> | ||
417 | <children xmi:type="notation:DecorationNode" xmi:id="_7KtWQny0EemI79hpD-o6pA" type="6002"> | ||
418 | <layoutConstraint xmi:type="notation:Location" xmi:id="_7KtWQ3y0EemI79hpD-o6pA" y="60"/> | ||
419 | </children> | ||
420 | <styles xmi:type="notation:FontStyle" xmi:id="_7KsvMXy0EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
421 | <element xmi:type="henshin:Edge" href="cps.henshin#_7KrhEHy0EemI79hpD-o6pA"/> | ||
422 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_7KsvMny0EemI79hpD-o6pA" points="[3, 23, -5, -62]$[11, 62, 3, -23]"/> | ||
423 | </edges> | ||
424 | <edges xmi:type="notation:Connector" xmi:id="__HxBsHy0EemI79hpD-o6pA" type="4001" source="_8lWIQHy0EemI79hpD-o6pA" target="_6FsO8Hy0EemI79hpD-o6pA"> | ||
425 | <children xmi:type="notation:DecorationNode" xmi:id="__HxBs3y0EemI79hpD-o6pA" type="6001"> | ||
426 | <layoutConstraint xmi:type="notation:Location" xmi:id="__HxBtHy0EemI79hpD-o6pA" y="40"/> | ||
427 | </children> | ||
428 | <children xmi:type="notation:DecorationNode" xmi:id="__HxowHy0EemI79hpD-o6pA" type="6002"> | ||
429 | <layoutConstraint xmi:type="notation:Location" xmi:id="__HxowXy0EemI79hpD-o6pA" y="60"/> | ||
430 | </children> | ||
431 | <styles xmi:type="notation:FontStyle" xmi:id="__HxBsXy0EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
432 | <element xmi:type="henshin:Edge" href="cps.henshin#__HvMgHy0EemI79hpD-o6pA"/> | ||
433 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="__HxBsny0EemI79hpD-o6pA" points="[-24, -5, 115, -1]$[-98, -5, 41, -1]"/> | ||
434 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__H0sEHy0EemI79hpD-o6pA" id="(0.20512820512820512,0.5869565217391305)"/> | ||
435 | </edges> | ||
436 | <edges xmi:type="notation:Connector" xmi:id="_epK2Iny5EemI79hpD-o6pA" type="4001" source="_U8_rwHy5EemI79hpD-o6pA" target="_YuaH4Hy5EemI79hpD-o6pA"> | ||
437 | <children xmi:type="notation:DecorationNode" xmi:id="_epK2JXy5EemI79hpD-o6pA" type="6001"> | ||
438 | <layoutConstraint xmi:type="notation:Location" xmi:id="_epK2Jny5EemI79hpD-o6pA" y="40"/> | ||
439 | </children> | ||
440 | <children xmi:type="notation:DecorationNode" xmi:id="_epK2J3y5EemI79hpD-o6pA" type="6002"> | ||
441 | <layoutConstraint xmi:type="notation:Location" xmi:id="_epK2KHy5EemI79hpD-o6pA" y="60"/> | ||
442 | </children> | ||
443 | <styles xmi:type="notation:FontStyle" xmi:id="_epK2I3y5EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
444 | <element xmi:type="henshin:Edge" href="cps.henshin#_epK2IHy5EemI79hpD-o6pA"/> | ||
445 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_epK2JHy5EemI79hpD-o6pA" points="[15, -1, -82, 0]$[79, -3, -18, -2]"/> | ||
446 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_epMEQHy5EemI79hpD-o6pA" id="(0.84375,0.43478260869565216)"/> | ||
447 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_epMEQXy5EemI79hpD-o6pA" id="(0.13740458015267176,0.41304347826086957)"/> | ||
448 | </edges> | ||
449 | <edges xmi:type="notation:Connector" xmi:id="_fGay0Hy5EemI79hpD-o6pA" type="4001" source="_YuaH4Hy5EemI79hpD-o6pA" target="_XGUIsHy5EemI79hpD-o6pA"> | ||
450 | <children xmi:type="notation:DecorationNode" xmi:id="_fGay03y5EemI79hpD-o6pA" type="6001"> | ||
451 | <layoutConstraint xmi:type="notation:Location" xmi:id="_fGay1Hy5EemI79hpD-o6pA" y="40"/> | ||
452 | </children> | ||
453 | <children xmi:type="notation:DecorationNode" xmi:id="_fGbZ4Hy5EemI79hpD-o6pA" type="6002"> | ||
454 | <layoutConstraint xmi:type="notation:Location" xmi:id="_fGbZ4Xy5EemI79hpD-o6pA" y="60"/> | ||
455 | </children> | ||
456 | <styles xmi:type="notation:FontStyle" xmi:id="_fGay0Xy5EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
457 | <element xmi:type="henshin:Edge" href="cps.henshin#_fGY9oHy5EemI79hpD-o6pA"/> | ||
458 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_fGay0ny5EemI79hpD-o6pA" points="[13, 1, -92, -3]$[106, -19, 1, -23]"/> | ||
459 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_fGfEQHy5EemI79hpD-o6pA" id="(0.9007633587786259,0.41304347826086957)"/> | ||
460 | </edges> | ||
461 | <edges xmi:type="notation:Connector" xmi:id="_fghU4Hy5EemI79hpD-o6pA" type="4001" source="_XGUIsHy5EemI79hpD-o6pA" target="_XfT3gHy5EemI79hpD-o6pA"> | ||
462 | <children xmi:type="notation:DecorationNode" xmi:id="_fgh78Hy5EemI79hpD-o6pA" type="6001"> | ||
463 | <layoutConstraint xmi:type="notation:Location" xmi:id="_fgh78Xy5EemI79hpD-o6pA" y="40"/> | ||
464 | </children> | ||
465 | <children xmi:type="notation:DecorationNode" xmi:id="_fgh78ny5EemI79hpD-o6pA" type="6002"> | ||
466 | <layoutConstraint xmi:type="notation:Location" xmi:id="_fgh783y5EemI79hpD-o6pA" y="60"/> | ||
467 | </children> | ||
468 | <styles xmi:type="notation:FontStyle" xmi:id="_fghU4Xy5EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
469 | <element xmi:type="henshin:Edge" href="cps.henshin#_fggGwHy5EemI79hpD-o6pA"/> | ||
470 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_fghU4ny5EemI79hpD-o6pA" points="[8, 23, 1, -116]$[8, 116, 1, -23]"/> | ||
471 | </edges> | ||
472 | <edges xmi:type="notation:Connector" xmi:id="_f_l2gny5EemI79hpD-o6pA" type="4001" source="_U8_rwHy5EemI79hpD-o6pA" target="_WEe4QHy5EemI79hpD-o6pA"> | ||
473 | <children xmi:type="notation:DecorationNode" xmi:id="_f_mdkHy5EemI79hpD-o6pA" type="6001"> | ||
474 | <layoutConstraint xmi:type="notation:Location" xmi:id="_f_mdkXy5EemI79hpD-o6pA" y="40"/> | ||
475 | </children> | ||
476 | <children xmi:type="notation:DecorationNode" xmi:id="_f_mdkny5EemI79hpD-o6pA" type="6002"> | ||
477 | <layoutConstraint xmi:type="notation:Location" xmi:id="_f_mdk3y5EemI79hpD-o6pA" y="60"/> | ||
478 | </children> | ||
479 | <styles xmi:type="notation:FontStyle" xmi:id="_f_l2g3y5EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
480 | <element xmi:type="henshin:Edge" href="cps.henshin#_f_l2gHy5EemI79hpD-o6pA"/> | ||
481 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_f_l2hHy5EemI79hpD-o6pA" points="[2, 23, 0, -69]$[3, 83, 1, -9]"/> | ||
482 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_f_nrsHy5EemI79hpD-o6pA" id="(0.5213675213675214,0.1956521739130435)"/> | ||
483 | </edges> | ||
484 | <edges xmi:type="notation:Connector" xmi:id="_gh1n8Hy5EemI79hpD-o6pA" type="4001" source="_WEe4QHy5EemI79hpD-o6pA" target="_XfT3gHy5EemI79hpD-o6pA"> | ||
485 | <children xmi:type="notation:DecorationNode" xmi:id="_gh2PAny5EemI79hpD-o6pA" type="6001"> | ||
486 | <layoutConstraint xmi:type="notation:Location" xmi:id="_gh2PA3y5EemI79hpD-o6pA" y="40"/> | ||
487 | </children> | ||
488 | <children xmi:type="notation:DecorationNode" xmi:id="_gh2PBHy5EemI79hpD-o6pA" type="6002"> | ||
489 | <layoutConstraint xmi:type="notation:Location" xmi:id="_gh2PBXy5EemI79hpD-o6pA" y="60"/> | ||
490 | </children> | ||
491 | <styles xmi:type="notation:FontStyle" xmi:id="_gh2PAHy5EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
492 | <element xmi:type="henshin:Edge" href="cps.henshin#_gh0Z0Hy5EemI79hpD-o6pA"/> | ||
493 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_gh2PAXy5EemI79hpD-o6pA" points="[15, 2, -284, -45]$[299, 70, 0, 23]"/> | ||
494 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_gh55YHy5EemI79hpD-o6pA" id="(0.8717948717948718,0.1956521739130435)"/> | ||
495 | </edges> | ||
496 | <edges xmi:type="notation:Connector" xmi:id="_hW6OwHy5EemI79hpD-o6pA" type="4001" source="_QzVuwHy5EemI79hpD-o6pA" target="_WEe4QHy5EemI79hpD-o6pA"> | ||
497 | <children xmi:type="notation:DecorationNode" xmi:id="_hW6Ow3y5EemI79hpD-o6pA" type="6001"> | ||
498 | <layoutConstraint xmi:type="notation:Location" xmi:id="_hW6OxHy5EemI79hpD-o6pA" y="40"/> | ||
499 | </children> | ||
500 | <children xmi:type="notation:DecorationNode" xmi:id="_hW6OxXy5EemI79hpD-o6pA" type="6002"> | ||
501 | <layoutConstraint xmi:type="notation:Location" xmi:id="_hW6Oxny5EemI79hpD-o6pA" y="60"/> | ||
502 | </children> | ||
503 | <styles xmi:type="notation:FontStyle" xmi:id="_hW6OwXy5EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
504 | <element xmi:type="henshin:Edge" href="cps.henshin#_hW5nsHy5EemI79hpD-o6pA"/> | ||
505 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hW6Owny5EemI79hpD-o6pA" points="[1, -5, -81, 0]$[71, -6, -11, -1]"/> | ||
506 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hW7c4Hy5EemI79hpD-o6pA" id="(0.9873417721518988,0.6739130434782609)"/> | ||
507 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hW7c4Xy5EemI79hpD-o6pA" id="(0.09401709401709402,0.41304347826086957)"/> | ||
508 | </edges> | ||
509 | <edges xmi:type="notation:Connector" xmi:id="_l0vE8Hy5EemI79hpD-o6pA" type="4001" source="_iu5VYHy5EemI79hpD-o6pA" target="_XfT3gHy5EemI79hpD-o6pA"> | ||
510 | <children xmi:type="notation:DecorationNode" xmi:id="_l0vE83y5EemI79hpD-o6pA" type="6001"> | ||
511 | <layoutConstraint xmi:type="notation:Location" xmi:id="_l0vE9Hy5EemI79hpD-o6pA" y="40"/> | ||
512 | </children> | ||
513 | <children xmi:type="notation:DecorationNode" xmi:id="_l0vE9Xy5EemI79hpD-o6pA" type="6002"> | ||
514 | <layoutConstraint xmi:type="notation:Location" xmi:id="_l0vE9ny5EemI79hpD-o6pA" y="60"/> | ||
515 | </children> | ||
516 | <styles xmi:type="notation:FontStyle" xmi:id="_l0vE8Xy5EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
517 | <element xmi:type="henshin:Edge" href="cps.henshin#_l0ud4Hy5EemI79hpD-o6pA"/> | ||
518 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_l0vE8ny5EemI79hpD-o6pA" points="[28, -5, -282, 43]$[309, -44, -1, 4]"/> | ||
519 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_l0w6IHy5EemI79hpD-o6pA" id="(0.7606837606837606,0.5652173913043478)"/> | ||
520 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_l0w6IXy5EemI79hpD-o6pA" id="(0.4691358024691358,0.9130434782608695)"/> | ||
521 | </edges> | ||
522 | <edges xmi:type="notation:Connector" xmi:id="_mLuBkHy5EemI79hpD-o6pA" type="4001" source="_QzVuwHy5EemI79hpD-o6pA" target="_iu5VYHy5EemI79hpD-o6pA"> | ||
523 | <children xmi:type="notation:DecorationNode" xmi:id="_mLuBk3y5EemI79hpD-o6pA" type="6001"> | ||
524 | <layoutConstraint xmi:type="notation:Location" xmi:id="_mLuBlHy5EemI79hpD-o6pA" y="40"/> | ||
525 | </children> | ||
526 | <children xmi:type="notation:DecorationNode" xmi:id="_mLuBlXy5EemI79hpD-o6pA" type="6002"> | ||
527 | <layoutConstraint xmi:type="notation:Location" xmi:id="_mLuBlny5EemI79hpD-o6pA" y="60"/> | ||
528 | </children> | ||
529 | <styles xmi:type="notation:FontStyle" xmi:id="_mLuBkXy5EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
530 | <element xmi:type="henshin:Edge" href="cps.henshin#_mLtagHy5EemI79hpD-o6pA"/> | ||
531 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_mLuBkny5EemI79hpD-o6pA" points="[28, 23, -111, -91]$[110, 123, -29, 9]"/> | ||
532 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_mLuooHy5EemI79hpD-o6pA" id="(0.24786324786324787,0.717391304347826)"/> | ||
533 | </edges> | ||
534 | <edges xmi:type="notation:Connector" xmi:id="_UpCYgHy6EemI79hpD-o6pA" type="4001" source="_OdxwIHy6EemI79hpD-o6pA" target="_PGbrkHy6EemI79hpD-o6pA"> | ||
535 | <children xmi:type="notation:DecorationNode" xmi:id="_UpCYg3y6EemI79hpD-o6pA" type="6001"> | ||
536 | <layoutConstraint xmi:type="notation:Location" xmi:id="_UpCYhHy6EemI79hpD-o6pA" y="40"/> | ||
537 | </children> | ||
538 | <children xmi:type="notation:DecorationNode" xmi:id="_UpCYhXy6EemI79hpD-o6pA" type="6002"> | ||
539 | <layoutConstraint xmi:type="notation:Location" xmi:id="_UpCYhny6EemI79hpD-o6pA" y="60"/> | ||
540 | </children> | ||
541 | <styles xmi:type="notation:FontStyle" xmi:id="_UpCYgXy6EemI79hpD-o6pA" fontName="Noto Sans"/> | ||
542 | <element xmi:type="henshin:Edge" href="cps.henshin#_UpBxcHy6EemI79hpD-o6pA"/> | ||
543 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_UpCYgny6EemI79hpD-o6pA" points="[4, 23, 0, -114]$[6, 128, 2, -9]"/> | ||
544 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_UpDmoHy6EemI79hpD-o6pA" id="(0.5432098765432098,0.1956521739130435)"/> | ||
545 | </edges> | ||
546 | <edges xmi:type="notation:Connector" xmi:id="_LOAqgH8VEemiUoPdWqOlQg" type="4001" source="_WEe4QHy5EemI79hpD-o6pA" target="_DK8L8H8VEemiUoPdWqOlQg"> | ||
547 | <children xmi:type="notation:DecorationNode" xmi:id="_LOAqg38VEemiUoPdWqOlQg" type="6001"> | ||
548 | <layoutConstraint xmi:type="notation:Location" xmi:id="_LOAqhH8VEemiUoPdWqOlQg" y="40"/> | ||
549 | </children> | ||
550 | <children xmi:type="notation:DecorationNode" xmi:id="_LOAqhX8VEemiUoPdWqOlQg" type="6002"> | ||
551 | <layoutConstraint xmi:type="notation:Location" xmi:id="_LOAqhn8VEemiUoPdWqOlQg" y="60"/> | ||
552 | </children> | ||
553 | <styles xmi:type="notation:FontStyle" xmi:id="_LOAqgX8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
554 | <element xmi:type="henshin:Edge" href="cps.henshin#_LOADcH8VEemiUoPdWqOlQg"/> | ||
555 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_LOAqgn8VEemiUoPdWqOlQg" points="[27, -7, -120, 30]$[134, -46, -13, -9]"/> | ||
556 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_LOCfsH8VEemiUoPdWqOlQg" id="(0.6666666666666666,0.15217391304347827)"/> | ||
557 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_LOCfsX8VEemiUoPdWqOlQg" id="(0.25925925925925924,0.1956521739130435)"/> | ||
558 | </edges> | ||
559 | <edges xmi:type="notation:Connector" xmi:id="_uW-YUH8VEemiUoPdWqOlQg" type="4001" source="_VfOboH8VEemiUoPdWqOlQg" target="_cTdIgH8VEemiUoPdWqOlQg"> | ||
560 | <children xmi:type="notation:DecorationNode" xmi:id="_uW-_YH8VEemiUoPdWqOlQg" type="6001"> | ||
561 | <layoutConstraint xmi:type="notation:Location" xmi:id="_uW-_YX8VEemiUoPdWqOlQg" y="40"/> | ||
562 | </children> | ||
563 | <children xmi:type="notation:DecorationNode" xmi:id="_uW-_Yn8VEemiUoPdWqOlQg" type="6002"> | ||
564 | <layoutConstraint xmi:type="notation:Location" xmi:id="_uW-_Y38VEemiUoPdWqOlQg" y="60"/> | ||
565 | </children> | ||
566 | <styles xmi:type="notation:FontStyle" xmi:id="_uW-YUX8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
567 | <element xmi:type="henshin:Edge" href="cps.henshin#_uW8jIH8VEemiUoPdWqOlQg"/> | ||
568 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_uW-YUn8VEemiUoPdWqOlQg" points="[36, -23, -86, 55]$[108, -86, -14, -8]"/> | ||
569 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_uXCCsH8VEemiUoPdWqOlQg" id="(0.28205128205128205,0.17391304347826086)"/> | ||
570 | </edges> | ||
571 | <edges xmi:type="notation:Connector" xmi:id="_ulQE4H8VEemiUoPdWqOlQg" type="4001" source="_VfOboH8VEemiUoPdWqOlQg" target="_Xr_OIH8VEemiUoPdWqOlQg"> | ||
572 | <children xmi:type="notation:DecorationNode" xmi:id="_ulQr8H8VEemiUoPdWqOlQg" type="6001"> | ||
573 | <layoutConstraint xmi:type="notation:Location" xmi:id="_ulQr8X8VEemiUoPdWqOlQg" y="40"/> | ||
574 | </children> | ||
575 | <children xmi:type="notation:DecorationNode" xmi:id="_ulQr8n8VEemiUoPdWqOlQg" type="6002"> | ||
576 | <layoutConstraint xmi:type="notation:Location" xmi:id="_ulQr838VEemiUoPdWqOlQg" y="60"/> | ||
577 | </children> | ||
578 | <styles xmi:type="notation:FontStyle" xmi:id="_ulQE4X8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
579 | <element xmi:type="henshin:Edge" href="cps.henshin#_ulPd0H8VEemiUoPdWqOlQg"/> | ||
580 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_ulQE4n8VEemiUoPdWqOlQg" points="[40, 19, -76, -39]$[89, 50, -27, -8]"/> | ||
581 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_ulTvQH8VEemiUoPdWqOlQg" id="(0.23076923076923078,0.30434782608695654)"/> | ||
582 | </edges> | ||
583 | <edges xmi:type="notation:Connector" xmi:id="_3NJHwH8VEemiUoPdWqOlQg" type="4001" source="_cTdIgH8VEemiUoPdWqOlQg" target="_wZseAH8VEemiUoPdWqOlQg"> | ||
584 | <children xmi:type="notation:DecorationNode" xmi:id="_3NJHw38VEemiUoPdWqOlQg" type="6001"> | ||
585 | <layoutConstraint xmi:type="notation:Location" xmi:id="_3NJHxH8VEemiUoPdWqOlQg" y="40"/> | ||
586 | </children> | ||
587 | <children xmi:type="notation:DecorationNode" xmi:id="_3NJHxX8VEemiUoPdWqOlQg" type="6002"> | ||
588 | <layoutConstraint xmi:type="notation:Location" xmi:id="_3NJHxn8VEemiUoPdWqOlQg" y="60"/> | ||
589 | </children> | ||
590 | <styles xmi:type="notation:FontStyle" xmi:id="_3NJHwX8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
591 | <element xmi:type="henshin:Edge" href="cps.henshin#_3NH5oH8VEemiUoPdWqOlQg"/> | ||
592 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_3NJHwn8VEemiUoPdWqOlQg" points="[-6, -4, 131, 94]$[-141, -121, -4, -23]"/> | ||
593 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3NK88H8VEemiUoPdWqOlQg" id="(0.2905982905982906,0.08695652173913043)"/> | ||
594 | </edges> | ||
595 | <edges xmi:type="notation:Connector" xmi:id="_4SrMcH8VEemiUoPdWqOlQg" type="4001" source="_WJm1YH8VEemiUoPdWqOlQg" target="_cTdIgH8VEemiUoPdWqOlQg"> | ||
596 | <children xmi:type="notation:DecorationNode" xmi:id="_4SrMc38VEemiUoPdWqOlQg" type="6001"> | ||
597 | <layoutConstraint xmi:type="notation:Location" xmi:id="_4SrMdH8VEemiUoPdWqOlQg" y="40"/> | ||
598 | </children> | ||
599 | <children xmi:type="notation:DecorationNode" xmi:id="_4SrMdX8VEemiUoPdWqOlQg" type="6002"> | ||
600 | <layoutConstraint xmi:type="notation:Location" xmi:id="_4SrMdn8VEemiUoPdWqOlQg" y="60"/> | ||
601 | </children> | ||
602 | <styles xmi:type="notation:FontStyle" xmi:id="_4SrMcX8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
603 | <element xmi:type="henshin:Edge" href="cps.henshin#_4SqlYH8VEemiUoPdWqOlQg"/> | ||
604 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_4SrMcn8VEemiUoPdWqOlQg" points="[5, 23, 6, -94]$[5, 94, 6, -23]"/> | ||
605 | </edges> | ||
606 | <edges xmi:type="notation:Connector" xmi:id="_44ku0H8VEemiUoPdWqOlQg" type="4001" source="_WJm1YH8VEemiUoPdWqOlQg" target="_fYb8cH8VEemiUoPdWqOlQg"> | ||
607 | <children xmi:type="notation:DecorationNode" xmi:id="_44ku038VEemiUoPdWqOlQg" type="6001"> | ||
608 | <layoutConstraint xmi:type="notation:Location" xmi:id="_44ku1H8VEemiUoPdWqOlQg" y="40"/> | ||
609 | </children> | ||
610 | <children xmi:type="notation:DecorationNode" xmi:id="_44ku1X8VEemiUoPdWqOlQg" type="6002"> | ||
611 | <layoutConstraint xmi:type="notation:Location" xmi:id="_44ku1n8VEemiUoPdWqOlQg" y="60"/> | ||
612 | </children> | ||
613 | <styles xmi:type="notation:FontStyle" xmi:id="_44ku0X8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
614 | <element xmi:type="henshin:Edge" href="cps.henshin#_44kHwH8VEemiUoPdWqOlQg"/> | ||
615 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_44ku0n8VEemiUoPdWqOlQg" points="[11, -1, -144, 2]$[90, -1, -65, 2]"/> | ||
616 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_44l88H8VEemiUoPdWqOlQg" id="(0.8854166666666666,0.5652173913043478)"/> | ||
617 | </edges> | ||
618 | <edges xmi:type="notation:Connector" xmi:id="_5ReXAH8VEemiUoPdWqOlQg" type="4001" source="_fYb8cH8VEemiUoPdWqOlQg" target="_kmA0kH8VEemiUoPdWqOlQg"> | ||
619 | <children xmi:type="notation:DecorationNode" xmi:id="_5ReXA38VEemiUoPdWqOlQg" type="6001"> | ||
620 | <layoutConstraint xmi:type="notation:Location" xmi:id="_5ReXBH8VEemiUoPdWqOlQg" y="40"/> | ||
621 | </children> | ||
622 | <children xmi:type="notation:DecorationNode" xmi:id="_5ReXBX8VEemiUoPdWqOlQg" type="6002"> | ||
623 | <layoutConstraint xmi:type="notation:Location" xmi:id="_5ReXBn8VEemiUoPdWqOlQg" y="60"/> | ||
624 | </children> | ||
625 | <styles xmi:type="notation:FontStyle" xmi:id="_5ReXAX8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
626 | <element xmi:type="henshin:Edge" href="cps.henshin#_5Rch0H8VEemiUoPdWqOlQg"/> | ||
627 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_5ReXAn8VEemiUoPdWqOlQg" points="[17, -2, -95, 1]$[79, -11, -33, -8]"/> | ||
628 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5RgMMH8VEemiUoPdWqOlQg" id="(0.8702290076335878,0.5652173913043478)"/> | ||
629 | </edges> | ||
630 | <edges xmi:type="notation:Connector" xmi:id="_5r5pMH8VEemiUoPdWqOlQg" type="4001" source="_kmA0kH8VEemiUoPdWqOlQg" target="_Y0FeoH8VEemiUoPdWqOlQg"> | ||
631 | <children xmi:type="notation:DecorationNode" xmi:id="_5r5pM38VEemiUoPdWqOlQg" type="6001"> | ||
632 | <layoutConstraint xmi:type="notation:Location" xmi:id="_5r5pNH8VEemiUoPdWqOlQg" y="40"/> | ||
633 | </children> | ||
634 | <children xmi:type="notation:DecorationNode" xmi:id="_5r5pNX8VEemiUoPdWqOlQg" type="6002"> | ||
635 | <layoutConstraint xmi:type="notation:Location" xmi:id="_5r5pNn8VEemiUoPdWqOlQg" y="60"/> | ||
636 | </children> | ||
637 | <styles xmi:type="notation:FontStyle" xmi:id="_5r5pMX8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
638 | <element xmi:type="henshin:Edge" href="cps.henshin#_5r5CIH8VEemiUoPdWqOlQg"/> | ||
639 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_5r5pMn8VEemiUoPdWqOlQg" points="[-3, 23, -3, -157]$[-3, 157, -3, -23]"/> | ||
640 | </edges> | ||
641 | <edges xmi:type="notation:Connector" xmi:id="_-vsTMH8VEemiUoPdWqOlQg" type="4001" source="_Xr_OIH8VEemiUoPdWqOlQg" target="_Y0FeoH8VEemiUoPdWqOlQg"> | ||
642 | <children xmi:type="notation:DecorationNode" xmi:id="_-vsTM38VEemiUoPdWqOlQg" type="6001"> | ||
643 | <layoutConstraint xmi:type="notation:Location" xmi:id="_-vsTNH8VEemiUoPdWqOlQg" y="40"/> | ||
644 | </children> | ||
645 | <children xmi:type="notation:DecorationNode" xmi:id="_-vsTNX8VEemiUoPdWqOlQg" type="6002"> | ||
646 | <layoutConstraint xmi:type="notation:Location" xmi:id="_-vsTNn8VEemiUoPdWqOlQg" y="60"/> | ||
647 | </children> | ||
648 | <styles xmi:type="notation:FontStyle" xmi:id="_-vsTMX8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
649 | <element xmi:type="henshin:Edge" href="cps.henshin#_-vrFEH8VEemiUoPdWqOlQg"/> | ||
650 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_-vsTMn8VEemiUoPdWqOlQg" points="[59, -14, -295, 53]$[346, -90, -8, -23]"/> | ||
651 | </edges> | ||
652 | <edges xmi:type="notation:Connector" xmi:id="__Tfj0H8VEemiUoPdWqOlQg" type="4001" source="_cTdIgH8VEemiUoPdWqOlQg" target="_Y0FeoH8VEemiUoPdWqOlQg"> | ||
653 | <children xmi:type="notation:DecorationNode" xmi:id="__Tfj038VEemiUoPdWqOlQg" type="6001"> | ||
654 | <layoutConstraint xmi:type="notation:Location" xmi:id="__Tfj1H8VEemiUoPdWqOlQg" y="40"/> | ||
655 | </children> | ||
656 | <children xmi:type="notation:DecorationNode" xmi:id="__Tfj1X8VEemiUoPdWqOlQg" type="6002"> | ||
657 | <layoutConstraint xmi:type="notation:Location" xmi:id="__Tfj1n8VEemiUoPdWqOlQg" y="60"/> | ||
658 | </children> | ||
659 | <styles xmi:type="notation:FontStyle" xmi:id="__Tfj0X8VEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
660 | <element xmi:type="henshin:Edge" href="cps.henshin#__Te8wH8VEemiUoPdWqOlQg"/> | ||
661 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="__Tfj0n8VEemiUoPdWqOlQg" points="[11, 2, -295, -62]$[266, 56, -40, -8]"/> | ||
662 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__TiAEH8VEemiUoPdWqOlQg" id="(0.905982905982906,0.4782608695652174)"/> | ||
663 | </edges> | ||
664 | <edges xmi:type="notation:Connector" xmi:id="_H6qjEH8YEemiUoPdWqOlQg" type="4001" source="_A8fQAH8YEemiUoPdWqOlQg" target="_DowB8H8YEemiUoPdWqOlQg"> | ||
665 | <children xmi:type="notation:DecorationNode" xmi:id="_H6qjE38YEemiUoPdWqOlQg" type="6001"> | ||
666 | <layoutConstraint xmi:type="notation:Location" xmi:id="_H6qjFH8YEemiUoPdWqOlQg" y="40"/> | ||
667 | </children> | ||
668 | <children xmi:type="notation:DecorationNode" xmi:id="_H6qjFX8YEemiUoPdWqOlQg" type="6002"> | ||
669 | <layoutConstraint xmi:type="notation:Location" xmi:id="_H6qjFn8YEemiUoPdWqOlQg" y="60"/> | ||
670 | </children> | ||
671 | <styles xmi:type="notation:FontStyle" xmi:id="_H6qjEX8YEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
672 | <element xmi:type="henshin:Edge" href="cps.henshin#_H6p8AH8YEemiUoPdWqOlQg"/> | ||
673 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_H6qjEn8YEemiUoPdWqOlQg" points="[-3, 23, -2, -129]$[-3, 175, -2, 23]"/> | ||
674 | </edges> | ||
675 | <edges xmi:type="notation:Connector" xmi:id="_IR7MgX8YEemiUoPdWqOlQg" type="4001" source="_AUGaUH8YEemiUoPdWqOlQg" target="_DowB8H8YEemiUoPdWqOlQg"> | ||
676 | <children xmi:type="notation:DecorationNode" xmi:id="_IR7zkH8YEemiUoPdWqOlQg" type="6001"> | ||
677 | <layoutConstraint xmi:type="notation:Location" xmi:id="_IR7zkX8YEemiUoPdWqOlQg" y="40"/> | ||
678 | </children> | ||
679 | <children xmi:type="notation:DecorationNode" xmi:id="_IR7zkn8YEemiUoPdWqOlQg" type="6002"> | ||
680 | <layoutConstraint xmi:type="notation:Location" xmi:id="_IR7zk38YEemiUoPdWqOlQg" y="60"/> | ||
681 | </children> | ||
682 | <styles xmi:type="notation:FontStyle" xmi:id="_IR7Mgn8YEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
683 | <element xmi:type="henshin:Edge" href="cps.henshin#_IR7MgH8YEemiUoPdWqOlQg"/> | ||
684 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_IR7Mg38YEemiUoPdWqOlQg" points="[29, 23, -155, -122]$[160, 140, -24, -5]"/> | ||
685 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_IR8aoH8YEemiUoPdWqOlQg" id="(0.20512820512820512,0.34782608695652173)"/> | ||
686 | </edges> | ||
687 | <edges xmi:type="notation:Connector" xmi:id="_InE9IH8YEemiUoPdWqOlQg" type="4001" source="_AUGaUH8YEemiUoPdWqOlQg" target="_A8fQAH8YEemiUoPdWqOlQg"> | ||
688 | <children xmi:type="notation:DecorationNode" xmi:id="_InE9I38YEemiUoPdWqOlQg" type="6001"> | ||
689 | <layoutConstraint xmi:type="notation:Location" xmi:id="_InE9JH8YEemiUoPdWqOlQg" y="40"/> | ||
690 | </children> | ||
691 | <children xmi:type="notation:DecorationNode" xmi:id="_InE9JX8YEemiUoPdWqOlQg" type="6002"> | ||
692 | <layoutConstraint xmi:type="notation:Location" xmi:id="_InE9Jn8YEemiUoPdWqOlQg" y="60"/> | ||
693 | </children> | ||
694 | <styles xmi:type="notation:FontStyle" xmi:id="_InE9IX8YEemiUoPdWqOlQg" fontName="Noto Sans"/> | ||
695 | <element xmi:type="henshin:Edge" href="cps.henshin#_InEWEH8YEemiUoPdWqOlQg"/> | ||
696 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_InE9In8YEemiUoPdWqOlQg" points="[16, 8, -179, 9]$[188, 22, -7, 23]"/> | ||
697 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_InGLQH8YEemiUoPdWqOlQg" id="(0.7974683544303798,0.5217391304347826)"/> | ||
698 | </edges> | ||
699 | </notation:Diagram> | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/plugin.properties b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/plugin.properties new file mode 100644 index 00000000..aa7cf04c --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/plugin.properties | |||
@@ -0,0 +1,4 @@ | |||
1 | # | ||
2 | |||
3 | pluginName = hu.bme.mit.inf.dslreasoner.domains.cps | ||
4 | providerName = www.example.org | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/plugin.xml b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/plugin.xml new file mode 100644 index 00000000..5a0fee8d --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/plugin.xml | |||
@@ -0,0 +1,27 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?><?eclipse version="3.0"?><!-- | ||
2 | --><plugin> | ||
3 | <extension point="org.eclipse.emf.ecore.generated_package"> | ||
4 | <!-- @generated cps --> | ||
5 | <package class="hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage" genModel="model/cps.genmodel" uri="http://www.example.org/cps"/> | ||
6 | </extension> | ||
7 | <extension id="hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsQueries" point="org.eclipse.viatra.query.runtime.queryspecification"> | ||
8 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsQueries" id="hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsQueries"> | ||
9 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.resourceRequirement"/> | ||
10 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocationWithoutResourceRequirement"/> | ||
11 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableMemory"/> | ||
12 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableHdd"/> | ||
13 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.instanceDoesNotSatisfyRequirement"/> | ||
14 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.requirementNotSatisfied"/> | ||
15 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.redundantInstancesOnSameHost"/> | ||
16 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeMemoryMetric"/> | ||
17 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeHddMetric"/> | ||
18 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.costMetric"/> | ||
19 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsCost"/> | ||
20 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocate"/> | ||
21 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocateAppInstance"/> | ||
22 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.createHostInstance"/> | ||
23 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.removeHostInstance"/> | ||
24 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.cps.queries.guidanceObjective"/> | ||
25 | </group> | ||
26 | </extension> | ||
27 | </plugin> | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/representations.aird b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/representations.aird new file mode 100644 index 00000000..dbaf9f8c --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/representations.aird | |||
@@ -0,0 +1,600 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style"> | ||
3 | <viewpoint:DAnalysis uid="_hQ-pEHpMEem6LP4EDiey6Q" selectedViews="_jsELcHpMEem6LP4EDiey6Q" version="14.1.0.201810161215"> | ||
4 | <semanticResources>model/cps.ecore</semanticResources> | ||
5 | <semanticResources>http://www.eclipse.org/emf/2002/Ecore</semanticResources> | ||
6 | <semanticResources>model/cps.genmodel</semanticResources> | ||
7 | <semanticResources>src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsMain.xtend</semanticResources> | ||
8 | <semanticResources>src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsSolver.xtend</semanticResources> | ||
9 | <semanticResources>src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend</semanticResources> | ||
10 | <semanticResources>src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql</semanticResources> | ||
11 | <semanticResources>src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/CpsStateCoder.xtend</semanticResources> | ||
12 | <ownedViews xmi:type="viewpoint:DView" uid="_jsELcHpMEem6LP4EDiey6Q"> | ||
13 | <viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']"/> | ||
14 | <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_kBjTQHpMEem6LP4EDiey6Q" name="cps class diagram" repPath="#_kAPrsHpMEem6LP4EDiey6Q"> | ||
15 | <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/> | ||
16 | <target xmi:type="ecore:EPackage" href="model/cps.ecore#/"/> | ||
17 | </ownedRepresentationDescriptors> | ||
18 | </ownedViews> | ||
19 | </viewpoint:DAnalysis> | ||
20 | <diagram:DSemanticDiagram uid="_kAPrsHpMEem6LP4EDiey6Q" name="cps class diagram"> | ||
21 | <ownedAnnotationEntries xmi:type="description:AnnotationEntry" uid="_kBb-gHpMEem6LP4EDiey6Q" source="DANNOTATION_CUSTOMIZATION_KEY"> | ||
22 | <data xmi:type="diagram:ComputedStyleDescriptionRegistry" uid="_kBclkHpMEem6LP4EDiey6Q"> | ||
23 | <computedStyleDescriptions xmi:type="style:BundledImageDescription" xmi:id="_kku40HpMEem6LP4EDiey6Q" labelExpression="service:render" labelAlignment="LEFT" tooltipExpression="service:renderTooltip" sizeComputationExpression="1"> | ||
24 | <borderColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
25 | <labelFormat>bold</labelFormat> | ||
26 | <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
27 | <color xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
28 | </computedStyleDescriptions> | ||
29 | <computedStyleDescriptions xmi:type="style:EdgeStyleDescription" xmi:id="_kk538HpMEem6LP4EDiey6Q" sourceArrow="FillDiamond" routingStyle="manhattan"> | ||
30 | <strokeColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
31 | <centerLabelStyleDescription xmi:type="style:CenterLabelStyleDescription" xmi:id="_kk538XpMEem6LP4EDiey6Q" showIcon="false" labelExpression="service:render"> | ||
32 | <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
33 | </centerLabelStyleDescription> | ||
34 | <endLabelStyleDescription xmi:type="style:EndLabelStyleDescription" xmi:id="_kk538npMEem6LP4EDiey6Q" labelSize="6" showIcon="false" labelExpression="service:eKeysLabel"> | ||
35 | <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='dark_blue']"/> | ||
36 | </endLabelStyleDescription> | ||
37 | </computedStyleDescriptions> | ||
38 | <computedStyleDescriptions xmi:type="style:EdgeStyleDescription" xmi:id="_kk_-kHpMEem6LP4EDiey6Q" routingStyle="manhattan"> | ||
39 | <strokeColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
40 | <centerLabelStyleDescription xmi:type="style:CenterLabelStyleDescription" xmi:id="_kk_-kXpMEem6LP4EDiey6Q" showIcon="false" labelExpression="service:render"> | ||
41 | <labelFormat>bold</labelFormat> | ||
42 | <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
43 | </centerLabelStyleDescription> | ||
44 | <endLabelStyleDescription xmi:type="style:EndLabelStyleDescription" xmi:id="_kk_-knpMEem6LP4EDiey6Q" labelSize="6" showIcon="false" labelExpression="service:eKeysLabel"> | ||
45 | <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='dark_blue']"/> | ||
46 | </endLabelStyleDescription> | ||
47 | </computedStyleDescriptions> | ||
48 | <computedStyleDescriptions xmi:type="style:EdgeStyleDescription" xmi:id="_klBzwHpMEem6LP4EDiey6Q" sourceArrow="InputArrow" routingStyle="manhattan"> | ||
49 | <strokeColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
50 | <beginLabelStyleDescription xmi:type="style:BeginLabelStyleDescription" xmi:id="_klBzwXpMEem6LP4EDiey6Q" showIcon="false" labelExpression="service:renderEOpposite"> | ||
51 | <labelFormat>bold</labelFormat> | ||
52 | <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
53 | </beginLabelStyleDescription> | ||
54 | <endLabelStyleDescription xmi:type="style:EndLabelStyleDescription" xmi:id="_klBzwnpMEem6LP4EDiey6Q" showIcon="false" labelExpression="service:render"> | ||
55 | <labelFormat>bold</labelFormat> | ||
56 | <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
57 | </endLabelStyleDescription> | ||
58 | </computedStyleDescriptions> | ||
59 | <computedStyleDescriptions xmi:type="style:EdgeStyleDescription" xmi:id="_klDo8HpMEem6LP4EDiey6Q" sourceArrow="FillDiamond" routingStyle="manhattan"> | ||
60 | <strokeColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
61 | <beginLabelStyleDescription xmi:type="style:BeginLabelStyleDescription" xmi:id="_klDo8XpMEem6LP4EDiey6Q" showIcon="false" labelExpression="service:renderEOpposite"> | ||
62 | <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
63 | </beginLabelStyleDescription> | ||
64 | <endLabelStyleDescription xmi:type="style:EndLabelStyleDescription" xmi:id="_klDo8npMEem6LP4EDiey6Q" showIcon="false" labelExpression="service:render"> | ||
65 | <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> | ||
66 | </endLabelStyleDescription> | ||
67 | </computedStyleDescriptions> | ||
68 | </data> | ||
69 | </ownedAnnotationEntries> | ||
70 | <ownedAnnotationEntries xmi:type="description:AnnotationEntry" uid="_kCIiEHpMEem6LP4EDiey6Q" source="GMF_DIAGRAMS"> | ||
71 | <data xmi:type="notation:Diagram" xmi:id="_kCIiEXpMEem6LP4EDiey6Q" type="Sirius" element="_kAPrsHpMEem6LP4EDiey6Q" measurementUnit="Pixel"> | ||
72 | <children xmi:type="notation:Node" xmi:id="_klH6YHpMEem6LP4EDiey6Q" type="2003" element="_kkaIsHpMEem6LP4EDiey6Q"> | ||
73 | <children xmi:type="notation:Node" xmi:id="_klIhcHpMEem6LP4EDiey6Q" type="5007"/> | ||
74 | <children xmi:type="notation:Node" xmi:id="_klKWoHpMEem6LP4EDiey6Q" type="7004"> | ||
75 | <styles xmi:type="notation:SortingStyle" xmi:id="_klKWoXpMEem6LP4EDiey6Q"/> | ||
76 | <styles xmi:type="notation:FilteringStyle" xmi:id="_klKWonpMEem6LP4EDiey6Q"/> | ||
77 | </children> | ||
78 | <styles xmi:type="notation:ShapeStyle" xmi:id="_klH6YXpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
79 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klH6YnpMEem6LP4EDiey6Q" x="200" y="960"/> | ||
80 | </children> | ||
81 | <children xmi:type="notation:Node" xmi:id="_klK9sHpMEem6LP4EDiey6Q" type="2003" element="_kkeaIHpMEem6LP4EDiey6Q"> | ||
82 | <children xmi:type="notation:Node" xmi:id="_klK9s3pMEem6LP4EDiey6Q" type="5007"/> | ||
83 | <children xmi:type="notation:Node" xmi:id="_klK9tHpMEem6LP4EDiey6Q" type="7004"> | ||
84 | <styles xmi:type="notation:SortingStyle" xmi:id="_klK9tXpMEem6LP4EDiey6Q"/> | ||
85 | <styles xmi:type="notation:FilteringStyle" xmi:id="_klK9tnpMEem6LP4EDiey6Q"/> | ||
86 | </children> | ||
87 | <styles xmi:type="notation:ShapeStyle" xmi:id="_klK9sXpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
88 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klK9snpMEem6LP4EDiey6Q" x="200" y="480"/> | ||
89 | </children> | ||
90 | <children xmi:type="notation:Node" xmi:id="_klK9t3pMEem6LP4EDiey6Q" type="2003" element="_kkfoQXpMEem6LP4EDiey6Q"> | ||
91 | <children xmi:type="notation:Node" xmi:id="_klLkwHpMEem6LP4EDiey6Q" type="5007"/> | ||
92 | <children xmi:type="notation:Node" xmi:id="_klLkwXpMEem6LP4EDiey6Q" type="7004"> | ||
93 | <children xmi:type="notation:Node" xmi:id="_klOoEHpMEem6LP4EDiey6Q" type="3010" element="_kktqsHpMEem6LP4EDiey6Q"> | ||
94 | <styles xmi:type="notation:FontStyle" xmi:id="_klOoEXpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8" bold="true"/> | ||
95 | <layoutConstraint xmi:type="notation:Location" xmi:id="_klOoEnpMEem6LP4EDiey6Q"/> | ||
96 | </children> | ||
97 | <children xmi:type="notation:Node" xmi:id="_klPPIHpMEem6LP4EDiey6Q" type="3010" element="_kkxVEHpMEem6LP4EDiey6Q"> | ||
98 | <styles xmi:type="notation:FontStyle" xmi:id="_klPPIXpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8" bold="true"/> | ||
99 | <layoutConstraint xmi:type="notation:Location" xmi:id="_klPPInpMEem6LP4EDiey6Q"/> | ||
100 | </children> | ||
101 | <children xmi:type="notation:Node" xmi:id="_klPPI3pMEem6LP4EDiey6Q" type="3010" element="_kkxVEnpMEem6LP4EDiey6Q"> | ||
102 | <styles xmi:type="notation:FontStyle" xmi:id="_klPPJHpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8" bold="true"/> | ||
103 | <layoutConstraint xmi:type="notation:Location" xmi:id="_klPPJXpMEem6LP4EDiey6Q"/> | ||
104 | </children> | ||
105 | <styles xmi:type="notation:SortingStyle" xmi:id="_klLkwnpMEem6LP4EDiey6Q"/> | ||
106 | <styles xmi:type="notation:FilteringStyle" xmi:id="_klLkw3pMEem6LP4EDiey6Q"/> | ||
107 | </children> | ||
108 | <styles xmi:type="notation:ShapeStyle" xmi:id="_klK9uHpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
109 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klK9uXpMEem6LP4EDiey6Q" x="140" y="160"/> | ||
110 | </children> | ||
111 | <children xmi:type="notation:Node" xmi:id="_klLkxHpMEem6LP4EDiey6Q" type="2003" element="_kkhdcHpMEem6LP4EDiey6Q"> | ||
112 | <children xmi:type="notation:Node" xmi:id="_klML0HpMEem6LP4EDiey6Q" type="5007"/> | ||
113 | <children xmi:type="notation:Node" xmi:id="_klML0XpMEem6LP4EDiey6Q" type="7004"> | ||
114 | <styles xmi:type="notation:SortingStyle" xmi:id="_klML0npMEem6LP4EDiey6Q"/> | ||
115 | <styles xmi:type="notation:FilteringStyle" xmi:id="_klML03pMEem6LP4EDiey6Q"/> | ||
116 | </children> | ||
117 | <styles xmi:type="notation:ShapeStyle" xmi:id="_klLkxXpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
118 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klLkxnpMEem6LP4EDiey6Q" x="380" y="800"/> | ||
119 | </children> | ||
120 | <children xmi:type="notation:Node" xmi:id="_klML1HpMEem6LP4EDiey6Q" type="2003" element="_kkirkHpMEem6LP4EDiey6Q"> | ||
121 | <children xmi:type="notation:Node" xmi:id="_klML13pMEem6LP4EDiey6Q" type="5007"/> | ||
122 | <children xmi:type="notation:Node" xmi:id="_klML2HpMEem6LP4EDiey6Q" type="7004"> | ||
123 | <children xmi:type="notation:Node" xmi:id="_klP2MHpMEem6LP4EDiey6Q" type="3010" element="_kkyjMHpMEem6LP4EDiey6Q"> | ||
124 | <styles xmi:type="notation:FontStyle" xmi:id="_klP2MXpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8" bold="true"/> | ||
125 | <layoutConstraint xmi:type="notation:Location" xmi:id="_klP2MnpMEem6LP4EDiey6Q"/> | ||
126 | </children> | ||
127 | <styles xmi:type="notation:SortingStyle" xmi:id="_klML2XpMEem6LP4EDiey6Q"/> | ||
128 | <styles xmi:type="notation:FilteringStyle" xmi:id="_klML2npMEem6LP4EDiey6Q"/> | ||
129 | </children> | ||
130 | <styles xmi:type="notation:ShapeStyle" xmi:id="_klML1XpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
131 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klML1npMEem6LP4EDiey6Q" x="380" y="640"/> | ||
132 | </children> | ||
133 | <children xmi:type="notation:Node" xmi:id="_klML23pMEem6LP4EDiey6Q" type="2003" element="_kkjSoXpMEem6LP4EDiey6Q"> | ||
134 | <children xmi:type="notation:Node" xmi:id="_klMy4HpMEem6LP4EDiey6Q" type="5007"/> | ||
135 | <children xmi:type="notation:Node" xmi:id="_klMy4XpMEem6LP4EDiey6Q" type="7004"> | ||
136 | <styles xmi:type="notation:SortingStyle" xmi:id="_klMy4npMEem6LP4EDiey6Q"/> | ||
137 | <styles xmi:type="notation:FilteringStyle" xmi:id="_klMy43pMEem6LP4EDiey6Q"/> | ||
138 | </children> | ||
139 | <styles xmi:type="notation:ShapeStyle" xmi:id="_klML3HpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
140 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klML3XpMEem6LP4EDiey6Q" x="400" y="320"/> | ||
141 | </children> | ||
142 | <children xmi:type="notation:Node" xmi:id="_klMy5HpMEem6LP4EDiey6Q" type="2003" element="_kkkgwHpMEem6LP4EDiey6Q"> | ||
143 | <children xmi:type="notation:Node" xmi:id="_klNZ8HpMEem6LP4EDiey6Q" type="5007"/> | ||
144 | <children xmi:type="notation:Node" xmi:id="_klNZ8XpMEem6LP4EDiey6Q" type="7004"> | ||
145 | <children xmi:type="notation:Node" xmi:id="_klP2M3pMEem6LP4EDiey6Q" type="3010" element="_kkzKQHpMEem6LP4EDiey6Q"> | ||
146 | <styles xmi:type="notation:FontStyle" xmi:id="_klP2NHpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8" bold="true"/> | ||
147 | <layoutConstraint xmi:type="notation:Location" xmi:id="_klP2NXpMEem6LP4EDiey6Q"/> | ||
148 | </children> | ||
149 | <children xmi:type="notation:Node" xmi:id="_klP2NnpMEem6LP4EDiey6Q" type="3010" element="_kkzxUXpMEem6LP4EDiey6Q"> | ||
150 | <styles xmi:type="notation:FontStyle" xmi:id="_klP2N3pMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8" bold="true"/> | ||
151 | <layoutConstraint xmi:type="notation:Location" xmi:id="_klP2OHpMEem6LP4EDiey6Q"/> | ||
152 | </children> | ||
153 | <styles xmi:type="notation:SortingStyle" xmi:id="_klNZ8npMEem6LP4EDiey6Q"/> | ||
154 | <styles xmi:type="notation:FilteringStyle" xmi:id="_klNZ83pMEem6LP4EDiey6Q"/> | ||
155 | </children> | ||
156 | <styles xmi:type="notation:ShapeStyle" xmi:id="_klMy5XpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
157 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klMy5npMEem6LP4EDiey6Q" x="180" y="320"/> | ||
158 | </children> | ||
159 | <children xmi:type="notation:Node" xmi:id="_klOBAHpMEem6LP4EDiey6Q" type="2003" element="_kklH0HpMEem6LP4EDiey6Q"> | ||
160 | <children xmi:type="notation:Node" xmi:id="_klOBA3pMEem6LP4EDiey6Q" type="5007"/> | ||
161 | <children xmi:type="notation:Node" xmi:id="_klOBBHpMEem6LP4EDiey6Q" type="7004"> | ||
162 | <styles xmi:type="notation:SortingStyle" xmi:id="_klOBBXpMEem6LP4EDiey6Q"/> | ||
163 | <styles xmi:type="notation:FilteringStyle" xmi:id="_klOBBnpMEem6LP4EDiey6Q"/> | ||
164 | </children> | ||
165 | <styles xmi:type="notation:ShapeStyle" xmi:id="_klOBAXpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
166 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klOBAnpMEem6LP4EDiey6Q" x="400"/> | ||
167 | </children> | ||
168 | <styles xmi:type="notation:DiagramStyle" xmi:id="_kCIiEnpMEem6LP4EDiey6Q"/> | ||
169 | <edges xmi:type="notation:Edge" xmi:id="_klTgkHpMEem6LP4EDiey6Q" type="4001" element="_kk4p0HpMEem6LP4EDiey6Q" source="_klH6YHpMEem6LP4EDiey6Q" target="_klLkxHpMEem6LP4EDiey6Q"> | ||
170 | <children xmi:type="notation:Node" xmi:id="_klUusHpMEem6LP4EDiey6Q" type="6001"> | ||
171 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klUusXpMEem6LP4EDiey6Q" y="-10"/> | ||
172 | </children> | ||
173 | <children xmi:type="notation:Node" xmi:id="_klVVwHpMEem6LP4EDiey6Q" type="6002"> | ||
174 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klVVwXpMEem6LP4EDiey6Q" y="10"/> | ||
175 | </children> | ||
176 | <children xmi:type="notation:Node" xmi:id="_klVVwnpMEem6LP4EDiey6Q" type="6003"> | ||
177 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klVVw3pMEem6LP4EDiey6Q" y="10"/> | ||
178 | </children> | ||
179 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_klTgkXpMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
180 | <styles xmi:type="notation:FontStyle" xmi:id="_klTgknpMEem6LP4EDiey6Q" fontColor="7490599" fontName="Noto Sans" fontHeight="8"/> | ||
181 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_klTgk3pMEem6LP4EDiey6Q" points="[0, -50, -181, 110]$[181, -110, 0, 50]"/> | ||
182 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klcqgHpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
183 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klcqgXpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
184 | </edges> | ||
185 | <edges xmi:type="notation:Edge" xmi:id="_kldRkHpMEem6LP4EDiey6Q" type="4001" element="_kk8UMHpMEem6LP4EDiey6Q" source="_klH6YHpMEem6LP4EDiey6Q" target="_klK9sHpMEem6LP4EDiey6Q"> | ||
186 | <children xmi:type="notation:Node" xmi:id="_kldRlHpMEem6LP4EDiey6Q" type="6001"> | ||
187 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kldRlXpMEem6LP4EDiey6Q" y="-10"/> | ||
188 | </children> | ||
189 | <children xmi:type="notation:Node" xmi:id="_kldRlnpMEem6LP4EDiey6Q" type="6002"> | ||
190 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kldRl3pMEem6LP4EDiey6Q" y="10"/> | ||
191 | </children> | ||
192 | <children xmi:type="notation:Node" xmi:id="_kldRmHpMEem6LP4EDiey6Q" type="6003"> | ||
193 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kldRmXpMEem6LP4EDiey6Q" y="10"/> | ||
194 | </children> | ||
195 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_kldRkXpMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
196 | <styles xmi:type="notation:FontStyle" xmi:id="_kldRknpMEem6LP4EDiey6Q" fontColor="7490599" fontName="Noto Sans" fontHeight="8"/> | ||
197 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_kldRk3pMEem6LP4EDiey6Q" points="[0, -50, 0, 430]$[0, -430, 0, 50]"/> | ||
198 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_kld4oHpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
199 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_kld4oXpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
200 | </edges> | ||
201 | <edges xmi:type="notation:Edge" xmi:id="_kld4onpMEem6LP4EDiey6Q" type="4001" element="_kk87RnpMEem6LP4EDiey6Q" source="_klH6YHpMEem6LP4EDiey6Q" target="_klK9t3pMEem6LP4EDiey6Q"> | ||
202 | <children xmi:type="notation:Node" xmi:id="_kld4pnpMEem6LP4EDiey6Q" type="6001"> | ||
203 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kld4p3pMEem6LP4EDiey6Q" y="-10"/> | ||
204 | </children> | ||
205 | <children xmi:type="notation:Node" xmi:id="_kld4qHpMEem6LP4EDiey6Q" type="6002"> | ||
206 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kld4qXpMEem6LP4EDiey6Q" y="10"/> | ||
207 | </children> | ||
208 | <children xmi:type="notation:Node" xmi:id="_klefsHpMEem6LP4EDiey6Q" type="6003"> | ||
209 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klefsXpMEem6LP4EDiey6Q" y="10"/> | ||
210 | </children> | ||
211 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_kld4o3pMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
212 | <styles xmi:type="notation:FontStyle" xmi:id="_kld4pHpMEem6LP4EDiey6Q" fontColor="7490599" fontName="Noto Sans" fontHeight="8"/> | ||
213 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_kld4pXpMEem6LP4EDiey6Q" points="[0, -50, 49, 750]$[-180, -111, -131, 689]$[-196, -591, -147, 209]$[-196, -690, -147, 110]$[-49, -750, 0, 50]"/> | ||
214 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klefsnpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
215 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klefs3pMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
216 | </edges> | ||
217 | <edges xmi:type="notation:Edge" xmi:id="_kleftHpMEem6LP4EDiey6Q" type="4001" element="_kk9iVnpMEem6LP4EDiey6Q" source="_klK9sHpMEem6LP4EDiey6Q" target="_klMy5HpMEem6LP4EDiey6Q"> | ||
218 | <children xmi:type="notation:Node" xmi:id="_klefuHpMEem6LP4EDiey6Q" type="6001"> | ||
219 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klefuXpMEem6LP4EDiey6Q" y="-10"/> | ||
220 | </children> | ||
221 | <children xmi:type="notation:Node" xmi:id="_klefunpMEem6LP4EDiey6Q" type="6002"> | ||
222 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klefu3pMEem6LP4EDiey6Q" y="10"/> | ||
223 | </children> | ||
224 | <children xmi:type="notation:Node" xmi:id="_klefvHpMEem6LP4EDiey6Q" type="6003"> | ||
225 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klefvXpMEem6LP4EDiey6Q" y="10"/> | ||
226 | </children> | ||
227 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_kleftXpMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
228 | <styles xmi:type="notation:FontStyle" xmi:id="_kleftnpMEem6LP4EDiey6Q" fontColor="7490599" fontName="Noto Sans" fontHeight="8"/> | ||
229 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_kleft3pMEem6LP4EDiey6Q" points="[0, -50, 0, 110]$[0, -110, 0, 50]"/> | ||
230 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klfGwHpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
231 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klfGwXpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
232 | </edges> | ||
233 | <edges xmi:type="notation:Edge" xmi:id="_klfGwnpMEem6LP4EDiey6Q" type="4001" element="_kk-wcHpMEem6LP4EDiey6Q" source="_klML1HpMEem6LP4EDiey6Q" target="_klK9sHpMEem6LP4EDiey6Q"> | ||
234 | <children xmi:type="notation:Node" xmi:id="_klfGxnpMEem6LP4EDiey6Q" type="6001"> | ||
235 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klfGx3pMEem6LP4EDiey6Q" y="-10"/> | ||
236 | </children> | ||
237 | <children xmi:type="notation:Node" xmi:id="_klfGyHpMEem6LP4EDiey6Q" type="6002"> | ||
238 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klfGyXpMEem6LP4EDiey6Q" y="10"/> | ||
239 | </children> | ||
240 | <children xmi:type="notation:Node" xmi:id="_klfGynpMEem6LP4EDiey6Q" type="6003"> | ||
241 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klfGy3pMEem6LP4EDiey6Q" y="10"/> | ||
242 | </children> | ||
243 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_klfGw3pMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
244 | <styles xmi:type="notation:FontStyle" xmi:id="_klfGxHpMEem6LP4EDiey6Q" fontColor="7490599" fontName="Noto Sans" fontHeight="8"/> | ||
245 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_klfGxXpMEem6LP4EDiey6Q" points="[0, 0, 181, 60]$[-181, -60, 0, 0]"/> | ||
246 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klft0HpMEem6LP4EDiey6Q" id="(0.5,0.0)"/> | ||
247 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klft0XpMEem6LP4EDiey6Q" id="(0.5,1.0)"/> | ||
248 | </edges> | ||
249 | <edges xmi:type="notation:Edge" xmi:id="_klft0npMEem6LP4EDiey6Q" type="4001" element="_kk_Xg3pMEem6LP4EDiey6Q" source="_klMy5HpMEem6LP4EDiey6Q" target="_klK9t3pMEem6LP4EDiey6Q"> | ||
250 | <children xmi:type="notation:Node" xmi:id="_klft1npMEem6LP4EDiey6Q" type="6001"> | ||
251 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klft13pMEem6LP4EDiey6Q" y="-10"/> | ||
252 | </children> | ||
253 | <children xmi:type="notation:Node" xmi:id="_klft2HpMEem6LP4EDiey6Q" type="6002"> | ||
254 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klft2XpMEem6LP4EDiey6Q" y="10"/> | ||
255 | </children> | ||
256 | <children xmi:type="notation:Node" xmi:id="_klft2npMEem6LP4EDiey6Q" type="6003"> | ||
257 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klft23pMEem6LP4EDiey6Q" y="10"/> | ||
258 | </children> | ||
259 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_klft03pMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
260 | <styles xmi:type="notation:FontStyle" xmi:id="_klft1HpMEem6LP4EDiey6Q" fontColor="7490599" fontName="Noto Sans" fontHeight="8"/> | ||
261 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_klft1XpMEem6LP4EDiey6Q" points="[0, -50, 49, 110]$[-49, -110, 0, 50]"/> | ||
262 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klgU4HpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
263 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klgU4XpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
264 | </edges> | ||
265 | <edges xmi:type="notation:Edge" xmi:id="_klgU4npMEem6LP4EDiey6Q" type="4001" element="_klBMsHpMEem6LP4EDiey6Q" source="_klML23pMEem6LP4EDiey6Q" target="_klOBAHpMEem6LP4EDiey6Q"> | ||
266 | <children xmi:type="notation:Node" xmi:id="_klgU5npMEem6LP4EDiey6Q" type="6001"> | ||
267 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klgU53pMEem6LP4EDiey6Q" y="-10"/> | ||
268 | </children> | ||
269 | <children xmi:type="notation:Node" xmi:id="_klgU6HpMEem6LP4EDiey6Q" type="6002"> | ||
270 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klgU6XpMEem6LP4EDiey6Q" y="10"/> | ||
271 | </children> | ||
272 | <children xmi:type="notation:Node" xmi:id="_klgU6npMEem6LP4EDiey6Q" type="6003"> | ||
273 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klgU63pMEem6LP4EDiey6Q" y="10"/> | ||
274 | </children> | ||
275 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_klgU43pMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
276 | <styles xmi:type="notation:FontStyle" xmi:id="_klgU5HpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8" bold="true"/> | ||
277 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_klgU5XpMEem6LP4EDiey6Q" points="[0, -50, 0, 270]$[0, -270, 0, 50]"/> | ||
278 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klg78HpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
279 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klg78XpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
280 | </edges> | ||
281 | <edges xmi:type="notation:Edge" xmi:id="_klg78npMEem6LP4EDiey6Q" type="4001" element="_klDB4HpMEem6LP4EDiey6Q" source="_klK9t3pMEem6LP4EDiey6Q" target="_klOBAHpMEem6LP4EDiey6Q"> | ||
282 | <children xmi:type="notation:Node" xmi:id="_klg79npMEem6LP4EDiey6Q" type="6001"> | ||
283 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klg793pMEem6LP4EDiey6Q" y="-10"/> | ||
284 | </children> | ||
285 | <children xmi:type="notation:Node" xmi:id="_klg7-HpMEem6LP4EDiey6Q" type="6002"> | ||
286 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klg7-XpMEem6LP4EDiey6Q" y="10"/> | ||
287 | </children> | ||
288 | <children xmi:type="notation:Node" xmi:id="_klg7-npMEem6LP4EDiey6Q" type="6003"> | ||
289 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klg7-3pMEem6LP4EDiey6Q" y="10"/> | ||
290 | </children> | ||
291 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_klg783pMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
292 | <styles xmi:type="notation:FontStyle" xmi:id="_klg79HpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
293 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_klg79XpMEem6LP4EDiey6Q" points="[0, -50, -247, 110]$[247, -110, 0, 50]"/> | ||
294 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klhjAHpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
295 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klhjAXpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
296 | </edges> | ||
297 | <edges xmi:type="notation:Edge" xmi:id="_klhjAnpMEem6LP4EDiey6Q" type="4001" element="_klDo-XpMEem6LP4EDiey6Q" source="_klLkxHpMEem6LP4EDiey6Q" target="_klML1HpMEem6LP4EDiey6Q"> | ||
298 | <children xmi:type="notation:Node" xmi:id="_klhjBnpMEem6LP4EDiey6Q" type="6001"> | ||
299 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klhjB3pMEem6LP4EDiey6Q" y="-10"/> | ||
300 | </children> | ||
301 | <children xmi:type="notation:Node" xmi:id="_klhjCHpMEem6LP4EDiey6Q" type="6002"> | ||
302 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klhjCXpMEem6LP4EDiey6Q" y="10"/> | ||
303 | </children> | ||
304 | <children xmi:type="notation:Node" xmi:id="_klhjCnpMEem6LP4EDiey6Q" type="6003"> | ||
305 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klhjC3pMEem6LP4EDiey6Q" y="10"/> | ||
306 | </children> | ||
307 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_klhjA3pMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
308 | <styles xmi:type="notation:FontStyle" xmi:id="_klhjBHpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
309 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_klhjBXpMEem6LP4EDiey6Q" points="[0, 0, 0, 60]$[0, -60, 0, 0]"/> | ||
310 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_kliKEHpMEem6LP4EDiey6Q" id="(0.5,0.0)"/> | ||
311 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_kliKEXpMEem6LP4EDiey6Q" id="(0.5,1.0)"/> | ||
312 | </edges> | ||
313 | <edges xmi:type="notation:Edge" xmi:id="_kliKEnpMEem6LP4EDiey6Q" type="4001" element="_klEQBnpMEem6LP4EDiey6Q" source="_klK9sHpMEem6LP4EDiey6Q" target="_klML23pMEem6LP4EDiey6Q"> | ||
314 | <children xmi:type="notation:Node" xmi:id="_kliKFnpMEem6LP4EDiey6Q" type="6001"> | ||
315 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kliKF3pMEem6LP4EDiey6Q" x="-5" y="-73"/> | ||
316 | </children> | ||
317 | <children xmi:type="notation:Node" xmi:id="_kliKGHpMEem6LP4EDiey6Q" type="6002"> | ||
318 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kliKGXpMEem6LP4EDiey6Q" x="18" y="18"/> | ||
319 | </children> | ||
320 | <children xmi:type="notation:Node" xmi:id="_kliKGnpMEem6LP4EDiey6Q" type="6003"> | ||
321 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kliKG3pMEem6LP4EDiey6Q" x="-1" y="-45"/> | ||
322 | </children> | ||
323 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_kliKE3pMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
324 | <styles xmi:type="notation:FontStyle" xmi:id="_kliKFHpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
325 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_kliKFXpMEem6LP4EDiey6Q" points="[59, 1, -143, 161]$[141, 1, -61, 161]$[141, -111, -61, 49]"/> | ||
326 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klixIHpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
327 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klixIXpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
328 | </edges> | ||
329 | <edges xmi:type="notation:Edge" xmi:id="_klixInpMEem6LP4EDiey6Q" type="4001" element="_klFeIHpMEem6LP4EDiey6Q" source="_klML1HpMEem6LP4EDiey6Q" target="_klML23pMEem6LP4EDiey6Q"> | ||
330 | <children xmi:type="notation:Node" xmi:id="_klixJnpMEem6LP4EDiey6Q" type="6001"> | ||
331 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klixJ3pMEem6LP4EDiey6Q" y="-10"/> | ||
332 | </children> | ||
333 | <children xmi:type="notation:Node" xmi:id="_klixKHpMEem6LP4EDiey6Q" type="6002"> | ||
334 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klixKXpMEem6LP4EDiey6Q" y="10"/> | ||
335 | </children> | ||
336 | <children xmi:type="notation:Node" xmi:id="_klixKnpMEem6LP4EDiey6Q" type="6003"> | ||
337 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_klixK3pMEem6LP4EDiey6Q" y="10"/> | ||
338 | </children> | ||
339 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_klixI3pMEem6LP4EDiey6Q" routing="Rectilinear"/> | ||
340 | <styles xmi:type="notation:FontStyle" xmi:id="_klixJHpMEem6LP4EDiey6Q" fontName="Noto Sans" fontHeight="8"/> | ||
341 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_klixJXpMEem6LP4EDiey6Q" points="[0, -50, -17, 270]$[17, -270, 0, 50]"/> | ||
342 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_klixLHpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
343 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_kljYMHpMEem6LP4EDiey6Q" id="(0.5,0.5)"/> | ||
344 | </edges> | ||
345 | </data> | ||
346 | </ownedAnnotationEntries> | ||
347 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_kkaIsHpMEem6LP4EDiey6Q" name="CyberPhysicalSystem" tooltipText="" outgoingEdges="_kk4p0HpMEem6LP4EDiey6Q _kk8UMHpMEem6LP4EDiey6Q _kk87RnpMEem6LP4EDiey6Q" width="12" height="10"> | ||
348 | <target xmi:type="ecore:EClass" href="model/cps.ecore#//CyberPhysicalSystem"/> | ||
349 | <semanticElements xmi:type="ecore:EClass" href="model/cps.ecore#//CyberPhysicalSystem"/> | ||
350 | <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_kkdMAHpMEem6LP4EDiey6Q" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> | ||
351 | <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> | ||
352 | </ownedStyle> | ||
353 | <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> | ||
354 | </ownedDiagramElements> | ||
355 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_kkeaIHpMEem6LP4EDiey6Q" name="ApplicationType" tooltipText="" outgoingEdges="_kk9iVnpMEem6LP4EDiey6Q _klEQBnpMEem6LP4EDiey6Q" incomingEdges="_kk8UMHpMEem6LP4EDiey6Q _kk-wcHpMEem6LP4EDiey6Q" width="12" height="10"> | ||
356 | <target xmi:type="ecore:EClass" href="model/cps.ecore#//ApplicationType"/> | ||
357 | <semanticElements xmi:type="ecore:EClass" href="model/cps.ecore#//ApplicationType"/> | ||
358 | <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_kkfBMHpMEem6LP4EDiey6Q" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> | ||
359 | <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> | ||
360 | </ownedStyle> | ||
361 | <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> | ||
362 | </ownedDiagramElements> | ||
363 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_kkfoQXpMEem6LP4EDiey6Q" name="HostType" tooltipText="" outgoingEdges="_klDB4HpMEem6LP4EDiey6Q" incomingEdges="_kk87RnpMEem6LP4EDiey6Q _kk_Xg3pMEem6LP4EDiey6Q" width="12" height="10"> | ||
364 | <target xmi:type="ecore:EClass" href="model/cps.ecore#//HostType"/> | ||
365 | <semanticElements xmi:type="ecore:EClass" href="model/cps.ecore#//HostType"/> | ||
366 | <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_kkgPUHpMEem6LP4EDiey6Q" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> | ||
367 | <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> | ||
368 | </ownedStyle> | ||
369 | <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> | ||
370 | <ownedElements xmi:type="diagram:DNodeListElement" uid="_kktqsHpMEem6LP4EDiey6Q" name="defaultMemory : EInt" tooltipText=""> | ||
371 | <target xmi:type="ecore:EAttribute" href="model/cps.ecore#//HostType/defaultMemory"/> | ||
372 | <semanticElements xmi:type="ecore:EAttribute" href="model/cps.ecore#//HostType/defaultMemory"/> | ||
373 | <ownedStyle xmi:type="diagram:BundledImage" uid="_kkwG8HpMEem6LP4EDiey6Q" labelAlignment="LEFT" description="_kku40HpMEem6LP4EDiey6Q"> | ||
374 | <labelFormat>bold</labelFormat> | ||
375 | </ownedStyle> | ||
376 | <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> | ||
377 | </ownedElements> | ||
378 | <ownedElements xmi:type="diagram:DNodeListElement" uid="_kkxVEHpMEem6LP4EDiey6Q" name="defaultHdd : EInt" tooltipText=""> | ||
379 | <target xmi:type="ecore:EAttribute" href="model/cps.ecore#//HostType/defaultHdd"/> | ||
380 | <semanticElements xmi:type="ecore:EAttribute" href="model/cps.ecore#//HostType/defaultHdd"/> | ||
381 | <ownedStyle xmi:type="diagram:BundledImage" uid="_kkxVEXpMEem6LP4EDiey6Q" labelAlignment="LEFT" description="_kku40HpMEem6LP4EDiey6Q"> | ||
382 | <labelFormat>bold</labelFormat> | ||
383 | </ownedStyle> | ||
384 | <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> | ||
385 | </ownedElements> | ||
386 | <ownedElements xmi:type="diagram:DNodeListElement" uid="_kkxVEnpMEem6LP4EDiey6Q" name="cost : EInt" tooltipText=""> | ||
387 | <target xmi:type="ecore:EAttribute" href="model/cps.ecore#//HostType/cost"/> | ||
388 | <semanticElements xmi:type="ecore:EAttribute" href="model/cps.ecore#//HostType/cost"/> | ||
389 | <ownedStyle xmi:type="diagram:BundledImage" uid="_kkx8IHpMEem6LP4EDiey6Q" labelAlignment="LEFT" description="_kku40HpMEem6LP4EDiey6Q"> | ||
390 | <labelFormat>bold</labelFormat> | ||
391 | </ownedStyle> | ||
392 | <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> | ||
393 | </ownedElements> | ||
394 | </ownedDiagramElements> | ||
395 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_kkhdcHpMEem6LP4EDiey6Q" name="Request" tooltipText="" outgoingEdges="_klDo-XpMEem6LP4EDiey6Q" incomingEdges="_kk4p0HpMEem6LP4EDiey6Q" width="12" height="10"> | ||
396 | <target xmi:type="ecore:EClass" href="model/cps.ecore#//Request"/> | ||
397 | <semanticElements xmi:type="ecore:EClass" href="model/cps.ecore#//Request"/> | ||
398 | <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_kkhdcXpMEem6LP4EDiey6Q" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> | ||
399 | <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> | ||
400 | </ownedStyle> | ||
401 | <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> | ||
402 | </ownedDiagramElements> | ||
403 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_kkirkHpMEem6LP4EDiey6Q" name="Requirement" tooltipText="" outgoingEdges="_kk-wcHpMEem6LP4EDiey6Q _klFeIHpMEem6LP4EDiey6Q" incomingEdges="_klDo-XpMEem6LP4EDiey6Q" width="12" height="10"> | ||
404 | <target xmi:type="ecore:EClass" href="model/cps.ecore#//Requirement"/> | ||
405 | <semanticElements xmi:type="ecore:EClass" href="model/cps.ecore#//Requirement"/> | ||
406 | <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_kkirkXpMEem6LP4EDiey6Q" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> | ||
407 | <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> | ||
408 | </ownedStyle> | ||
409 | <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> | ||
410 | <ownedElements xmi:type="diagram:DNodeListElement" uid="_kkyjMHpMEem6LP4EDiey6Q" name="count : EInt" tooltipText=""> | ||
411 | <target xmi:type="ecore:EAttribute" href="model/cps.ecore#//Requirement/count"/> | ||
412 | <semanticElements xmi:type="ecore:EAttribute" href="model/cps.ecore#//Requirement/count"/> | ||
413 | <ownedStyle xmi:type="diagram:BundledImage" uid="_kkyjMXpMEem6LP4EDiey6Q" labelAlignment="LEFT" description="_kku40HpMEem6LP4EDiey6Q"> | ||
414 | <labelFormat>bold</labelFormat> | ||
415 | </ownedStyle> | ||
416 | <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> | ||
417 | </ownedElements> | ||
418 | </ownedDiagramElements> | ||
419 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_kkjSoXpMEem6LP4EDiey6Q" name="ApplicationInstance" tooltipText="" outgoingEdges="_klBMsHpMEem6LP4EDiey6Q" incomingEdges="_klEQBnpMEem6LP4EDiey6Q _klFeIHpMEem6LP4EDiey6Q" width="12" height="10"> | ||
420 | <target xmi:type="ecore:EClass" href="model/cps.ecore#//ApplicationInstance"/> | ||
421 | <semanticElements xmi:type="ecore:EClass" href="model/cps.ecore#//ApplicationInstance"/> | ||
422 | <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_kkj5sHpMEem6LP4EDiey6Q" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> | ||
423 | <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> | ||
424 | </ownedStyle> | ||
425 | <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> | ||
426 | </ownedDiagramElements> | ||
427 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_kkkgwHpMEem6LP4EDiey6Q" name="ResourceRequirement" tooltipText="" outgoingEdges="_kk_Xg3pMEem6LP4EDiey6Q" incomingEdges="_kk9iVnpMEem6LP4EDiey6Q" width="12" height="10"> | ||
428 | <target xmi:type="ecore:EClass" href="model/cps.ecore#//ResourceRequirement"/> | ||
429 | <semanticElements xmi:type="ecore:EClass" href="model/cps.ecore#//ResourceRequirement"/> | ||
430 | <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_kkkgwXpMEem6LP4EDiey6Q" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> | ||
431 | <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> | ||
432 | </ownedStyle> | ||
433 | <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> | ||
434 | <ownedElements xmi:type="diagram:DNodeListElement" uid="_kkzKQHpMEem6LP4EDiey6Q" name="requiredMemory : EInt" tooltipText=""> | ||
435 | <target xmi:type="ecore:EAttribute" href="model/cps.ecore#//ResourceRequirement/requiredMemory"/> | ||
436 | <semanticElements xmi:type="ecore:EAttribute" href="model/cps.ecore#//ResourceRequirement/requiredMemory"/> | ||
437 | <ownedStyle xmi:type="diagram:BundledImage" uid="_kkzxUHpMEem6LP4EDiey6Q" labelAlignment="LEFT" description="_kku40HpMEem6LP4EDiey6Q"> | ||
438 | <labelFormat>bold</labelFormat> | ||
439 | </ownedStyle> | ||
440 | <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> | ||
441 | </ownedElements> | ||
442 | <ownedElements xmi:type="diagram:DNodeListElement" uid="_kkzxUXpMEem6LP4EDiey6Q" name="requiredHdd : EInt" tooltipText=""> | ||
443 | <target xmi:type="ecore:EAttribute" href="model/cps.ecore#//ResourceRequirement/requiredHdd"/> | ||
444 | <semanticElements xmi:type="ecore:EAttribute" href="model/cps.ecore#//ResourceRequirement/requiredHdd"/> | ||
445 | <ownedStyle xmi:type="diagram:BundledImage" uid="_kk0YYHpMEem6LP4EDiey6Q" labelAlignment="LEFT" description="_kku40HpMEem6LP4EDiey6Q"> | ||
446 | <labelFormat>bold</labelFormat> | ||
447 | </ownedStyle> | ||
448 | <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> | ||
449 | </ownedElements> | ||
450 | </ownedDiagramElements> | ||
451 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_kklH0HpMEem6LP4EDiey6Q" name="HostInstance" tooltipText="" incomingEdges="_klBMsHpMEem6LP4EDiey6Q _klDB4HpMEem6LP4EDiey6Q" width="12" height="10"> | ||
452 | <target xmi:type="ecore:EClass" href="model/cps.ecore#//HostInstance"/> | ||
453 | <semanticElements xmi:type="ecore:EClass" href="model/cps.ecore#//HostInstance"/> | ||
454 | <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_kklH0XpMEem6LP4EDiey6Q" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> | ||
455 | <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> | ||
456 | </ownedStyle> | ||
457 | <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> | ||
458 | </ownedDiagramElements> | ||
459 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_kk4p0HpMEem6LP4EDiey6Q" name="[0..*] requests" sourceNode="_kkaIsHpMEem6LP4EDiey6Q" targetNode="_kkhdcHpMEem6LP4EDiey6Q"> | ||
460 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//CyberPhysicalSystem/requests"/> | ||
461 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//CyberPhysicalSystem/requests"/> | ||
462 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_kk7GEHpMEem6LP4EDiey6Q" description="_kk538HpMEem6LP4EDiey6Q" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0"> | ||
463 | <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_kk7tIXpMEem6LP4EDiey6Q" showIcon="false"> | ||
464 | <customFeatures>labelSize</customFeatures> | ||
465 | </centerLabelStyle> | ||
466 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_kk7tIHpMEem6LP4EDiey6Q" showIcon="false" labelColor="39,76,114"> | ||
467 | <customFeatures>labelSize</customFeatures> | ||
468 | </endLabelStyle> | ||
469 | </ownedStyle> | ||
470 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/> | ||
471 | </ownedDiagramElements> | ||
472 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_kk8UMHpMEem6LP4EDiey6Q" name="[0..*] applicationTypes" sourceNode="_kkaIsHpMEem6LP4EDiey6Q" targetNode="_kkeaIHpMEem6LP4EDiey6Q"> | ||
473 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//CyberPhysicalSystem/applicationTypes"/> | ||
474 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//CyberPhysicalSystem/applicationTypes"/> | ||
475 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_kk87QHpMEem6LP4EDiey6Q" description="_kk538HpMEem6LP4EDiey6Q" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0"> | ||
476 | <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_kk87QnpMEem6LP4EDiey6Q" showIcon="false"> | ||
477 | <customFeatures>labelSize</customFeatures> | ||
478 | </centerLabelStyle> | ||
479 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_kk87QXpMEem6LP4EDiey6Q" showIcon="false" labelColor="39,76,114"> | ||
480 | <customFeatures>labelSize</customFeatures> | ||
481 | </endLabelStyle> | ||
482 | </ownedStyle> | ||
483 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/> | ||
484 | </ownedDiagramElements> | ||
485 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_kk87RnpMEem6LP4EDiey6Q" name="[0..*] hostTypes" sourceNode="_kkaIsHpMEem6LP4EDiey6Q" targetNode="_kkfoQXpMEem6LP4EDiey6Q"> | ||
486 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//CyberPhysicalSystem/hostTypes"/> | ||
487 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//CyberPhysicalSystem/hostTypes"/> | ||
488 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_kk9iUHpMEem6LP4EDiey6Q" description="_kk538HpMEem6LP4EDiey6Q" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0"> | ||
489 | <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_kk9iUnpMEem6LP4EDiey6Q" showIcon="false"> | ||
490 | <customFeatures>labelSize</customFeatures> | ||
491 | </centerLabelStyle> | ||
492 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_kk9iUXpMEem6LP4EDiey6Q" showIcon="false" labelColor="39,76,114"> | ||
493 | <customFeatures>labelSize</customFeatures> | ||
494 | </endLabelStyle> | ||
495 | </ownedStyle> | ||
496 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/> | ||
497 | </ownedDiagramElements> | ||
498 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_kk9iVnpMEem6LP4EDiey6Q" name="[0..*] requirements" sourceNode="_kkeaIHpMEem6LP4EDiey6Q" targetNode="_kkkgwHpMEem6LP4EDiey6Q"> | ||
499 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//ApplicationType/requirements"/> | ||
500 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//ApplicationType/requirements"/> | ||
501 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_kk-JYHpMEem6LP4EDiey6Q" description="_kk538HpMEem6LP4EDiey6Q" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0"> | ||
502 | <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_kk-JYnpMEem6LP4EDiey6Q" showIcon="false"> | ||
503 | <customFeatures>labelSize</customFeatures> | ||
504 | </centerLabelStyle> | ||
505 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_kk-JYXpMEem6LP4EDiey6Q" showIcon="false" labelColor="39,76,114"> | ||
506 | <customFeatures>labelSize</customFeatures> | ||
507 | </endLabelStyle> | ||
508 | </ownedStyle> | ||
509 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/> | ||
510 | </ownedDiagramElements> | ||
511 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_kk-wcHpMEem6LP4EDiey6Q" name="[0..1] type" sourceNode="_kkirkHpMEem6LP4EDiey6Q" targetNode="_kkeaIHpMEem6LP4EDiey6Q"> | ||
512 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//Requirement/type"/> | ||
513 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//Requirement/type"/> | ||
514 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_kk-wcXpMEem6LP4EDiey6Q" routingStyle="manhattan" strokeColor="0,0,0"> | ||
515 | <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']/@style"/> | ||
516 | <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_kk-wc3pMEem6LP4EDiey6Q" showIcon="false"> | ||
517 | <customFeatures>labelSize</customFeatures> | ||
518 | </centerLabelStyle> | ||
519 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_kk-wcnpMEem6LP4EDiey6Q" showIcon="false" labelColor="39,76,114"> | ||
520 | <customFeatures>labelSize</customFeatures> | ||
521 | </endLabelStyle> | ||
522 | </ownedStyle> | ||
523 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/> | ||
524 | </ownedDiagramElements> | ||
525 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_kk_Xg3pMEem6LP4EDiey6Q" name="[1..1] hostType" sourceNode="_kkkgwHpMEem6LP4EDiey6Q" targetNode="_kkfoQXpMEem6LP4EDiey6Q"> | ||
526 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//ResourceRequirement/hostType"/> | ||
527 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//ResourceRequirement/hostType"/> | ||
528 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_kk_-k3pMEem6LP4EDiey6Q" description="_kk_-kHpMEem6LP4EDiey6Q" routingStyle="manhattan" strokeColor="0,0,0"> | ||
529 | <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_kk_-lXpMEem6LP4EDiey6Q" showIcon="false"> | ||
530 | <customFeatures>labelSize</customFeatures> | ||
531 | </centerLabelStyle> | ||
532 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_kk_-lHpMEem6LP4EDiey6Q" showIcon="false" labelColor="39,76,114"> | ||
533 | <customFeatures>labelSize</customFeatures> | ||
534 | </endLabelStyle> | ||
535 | </ownedStyle> | ||
536 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/> | ||
537 | </ownedDiagramElements> | ||
538 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_klBMsHpMEem6LP4EDiey6Q" sourceNode="_kkjSoXpMEem6LP4EDiey6Q" targetNode="_kklH0HpMEem6LP4EDiey6Q" beginLabel="[0..*] applications" endLabel="[1..1] allocatedTo"> | ||
539 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
540 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//ApplicationInstance/allocatedTo"/> | ||
541 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//HostInstance/applications"/> | ||
542 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_klBzw3pMEem6LP4EDiey6Q" description="_klBzwHpMEem6LP4EDiey6Q" sourceArrow="InputArrow" routingStyle="manhattan" strokeColor="0,0,0"> | ||
543 | <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_klCa0HpMEem6LP4EDiey6Q" showIcon="false"> | ||
544 | <labelFormat>bold</labelFormat> | ||
545 | </beginLabelStyle> | ||
546 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_klCa0XpMEem6LP4EDiey6Q" showIcon="false"> | ||
547 | <labelFormat>bold</labelFormat> | ||
548 | </endLabelStyle> | ||
549 | </ownedStyle> | ||
550 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/> | ||
551 | </ownedDiagramElements> | ||
552 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_klDB4HpMEem6LP4EDiey6Q" sourceNode="_kkfoQXpMEem6LP4EDiey6Q" targetNode="_kklH0HpMEem6LP4EDiey6Q" beginLabel="[1..1] type" endLabel="[0..*] instances"> | ||
553 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//HostType/instances"/> | ||
554 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//HostType/instances"/> | ||
555 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//HostInstance/type"/> | ||
556 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_klDo83pMEem6LP4EDiey6Q" description="_klDo8HpMEem6LP4EDiey6Q" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0"> | ||
557 | <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_klDo9HpMEem6LP4EDiey6Q" showIcon="false"/> | ||
558 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_klDo9XpMEem6LP4EDiey6Q" showIcon="false"/> | ||
559 | </ownedStyle> | ||
560 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/> | ||
561 | </ownedDiagramElements> | ||
562 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_klDo-XpMEem6LP4EDiey6Q" sourceNode="_kkhdcHpMEem6LP4EDiey6Q" targetNode="_kkirkHpMEem6LP4EDiey6Q" beginLabel="[1..1] request" endLabel="[0..*] requirements"> | ||
563 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//Request/requirements"/> | ||
564 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//Requirement/request"/> | ||
565 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//Request/requirements"/> | ||
566 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_klEQAHpMEem6LP4EDiey6Q" description="_klDo8HpMEem6LP4EDiey6Q" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0"> | ||
567 | <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_klEQAXpMEem6LP4EDiey6Q" showIcon="false"/> | ||
568 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_klEQAnpMEem6LP4EDiey6Q" showIcon="false"/> | ||
569 | </ownedStyle> | ||
570 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/> | ||
571 | </ownedDiagramElements> | ||
572 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_klEQBnpMEem6LP4EDiey6Q" sourceNode="_kkeaIHpMEem6LP4EDiey6Q" targetNode="_kkjSoXpMEem6LP4EDiey6Q" beginLabel="[1..1] type" endLabel="[0..*] instances"> | ||
573 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//ApplicationType/instances"/> | ||
574 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//ApplicationType/instances"/> | ||
575 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//ApplicationInstance/type"/> | ||
576 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_klE3EHpMEem6LP4EDiey6Q" description="_klDo8HpMEem6LP4EDiey6Q" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0"> | ||
577 | <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_klE3EXpMEem6LP4EDiey6Q" showIcon="false"/> | ||
578 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_klE3EnpMEem6LP4EDiey6Q" showIcon="false"/> | ||
579 | </ownedStyle> | ||
580 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/> | ||
581 | </ownedDiagramElements> | ||
582 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_klFeIHpMEem6LP4EDiey6Q" sourceNode="_kkirkHpMEem6LP4EDiey6Q" targetNode="_kkjSoXpMEem6LP4EDiey6Q" beginLabel="[0..1] requirement" endLabel="[0..*] instances"> | ||
583 | <target xmi:type="ecore:EReference" href="model/cps.ecore#//Requirement/instances"/> | ||
584 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//Requirement/instances"/> | ||
585 | <semanticElements xmi:type="ecore:EReference" href="model/cps.ecore#//ApplicationInstance/requirement"/> | ||
586 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_klFeIXpMEem6LP4EDiey6Q" sourceArrow="InputArrow" routingStyle="manhattan" strokeColor="0,0,0"> | ||
587 | <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']/@style"/> | ||
588 | <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_klFeInpMEem6LP4EDiey6Q" showIcon="false"/> | ||
589 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_klFeI3pMEem6LP4EDiey6Q" showIcon="false"/> | ||
590 | </ownedStyle> | ||
591 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/> | ||
592 | </ownedDiagramElements> | ||
593 | <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/> | ||
594 | <filterVariableHistory xmi:type="diagram:FilterVariableHistory" uid="_kAqicHpMEem6LP4EDiey6Q"/> | ||
595 | <activatedLayers xmi:type="description_1:Layer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/> | ||
596 | <activatedLayers xmi:type="description_1:AdditionalLayer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']"/> | ||
597 | <activatedLayers xmi:type="description_1:AdditionalLayer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Validation']"/> | ||
598 | <target xmi:type="ecore:EPackage" href="model/cps.ecore#/"/> | ||
599 | </diagram:DSemanticDiagram> | ||
600 | </xmi:XMI> | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/.gitignore new file mode 100644 index 00000000..d3114d9d --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/.gitignore | |||
@@ -0,0 +1,44 @@ | |||
1 | /.CpsApplications.java._trace | ||
2 | /.CpsQueries.java._trace | ||
3 | /.CpsHosts.java._trace | ||
4 | /.TotalMemory.java._trace | ||
5 | /.TotalHdd.java._trace | ||
6 | /.AvailableMemory.java._trace | ||
7 | /.AvailableHdd.java._trace | ||
8 | /.AllocationWithoutResourceRequirement.java._trace | ||
9 | /.NotEnoughAvailableMemory.java._trace | ||
10 | /.NotEnoughAvailableHdd.java._trace | ||
11 | /.InstanceDoesNotSatisfyRequirement.java._trace | ||
12 | /.RequirementNotSatisfied.java._trace | ||
13 | /.AverageFreeMemoryMetric.java._trace | ||
14 | /.AverageFreeHddMetric.java._trace | ||
15 | /.CostMetric.java._trace | ||
16 | /.CpsCost.java._trace | ||
17 | /.RedundantInstancesOnSameHost.java._trace | ||
18 | /.Allocate.java._trace | ||
19 | /.CpsTransformationRules.java._trace | ||
20 | /.ResourceRequirement.java._trace | ||
21 | /.CreateInstance.java._trace | ||
22 | /.CreateHostInstance.java._trace | ||
23 | /.UnallocatedAppInstance.java._trace | ||
24 | /.RequiredAppInstances.java._trace | ||
25 | /.GuidanceObjective.java._trace | ||
26 | /.RemoveHostInstance.java._trace | ||
27 | /.UnallocateAppInstance.java._trace | ||
28 | /Allocate.java | ||
29 | /AllocationWithoutResourceRequirement.java | ||
30 | /AverageFreeHddMetric.java | ||
31 | /AverageFreeMemoryMetric.java | ||
32 | /CostMetric.java | ||
33 | /CpsCost.java | ||
34 | /CpsQueries.java | ||
35 | /CreateHostInstance.java | ||
36 | /GuidanceObjective.java | ||
37 | /InstanceDoesNotSatisfyRequirement.java | ||
38 | /NotEnoughAvailableHdd.java | ||
39 | /NotEnoughAvailableMemory.java | ||
40 | /RedundantInstancesOnSameHost.java | ||
41 | /RemoveHostInstance.java | ||
42 | /RequirementNotSatisfied.java | ||
43 | /ResourceRequirement.java | ||
44 | /UnallocateAppInstance.java | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/Allocate.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/Allocate.java new file mode 100644 index 00000000..830dc8a0 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/Allocate.java | |||
@@ -0,0 +1,862 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableHdd; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableMemory; | ||
10 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.UnallocatedAppInstance; | ||
11 | import java.util.Arrays; | ||
12 | import java.util.Collection; | ||
13 | import java.util.Collections; | ||
14 | import java.util.LinkedHashSet; | ||
15 | import java.util.List; | ||
16 | import java.util.Objects; | ||
17 | import java.util.Optional; | ||
18 | import java.util.Set; | ||
19 | import java.util.function.Consumer; | ||
20 | import java.util.stream.Collectors; | ||
21 | import java.util.stream.Stream; | ||
22 | import org.apache.log4j.Logger; | ||
23 | import org.eclipse.emf.ecore.EClass; | ||
24 | import org.eclipse.emf.ecore.EDataType; | ||
25 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
27 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
28 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
29 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
30 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
31 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
32 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
33 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
34 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
44 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
45 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
46 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
47 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
48 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
49 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
50 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
51 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
52 | |||
53 | /** | ||
54 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
55 | * | ||
56 | * <p>Original source: | ||
57 | * <code><pre> | ||
58 | * // | ||
59 | * // Transformation rule preconditions for rule-based DSE | ||
60 | * // | ||
61 | * | ||
62 | * pattern allocate(App : ApplicationInstance, Host : HostInstance) { | ||
63 | * ApplicationInstance.type.requirements(App, Req); | ||
64 | * ResourceRequirement.hostType.instances(Req, Host); | ||
65 | * find unallocatedAppInstance(App); | ||
66 | * find availableMemory(Host, AvailableMem); | ||
67 | * find availableHdd(Host, AvailableHdd); | ||
68 | * ResourceRequirement.requiredMemory(Req, RequiredMem); | ||
69 | * ResourceRequirement.requiredHdd(Req, RequiredHdd); | ||
70 | * check(AvailableMem {@literal >}= RequiredMem); | ||
71 | * check(AvailableHdd {@literal >}= RequiredHdd); | ||
72 | * neg ApplicationInstance.requirement.instances.allocatedTo(App, Host); | ||
73 | * } | ||
74 | * </pre></code> | ||
75 | * | ||
76 | * @see Matcher | ||
77 | * @see Match | ||
78 | * | ||
79 | */ | ||
80 | @SuppressWarnings("all") | ||
81 | public final class Allocate extends BaseGeneratedEMFQuerySpecification<Allocate.Matcher> { | ||
82 | /** | ||
83 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocate pattern, | ||
84 | * to be used in conjunction with {@link Matcher}. | ||
85 | * | ||
86 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
87 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
88 | * usable to represent a match of the pattern in the result of a query, | ||
89 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
90 | * | ||
91 | * @see Matcher | ||
92 | * | ||
93 | */ | ||
94 | public static abstract class Match extends BasePatternMatch { | ||
95 | private ApplicationInstance fApp; | ||
96 | |||
97 | private HostInstance fHost; | ||
98 | |||
99 | private static List<String> parameterNames = makeImmutableList("App", "Host"); | ||
100 | |||
101 | private Match(final ApplicationInstance pApp, final HostInstance pHost) { | ||
102 | this.fApp = pApp; | ||
103 | this.fHost = pHost; | ||
104 | } | ||
105 | |||
106 | @Override | ||
107 | public Object get(final String parameterName) { | ||
108 | if ("App".equals(parameterName)) return this.fApp; | ||
109 | if ("Host".equals(parameterName)) return this.fHost; | ||
110 | return null; | ||
111 | } | ||
112 | |||
113 | public ApplicationInstance getApp() { | ||
114 | return this.fApp; | ||
115 | } | ||
116 | |||
117 | public HostInstance getHost() { | ||
118 | return this.fHost; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public boolean set(final String parameterName, final Object newValue) { | ||
123 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
124 | if ("App".equals(parameterName) ) { | ||
125 | this.fApp = (ApplicationInstance) newValue; | ||
126 | return true; | ||
127 | } | ||
128 | if ("Host".equals(parameterName) ) { | ||
129 | this.fHost = (HostInstance) newValue; | ||
130 | return true; | ||
131 | } | ||
132 | return false; | ||
133 | } | ||
134 | |||
135 | public void setApp(final ApplicationInstance pApp) { | ||
136 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
137 | this.fApp = pApp; | ||
138 | } | ||
139 | |||
140 | public void setHost(final HostInstance pHost) { | ||
141 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
142 | this.fHost = pHost; | ||
143 | } | ||
144 | |||
145 | @Override | ||
146 | public String patternName() { | ||
147 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocate"; | ||
148 | } | ||
149 | |||
150 | @Override | ||
151 | public List<String> parameterNames() { | ||
152 | return Allocate.Match.parameterNames; | ||
153 | } | ||
154 | |||
155 | @Override | ||
156 | public Object[] toArray() { | ||
157 | return new Object[]{fApp, fHost}; | ||
158 | } | ||
159 | |||
160 | @Override | ||
161 | public Allocate.Match toImmutable() { | ||
162 | return isMutable() ? newMatch(fApp, fHost) : this; | ||
163 | } | ||
164 | |||
165 | @Override | ||
166 | public String prettyPrint() { | ||
167 | StringBuilder result = new StringBuilder(); | ||
168 | result.append("\"App\"=" + prettyPrintValue(fApp) + ", "); | ||
169 | result.append("\"Host\"=" + prettyPrintValue(fHost)); | ||
170 | return result.toString(); | ||
171 | } | ||
172 | |||
173 | @Override | ||
174 | public int hashCode() { | ||
175 | return Objects.hash(fApp, fHost); | ||
176 | } | ||
177 | |||
178 | @Override | ||
179 | public boolean equals(final Object obj) { | ||
180 | if (this == obj) | ||
181 | return true; | ||
182 | if (obj == null) { | ||
183 | return false; | ||
184 | } | ||
185 | if ((obj instanceof Allocate.Match)) { | ||
186 | Allocate.Match other = (Allocate.Match) obj; | ||
187 | return Objects.equals(fApp, other.fApp) && Objects.equals(fHost, other.fHost); | ||
188 | } else { | ||
189 | // this should be infrequent | ||
190 | if (!(obj instanceof IPatternMatch)) { | ||
191 | return false; | ||
192 | } | ||
193 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
194 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | @Override | ||
199 | public Allocate specification() { | ||
200 | return Allocate.instance(); | ||
201 | } | ||
202 | |||
203 | /** | ||
204 | * Returns an empty, mutable match. | ||
205 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
206 | * | ||
207 | * @return the empty match. | ||
208 | * | ||
209 | */ | ||
210 | public static Allocate.Match newEmptyMatch() { | ||
211 | return new Mutable(null, null); | ||
212 | } | ||
213 | |||
214 | /** | ||
215 | * Returns a mutable (partial) match. | ||
216 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
217 | * | ||
218 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
219 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
220 | * @return the new, mutable (partial) match object. | ||
221 | * | ||
222 | */ | ||
223 | public static Allocate.Match newMutableMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
224 | return new Mutable(pApp, pHost); | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * Returns a new (partial) match. | ||
229 | * This can be used e.g. to call the matcher with a partial match. | ||
230 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
231 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
232 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
233 | * @return the (partial) match object. | ||
234 | * | ||
235 | */ | ||
236 | public static Allocate.Match newMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
237 | return new Immutable(pApp, pHost); | ||
238 | } | ||
239 | |||
240 | private static final class Mutable extends Allocate.Match { | ||
241 | Mutable(final ApplicationInstance pApp, final HostInstance pHost) { | ||
242 | super(pApp, pHost); | ||
243 | } | ||
244 | |||
245 | @Override | ||
246 | public boolean isMutable() { | ||
247 | return true; | ||
248 | } | ||
249 | } | ||
250 | |||
251 | private static final class Immutable extends Allocate.Match { | ||
252 | Immutable(final ApplicationInstance pApp, final HostInstance pHost) { | ||
253 | super(pApp, pHost); | ||
254 | } | ||
255 | |||
256 | @Override | ||
257 | public boolean isMutable() { | ||
258 | return false; | ||
259 | } | ||
260 | } | ||
261 | } | ||
262 | |||
263 | /** | ||
264 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocate pattern, | ||
265 | * providing pattern-specific query methods. | ||
266 | * | ||
267 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
268 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
269 | * | ||
270 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
271 | * | ||
272 | * <p>Original source: | ||
273 | * <code><pre> | ||
274 | * // | ||
275 | * // Transformation rule preconditions for rule-based DSE | ||
276 | * // | ||
277 | * | ||
278 | * pattern allocate(App : ApplicationInstance, Host : HostInstance) { | ||
279 | * ApplicationInstance.type.requirements(App, Req); | ||
280 | * ResourceRequirement.hostType.instances(Req, Host); | ||
281 | * find unallocatedAppInstance(App); | ||
282 | * find availableMemory(Host, AvailableMem); | ||
283 | * find availableHdd(Host, AvailableHdd); | ||
284 | * ResourceRequirement.requiredMemory(Req, RequiredMem); | ||
285 | * ResourceRequirement.requiredHdd(Req, RequiredHdd); | ||
286 | * check(AvailableMem {@literal >}= RequiredMem); | ||
287 | * check(AvailableHdd {@literal >}= RequiredHdd); | ||
288 | * neg ApplicationInstance.requirement.instances.allocatedTo(App, Host); | ||
289 | * } | ||
290 | * </pre></code> | ||
291 | * | ||
292 | * @see Match | ||
293 | * @see Allocate | ||
294 | * | ||
295 | */ | ||
296 | public static class Matcher extends BaseMatcher<Allocate.Match> { | ||
297 | /** | ||
298 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
299 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
300 | * | ||
301 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
302 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
303 | * | ||
304 | */ | ||
305 | public static Allocate.Matcher on(final ViatraQueryEngine engine) { | ||
306 | // check if matcher already exists | ||
307 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
308 | if (matcher == null) { | ||
309 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
310 | } | ||
311 | return matcher; | ||
312 | } | ||
313 | |||
314 | /** | ||
315 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
316 | * @return an initialized matcher | ||
317 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
318 | * | ||
319 | */ | ||
320 | public static Allocate.Matcher create() { | ||
321 | return new Matcher(); | ||
322 | } | ||
323 | |||
324 | private static final int POSITION_APP = 0; | ||
325 | |||
326 | private static final int POSITION_HOST = 1; | ||
327 | |||
328 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Allocate.Matcher.class); | ||
329 | |||
330 | /** | ||
331 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
332 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
333 | * | ||
334 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
335 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
336 | * | ||
337 | */ | ||
338 | private Matcher() { | ||
339 | super(querySpecification()); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
344 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
345 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
346 | * @return matches represented as a Match object. | ||
347 | * | ||
348 | */ | ||
349 | public Collection<Allocate.Match> getAllMatches(final ApplicationInstance pApp, final HostInstance pHost) { | ||
350 | return rawStreamAllMatches(new Object[]{pApp, pHost}).collect(Collectors.toSet()); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
355 | * </p> | ||
356 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
357 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
358 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
359 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
360 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
361 | * @return a stream of matches represented as a Match object. | ||
362 | * | ||
363 | */ | ||
364 | public Stream<Allocate.Match> streamAllMatches(final ApplicationInstance pApp, final HostInstance pHost) { | ||
365 | return rawStreamAllMatches(new Object[]{pApp, pHost}); | ||
366 | } | ||
367 | |||
368 | /** | ||
369 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
370 | * Neither determinism nor randomness of selection is guaranteed. | ||
371 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
372 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
373 | * @return a match represented as a Match object, or null if no match is found. | ||
374 | * | ||
375 | */ | ||
376 | public Optional<Allocate.Match> getOneArbitraryMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
377 | return rawGetOneArbitraryMatch(new Object[]{pApp, pHost}); | ||
378 | } | ||
379 | |||
380 | /** | ||
381 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
382 | * under any possible substitution of the unspecified parameters (if any). | ||
383 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
384 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
385 | * @return true if the input is a valid (partial) match of the pattern. | ||
386 | * | ||
387 | */ | ||
388 | public boolean hasMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
389 | return rawHasMatch(new Object[]{pApp, pHost}); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
394 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
395 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
396 | * @return the number of pattern matches found. | ||
397 | * | ||
398 | */ | ||
399 | public int countMatches(final ApplicationInstance pApp, final HostInstance pHost) { | ||
400 | return rawCountMatches(new Object[]{pApp, pHost}); | ||
401 | } | ||
402 | |||
403 | /** | ||
404 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
405 | * Neither determinism nor randomness of selection is guaranteed. | ||
406 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
407 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
408 | * @param processor the action that will process the selected match. | ||
409 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
410 | * | ||
411 | */ | ||
412 | public boolean forOneArbitraryMatch(final ApplicationInstance pApp, final HostInstance pHost, final Consumer<? super Allocate.Match> processor) { | ||
413 | return rawForOneArbitraryMatch(new Object[]{pApp, pHost}, processor); | ||
414 | } | ||
415 | |||
416 | /** | ||
417 | * Returns a new (partial) match. | ||
418 | * This can be used e.g. to call the matcher with a partial match. | ||
419 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
420 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
421 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
422 | * @return the (partial) match object. | ||
423 | * | ||
424 | */ | ||
425 | public Allocate.Match newMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
426 | return Allocate.Match.newMatch(pApp, pHost); | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * Retrieve the set of values that occur in matches for App. | ||
431 | * @return the Set of all values or empty set if there are no matches | ||
432 | * | ||
433 | */ | ||
434 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
435 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
436 | } | ||
437 | |||
438 | /** | ||
439 | * Retrieve the set of values that occur in matches for App. | ||
440 | * @return the Set of all values or empty set if there are no matches | ||
441 | * | ||
442 | */ | ||
443 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
444 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
445 | } | ||
446 | |||
447 | /** | ||
448 | * Retrieve the set of values that occur in matches for App. | ||
449 | * @return the Set of all values or empty set if there are no matches | ||
450 | * | ||
451 | */ | ||
452 | public Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
453 | return rawStreamAllValuesOfApp(emptyArray()); | ||
454 | } | ||
455 | |||
456 | /** | ||
457 | * Retrieve the set of values that occur in matches for App. | ||
458 | * </p> | ||
459 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
460 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
461 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
462 | * | ||
463 | * @return the Stream of all values or empty set if there are no matches | ||
464 | * | ||
465 | */ | ||
466 | public Stream<ApplicationInstance> streamAllValuesOfApp(final Allocate.Match partialMatch) { | ||
467 | return rawStreamAllValuesOfApp(partialMatch.toArray()); | ||
468 | } | ||
469 | |||
470 | /** | ||
471 | * Retrieve the set of values that occur in matches for App. | ||
472 | * </p> | ||
473 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
474 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
475 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
476 | * | ||
477 | * @return the Stream of all values or empty set if there are no matches | ||
478 | * | ||
479 | */ | ||
480 | public Stream<ApplicationInstance> streamAllValuesOfApp(final HostInstance pHost) { | ||
481 | return rawStreamAllValuesOfApp(new Object[]{null, pHost}); | ||
482 | } | ||
483 | |||
484 | /** | ||
485 | * Retrieve the set of values that occur in matches for App. | ||
486 | * @return the Set of all values or empty set if there are no matches | ||
487 | * | ||
488 | */ | ||
489 | public Set<ApplicationInstance> getAllValuesOfApp(final Allocate.Match partialMatch) { | ||
490 | return rawStreamAllValuesOfApp(partialMatch.toArray()).collect(Collectors.toSet()); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * Retrieve the set of values that occur in matches for App. | ||
495 | * @return the Set of all values or empty set if there are no matches | ||
496 | * | ||
497 | */ | ||
498 | public Set<ApplicationInstance> getAllValuesOfApp(final HostInstance pHost) { | ||
499 | return rawStreamAllValuesOfApp(new Object[]{null, pHost}).collect(Collectors.toSet()); | ||
500 | } | ||
501 | |||
502 | /** | ||
503 | * Retrieve the set of values that occur in matches for Host. | ||
504 | * @return the Set of all values or empty set if there are no matches | ||
505 | * | ||
506 | */ | ||
507 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
508 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
509 | } | ||
510 | |||
511 | /** | ||
512 | * Retrieve the set of values that occur in matches for Host. | ||
513 | * @return the Set of all values or empty set if there are no matches | ||
514 | * | ||
515 | */ | ||
516 | public Set<HostInstance> getAllValuesOfHost() { | ||
517 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
518 | } | ||
519 | |||
520 | /** | ||
521 | * Retrieve the set of values that occur in matches for Host. | ||
522 | * @return the Set of all values or empty set if there are no matches | ||
523 | * | ||
524 | */ | ||
525 | public Stream<HostInstance> streamAllValuesOfHost() { | ||
526 | return rawStreamAllValuesOfHost(emptyArray()); | ||
527 | } | ||
528 | |||
529 | /** | ||
530 | * Retrieve the set of values that occur in matches for Host. | ||
531 | * </p> | ||
532 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
533 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
534 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
535 | * | ||
536 | * @return the Stream of all values or empty set if there are no matches | ||
537 | * | ||
538 | */ | ||
539 | public Stream<HostInstance> streamAllValuesOfHost(final Allocate.Match partialMatch) { | ||
540 | return rawStreamAllValuesOfHost(partialMatch.toArray()); | ||
541 | } | ||
542 | |||
543 | /** | ||
544 | * Retrieve the set of values that occur in matches for Host. | ||
545 | * </p> | ||
546 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
547 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
548 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
549 | * | ||
550 | * @return the Stream of all values or empty set if there are no matches | ||
551 | * | ||
552 | */ | ||
553 | public Stream<HostInstance> streamAllValuesOfHost(final ApplicationInstance pApp) { | ||
554 | return rawStreamAllValuesOfHost(new Object[]{pApp, null}); | ||
555 | } | ||
556 | |||
557 | /** | ||
558 | * Retrieve the set of values that occur in matches for Host. | ||
559 | * @return the Set of all values or empty set if there are no matches | ||
560 | * | ||
561 | */ | ||
562 | public Set<HostInstance> getAllValuesOfHost(final Allocate.Match partialMatch) { | ||
563 | return rawStreamAllValuesOfHost(partialMatch.toArray()).collect(Collectors.toSet()); | ||
564 | } | ||
565 | |||
566 | /** | ||
567 | * Retrieve the set of values that occur in matches for Host. | ||
568 | * @return the Set of all values or empty set if there are no matches | ||
569 | * | ||
570 | */ | ||
571 | public Set<HostInstance> getAllValuesOfHost(final ApplicationInstance pApp) { | ||
572 | return rawStreamAllValuesOfHost(new Object[]{pApp, null}).collect(Collectors.toSet()); | ||
573 | } | ||
574 | |||
575 | @Override | ||
576 | protected Allocate.Match tupleToMatch(final Tuple t) { | ||
577 | try { | ||
578 | return Allocate.Match.newMatch((ApplicationInstance) t.get(POSITION_APP), (HostInstance) t.get(POSITION_HOST)); | ||
579 | } catch(ClassCastException e) { | ||
580 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
581 | return null; | ||
582 | } | ||
583 | } | ||
584 | |||
585 | @Override | ||
586 | protected Allocate.Match arrayToMatch(final Object[] match) { | ||
587 | try { | ||
588 | return Allocate.Match.newMatch((ApplicationInstance) match[POSITION_APP], (HostInstance) match[POSITION_HOST]); | ||
589 | } catch(ClassCastException e) { | ||
590 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
591 | return null; | ||
592 | } | ||
593 | } | ||
594 | |||
595 | @Override | ||
596 | protected Allocate.Match arrayToMatchMutable(final Object[] match) { | ||
597 | try { | ||
598 | return Allocate.Match.newMutableMatch((ApplicationInstance) match[POSITION_APP], (HostInstance) match[POSITION_HOST]); | ||
599 | } catch(ClassCastException e) { | ||
600 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
601 | return null; | ||
602 | } | ||
603 | } | ||
604 | |||
605 | /** | ||
606 | * @return the singleton instance of the query specification of this pattern | ||
607 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
608 | * | ||
609 | */ | ||
610 | public static IQuerySpecification<Allocate.Matcher> querySpecification() { | ||
611 | return Allocate.instance(); | ||
612 | } | ||
613 | } | ||
614 | |||
615 | private Allocate() { | ||
616 | super(GeneratedPQuery.INSTANCE); | ||
617 | } | ||
618 | |||
619 | /** | ||
620 | * @return the singleton instance of the query specification | ||
621 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
622 | * | ||
623 | */ | ||
624 | public static Allocate instance() { | ||
625 | try{ | ||
626 | return LazyHolder.INSTANCE; | ||
627 | } catch (ExceptionInInitializerError err) { | ||
628 | throw processInitializerError(err); | ||
629 | } | ||
630 | } | ||
631 | |||
632 | @Override | ||
633 | protected Allocate.Matcher instantiate(final ViatraQueryEngine engine) { | ||
634 | return Allocate.Matcher.on(engine); | ||
635 | } | ||
636 | |||
637 | @Override | ||
638 | public Allocate.Matcher instantiate() { | ||
639 | return Allocate.Matcher.create(); | ||
640 | } | ||
641 | |||
642 | @Override | ||
643 | public Allocate.Match newEmptyMatch() { | ||
644 | return Allocate.Match.newEmptyMatch(); | ||
645 | } | ||
646 | |||
647 | @Override | ||
648 | public Allocate.Match newMatch(final Object... parameters) { | ||
649 | return Allocate.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[1]); | ||
650 | } | ||
651 | |||
652 | /** | ||
653 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.Allocate (visibility: PUBLIC, simpleName: Allocate, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.Allocate, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
654 | * <b>not</b> at the class load time of the outer class, | ||
655 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.Allocate (visibility: PUBLIC, simpleName: Allocate, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.Allocate, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
656 | * | ||
657 | * <p> This workaround is required e.g. to support recursion. | ||
658 | * | ||
659 | */ | ||
660 | private static class LazyHolder { | ||
661 | private static final Allocate INSTANCE = new Allocate(); | ||
662 | |||
663 | /** | ||
664 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
665 | * This initialization order is required to support indirect recursion. | ||
666 | * | ||
667 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
668 | * | ||
669 | */ | ||
670 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
671 | |||
672 | public static Object ensureInitialized() { | ||
673 | INSTANCE.ensureInitializedInternal(); | ||
674 | return null; | ||
675 | } | ||
676 | } | ||
677 | |||
678 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
679 | private static final Allocate.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
680 | |||
681 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
682 | |||
683 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
684 | |||
685 | private final List<PParameter> parameters = Arrays.asList(parameter_App, parameter_Host); | ||
686 | |||
687 | private class Embedded_1_ApplicationInstance_requirement_instances_allocatedTo extends BaseGeneratedEMFPQuery { | ||
688 | private final PParameter parameter_p0 = new PParameter("p0", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
689 | |||
690 | private final PParameter parameter_p1 = new PParameter("p1", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
691 | |||
692 | private final List<PParameter> embeddedParameters = Arrays.asList(parameter_p0, parameter_p1); | ||
693 | |||
694 | public Embedded_1_ApplicationInstance_requirement_instances_allocatedTo() { | ||
695 | super(PVisibility.EMBEDDED); | ||
696 | } | ||
697 | |||
698 | @Override | ||
699 | public String getFullyQualifiedName() { | ||
700 | return GeneratedPQuery.this.getFullyQualifiedName() + "$Embedded_1_ApplicationInstance_requirement_instances_allocatedTo"; | ||
701 | } | ||
702 | |||
703 | @Override | ||
704 | public List<PParameter> getParameters() { | ||
705 | return embeddedParameters; | ||
706 | } | ||
707 | |||
708 | @Override | ||
709 | public Set<PBody> doGetContainedBodies() { | ||
710 | PBody body = new PBody(this); | ||
711 | PVariable var_p0 = body.getOrCreateVariableByName("p0"); | ||
712 | PVariable var_p1 = body.getOrCreateVariableByName("p1"); | ||
713 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
714 | new ExportedParameter(body, var_p0, parameter_p0), | ||
715 | new ExportedParameter(body, var_p1, parameter_p1) | ||
716 | )); | ||
717 | // ApplicationInstance.requirement.instances.allocatedTo(App, Host) | ||
718 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
719 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
720 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "requirement"))); | ||
721 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
722 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
723 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "instances"))); | ||
724 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
725 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
726 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
727 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
728 | new Equality(body, var__virtual_2_, var_p1); | ||
729 | return Collections.singleton(body); | ||
730 | } | ||
731 | } | ||
732 | |||
733 | private GeneratedPQuery() { | ||
734 | super(PVisibility.PUBLIC); | ||
735 | } | ||
736 | |||
737 | @Override | ||
738 | public String getFullyQualifiedName() { | ||
739 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocate"; | ||
740 | } | ||
741 | |||
742 | @Override | ||
743 | public List<String> getParameterNames() { | ||
744 | return Arrays.asList("App","Host"); | ||
745 | } | ||
746 | |||
747 | @Override | ||
748 | public List<PParameter> getParameters() { | ||
749 | return parameters; | ||
750 | } | ||
751 | |||
752 | @Override | ||
753 | public Set<PBody> doGetContainedBodies() { | ||
754 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
755 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
756 | { | ||
757 | PBody body = new PBody(this); | ||
758 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
759 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
760 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
761 | PVariable var_AvailableMem = body.getOrCreateVariableByName("AvailableMem"); | ||
762 | PVariable var_AvailableHdd = body.getOrCreateVariableByName("AvailableHdd"); | ||
763 | PVariable var_RequiredMem = body.getOrCreateVariableByName("RequiredMem"); | ||
764 | PVariable var_RequiredHdd = body.getOrCreateVariableByName("RequiredHdd"); | ||
765 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
766 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
767 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
768 | new ExportedParameter(body, var_App, parameter_App), | ||
769 | new ExportedParameter(body, var_Host, parameter_Host) | ||
770 | )); | ||
771 | // ApplicationInstance.type.requirements(App, Req) | ||
772 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
773 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
774 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "type"))); | ||
775 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationType"))); | ||
776 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
777 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationType", "requirements"))); | ||
778 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
779 | new Equality(body, var__virtual_1_, var_Req); | ||
780 | // ResourceRequirement.hostType.instances(Req, Host) | ||
781 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
782 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
783 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "hostType"))); | ||
784 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
785 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
786 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostType", "instances"))); | ||
787 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
788 | new Equality(body, var__virtual_3_, var_Host); | ||
789 | // find unallocatedAppInstance(App) | ||
790 | new PositivePatternCall(body, Tuples.flatTupleOf(var_App), UnallocatedAppInstance.instance().getInternalQueryRepresentation()); | ||
791 | // find availableMemory(Host, AvailableMem) | ||
792 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_AvailableMem), AvailableMemory.instance().getInternalQueryRepresentation()); | ||
793 | // find availableHdd(Host, AvailableHdd) | ||
794 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_AvailableHdd), AvailableHdd.instance().getInternalQueryRepresentation()); | ||
795 | // ResourceRequirement.requiredMemory(Req, RequiredMem) | ||
796 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
797 | PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); | ||
798 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "requiredMemory"))); | ||
799 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
800 | new Equality(body, var__virtual_4_, var_RequiredMem); | ||
801 | // ResourceRequirement.requiredHdd(Req, RequiredHdd) | ||
802 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
803 | PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); | ||
804 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "requiredHdd"))); | ||
805 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
806 | new Equality(body, var__virtual_5_, var_RequiredHdd); | ||
807 | // check(AvailableMem >= RequiredMem) | ||
808 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
809 | |||
810 | @Override | ||
811 | public String getShortDescription() { | ||
812 | return "Expression evaluation from pattern allocate"; | ||
813 | } | ||
814 | |||
815 | @Override | ||
816 | public Iterable<String> getInputParameterNames() { | ||
817 | return Arrays.asList("AvailableMem", "RequiredMem");} | ||
818 | |||
819 | @Override | ||
820 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
821 | Integer AvailableMem = (Integer) provider.getValue("AvailableMem"); | ||
822 | Integer RequiredMem = (Integer) provider.getValue("RequiredMem"); | ||
823 | return evaluateExpression_1_1(AvailableMem, RequiredMem); | ||
824 | } | ||
825 | }, null); | ||
826 | // check(AvailableHdd >= RequiredHdd) | ||
827 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
828 | |||
829 | @Override | ||
830 | public String getShortDescription() { | ||
831 | return "Expression evaluation from pattern allocate"; | ||
832 | } | ||
833 | |||
834 | @Override | ||
835 | public Iterable<String> getInputParameterNames() { | ||
836 | return Arrays.asList("AvailableHdd", "RequiredHdd");} | ||
837 | |||
838 | @Override | ||
839 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
840 | Integer AvailableHdd = (Integer) provider.getValue("AvailableHdd"); | ||
841 | Integer RequiredHdd = (Integer) provider.getValue("RequiredHdd"); | ||
842 | return evaluateExpression_1_2(AvailableHdd, RequiredHdd); | ||
843 | } | ||
844 | }, null); | ||
845 | // neg ApplicationInstance.requirement.instances.allocatedTo(App, Host) | ||
846 | new NegativePatternCall(body, Tuples.flatTupleOf(var_App, var_Host), new Allocate.GeneratedPQuery.Embedded_1_ApplicationInstance_requirement_instances_allocatedTo()); | ||
847 | bodies.add(body); | ||
848 | } | ||
849 | return bodies; | ||
850 | } | ||
851 | } | ||
852 | |||
853 | private static boolean evaluateExpression_1_1(final Integer AvailableMem, final Integer RequiredMem) { | ||
854 | boolean _greaterEqualsThan = (AvailableMem.compareTo(RequiredMem) >= 0); | ||
855 | return _greaterEqualsThan; | ||
856 | } | ||
857 | |||
858 | private static boolean evaluateExpression_1_2(final Integer AvailableHdd, final Integer RequiredHdd) { | ||
859 | boolean _greaterEqualsThan = (AvailableHdd.compareTo(RequiredHdd) >= 0); | ||
860 | return _greaterEqualsThan; | ||
861 | } | ||
862 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/AllocationWithoutResourceRequirement.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/AllocationWithoutResourceRequirement.java new file mode 100644 index 00000000..6da5f76d --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/AllocationWithoutResourceRequirement.java | |||
@@ -0,0 +1,717 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.ResourceRequirement; | ||
9 | import java.util.Arrays; | ||
10 | import java.util.Collection; | ||
11 | import java.util.LinkedHashSet; | ||
12 | import java.util.List; | ||
13 | import java.util.Objects; | ||
14 | import java.util.Optional; | ||
15 | import java.util.Set; | ||
16 | import java.util.function.Consumer; | ||
17 | import java.util.stream.Collectors; | ||
18 | import java.util.stream.Stream; | ||
19 | import org.apache.log4j.Logger; | ||
20 | import org.eclipse.emf.ecore.EClass; | ||
21 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
22 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
27 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
44 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
45 | |||
46 | /** | ||
47 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
48 | * | ||
49 | * <p>Original source: | ||
50 | * <code><pre> | ||
51 | * {@literal @}Constraint(severity = "error", key = {Host, App}, | ||
52 | * message = "Application instance must be allocated to a supported host type.") | ||
53 | * pattern allocationWithoutResourceRequirement(Host : HostInstance, App : ApplicationInstance) { | ||
54 | * ApplicationInstance.allocatedTo(App, Host); | ||
55 | * neg find resourceRequirement(Host, App, _); | ||
56 | * } | ||
57 | * </pre></code> | ||
58 | * | ||
59 | * @see Matcher | ||
60 | * @see Match | ||
61 | * | ||
62 | */ | ||
63 | @SuppressWarnings("all") | ||
64 | public final class AllocationWithoutResourceRequirement extends BaseGeneratedEMFQuerySpecification<AllocationWithoutResourceRequirement.Matcher> { | ||
65 | /** | ||
66 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocationWithoutResourceRequirement pattern, | ||
67 | * to be used in conjunction with {@link Matcher}. | ||
68 | * | ||
69 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
70 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
71 | * usable to represent a match of the pattern in the result of a query, | ||
72 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
73 | * | ||
74 | * @see Matcher | ||
75 | * | ||
76 | */ | ||
77 | public static abstract class Match extends BasePatternMatch { | ||
78 | private HostInstance fHost; | ||
79 | |||
80 | private ApplicationInstance fApp; | ||
81 | |||
82 | private static List<String> parameterNames = makeImmutableList("Host", "App"); | ||
83 | |||
84 | private Match(final HostInstance pHost, final ApplicationInstance pApp) { | ||
85 | this.fHost = pHost; | ||
86 | this.fApp = pApp; | ||
87 | } | ||
88 | |||
89 | @Override | ||
90 | public Object get(final String parameterName) { | ||
91 | if ("Host".equals(parameterName)) return this.fHost; | ||
92 | if ("App".equals(parameterName)) return this.fApp; | ||
93 | return null; | ||
94 | } | ||
95 | |||
96 | public HostInstance getHost() { | ||
97 | return this.fHost; | ||
98 | } | ||
99 | |||
100 | public ApplicationInstance getApp() { | ||
101 | return this.fApp; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public boolean set(final String parameterName, final Object newValue) { | ||
106 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
107 | if ("Host".equals(parameterName) ) { | ||
108 | this.fHost = (HostInstance) newValue; | ||
109 | return true; | ||
110 | } | ||
111 | if ("App".equals(parameterName) ) { | ||
112 | this.fApp = (ApplicationInstance) newValue; | ||
113 | return true; | ||
114 | } | ||
115 | return false; | ||
116 | } | ||
117 | |||
118 | public void setHost(final HostInstance pHost) { | ||
119 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
120 | this.fHost = pHost; | ||
121 | } | ||
122 | |||
123 | public void setApp(final ApplicationInstance pApp) { | ||
124 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
125 | this.fApp = pApp; | ||
126 | } | ||
127 | |||
128 | @Override | ||
129 | public String patternName() { | ||
130 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocationWithoutResourceRequirement"; | ||
131 | } | ||
132 | |||
133 | @Override | ||
134 | public List<String> parameterNames() { | ||
135 | return AllocationWithoutResourceRequirement.Match.parameterNames; | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public Object[] toArray() { | ||
140 | return new Object[]{fHost, fApp}; | ||
141 | } | ||
142 | |||
143 | @Override | ||
144 | public AllocationWithoutResourceRequirement.Match toImmutable() { | ||
145 | return isMutable() ? newMatch(fHost, fApp) : this; | ||
146 | } | ||
147 | |||
148 | @Override | ||
149 | public String prettyPrint() { | ||
150 | StringBuilder result = new StringBuilder(); | ||
151 | result.append("\"Host\"=" + prettyPrintValue(fHost) + ", "); | ||
152 | result.append("\"App\"=" + prettyPrintValue(fApp)); | ||
153 | return result.toString(); | ||
154 | } | ||
155 | |||
156 | @Override | ||
157 | public int hashCode() { | ||
158 | return Objects.hash(fHost, fApp); | ||
159 | } | ||
160 | |||
161 | @Override | ||
162 | public boolean equals(final Object obj) { | ||
163 | if (this == obj) | ||
164 | return true; | ||
165 | if (obj == null) { | ||
166 | return false; | ||
167 | } | ||
168 | if ((obj instanceof AllocationWithoutResourceRequirement.Match)) { | ||
169 | AllocationWithoutResourceRequirement.Match other = (AllocationWithoutResourceRequirement.Match) obj; | ||
170 | return Objects.equals(fHost, other.fHost) && Objects.equals(fApp, other.fApp); | ||
171 | } else { | ||
172 | // this should be infrequent | ||
173 | if (!(obj instanceof IPatternMatch)) { | ||
174 | return false; | ||
175 | } | ||
176 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
177 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | @Override | ||
182 | public AllocationWithoutResourceRequirement specification() { | ||
183 | return AllocationWithoutResourceRequirement.instance(); | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * Returns an empty, mutable match. | ||
188 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
189 | * | ||
190 | * @return the empty match. | ||
191 | * | ||
192 | */ | ||
193 | public static AllocationWithoutResourceRequirement.Match newEmptyMatch() { | ||
194 | return new Mutable(null, null); | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * Returns a mutable (partial) match. | ||
199 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
200 | * | ||
201 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
202 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
203 | * @return the new, mutable (partial) match object. | ||
204 | * | ||
205 | */ | ||
206 | public static AllocationWithoutResourceRequirement.Match newMutableMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
207 | return new Mutable(pHost, pApp); | ||
208 | } | ||
209 | |||
210 | /** | ||
211 | * Returns a new (partial) match. | ||
212 | * This can be used e.g. to call the matcher with a partial match. | ||
213 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
214 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
215 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
216 | * @return the (partial) match object. | ||
217 | * | ||
218 | */ | ||
219 | public static AllocationWithoutResourceRequirement.Match newMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
220 | return new Immutable(pHost, pApp); | ||
221 | } | ||
222 | |||
223 | private static final class Mutable extends AllocationWithoutResourceRequirement.Match { | ||
224 | Mutable(final HostInstance pHost, final ApplicationInstance pApp) { | ||
225 | super(pHost, pApp); | ||
226 | } | ||
227 | |||
228 | @Override | ||
229 | public boolean isMutable() { | ||
230 | return true; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | private static final class Immutable extends AllocationWithoutResourceRequirement.Match { | ||
235 | Immutable(final HostInstance pHost, final ApplicationInstance pApp) { | ||
236 | super(pHost, pApp); | ||
237 | } | ||
238 | |||
239 | @Override | ||
240 | public boolean isMutable() { | ||
241 | return false; | ||
242 | } | ||
243 | } | ||
244 | } | ||
245 | |||
246 | /** | ||
247 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocationWithoutResourceRequirement pattern, | ||
248 | * providing pattern-specific query methods. | ||
249 | * | ||
250 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
251 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
252 | * | ||
253 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
254 | * | ||
255 | * <p>Original source: | ||
256 | * <code><pre> | ||
257 | * {@literal @}Constraint(severity = "error", key = {Host, App}, | ||
258 | * message = "Application instance must be allocated to a supported host type.") | ||
259 | * pattern allocationWithoutResourceRequirement(Host : HostInstance, App : ApplicationInstance) { | ||
260 | * ApplicationInstance.allocatedTo(App, Host); | ||
261 | * neg find resourceRequirement(Host, App, _); | ||
262 | * } | ||
263 | * </pre></code> | ||
264 | * | ||
265 | * @see Match | ||
266 | * @see AllocationWithoutResourceRequirement | ||
267 | * | ||
268 | */ | ||
269 | public static class Matcher extends BaseMatcher<AllocationWithoutResourceRequirement.Match> { | ||
270 | /** | ||
271 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
272 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
273 | * | ||
274 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
275 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
276 | * | ||
277 | */ | ||
278 | public static AllocationWithoutResourceRequirement.Matcher on(final ViatraQueryEngine engine) { | ||
279 | // check if matcher already exists | ||
280 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
281 | if (matcher == null) { | ||
282 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
283 | } | ||
284 | return matcher; | ||
285 | } | ||
286 | |||
287 | /** | ||
288 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
289 | * @return an initialized matcher | ||
290 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
291 | * | ||
292 | */ | ||
293 | public static AllocationWithoutResourceRequirement.Matcher create() { | ||
294 | return new Matcher(); | ||
295 | } | ||
296 | |||
297 | private static final int POSITION_HOST = 0; | ||
298 | |||
299 | private static final int POSITION_APP = 1; | ||
300 | |||
301 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AllocationWithoutResourceRequirement.Matcher.class); | ||
302 | |||
303 | /** | ||
304 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
305 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
306 | * | ||
307 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
308 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
309 | * | ||
310 | */ | ||
311 | private Matcher() { | ||
312 | super(querySpecification()); | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
317 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
318 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
319 | * @return matches represented as a Match object. | ||
320 | * | ||
321 | */ | ||
322 | public Collection<AllocationWithoutResourceRequirement.Match> getAllMatches(final HostInstance pHost, final ApplicationInstance pApp) { | ||
323 | return rawStreamAllMatches(new Object[]{pHost, pApp}).collect(Collectors.toSet()); | ||
324 | } | ||
325 | |||
326 | /** | ||
327 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
328 | * </p> | ||
329 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
330 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
331 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
332 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
333 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
334 | * @return a stream of matches represented as a Match object. | ||
335 | * | ||
336 | */ | ||
337 | public Stream<AllocationWithoutResourceRequirement.Match> streamAllMatches(final HostInstance pHost, final ApplicationInstance pApp) { | ||
338 | return rawStreamAllMatches(new Object[]{pHost, pApp}); | ||
339 | } | ||
340 | |||
341 | /** | ||
342 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
343 | * Neither determinism nor randomness of selection is guaranteed. | ||
344 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
345 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
346 | * @return a match represented as a Match object, or null if no match is found. | ||
347 | * | ||
348 | */ | ||
349 | public Optional<AllocationWithoutResourceRequirement.Match> getOneArbitraryMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
350 | return rawGetOneArbitraryMatch(new Object[]{pHost, pApp}); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
355 | * under any possible substitution of the unspecified parameters (if any). | ||
356 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
357 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
358 | * @return true if the input is a valid (partial) match of the pattern. | ||
359 | * | ||
360 | */ | ||
361 | public boolean hasMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
362 | return rawHasMatch(new Object[]{pHost, pApp}); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
367 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
368 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
369 | * @return the number of pattern matches found. | ||
370 | * | ||
371 | */ | ||
372 | public int countMatches(final HostInstance pHost, final ApplicationInstance pApp) { | ||
373 | return rawCountMatches(new Object[]{pHost, pApp}); | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
378 | * Neither determinism nor randomness of selection is guaranteed. | ||
379 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
380 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
381 | * @param processor the action that will process the selected match. | ||
382 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
383 | * | ||
384 | */ | ||
385 | public boolean forOneArbitraryMatch(final HostInstance pHost, final ApplicationInstance pApp, final Consumer<? super AllocationWithoutResourceRequirement.Match> processor) { | ||
386 | return rawForOneArbitraryMatch(new Object[]{pHost, pApp}, processor); | ||
387 | } | ||
388 | |||
389 | /** | ||
390 | * Returns a new (partial) match. | ||
391 | * This can be used e.g. to call the matcher with a partial match. | ||
392 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
393 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
394 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
395 | * @return the (partial) match object. | ||
396 | * | ||
397 | */ | ||
398 | public AllocationWithoutResourceRequirement.Match newMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
399 | return AllocationWithoutResourceRequirement.Match.newMatch(pHost, pApp); | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * Retrieve the set of values that occur in matches for Host. | ||
404 | * @return the Set of all values or empty set if there are no matches | ||
405 | * | ||
406 | */ | ||
407 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
408 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
409 | } | ||
410 | |||
411 | /** | ||
412 | * Retrieve the set of values that occur in matches for Host. | ||
413 | * @return the Set of all values or empty set if there are no matches | ||
414 | * | ||
415 | */ | ||
416 | public Set<HostInstance> getAllValuesOfHost() { | ||
417 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * Retrieve the set of values that occur in matches for Host. | ||
422 | * @return the Set of all values or empty set if there are no matches | ||
423 | * | ||
424 | */ | ||
425 | public Stream<HostInstance> streamAllValuesOfHost() { | ||
426 | return rawStreamAllValuesOfHost(emptyArray()); | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * Retrieve the set of values that occur in matches for Host. | ||
431 | * </p> | ||
432 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
433 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
434 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
435 | * | ||
436 | * @return the Stream of all values or empty set if there are no matches | ||
437 | * | ||
438 | */ | ||
439 | public Stream<HostInstance> streamAllValuesOfHost(final AllocationWithoutResourceRequirement.Match partialMatch) { | ||
440 | return rawStreamAllValuesOfHost(partialMatch.toArray()); | ||
441 | } | ||
442 | |||
443 | /** | ||
444 | * Retrieve the set of values that occur in matches for Host. | ||
445 | * </p> | ||
446 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
447 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
448 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
449 | * | ||
450 | * @return the Stream of all values or empty set if there are no matches | ||
451 | * | ||
452 | */ | ||
453 | public Stream<HostInstance> streamAllValuesOfHost(final ApplicationInstance pApp) { | ||
454 | return rawStreamAllValuesOfHost(new Object[]{null, pApp}); | ||
455 | } | ||
456 | |||
457 | /** | ||
458 | * Retrieve the set of values that occur in matches for Host. | ||
459 | * @return the Set of all values or empty set if there are no matches | ||
460 | * | ||
461 | */ | ||
462 | public Set<HostInstance> getAllValuesOfHost(final AllocationWithoutResourceRequirement.Match partialMatch) { | ||
463 | return rawStreamAllValuesOfHost(partialMatch.toArray()).collect(Collectors.toSet()); | ||
464 | } | ||
465 | |||
466 | /** | ||
467 | * Retrieve the set of values that occur in matches for Host. | ||
468 | * @return the Set of all values or empty set if there are no matches | ||
469 | * | ||
470 | */ | ||
471 | public Set<HostInstance> getAllValuesOfHost(final ApplicationInstance pApp) { | ||
472 | return rawStreamAllValuesOfHost(new Object[]{null, pApp}).collect(Collectors.toSet()); | ||
473 | } | ||
474 | |||
475 | /** | ||
476 | * Retrieve the set of values that occur in matches for App. | ||
477 | * @return the Set of all values or empty set if there are no matches | ||
478 | * | ||
479 | */ | ||
480 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
481 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
482 | } | ||
483 | |||
484 | /** | ||
485 | * Retrieve the set of values that occur in matches for App. | ||
486 | * @return the Set of all values or empty set if there are no matches | ||
487 | * | ||
488 | */ | ||
489 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
490 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * Retrieve the set of values that occur in matches for App. | ||
495 | * @return the Set of all values or empty set if there are no matches | ||
496 | * | ||
497 | */ | ||
498 | public Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
499 | return rawStreamAllValuesOfApp(emptyArray()); | ||
500 | } | ||
501 | |||
502 | /** | ||
503 | * Retrieve the set of values that occur in matches for App. | ||
504 | * </p> | ||
505 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
506 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
507 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
508 | * | ||
509 | * @return the Stream of all values or empty set if there are no matches | ||
510 | * | ||
511 | */ | ||
512 | public Stream<ApplicationInstance> streamAllValuesOfApp(final AllocationWithoutResourceRequirement.Match partialMatch) { | ||
513 | return rawStreamAllValuesOfApp(partialMatch.toArray()); | ||
514 | } | ||
515 | |||
516 | /** | ||
517 | * Retrieve the set of values that occur in matches for App. | ||
518 | * </p> | ||
519 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
520 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
521 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
522 | * | ||
523 | * @return the Stream of all values or empty set if there are no matches | ||
524 | * | ||
525 | */ | ||
526 | public Stream<ApplicationInstance> streamAllValuesOfApp(final HostInstance pHost) { | ||
527 | return rawStreamAllValuesOfApp(new Object[]{pHost, null}); | ||
528 | } | ||
529 | |||
530 | /** | ||
531 | * Retrieve the set of values that occur in matches for App. | ||
532 | * @return the Set of all values or empty set if there are no matches | ||
533 | * | ||
534 | */ | ||
535 | public Set<ApplicationInstance> getAllValuesOfApp(final AllocationWithoutResourceRequirement.Match partialMatch) { | ||
536 | return rawStreamAllValuesOfApp(partialMatch.toArray()).collect(Collectors.toSet()); | ||
537 | } | ||
538 | |||
539 | /** | ||
540 | * Retrieve the set of values that occur in matches for App. | ||
541 | * @return the Set of all values or empty set if there are no matches | ||
542 | * | ||
543 | */ | ||
544 | public Set<ApplicationInstance> getAllValuesOfApp(final HostInstance pHost) { | ||
545 | return rawStreamAllValuesOfApp(new Object[]{pHost, null}).collect(Collectors.toSet()); | ||
546 | } | ||
547 | |||
548 | @Override | ||
549 | protected AllocationWithoutResourceRequirement.Match tupleToMatch(final Tuple t) { | ||
550 | try { | ||
551 | return AllocationWithoutResourceRequirement.Match.newMatch((HostInstance) t.get(POSITION_HOST), (ApplicationInstance) t.get(POSITION_APP)); | ||
552 | } catch(ClassCastException e) { | ||
553 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
554 | return null; | ||
555 | } | ||
556 | } | ||
557 | |||
558 | @Override | ||
559 | protected AllocationWithoutResourceRequirement.Match arrayToMatch(final Object[] match) { | ||
560 | try { | ||
561 | return AllocationWithoutResourceRequirement.Match.newMatch((HostInstance) match[POSITION_HOST], (ApplicationInstance) match[POSITION_APP]); | ||
562 | } catch(ClassCastException e) { | ||
563 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
564 | return null; | ||
565 | } | ||
566 | } | ||
567 | |||
568 | @Override | ||
569 | protected AllocationWithoutResourceRequirement.Match arrayToMatchMutable(final Object[] match) { | ||
570 | try { | ||
571 | return AllocationWithoutResourceRequirement.Match.newMutableMatch((HostInstance) match[POSITION_HOST], (ApplicationInstance) match[POSITION_APP]); | ||
572 | } catch(ClassCastException e) { | ||
573 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
574 | return null; | ||
575 | } | ||
576 | } | ||
577 | |||
578 | /** | ||
579 | * @return the singleton instance of the query specification of this pattern | ||
580 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
581 | * | ||
582 | */ | ||
583 | public static IQuerySpecification<AllocationWithoutResourceRequirement.Matcher> querySpecification() { | ||
584 | return AllocationWithoutResourceRequirement.instance(); | ||
585 | } | ||
586 | } | ||
587 | |||
588 | private AllocationWithoutResourceRequirement() { | ||
589 | super(GeneratedPQuery.INSTANCE); | ||
590 | } | ||
591 | |||
592 | /** | ||
593 | * @return the singleton instance of the query specification | ||
594 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
595 | * | ||
596 | */ | ||
597 | public static AllocationWithoutResourceRequirement instance() { | ||
598 | try{ | ||
599 | return LazyHolder.INSTANCE; | ||
600 | } catch (ExceptionInInitializerError err) { | ||
601 | throw processInitializerError(err); | ||
602 | } | ||
603 | } | ||
604 | |||
605 | @Override | ||
606 | protected AllocationWithoutResourceRequirement.Matcher instantiate(final ViatraQueryEngine engine) { | ||
607 | return AllocationWithoutResourceRequirement.Matcher.on(engine); | ||
608 | } | ||
609 | |||
610 | @Override | ||
611 | public AllocationWithoutResourceRequirement.Matcher instantiate() { | ||
612 | return AllocationWithoutResourceRequirement.Matcher.create(); | ||
613 | } | ||
614 | |||
615 | @Override | ||
616 | public AllocationWithoutResourceRequirement.Match newEmptyMatch() { | ||
617 | return AllocationWithoutResourceRequirement.Match.newEmptyMatch(); | ||
618 | } | ||
619 | |||
620 | @Override | ||
621 | public AllocationWithoutResourceRequirement.Match newMatch(final Object... parameters) { | ||
622 | return AllocationWithoutResourceRequirement.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance) parameters[1]); | ||
623 | } | ||
624 | |||
625 | /** | ||
626 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AllocationWithoutResourceRequirement (visibility: PUBLIC, simpleName: AllocationWithoutResourceRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AllocationWithoutResourceRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
627 | * <b>not</b> at the class load time of the outer class, | ||
628 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AllocationWithoutResourceRequirement (visibility: PUBLIC, simpleName: AllocationWithoutResourceRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AllocationWithoutResourceRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
629 | * | ||
630 | * <p> This workaround is required e.g. to support recursion. | ||
631 | * | ||
632 | */ | ||
633 | private static class LazyHolder { | ||
634 | private static final AllocationWithoutResourceRequirement INSTANCE = new AllocationWithoutResourceRequirement(); | ||
635 | |||
636 | /** | ||
637 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
638 | * This initialization order is required to support indirect recursion. | ||
639 | * | ||
640 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
641 | * | ||
642 | */ | ||
643 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
644 | |||
645 | public static Object ensureInitialized() { | ||
646 | INSTANCE.ensureInitializedInternal(); | ||
647 | return null; | ||
648 | } | ||
649 | } | ||
650 | |||
651 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
652 | private static final AllocationWithoutResourceRequirement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
653 | |||
654 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
655 | |||
656 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
657 | |||
658 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_App); | ||
659 | |||
660 | private GeneratedPQuery() { | ||
661 | super(PVisibility.PUBLIC); | ||
662 | } | ||
663 | |||
664 | @Override | ||
665 | public String getFullyQualifiedName() { | ||
666 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocationWithoutResourceRequirement"; | ||
667 | } | ||
668 | |||
669 | @Override | ||
670 | public List<String> getParameterNames() { | ||
671 | return Arrays.asList("Host","App"); | ||
672 | } | ||
673 | |||
674 | @Override | ||
675 | public List<PParameter> getParameters() { | ||
676 | return parameters; | ||
677 | } | ||
678 | |||
679 | @Override | ||
680 | public Set<PBody> doGetContainedBodies() { | ||
681 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
682 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
683 | { | ||
684 | PBody body = new PBody(this); | ||
685 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
686 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
687 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
688 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
689 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
690 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
691 | new ExportedParameter(body, var_Host, parameter_Host), | ||
692 | new ExportedParameter(body, var_App, parameter_App) | ||
693 | )); | ||
694 | // ApplicationInstance.allocatedTo(App, Host) | ||
695 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
696 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
697 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
698 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
699 | new Equality(body, var__virtual_0_, var_Host); | ||
700 | // neg find resourceRequirement(Host, App, _) | ||
701 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Host, var_App, var___0_), ResourceRequirement.instance().getInternalQueryRepresentation()); | ||
702 | bodies.add(body); | ||
703 | } | ||
704 | { | ||
705 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
706 | annotation.addAttribute("severity", "error"); | ||
707 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
708 | new ParameterReference("Host"), | ||
709 | new ParameterReference("App") | ||
710 | })); | ||
711 | annotation.addAttribute("message", "Application instance must be allocated to a supported host type."); | ||
712 | addAnnotation(annotation); | ||
713 | } | ||
714 | return bodies; | ||
715 | } | ||
716 | } | ||
717 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/AverageFreeHddMetric.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/AverageFreeHddMetric.java new file mode 100644 index 00000000..bc38b60b --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/AverageFreeHddMetric.java | |||
@@ -0,0 +1,544 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeHddPercentage; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.Collection; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Objects; | ||
12 | import java.util.Optional; | ||
13 | import java.util.Set; | ||
14 | import java.util.function.Consumer; | ||
15 | import java.util.stream.Collectors; | ||
16 | import java.util.stream.Stream; | ||
17 | import org.apache.log4j.Logger; | ||
18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
21 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.aggregators.avg; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
39 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
40 | |||
41 | /** | ||
42 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
43 | * | ||
44 | * <p>Original source: | ||
45 | * <code><pre> | ||
46 | * // Free HDD | ||
47 | * | ||
48 | * pattern averageFreeHddMetric(Average : java Double) { | ||
49 | * Average == avg find freeHddPercentage(_, #_); | ||
50 | * } | ||
51 | * </pre></code> | ||
52 | * | ||
53 | * @see Matcher | ||
54 | * @see Match | ||
55 | * | ||
56 | */ | ||
57 | @SuppressWarnings("all") | ||
58 | public final class AverageFreeHddMetric extends BaseGeneratedEMFQuerySpecification<AverageFreeHddMetric.Matcher> { | ||
59 | /** | ||
60 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeHddMetric pattern, | ||
61 | * to be used in conjunction with {@link Matcher}. | ||
62 | * | ||
63 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
64 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
65 | * usable to represent a match of the pattern in the result of a query, | ||
66 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
67 | * | ||
68 | * @see Matcher | ||
69 | * | ||
70 | */ | ||
71 | public static abstract class Match extends BasePatternMatch { | ||
72 | private Double fAverage; | ||
73 | |||
74 | private static List<String> parameterNames = makeImmutableList("Average"); | ||
75 | |||
76 | private Match(final Double pAverage) { | ||
77 | this.fAverage = pAverage; | ||
78 | } | ||
79 | |||
80 | @Override | ||
81 | public Object get(final String parameterName) { | ||
82 | if ("Average".equals(parameterName)) return this.fAverage; | ||
83 | return null; | ||
84 | } | ||
85 | |||
86 | public Double getAverage() { | ||
87 | return this.fAverage; | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public boolean set(final String parameterName, final Object newValue) { | ||
92 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
93 | if ("Average".equals(parameterName) ) { | ||
94 | this.fAverage = (Double) newValue; | ||
95 | return true; | ||
96 | } | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | public void setAverage(final Double pAverage) { | ||
101 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
102 | this.fAverage = pAverage; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String patternName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeHddMetric"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> parameterNames() { | ||
112 | return AverageFreeHddMetric.Match.parameterNames; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Object[] toArray() { | ||
117 | return new Object[]{fAverage}; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public AverageFreeHddMetric.Match toImmutable() { | ||
122 | return isMutable() ? newMatch(fAverage) : this; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public String prettyPrint() { | ||
127 | StringBuilder result = new StringBuilder(); | ||
128 | result.append("\"Average\"=" + prettyPrintValue(fAverage)); | ||
129 | return result.toString(); | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public int hashCode() { | ||
134 | return Objects.hash(fAverage); | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public boolean equals(final Object obj) { | ||
139 | if (this == obj) | ||
140 | return true; | ||
141 | if (obj == null) { | ||
142 | return false; | ||
143 | } | ||
144 | if ((obj instanceof AverageFreeHddMetric.Match)) { | ||
145 | AverageFreeHddMetric.Match other = (AverageFreeHddMetric.Match) obj; | ||
146 | return Objects.equals(fAverage, other.fAverage); | ||
147 | } else { | ||
148 | // this should be infrequent | ||
149 | if (!(obj instanceof IPatternMatch)) { | ||
150 | return false; | ||
151 | } | ||
152 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
153 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | @Override | ||
158 | public AverageFreeHddMetric specification() { | ||
159 | return AverageFreeHddMetric.instance(); | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * Returns an empty, mutable match. | ||
164 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
165 | * | ||
166 | * @return the empty match. | ||
167 | * | ||
168 | */ | ||
169 | public static AverageFreeHddMetric.Match newEmptyMatch() { | ||
170 | return new Mutable(null); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * Returns a mutable (partial) match. | ||
175 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
176 | * | ||
177 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
178 | * @return the new, mutable (partial) match object. | ||
179 | * | ||
180 | */ | ||
181 | public static AverageFreeHddMetric.Match newMutableMatch(final Double pAverage) { | ||
182 | return new Mutable(pAverage); | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | * Returns a new (partial) match. | ||
187 | * This can be used e.g. to call the matcher with a partial match. | ||
188 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
189 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
190 | * @return the (partial) match object. | ||
191 | * | ||
192 | */ | ||
193 | public static AverageFreeHddMetric.Match newMatch(final Double pAverage) { | ||
194 | return new Immutable(pAverage); | ||
195 | } | ||
196 | |||
197 | private static final class Mutable extends AverageFreeHddMetric.Match { | ||
198 | Mutable(final Double pAverage) { | ||
199 | super(pAverage); | ||
200 | } | ||
201 | |||
202 | @Override | ||
203 | public boolean isMutable() { | ||
204 | return true; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | private static final class Immutable extends AverageFreeHddMetric.Match { | ||
209 | Immutable(final Double pAverage) { | ||
210 | super(pAverage); | ||
211 | } | ||
212 | |||
213 | @Override | ||
214 | public boolean isMutable() { | ||
215 | return false; | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeHddMetric pattern, | ||
222 | * providing pattern-specific query methods. | ||
223 | * | ||
224 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
225 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
226 | * | ||
227 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
228 | * | ||
229 | * <p>Original source: | ||
230 | * <code><pre> | ||
231 | * // Free HDD | ||
232 | * | ||
233 | * pattern averageFreeHddMetric(Average : java Double) { | ||
234 | * Average == avg find freeHddPercentage(_, #_); | ||
235 | * } | ||
236 | * </pre></code> | ||
237 | * | ||
238 | * @see Match | ||
239 | * @see AverageFreeHddMetric | ||
240 | * | ||
241 | */ | ||
242 | public static class Matcher extends BaseMatcher<AverageFreeHddMetric.Match> { | ||
243 | /** | ||
244 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
245 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
246 | * | ||
247 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
248 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
249 | * | ||
250 | */ | ||
251 | public static AverageFreeHddMetric.Matcher on(final ViatraQueryEngine engine) { | ||
252 | // check if matcher already exists | ||
253 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
254 | if (matcher == null) { | ||
255 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
256 | } | ||
257 | return matcher; | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
262 | * @return an initialized matcher | ||
263 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
264 | * | ||
265 | */ | ||
266 | public static AverageFreeHddMetric.Matcher create() { | ||
267 | return new Matcher(); | ||
268 | } | ||
269 | |||
270 | private static final int POSITION_AVERAGE = 0; | ||
271 | |||
272 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AverageFreeHddMetric.Matcher.class); | ||
273 | |||
274 | /** | ||
275 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
276 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
277 | * | ||
278 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
279 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
280 | * | ||
281 | */ | ||
282 | private Matcher() { | ||
283 | super(querySpecification()); | ||
284 | } | ||
285 | |||
286 | /** | ||
287 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
288 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
289 | * @return matches represented as a Match object. | ||
290 | * | ||
291 | */ | ||
292 | public Collection<AverageFreeHddMetric.Match> getAllMatches(final Double pAverage) { | ||
293 | return rawStreamAllMatches(new Object[]{pAverage}).collect(Collectors.toSet()); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
298 | * </p> | ||
299 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
300 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
301 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
302 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
303 | * @return a stream of matches represented as a Match object. | ||
304 | * | ||
305 | */ | ||
306 | public Stream<AverageFreeHddMetric.Match> streamAllMatches(final Double pAverage) { | ||
307 | return rawStreamAllMatches(new Object[]{pAverage}); | ||
308 | } | ||
309 | |||
310 | /** | ||
311 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
312 | * Neither determinism nor randomness of selection is guaranteed. | ||
313 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
314 | * @return a match represented as a Match object, or null if no match is found. | ||
315 | * | ||
316 | */ | ||
317 | public Optional<AverageFreeHddMetric.Match> getOneArbitraryMatch(final Double pAverage) { | ||
318 | return rawGetOneArbitraryMatch(new Object[]{pAverage}); | ||
319 | } | ||
320 | |||
321 | /** | ||
322 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
323 | * under any possible substitution of the unspecified parameters (if any). | ||
324 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
325 | * @return true if the input is a valid (partial) match of the pattern. | ||
326 | * | ||
327 | */ | ||
328 | public boolean hasMatch(final Double pAverage) { | ||
329 | return rawHasMatch(new Object[]{pAverage}); | ||
330 | } | ||
331 | |||
332 | /** | ||
333 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
334 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
335 | * @return the number of pattern matches found. | ||
336 | * | ||
337 | */ | ||
338 | public int countMatches(final Double pAverage) { | ||
339 | return rawCountMatches(new Object[]{pAverage}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
344 | * Neither determinism nor randomness of selection is guaranteed. | ||
345 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
346 | * @param processor the action that will process the selected match. | ||
347 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
348 | * | ||
349 | */ | ||
350 | public boolean forOneArbitraryMatch(final Double pAverage, final Consumer<? super AverageFreeHddMetric.Match> processor) { | ||
351 | return rawForOneArbitraryMatch(new Object[]{pAverage}, processor); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * Returns a new (partial) match. | ||
356 | * This can be used e.g. to call the matcher with a partial match. | ||
357 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
358 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
359 | * @return the (partial) match object. | ||
360 | * | ||
361 | */ | ||
362 | public AverageFreeHddMetric.Match newMatch(final Double pAverage) { | ||
363 | return AverageFreeHddMetric.Match.newMatch(pAverage); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Retrieve the set of values that occur in matches for Average. | ||
368 | * @return the Set of all values or empty set if there are no matches | ||
369 | * | ||
370 | */ | ||
371 | protected Stream<Double> rawStreamAllValuesOfAverage(final Object[] parameters) { | ||
372 | return rawStreamAllValues(POSITION_AVERAGE, parameters).map(Double.class::cast); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * Retrieve the set of values that occur in matches for Average. | ||
377 | * @return the Set of all values or empty set if there are no matches | ||
378 | * | ||
379 | */ | ||
380 | public Set<Double> getAllValuesOfAverage() { | ||
381 | return rawStreamAllValuesOfAverage(emptyArray()).collect(Collectors.toSet()); | ||
382 | } | ||
383 | |||
384 | /** | ||
385 | * Retrieve the set of values that occur in matches for Average. | ||
386 | * @return the Set of all values or empty set if there are no matches | ||
387 | * | ||
388 | */ | ||
389 | public Stream<Double> streamAllValuesOfAverage() { | ||
390 | return rawStreamAllValuesOfAverage(emptyArray()); | ||
391 | } | ||
392 | |||
393 | @Override | ||
394 | protected AverageFreeHddMetric.Match tupleToMatch(final Tuple t) { | ||
395 | try { | ||
396 | return AverageFreeHddMetric.Match.newMatch((Double) t.get(POSITION_AVERAGE)); | ||
397 | } catch(ClassCastException e) { | ||
398 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
399 | return null; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | @Override | ||
404 | protected AverageFreeHddMetric.Match arrayToMatch(final Object[] match) { | ||
405 | try { | ||
406 | return AverageFreeHddMetric.Match.newMatch((Double) match[POSITION_AVERAGE]); | ||
407 | } catch(ClassCastException e) { | ||
408 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
409 | return null; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | @Override | ||
414 | protected AverageFreeHddMetric.Match arrayToMatchMutable(final Object[] match) { | ||
415 | try { | ||
416 | return AverageFreeHddMetric.Match.newMutableMatch((Double) match[POSITION_AVERAGE]); | ||
417 | } catch(ClassCastException e) { | ||
418 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
419 | return null; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | /** | ||
424 | * @return the singleton instance of the query specification of this pattern | ||
425 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
426 | * | ||
427 | */ | ||
428 | public static IQuerySpecification<AverageFreeHddMetric.Matcher> querySpecification() { | ||
429 | return AverageFreeHddMetric.instance(); | ||
430 | } | ||
431 | } | ||
432 | |||
433 | private AverageFreeHddMetric() { | ||
434 | super(GeneratedPQuery.INSTANCE); | ||
435 | } | ||
436 | |||
437 | /** | ||
438 | * @return the singleton instance of the query specification | ||
439 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
440 | * | ||
441 | */ | ||
442 | public static AverageFreeHddMetric instance() { | ||
443 | try{ | ||
444 | return LazyHolder.INSTANCE; | ||
445 | } catch (ExceptionInInitializerError err) { | ||
446 | throw processInitializerError(err); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | @Override | ||
451 | protected AverageFreeHddMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
452 | return AverageFreeHddMetric.Matcher.on(engine); | ||
453 | } | ||
454 | |||
455 | @Override | ||
456 | public AverageFreeHddMetric.Matcher instantiate() { | ||
457 | return AverageFreeHddMetric.Matcher.create(); | ||
458 | } | ||
459 | |||
460 | @Override | ||
461 | public AverageFreeHddMetric.Match newEmptyMatch() { | ||
462 | return AverageFreeHddMetric.Match.newEmptyMatch(); | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | public AverageFreeHddMetric.Match newMatch(final Object... parameters) { | ||
467 | return AverageFreeHddMetric.Match.newMatch((java.lang.Double) parameters[0]); | ||
468 | } | ||
469 | |||
470 | /** | ||
471 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeHddMetric (visibility: PUBLIC, simpleName: AverageFreeHddMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeHddMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
472 | * <b>not</b> at the class load time of the outer class, | ||
473 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeHddMetric (visibility: PUBLIC, simpleName: AverageFreeHddMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeHddMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
474 | * | ||
475 | * <p> This workaround is required e.g. to support recursion. | ||
476 | * | ||
477 | */ | ||
478 | private static class LazyHolder { | ||
479 | private static final AverageFreeHddMetric INSTANCE = new AverageFreeHddMetric(); | ||
480 | |||
481 | /** | ||
482 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
483 | * This initialization order is required to support indirect recursion. | ||
484 | * | ||
485 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
486 | * | ||
487 | */ | ||
488 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
489 | |||
490 | public static Object ensureInitialized() { | ||
491 | INSTANCE.ensureInitializedInternal(); | ||
492 | return null; | ||
493 | } | ||
494 | } | ||
495 | |||
496 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
497 | private static final AverageFreeHddMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
498 | |||
499 | private final PParameter parameter_Average = new PParameter("Average", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
500 | |||
501 | private final List<PParameter> parameters = Arrays.asList(parameter_Average); | ||
502 | |||
503 | private GeneratedPQuery() { | ||
504 | super(PVisibility.PUBLIC); | ||
505 | } | ||
506 | |||
507 | @Override | ||
508 | public String getFullyQualifiedName() { | ||
509 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeHddMetric"; | ||
510 | } | ||
511 | |||
512 | @Override | ||
513 | public List<String> getParameterNames() { | ||
514 | return Arrays.asList("Average"); | ||
515 | } | ||
516 | |||
517 | @Override | ||
518 | public List<PParameter> getParameters() { | ||
519 | return parameters; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public Set<PBody> doGetContainedBodies() { | ||
524 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
525 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
526 | { | ||
527 | PBody body = new PBody(this); | ||
528 | PVariable var_Average = body.getOrCreateVariableByName("Average"); | ||
529 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
530 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
531 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Average), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
532 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
533 | new ExportedParameter(body, var_Average, parameter_Average) | ||
534 | )); | ||
535 | // Average == avg find freeHddPercentage(_, #_) | ||
536 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
537 | new AggregatorConstraint(new avg().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), FreeHddPercentage.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
538 | new Equality(body, var_Average, var__virtual_0_); | ||
539 | bodies.add(body); | ||
540 | } | ||
541 | return bodies; | ||
542 | } | ||
543 | } | ||
544 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/AverageFreeMemoryMetric.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/AverageFreeMemoryMetric.java new file mode 100644 index 00000000..98974ea5 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/AverageFreeMemoryMetric.java | |||
@@ -0,0 +1,552 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeMemoryPercentage; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.Collection; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Objects; | ||
12 | import java.util.Optional; | ||
13 | import java.util.Set; | ||
14 | import java.util.function.Consumer; | ||
15 | import java.util.stream.Collectors; | ||
16 | import java.util.stream.Stream; | ||
17 | import org.apache.log4j.Logger; | ||
18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
21 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.aggregators.avg; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
39 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
40 | |||
41 | /** | ||
42 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
43 | * | ||
44 | * <p>Original source: | ||
45 | * <code><pre> | ||
46 | * // | ||
47 | * // Metrics | ||
48 | * // | ||
49 | * | ||
50 | * // Free memory | ||
51 | * | ||
52 | * pattern averageFreeMemoryMetric(Average : java Double) { | ||
53 | * Average == avg find freeMemoryPercentage(_, #_); | ||
54 | * } | ||
55 | * </pre></code> | ||
56 | * | ||
57 | * @see Matcher | ||
58 | * @see Match | ||
59 | * | ||
60 | */ | ||
61 | @SuppressWarnings("all") | ||
62 | public final class AverageFreeMemoryMetric extends BaseGeneratedEMFQuerySpecification<AverageFreeMemoryMetric.Matcher> { | ||
63 | /** | ||
64 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeMemoryMetric pattern, | ||
65 | * to be used in conjunction with {@link Matcher}. | ||
66 | * | ||
67 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
68 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
69 | * usable to represent a match of the pattern in the result of a query, | ||
70 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
71 | * | ||
72 | * @see Matcher | ||
73 | * | ||
74 | */ | ||
75 | public static abstract class Match extends BasePatternMatch { | ||
76 | private Double fAverage; | ||
77 | |||
78 | private static List<String> parameterNames = makeImmutableList("Average"); | ||
79 | |||
80 | private Match(final Double pAverage) { | ||
81 | this.fAverage = pAverage; | ||
82 | } | ||
83 | |||
84 | @Override | ||
85 | public Object get(final String parameterName) { | ||
86 | if ("Average".equals(parameterName)) return this.fAverage; | ||
87 | return null; | ||
88 | } | ||
89 | |||
90 | public Double getAverage() { | ||
91 | return this.fAverage; | ||
92 | } | ||
93 | |||
94 | @Override | ||
95 | public boolean set(final String parameterName, final Object newValue) { | ||
96 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
97 | if ("Average".equals(parameterName) ) { | ||
98 | this.fAverage = (Double) newValue; | ||
99 | return true; | ||
100 | } | ||
101 | return false; | ||
102 | } | ||
103 | |||
104 | public void setAverage(final Double pAverage) { | ||
105 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
106 | this.fAverage = pAverage; | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public String patternName() { | ||
111 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeMemoryMetric"; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public List<String> parameterNames() { | ||
116 | return AverageFreeMemoryMetric.Match.parameterNames; | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public Object[] toArray() { | ||
121 | return new Object[]{fAverage}; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public AverageFreeMemoryMetric.Match toImmutable() { | ||
126 | return isMutable() ? newMatch(fAverage) : this; | ||
127 | } | ||
128 | |||
129 | @Override | ||
130 | public String prettyPrint() { | ||
131 | StringBuilder result = new StringBuilder(); | ||
132 | result.append("\"Average\"=" + prettyPrintValue(fAverage)); | ||
133 | return result.toString(); | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public int hashCode() { | ||
138 | return Objects.hash(fAverage); | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public boolean equals(final Object obj) { | ||
143 | if (this == obj) | ||
144 | return true; | ||
145 | if (obj == null) { | ||
146 | return false; | ||
147 | } | ||
148 | if ((obj instanceof AverageFreeMemoryMetric.Match)) { | ||
149 | AverageFreeMemoryMetric.Match other = (AverageFreeMemoryMetric.Match) obj; | ||
150 | return Objects.equals(fAverage, other.fAverage); | ||
151 | } else { | ||
152 | // this should be infrequent | ||
153 | if (!(obj instanceof IPatternMatch)) { | ||
154 | return false; | ||
155 | } | ||
156 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
157 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | @Override | ||
162 | public AverageFreeMemoryMetric specification() { | ||
163 | return AverageFreeMemoryMetric.instance(); | ||
164 | } | ||
165 | |||
166 | /** | ||
167 | * Returns an empty, mutable match. | ||
168 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
169 | * | ||
170 | * @return the empty match. | ||
171 | * | ||
172 | */ | ||
173 | public static AverageFreeMemoryMetric.Match newEmptyMatch() { | ||
174 | return new Mutable(null); | ||
175 | } | ||
176 | |||
177 | /** | ||
178 | * Returns a mutable (partial) match. | ||
179 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
180 | * | ||
181 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
182 | * @return the new, mutable (partial) match object. | ||
183 | * | ||
184 | */ | ||
185 | public static AverageFreeMemoryMetric.Match newMutableMatch(final Double pAverage) { | ||
186 | return new Mutable(pAverage); | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * Returns a new (partial) match. | ||
191 | * This can be used e.g. to call the matcher with a partial match. | ||
192 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
193 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
194 | * @return the (partial) match object. | ||
195 | * | ||
196 | */ | ||
197 | public static AverageFreeMemoryMetric.Match newMatch(final Double pAverage) { | ||
198 | return new Immutable(pAverage); | ||
199 | } | ||
200 | |||
201 | private static final class Mutable extends AverageFreeMemoryMetric.Match { | ||
202 | Mutable(final Double pAverage) { | ||
203 | super(pAverage); | ||
204 | } | ||
205 | |||
206 | @Override | ||
207 | public boolean isMutable() { | ||
208 | return true; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | private static final class Immutable extends AverageFreeMemoryMetric.Match { | ||
213 | Immutable(final Double pAverage) { | ||
214 | super(pAverage); | ||
215 | } | ||
216 | |||
217 | @Override | ||
218 | public boolean isMutable() { | ||
219 | return false; | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | |||
224 | /** | ||
225 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeMemoryMetric pattern, | ||
226 | * providing pattern-specific query methods. | ||
227 | * | ||
228 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
229 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
230 | * | ||
231 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
232 | * | ||
233 | * <p>Original source: | ||
234 | * <code><pre> | ||
235 | * // | ||
236 | * // Metrics | ||
237 | * // | ||
238 | * | ||
239 | * // Free memory | ||
240 | * | ||
241 | * pattern averageFreeMemoryMetric(Average : java Double) { | ||
242 | * Average == avg find freeMemoryPercentage(_, #_); | ||
243 | * } | ||
244 | * </pre></code> | ||
245 | * | ||
246 | * @see Match | ||
247 | * @see AverageFreeMemoryMetric | ||
248 | * | ||
249 | */ | ||
250 | public static class Matcher extends BaseMatcher<AverageFreeMemoryMetric.Match> { | ||
251 | /** | ||
252 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
253 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
254 | * | ||
255 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
256 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
257 | * | ||
258 | */ | ||
259 | public static AverageFreeMemoryMetric.Matcher on(final ViatraQueryEngine engine) { | ||
260 | // check if matcher already exists | ||
261 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
262 | if (matcher == null) { | ||
263 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
264 | } | ||
265 | return matcher; | ||
266 | } | ||
267 | |||
268 | /** | ||
269 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
270 | * @return an initialized matcher | ||
271 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
272 | * | ||
273 | */ | ||
274 | public static AverageFreeMemoryMetric.Matcher create() { | ||
275 | return new Matcher(); | ||
276 | } | ||
277 | |||
278 | private static final int POSITION_AVERAGE = 0; | ||
279 | |||
280 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AverageFreeMemoryMetric.Matcher.class); | ||
281 | |||
282 | /** | ||
283 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
284 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
285 | * | ||
286 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
287 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
288 | * | ||
289 | */ | ||
290 | private Matcher() { | ||
291 | super(querySpecification()); | ||
292 | } | ||
293 | |||
294 | /** | ||
295 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
296 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
297 | * @return matches represented as a Match object. | ||
298 | * | ||
299 | */ | ||
300 | public Collection<AverageFreeMemoryMetric.Match> getAllMatches(final Double pAverage) { | ||
301 | return rawStreamAllMatches(new Object[]{pAverage}).collect(Collectors.toSet()); | ||
302 | } | ||
303 | |||
304 | /** | ||
305 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
306 | * </p> | ||
307 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
308 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
309 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
310 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
311 | * @return a stream of matches represented as a Match object. | ||
312 | * | ||
313 | */ | ||
314 | public Stream<AverageFreeMemoryMetric.Match> streamAllMatches(final Double pAverage) { | ||
315 | return rawStreamAllMatches(new Object[]{pAverage}); | ||
316 | } | ||
317 | |||
318 | /** | ||
319 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
320 | * Neither determinism nor randomness of selection is guaranteed. | ||
321 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
322 | * @return a match represented as a Match object, or null if no match is found. | ||
323 | * | ||
324 | */ | ||
325 | public Optional<AverageFreeMemoryMetric.Match> getOneArbitraryMatch(final Double pAverage) { | ||
326 | return rawGetOneArbitraryMatch(new Object[]{pAverage}); | ||
327 | } | ||
328 | |||
329 | /** | ||
330 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
331 | * under any possible substitution of the unspecified parameters (if any). | ||
332 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
333 | * @return true if the input is a valid (partial) match of the pattern. | ||
334 | * | ||
335 | */ | ||
336 | public boolean hasMatch(final Double pAverage) { | ||
337 | return rawHasMatch(new Object[]{pAverage}); | ||
338 | } | ||
339 | |||
340 | /** | ||
341 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
342 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
343 | * @return the number of pattern matches found. | ||
344 | * | ||
345 | */ | ||
346 | public int countMatches(final Double pAverage) { | ||
347 | return rawCountMatches(new Object[]{pAverage}); | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
352 | * Neither determinism nor randomness of selection is guaranteed. | ||
353 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
354 | * @param processor the action that will process the selected match. | ||
355 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
356 | * | ||
357 | */ | ||
358 | public boolean forOneArbitraryMatch(final Double pAverage, final Consumer<? super AverageFreeMemoryMetric.Match> processor) { | ||
359 | return rawForOneArbitraryMatch(new Object[]{pAverage}, processor); | ||
360 | } | ||
361 | |||
362 | /** | ||
363 | * Returns a new (partial) match. | ||
364 | * This can be used e.g. to call the matcher with a partial match. | ||
365 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
366 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
367 | * @return the (partial) match object. | ||
368 | * | ||
369 | */ | ||
370 | public AverageFreeMemoryMetric.Match newMatch(final Double pAverage) { | ||
371 | return AverageFreeMemoryMetric.Match.newMatch(pAverage); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * Retrieve the set of values that occur in matches for Average. | ||
376 | * @return the Set of all values or empty set if there are no matches | ||
377 | * | ||
378 | */ | ||
379 | protected Stream<Double> rawStreamAllValuesOfAverage(final Object[] parameters) { | ||
380 | return rawStreamAllValues(POSITION_AVERAGE, parameters).map(Double.class::cast); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * Retrieve the set of values that occur in matches for Average. | ||
385 | * @return the Set of all values or empty set if there are no matches | ||
386 | * | ||
387 | */ | ||
388 | public Set<Double> getAllValuesOfAverage() { | ||
389 | return rawStreamAllValuesOfAverage(emptyArray()).collect(Collectors.toSet()); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * Retrieve the set of values that occur in matches for Average. | ||
394 | * @return the Set of all values or empty set if there are no matches | ||
395 | * | ||
396 | */ | ||
397 | public Stream<Double> streamAllValuesOfAverage() { | ||
398 | return rawStreamAllValuesOfAverage(emptyArray()); | ||
399 | } | ||
400 | |||
401 | @Override | ||
402 | protected AverageFreeMemoryMetric.Match tupleToMatch(final Tuple t) { | ||
403 | try { | ||
404 | return AverageFreeMemoryMetric.Match.newMatch((Double) t.get(POSITION_AVERAGE)); | ||
405 | } catch(ClassCastException e) { | ||
406 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
407 | return null; | ||
408 | } | ||
409 | } | ||
410 | |||
411 | @Override | ||
412 | protected AverageFreeMemoryMetric.Match arrayToMatch(final Object[] match) { | ||
413 | try { | ||
414 | return AverageFreeMemoryMetric.Match.newMatch((Double) match[POSITION_AVERAGE]); | ||
415 | } catch(ClassCastException e) { | ||
416 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
417 | return null; | ||
418 | } | ||
419 | } | ||
420 | |||
421 | @Override | ||
422 | protected AverageFreeMemoryMetric.Match arrayToMatchMutable(final Object[] match) { | ||
423 | try { | ||
424 | return AverageFreeMemoryMetric.Match.newMutableMatch((Double) match[POSITION_AVERAGE]); | ||
425 | } catch(ClassCastException e) { | ||
426 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
427 | return null; | ||
428 | } | ||
429 | } | ||
430 | |||
431 | /** | ||
432 | * @return the singleton instance of the query specification of this pattern | ||
433 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
434 | * | ||
435 | */ | ||
436 | public static IQuerySpecification<AverageFreeMemoryMetric.Matcher> querySpecification() { | ||
437 | return AverageFreeMemoryMetric.instance(); | ||
438 | } | ||
439 | } | ||
440 | |||
441 | private AverageFreeMemoryMetric() { | ||
442 | super(GeneratedPQuery.INSTANCE); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * @return the singleton instance of the query specification | ||
447 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
448 | * | ||
449 | */ | ||
450 | public static AverageFreeMemoryMetric instance() { | ||
451 | try{ | ||
452 | return LazyHolder.INSTANCE; | ||
453 | } catch (ExceptionInInitializerError err) { | ||
454 | throw processInitializerError(err); | ||
455 | } | ||
456 | } | ||
457 | |||
458 | @Override | ||
459 | protected AverageFreeMemoryMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
460 | return AverageFreeMemoryMetric.Matcher.on(engine); | ||
461 | } | ||
462 | |||
463 | @Override | ||
464 | public AverageFreeMemoryMetric.Matcher instantiate() { | ||
465 | return AverageFreeMemoryMetric.Matcher.create(); | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | public AverageFreeMemoryMetric.Match newEmptyMatch() { | ||
470 | return AverageFreeMemoryMetric.Match.newEmptyMatch(); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public AverageFreeMemoryMetric.Match newMatch(final Object... parameters) { | ||
475 | return AverageFreeMemoryMetric.Match.newMatch((java.lang.Double) parameters[0]); | ||
476 | } | ||
477 | |||
478 | /** | ||
479 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeMemoryMetric (visibility: PUBLIC, simpleName: AverageFreeMemoryMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeMemoryMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
480 | * <b>not</b> at the class load time of the outer class, | ||
481 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeMemoryMetric (visibility: PUBLIC, simpleName: AverageFreeMemoryMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeMemoryMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
482 | * | ||
483 | * <p> This workaround is required e.g. to support recursion. | ||
484 | * | ||
485 | */ | ||
486 | private static class LazyHolder { | ||
487 | private static final AverageFreeMemoryMetric INSTANCE = new AverageFreeMemoryMetric(); | ||
488 | |||
489 | /** | ||
490 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
491 | * This initialization order is required to support indirect recursion. | ||
492 | * | ||
493 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
494 | * | ||
495 | */ | ||
496 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
497 | |||
498 | public static Object ensureInitialized() { | ||
499 | INSTANCE.ensureInitializedInternal(); | ||
500 | return null; | ||
501 | } | ||
502 | } | ||
503 | |||
504 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
505 | private static final AverageFreeMemoryMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
506 | |||
507 | private final PParameter parameter_Average = new PParameter("Average", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
508 | |||
509 | private final List<PParameter> parameters = Arrays.asList(parameter_Average); | ||
510 | |||
511 | private GeneratedPQuery() { | ||
512 | super(PVisibility.PUBLIC); | ||
513 | } | ||
514 | |||
515 | @Override | ||
516 | public String getFullyQualifiedName() { | ||
517 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeMemoryMetric"; | ||
518 | } | ||
519 | |||
520 | @Override | ||
521 | public List<String> getParameterNames() { | ||
522 | return Arrays.asList("Average"); | ||
523 | } | ||
524 | |||
525 | @Override | ||
526 | public List<PParameter> getParameters() { | ||
527 | return parameters; | ||
528 | } | ||
529 | |||
530 | @Override | ||
531 | public Set<PBody> doGetContainedBodies() { | ||
532 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
533 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
534 | { | ||
535 | PBody body = new PBody(this); | ||
536 | PVariable var_Average = body.getOrCreateVariableByName("Average"); | ||
537 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
538 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
539 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Average), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
540 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
541 | new ExportedParameter(body, var_Average, parameter_Average) | ||
542 | )); | ||
543 | // Average == avg find freeMemoryPercentage(_, #_) | ||
544 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
545 | new AggregatorConstraint(new avg().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), FreeMemoryPercentage.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
546 | new Equality(body, var_Average, var__virtual_0_); | ||
547 | bodies.add(body); | ||
548 | } | ||
549 | return bodies; | ||
550 | } | ||
551 | } | ||
552 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CostMetric.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CostMetric.java new file mode 100644 index 00000000..bf886ec0 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CostMetric.java | |||
@@ -0,0 +1,544 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsCost; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.Collection; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Objects; | ||
12 | import java.util.Optional; | ||
13 | import java.util.Set; | ||
14 | import java.util.function.Consumer; | ||
15 | import java.util.stream.Collectors; | ||
16 | import java.util.stream.Stream; | ||
17 | import org.apache.log4j.Logger; | ||
18 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
19 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
20 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
21 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
39 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
40 | |||
41 | /** | ||
42 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
43 | * | ||
44 | * <p>Original source: | ||
45 | * <code><pre> | ||
46 | * // Total cost | ||
47 | * | ||
48 | * pattern costMetric(Cost : java Integer) { | ||
49 | * Cost == sum find cpsCost(_, #_); | ||
50 | * } | ||
51 | * </pre></code> | ||
52 | * | ||
53 | * @see Matcher | ||
54 | * @see Match | ||
55 | * | ||
56 | */ | ||
57 | @SuppressWarnings("all") | ||
58 | public final class CostMetric extends BaseGeneratedEMFQuerySpecification<CostMetric.Matcher> { | ||
59 | /** | ||
60 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.costMetric pattern, | ||
61 | * to be used in conjunction with {@link Matcher}. | ||
62 | * | ||
63 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
64 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
65 | * usable to represent a match of the pattern in the result of a query, | ||
66 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
67 | * | ||
68 | * @see Matcher | ||
69 | * | ||
70 | */ | ||
71 | public static abstract class Match extends BasePatternMatch { | ||
72 | private Integer fCost; | ||
73 | |||
74 | private static List<String> parameterNames = makeImmutableList("Cost"); | ||
75 | |||
76 | private Match(final Integer pCost) { | ||
77 | this.fCost = pCost; | ||
78 | } | ||
79 | |||
80 | @Override | ||
81 | public Object get(final String parameterName) { | ||
82 | if ("Cost".equals(parameterName)) return this.fCost; | ||
83 | return null; | ||
84 | } | ||
85 | |||
86 | public Integer getCost() { | ||
87 | return this.fCost; | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public boolean set(final String parameterName, final Object newValue) { | ||
92 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
93 | if ("Cost".equals(parameterName) ) { | ||
94 | this.fCost = (Integer) newValue; | ||
95 | return true; | ||
96 | } | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | public void setCost(final Integer pCost) { | ||
101 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
102 | this.fCost = pCost; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String patternName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.costMetric"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> parameterNames() { | ||
112 | return CostMetric.Match.parameterNames; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Object[] toArray() { | ||
117 | return new Object[]{fCost}; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public CostMetric.Match toImmutable() { | ||
122 | return isMutable() ? newMatch(fCost) : this; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public String prettyPrint() { | ||
127 | StringBuilder result = new StringBuilder(); | ||
128 | result.append("\"Cost\"=" + prettyPrintValue(fCost)); | ||
129 | return result.toString(); | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public int hashCode() { | ||
134 | return Objects.hash(fCost); | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public boolean equals(final Object obj) { | ||
139 | if (this == obj) | ||
140 | return true; | ||
141 | if (obj == null) { | ||
142 | return false; | ||
143 | } | ||
144 | if ((obj instanceof CostMetric.Match)) { | ||
145 | CostMetric.Match other = (CostMetric.Match) obj; | ||
146 | return Objects.equals(fCost, other.fCost); | ||
147 | } else { | ||
148 | // this should be infrequent | ||
149 | if (!(obj instanceof IPatternMatch)) { | ||
150 | return false; | ||
151 | } | ||
152 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
153 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | @Override | ||
158 | public CostMetric specification() { | ||
159 | return CostMetric.instance(); | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * Returns an empty, mutable match. | ||
164 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
165 | * | ||
166 | * @return the empty match. | ||
167 | * | ||
168 | */ | ||
169 | public static CostMetric.Match newEmptyMatch() { | ||
170 | return new Mutable(null); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * Returns a mutable (partial) match. | ||
175 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
176 | * | ||
177 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
178 | * @return the new, mutable (partial) match object. | ||
179 | * | ||
180 | */ | ||
181 | public static CostMetric.Match newMutableMatch(final Integer pCost) { | ||
182 | return new Mutable(pCost); | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | * Returns a new (partial) match. | ||
187 | * This can be used e.g. to call the matcher with a partial match. | ||
188 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
189 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
190 | * @return the (partial) match object. | ||
191 | * | ||
192 | */ | ||
193 | public static CostMetric.Match newMatch(final Integer pCost) { | ||
194 | return new Immutable(pCost); | ||
195 | } | ||
196 | |||
197 | private static final class Mutable extends CostMetric.Match { | ||
198 | Mutable(final Integer pCost) { | ||
199 | super(pCost); | ||
200 | } | ||
201 | |||
202 | @Override | ||
203 | public boolean isMutable() { | ||
204 | return true; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | private static final class Immutable extends CostMetric.Match { | ||
209 | Immutable(final Integer pCost) { | ||
210 | super(pCost); | ||
211 | } | ||
212 | |||
213 | @Override | ||
214 | public boolean isMutable() { | ||
215 | return false; | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.costMetric pattern, | ||
222 | * providing pattern-specific query methods. | ||
223 | * | ||
224 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
225 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
226 | * | ||
227 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
228 | * | ||
229 | * <p>Original source: | ||
230 | * <code><pre> | ||
231 | * // Total cost | ||
232 | * | ||
233 | * pattern costMetric(Cost : java Integer) { | ||
234 | * Cost == sum find cpsCost(_, #_); | ||
235 | * } | ||
236 | * </pre></code> | ||
237 | * | ||
238 | * @see Match | ||
239 | * @see CostMetric | ||
240 | * | ||
241 | */ | ||
242 | public static class Matcher extends BaseMatcher<CostMetric.Match> { | ||
243 | /** | ||
244 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
245 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
246 | * | ||
247 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
248 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
249 | * | ||
250 | */ | ||
251 | public static CostMetric.Matcher on(final ViatraQueryEngine engine) { | ||
252 | // check if matcher already exists | ||
253 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
254 | if (matcher == null) { | ||
255 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
256 | } | ||
257 | return matcher; | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
262 | * @return an initialized matcher | ||
263 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
264 | * | ||
265 | */ | ||
266 | public static CostMetric.Matcher create() { | ||
267 | return new Matcher(); | ||
268 | } | ||
269 | |||
270 | private static final int POSITION_COST = 0; | ||
271 | |||
272 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CostMetric.Matcher.class); | ||
273 | |||
274 | /** | ||
275 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
276 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
277 | * | ||
278 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
279 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
280 | * | ||
281 | */ | ||
282 | private Matcher() { | ||
283 | super(querySpecification()); | ||
284 | } | ||
285 | |||
286 | /** | ||
287 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
288 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
289 | * @return matches represented as a Match object. | ||
290 | * | ||
291 | */ | ||
292 | public Collection<CostMetric.Match> getAllMatches(final Integer pCost) { | ||
293 | return rawStreamAllMatches(new Object[]{pCost}).collect(Collectors.toSet()); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
298 | * </p> | ||
299 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
300 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
301 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
302 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
303 | * @return a stream of matches represented as a Match object. | ||
304 | * | ||
305 | */ | ||
306 | public Stream<CostMetric.Match> streamAllMatches(final Integer pCost) { | ||
307 | return rawStreamAllMatches(new Object[]{pCost}); | ||
308 | } | ||
309 | |||
310 | /** | ||
311 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
312 | * Neither determinism nor randomness of selection is guaranteed. | ||
313 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
314 | * @return a match represented as a Match object, or null if no match is found. | ||
315 | * | ||
316 | */ | ||
317 | public Optional<CostMetric.Match> getOneArbitraryMatch(final Integer pCost) { | ||
318 | return rawGetOneArbitraryMatch(new Object[]{pCost}); | ||
319 | } | ||
320 | |||
321 | /** | ||
322 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
323 | * under any possible substitution of the unspecified parameters (if any). | ||
324 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
325 | * @return true if the input is a valid (partial) match of the pattern. | ||
326 | * | ||
327 | */ | ||
328 | public boolean hasMatch(final Integer pCost) { | ||
329 | return rawHasMatch(new Object[]{pCost}); | ||
330 | } | ||
331 | |||
332 | /** | ||
333 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
334 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
335 | * @return the number of pattern matches found. | ||
336 | * | ||
337 | */ | ||
338 | public int countMatches(final Integer pCost) { | ||
339 | return rawCountMatches(new Object[]{pCost}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
344 | * Neither determinism nor randomness of selection is guaranteed. | ||
345 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
346 | * @param processor the action that will process the selected match. | ||
347 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
348 | * | ||
349 | */ | ||
350 | public boolean forOneArbitraryMatch(final Integer pCost, final Consumer<? super CostMetric.Match> processor) { | ||
351 | return rawForOneArbitraryMatch(new Object[]{pCost}, processor); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * Returns a new (partial) match. | ||
356 | * This can be used e.g. to call the matcher with a partial match. | ||
357 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
358 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
359 | * @return the (partial) match object. | ||
360 | * | ||
361 | */ | ||
362 | public CostMetric.Match newMatch(final Integer pCost) { | ||
363 | return CostMetric.Match.newMatch(pCost); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Retrieve the set of values that occur in matches for Cost. | ||
368 | * @return the Set of all values or empty set if there are no matches | ||
369 | * | ||
370 | */ | ||
371 | protected Stream<Integer> rawStreamAllValuesOfCost(final Object[] parameters) { | ||
372 | return rawStreamAllValues(POSITION_COST, parameters).map(Integer.class::cast); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * Retrieve the set of values that occur in matches for Cost. | ||
377 | * @return the Set of all values or empty set if there are no matches | ||
378 | * | ||
379 | */ | ||
380 | public Set<Integer> getAllValuesOfCost() { | ||
381 | return rawStreamAllValuesOfCost(emptyArray()).collect(Collectors.toSet()); | ||
382 | } | ||
383 | |||
384 | /** | ||
385 | * Retrieve the set of values that occur in matches for Cost. | ||
386 | * @return the Set of all values or empty set if there are no matches | ||
387 | * | ||
388 | */ | ||
389 | public Stream<Integer> streamAllValuesOfCost() { | ||
390 | return rawStreamAllValuesOfCost(emptyArray()); | ||
391 | } | ||
392 | |||
393 | @Override | ||
394 | protected CostMetric.Match tupleToMatch(final Tuple t) { | ||
395 | try { | ||
396 | return CostMetric.Match.newMatch((Integer) t.get(POSITION_COST)); | ||
397 | } catch(ClassCastException e) { | ||
398 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
399 | return null; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | @Override | ||
404 | protected CostMetric.Match arrayToMatch(final Object[] match) { | ||
405 | try { | ||
406 | return CostMetric.Match.newMatch((Integer) match[POSITION_COST]); | ||
407 | } catch(ClassCastException e) { | ||
408 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
409 | return null; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | @Override | ||
414 | protected CostMetric.Match arrayToMatchMutable(final Object[] match) { | ||
415 | try { | ||
416 | return CostMetric.Match.newMutableMatch((Integer) match[POSITION_COST]); | ||
417 | } catch(ClassCastException e) { | ||
418 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
419 | return null; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | /** | ||
424 | * @return the singleton instance of the query specification of this pattern | ||
425 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
426 | * | ||
427 | */ | ||
428 | public static IQuerySpecification<CostMetric.Matcher> querySpecification() { | ||
429 | return CostMetric.instance(); | ||
430 | } | ||
431 | } | ||
432 | |||
433 | private CostMetric() { | ||
434 | super(GeneratedPQuery.INSTANCE); | ||
435 | } | ||
436 | |||
437 | /** | ||
438 | * @return the singleton instance of the query specification | ||
439 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
440 | * | ||
441 | */ | ||
442 | public static CostMetric instance() { | ||
443 | try{ | ||
444 | return LazyHolder.INSTANCE; | ||
445 | } catch (ExceptionInInitializerError err) { | ||
446 | throw processInitializerError(err); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | @Override | ||
451 | protected CostMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
452 | return CostMetric.Matcher.on(engine); | ||
453 | } | ||
454 | |||
455 | @Override | ||
456 | public CostMetric.Matcher instantiate() { | ||
457 | return CostMetric.Matcher.create(); | ||
458 | } | ||
459 | |||
460 | @Override | ||
461 | public CostMetric.Match newEmptyMatch() { | ||
462 | return CostMetric.Match.newEmptyMatch(); | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | public CostMetric.Match newMatch(final Object... parameters) { | ||
467 | return CostMetric.Match.newMatch((java.lang.Integer) parameters[0]); | ||
468 | } | ||
469 | |||
470 | /** | ||
471 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CostMetric (visibility: PUBLIC, simpleName: CostMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CostMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
472 | * <b>not</b> at the class load time of the outer class, | ||
473 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CostMetric (visibility: PUBLIC, simpleName: CostMetric, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CostMetric, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
474 | * | ||
475 | * <p> This workaround is required e.g. to support recursion. | ||
476 | * | ||
477 | */ | ||
478 | private static class LazyHolder { | ||
479 | private static final CostMetric INSTANCE = new CostMetric(); | ||
480 | |||
481 | /** | ||
482 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
483 | * This initialization order is required to support indirect recursion. | ||
484 | * | ||
485 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
486 | * | ||
487 | */ | ||
488 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
489 | |||
490 | public static Object ensureInitialized() { | ||
491 | INSTANCE.ensureInitializedInternal(); | ||
492 | return null; | ||
493 | } | ||
494 | } | ||
495 | |||
496 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
497 | private static final CostMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
498 | |||
499 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
500 | |||
501 | private final List<PParameter> parameters = Arrays.asList(parameter_Cost); | ||
502 | |||
503 | private GeneratedPQuery() { | ||
504 | super(PVisibility.PUBLIC); | ||
505 | } | ||
506 | |||
507 | @Override | ||
508 | public String getFullyQualifiedName() { | ||
509 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.costMetric"; | ||
510 | } | ||
511 | |||
512 | @Override | ||
513 | public List<String> getParameterNames() { | ||
514 | return Arrays.asList("Cost"); | ||
515 | } | ||
516 | |||
517 | @Override | ||
518 | public List<PParameter> getParameters() { | ||
519 | return parameters; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public Set<PBody> doGetContainedBodies() { | ||
524 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
525 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
526 | { | ||
527 | PBody body = new PBody(this); | ||
528 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
529 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
530 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
531 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
532 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
533 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
534 | )); | ||
535 | // Cost == sum find cpsCost(_, #_) | ||
536 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
537 | new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var___0_, var___1_), CpsCost.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
538 | new Equality(body, var_Cost, var__virtual_0_); | ||
539 | bodies.add(body); | ||
540 | } | ||
541 | return bodies; | ||
542 | } | ||
543 | } | ||
544 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsCost.java new file mode 100644 index 00000000..fc90ef12 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsCost.java | |||
@@ -0,0 +1,738 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsApplications; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HostInstanceCost; | ||
9 | import java.util.Arrays; | ||
10 | import java.util.Collection; | ||
11 | import java.util.LinkedHashSet; | ||
12 | import java.util.List; | ||
13 | import java.util.Objects; | ||
14 | import java.util.Optional; | ||
15 | import java.util.Set; | ||
16 | import java.util.function.Consumer; | ||
17 | import java.util.stream.Collectors; | ||
18 | import java.util.stream.Stream; | ||
19 | import org.apache.log4j.Logger; | ||
20 | import org.eclipse.emf.ecore.EClass; | ||
21 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
22 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
27 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
44 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
45 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
46 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
47 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
48 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
49 | |||
50 | /** | ||
51 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
52 | * | ||
53 | * <p>Original source: | ||
54 | * <code><pre> | ||
55 | * pattern cpsCost(Cps : CyberPhysicalSystem, Cost : java Integer) { | ||
56 | * AppCount == count find cpsApplications(Cps, _); | ||
57 | * HostCost == sum find hostInstanceCost(Cps, _, #_); | ||
58 | * Cost == eval(5 AppCount + HostCost); | ||
59 | * } | ||
60 | * </pre></code> | ||
61 | * | ||
62 | * @see Matcher | ||
63 | * @see Match | ||
64 | * | ||
65 | */ | ||
66 | @SuppressWarnings("all") | ||
67 | public final class CpsCost extends BaseGeneratedEMFQuerySpecification<CpsCost.Matcher> { | ||
68 | /** | ||
69 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsCost pattern, | ||
70 | * to be used in conjunction with {@link Matcher}. | ||
71 | * | ||
72 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
73 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
74 | * usable to represent a match of the pattern in the result of a query, | ||
75 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
76 | * | ||
77 | * @see Matcher | ||
78 | * | ||
79 | */ | ||
80 | public static abstract class Match extends BasePatternMatch { | ||
81 | private CyberPhysicalSystem fCps; | ||
82 | |||
83 | private Integer fCost; | ||
84 | |||
85 | private static List<String> parameterNames = makeImmutableList("Cps", "Cost"); | ||
86 | |||
87 | private Match(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
88 | this.fCps = pCps; | ||
89 | this.fCost = pCost; | ||
90 | } | ||
91 | |||
92 | @Override | ||
93 | public Object get(final String parameterName) { | ||
94 | if ("Cps".equals(parameterName)) return this.fCps; | ||
95 | if ("Cost".equals(parameterName)) return this.fCost; | ||
96 | return null; | ||
97 | } | ||
98 | |||
99 | public CyberPhysicalSystem getCps() { | ||
100 | return this.fCps; | ||
101 | } | ||
102 | |||
103 | public Integer getCost() { | ||
104 | return this.fCost; | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public boolean set(final String parameterName, final Object newValue) { | ||
109 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
110 | if ("Cps".equals(parameterName) ) { | ||
111 | this.fCps = (CyberPhysicalSystem) newValue; | ||
112 | return true; | ||
113 | } | ||
114 | if ("Cost".equals(parameterName) ) { | ||
115 | this.fCost = (Integer) newValue; | ||
116 | return true; | ||
117 | } | ||
118 | return false; | ||
119 | } | ||
120 | |||
121 | public void setCps(final CyberPhysicalSystem pCps) { | ||
122 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
123 | this.fCps = pCps; | ||
124 | } | ||
125 | |||
126 | public void setCost(final Integer pCost) { | ||
127 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
128 | this.fCost = pCost; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public String patternName() { | ||
133 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsCost"; | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public List<String> parameterNames() { | ||
138 | return CpsCost.Match.parameterNames; | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public Object[] toArray() { | ||
143 | return new Object[]{fCps, fCost}; | ||
144 | } | ||
145 | |||
146 | @Override | ||
147 | public CpsCost.Match toImmutable() { | ||
148 | return isMutable() ? newMatch(fCps, fCost) : this; | ||
149 | } | ||
150 | |||
151 | @Override | ||
152 | public String prettyPrint() { | ||
153 | StringBuilder result = new StringBuilder(); | ||
154 | result.append("\"Cps\"=" + prettyPrintValue(fCps) + ", "); | ||
155 | result.append("\"Cost\"=" + prettyPrintValue(fCost)); | ||
156 | return result.toString(); | ||
157 | } | ||
158 | |||
159 | @Override | ||
160 | public int hashCode() { | ||
161 | return Objects.hash(fCps, fCost); | ||
162 | } | ||
163 | |||
164 | @Override | ||
165 | public boolean equals(final Object obj) { | ||
166 | if (this == obj) | ||
167 | return true; | ||
168 | if (obj == null) { | ||
169 | return false; | ||
170 | } | ||
171 | if ((obj instanceof CpsCost.Match)) { | ||
172 | CpsCost.Match other = (CpsCost.Match) obj; | ||
173 | return Objects.equals(fCps, other.fCps) && Objects.equals(fCost, other.fCost); | ||
174 | } else { | ||
175 | // this should be infrequent | ||
176 | if (!(obj instanceof IPatternMatch)) { | ||
177 | return false; | ||
178 | } | ||
179 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
180 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
181 | } | ||
182 | } | ||
183 | |||
184 | @Override | ||
185 | public CpsCost specification() { | ||
186 | return CpsCost.instance(); | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * Returns an empty, mutable match. | ||
191 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
192 | * | ||
193 | * @return the empty match. | ||
194 | * | ||
195 | */ | ||
196 | public static CpsCost.Match newEmptyMatch() { | ||
197 | return new Mutable(null, null); | ||
198 | } | ||
199 | |||
200 | /** | ||
201 | * Returns a mutable (partial) match. | ||
202 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
203 | * | ||
204 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
205 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
206 | * @return the new, mutable (partial) match object. | ||
207 | * | ||
208 | */ | ||
209 | public static CpsCost.Match newMutableMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
210 | return new Mutable(pCps, pCost); | ||
211 | } | ||
212 | |||
213 | /** | ||
214 | * Returns a new (partial) match. | ||
215 | * This can be used e.g. to call the matcher with a partial match. | ||
216 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
217 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
218 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
219 | * @return the (partial) match object. | ||
220 | * | ||
221 | */ | ||
222 | public static CpsCost.Match newMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
223 | return new Immutable(pCps, pCost); | ||
224 | } | ||
225 | |||
226 | private static final class Mutable extends CpsCost.Match { | ||
227 | Mutable(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
228 | super(pCps, pCost); | ||
229 | } | ||
230 | |||
231 | @Override | ||
232 | public boolean isMutable() { | ||
233 | return true; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | private static final class Immutable extends CpsCost.Match { | ||
238 | Immutable(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
239 | super(pCps, pCost); | ||
240 | } | ||
241 | |||
242 | @Override | ||
243 | public boolean isMutable() { | ||
244 | return false; | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | |||
249 | /** | ||
250 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsCost pattern, | ||
251 | * providing pattern-specific query methods. | ||
252 | * | ||
253 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
254 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
255 | * | ||
256 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
257 | * | ||
258 | * <p>Original source: | ||
259 | * <code><pre> | ||
260 | * pattern cpsCost(Cps : CyberPhysicalSystem, Cost : java Integer) { | ||
261 | * AppCount == count find cpsApplications(Cps, _); | ||
262 | * HostCost == sum find hostInstanceCost(Cps, _, #_); | ||
263 | * Cost == eval(5 AppCount + HostCost); | ||
264 | * } | ||
265 | * </pre></code> | ||
266 | * | ||
267 | * @see Match | ||
268 | * @see CpsCost | ||
269 | * | ||
270 | */ | ||
271 | public static class Matcher extends BaseMatcher<CpsCost.Match> { | ||
272 | /** | ||
273 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
274 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
275 | * | ||
276 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
277 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
278 | * | ||
279 | */ | ||
280 | public static CpsCost.Matcher on(final ViatraQueryEngine engine) { | ||
281 | // check if matcher already exists | ||
282 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
283 | if (matcher == null) { | ||
284 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
285 | } | ||
286 | return matcher; | ||
287 | } | ||
288 | |||
289 | /** | ||
290 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
291 | * @return an initialized matcher | ||
292 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
293 | * | ||
294 | */ | ||
295 | public static CpsCost.Matcher create() { | ||
296 | return new Matcher(); | ||
297 | } | ||
298 | |||
299 | private static final int POSITION_CPS = 0; | ||
300 | |||
301 | private static final int POSITION_COST = 1; | ||
302 | |||
303 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CpsCost.Matcher.class); | ||
304 | |||
305 | /** | ||
306 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
307 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
308 | * | ||
309 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
310 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
311 | * | ||
312 | */ | ||
313 | private Matcher() { | ||
314 | super(querySpecification()); | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
319 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
320 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
321 | * @return matches represented as a Match object. | ||
322 | * | ||
323 | */ | ||
324 | public Collection<CpsCost.Match> getAllMatches(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
325 | return rawStreamAllMatches(new Object[]{pCps, pCost}).collect(Collectors.toSet()); | ||
326 | } | ||
327 | |||
328 | /** | ||
329 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
330 | * </p> | ||
331 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
332 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
333 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
334 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
335 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
336 | * @return a stream of matches represented as a Match object. | ||
337 | * | ||
338 | */ | ||
339 | public Stream<CpsCost.Match> streamAllMatches(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
340 | return rawStreamAllMatches(new Object[]{pCps, pCost}); | ||
341 | } | ||
342 | |||
343 | /** | ||
344 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
345 | * Neither determinism nor randomness of selection is guaranteed. | ||
346 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
347 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
348 | * @return a match represented as a Match object, or null if no match is found. | ||
349 | * | ||
350 | */ | ||
351 | public Optional<CpsCost.Match> getOneArbitraryMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
352 | return rawGetOneArbitraryMatch(new Object[]{pCps, pCost}); | ||
353 | } | ||
354 | |||
355 | /** | ||
356 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
357 | * under any possible substitution of the unspecified parameters (if any). | ||
358 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
359 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
360 | * @return true if the input is a valid (partial) match of the pattern. | ||
361 | * | ||
362 | */ | ||
363 | public boolean hasMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
364 | return rawHasMatch(new Object[]{pCps, pCost}); | ||
365 | } | ||
366 | |||
367 | /** | ||
368 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
369 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
370 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
371 | * @return the number of pattern matches found. | ||
372 | * | ||
373 | */ | ||
374 | public int countMatches(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
375 | return rawCountMatches(new Object[]{pCps, pCost}); | ||
376 | } | ||
377 | |||
378 | /** | ||
379 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
380 | * Neither determinism nor randomness of selection is guaranteed. | ||
381 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
382 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
383 | * @param processor the action that will process the selected match. | ||
384 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
385 | * | ||
386 | */ | ||
387 | public boolean forOneArbitraryMatch(final CyberPhysicalSystem pCps, final Integer pCost, final Consumer<? super CpsCost.Match> processor) { | ||
388 | return rawForOneArbitraryMatch(new Object[]{pCps, pCost}, processor); | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * Returns a new (partial) match. | ||
393 | * This can be used e.g. to call the matcher with a partial match. | ||
394 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
395 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
396 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
397 | * @return the (partial) match object. | ||
398 | * | ||
399 | */ | ||
400 | public CpsCost.Match newMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
401 | return CpsCost.Match.newMatch(pCps, pCost); | ||
402 | } | ||
403 | |||
404 | /** | ||
405 | * Retrieve the set of values that occur in matches for Cps. | ||
406 | * @return the Set of all values or empty set if there are no matches | ||
407 | * | ||
408 | */ | ||
409 | protected Stream<CyberPhysicalSystem> rawStreamAllValuesOfCps(final Object[] parameters) { | ||
410 | return rawStreamAllValues(POSITION_CPS, parameters).map(CyberPhysicalSystem.class::cast); | ||
411 | } | ||
412 | |||
413 | /** | ||
414 | * Retrieve the set of values that occur in matches for Cps. | ||
415 | * @return the Set of all values or empty set if there are no matches | ||
416 | * | ||
417 | */ | ||
418 | public Set<CyberPhysicalSystem> getAllValuesOfCps() { | ||
419 | return rawStreamAllValuesOfCps(emptyArray()).collect(Collectors.toSet()); | ||
420 | } | ||
421 | |||
422 | /** | ||
423 | * Retrieve the set of values that occur in matches for Cps. | ||
424 | * @return the Set of all values or empty set if there are no matches | ||
425 | * | ||
426 | */ | ||
427 | public Stream<CyberPhysicalSystem> streamAllValuesOfCps() { | ||
428 | return rawStreamAllValuesOfCps(emptyArray()); | ||
429 | } | ||
430 | |||
431 | /** | ||
432 | * Retrieve the set of values that occur in matches for Cps. | ||
433 | * </p> | ||
434 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
435 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
436 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
437 | * | ||
438 | * @return the Stream of all values or empty set if there are no matches | ||
439 | * | ||
440 | */ | ||
441 | public Stream<CyberPhysicalSystem> streamAllValuesOfCps(final CpsCost.Match partialMatch) { | ||
442 | return rawStreamAllValuesOfCps(partialMatch.toArray()); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * Retrieve the set of values that occur in matches for Cps. | ||
447 | * </p> | ||
448 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
449 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
450 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
451 | * | ||
452 | * @return the Stream of all values or empty set if there are no matches | ||
453 | * | ||
454 | */ | ||
455 | public Stream<CyberPhysicalSystem> streamAllValuesOfCps(final Integer pCost) { | ||
456 | return rawStreamAllValuesOfCps(new Object[]{null, pCost}); | ||
457 | } | ||
458 | |||
459 | /** | ||
460 | * Retrieve the set of values that occur in matches for Cps. | ||
461 | * @return the Set of all values or empty set if there are no matches | ||
462 | * | ||
463 | */ | ||
464 | public Set<CyberPhysicalSystem> getAllValuesOfCps(final CpsCost.Match partialMatch) { | ||
465 | return rawStreamAllValuesOfCps(partialMatch.toArray()).collect(Collectors.toSet()); | ||
466 | } | ||
467 | |||
468 | /** | ||
469 | * Retrieve the set of values that occur in matches for Cps. | ||
470 | * @return the Set of all values or empty set if there are no matches | ||
471 | * | ||
472 | */ | ||
473 | public Set<CyberPhysicalSystem> getAllValuesOfCps(final Integer pCost) { | ||
474 | return rawStreamAllValuesOfCps(new Object[]{null, pCost}).collect(Collectors.toSet()); | ||
475 | } | ||
476 | |||
477 | /** | ||
478 | * Retrieve the set of values that occur in matches for Cost. | ||
479 | * @return the Set of all values or empty set if there are no matches | ||
480 | * | ||
481 | */ | ||
482 | protected Stream<Integer> rawStreamAllValuesOfCost(final Object[] parameters) { | ||
483 | return rawStreamAllValues(POSITION_COST, parameters).map(Integer.class::cast); | ||
484 | } | ||
485 | |||
486 | /** | ||
487 | * Retrieve the set of values that occur in matches for Cost. | ||
488 | * @return the Set of all values or empty set if there are no matches | ||
489 | * | ||
490 | */ | ||
491 | public Set<Integer> getAllValuesOfCost() { | ||
492 | return rawStreamAllValuesOfCost(emptyArray()).collect(Collectors.toSet()); | ||
493 | } | ||
494 | |||
495 | /** | ||
496 | * Retrieve the set of values that occur in matches for Cost. | ||
497 | * @return the Set of all values or empty set if there are no matches | ||
498 | * | ||
499 | */ | ||
500 | public Stream<Integer> streamAllValuesOfCost() { | ||
501 | return rawStreamAllValuesOfCost(emptyArray()); | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * Retrieve the set of values that occur in matches for Cost. | ||
506 | * </p> | ||
507 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
508 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
509 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
510 | * | ||
511 | * @return the Stream of all values or empty set if there are no matches | ||
512 | * | ||
513 | */ | ||
514 | public Stream<Integer> streamAllValuesOfCost(final CpsCost.Match partialMatch) { | ||
515 | return rawStreamAllValuesOfCost(partialMatch.toArray()); | ||
516 | } | ||
517 | |||
518 | /** | ||
519 | * Retrieve the set of values that occur in matches for Cost. | ||
520 | * </p> | ||
521 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
522 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
523 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
524 | * | ||
525 | * @return the Stream of all values or empty set if there are no matches | ||
526 | * | ||
527 | */ | ||
528 | public Stream<Integer> streamAllValuesOfCost(final CyberPhysicalSystem pCps) { | ||
529 | return rawStreamAllValuesOfCost(new Object[]{pCps, null}); | ||
530 | } | ||
531 | |||
532 | /** | ||
533 | * Retrieve the set of values that occur in matches for Cost. | ||
534 | * @return the Set of all values or empty set if there are no matches | ||
535 | * | ||
536 | */ | ||
537 | public Set<Integer> getAllValuesOfCost(final CpsCost.Match partialMatch) { | ||
538 | return rawStreamAllValuesOfCost(partialMatch.toArray()).collect(Collectors.toSet()); | ||
539 | } | ||
540 | |||
541 | /** | ||
542 | * Retrieve the set of values that occur in matches for Cost. | ||
543 | * @return the Set of all values or empty set if there are no matches | ||
544 | * | ||
545 | */ | ||
546 | public Set<Integer> getAllValuesOfCost(final CyberPhysicalSystem pCps) { | ||
547 | return rawStreamAllValuesOfCost(new Object[]{pCps, null}).collect(Collectors.toSet()); | ||
548 | } | ||
549 | |||
550 | @Override | ||
551 | protected CpsCost.Match tupleToMatch(final Tuple t) { | ||
552 | try { | ||
553 | return CpsCost.Match.newMatch((CyberPhysicalSystem) t.get(POSITION_CPS), (Integer) t.get(POSITION_COST)); | ||
554 | } catch(ClassCastException e) { | ||
555 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
556 | return null; | ||
557 | } | ||
558 | } | ||
559 | |||
560 | @Override | ||
561 | protected CpsCost.Match arrayToMatch(final Object[] match) { | ||
562 | try { | ||
563 | return CpsCost.Match.newMatch((CyberPhysicalSystem) match[POSITION_CPS], (Integer) match[POSITION_COST]); | ||
564 | } catch(ClassCastException e) { | ||
565 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
566 | return null; | ||
567 | } | ||
568 | } | ||
569 | |||
570 | @Override | ||
571 | protected CpsCost.Match arrayToMatchMutable(final Object[] match) { | ||
572 | try { | ||
573 | return CpsCost.Match.newMutableMatch((CyberPhysicalSystem) match[POSITION_CPS], (Integer) match[POSITION_COST]); | ||
574 | } catch(ClassCastException e) { | ||
575 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
576 | return null; | ||
577 | } | ||
578 | } | ||
579 | |||
580 | /** | ||
581 | * @return the singleton instance of the query specification of this pattern | ||
582 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
583 | * | ||
584 | */ | ||
585 | public static IQuerySpecification<CpsCost.Matcher> querySpecification() { | ||
586 | return CpsCost.instance(); | ||
587 | } | ||
588 | } | ||
589 | |||
590 | private CpsCost() { | ||
591 | super(GeneratedPQuery.INSTANCE); | ||
592 | } | ||
593 | |||
594 | /** | ||
595 | * @return the singleton instance of the query specification | ||
596 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
597 | * | ||
598 | */ | ||
599 | public static CpsCost instance() { | ||
600 | try{ | ||
601 | return LazyHolder.INSTANCE; | ||
602 | } catch (ExceptionInInitializerError err) { | ||
603 | throw processInitializerError(err); | ||
604 | } | ||
605 | } | ||
606 | |||
607 | @Override | ||
608 | protected CpsCost.Matcher instantiate(final ViatraQueryEngine engine) { | ||
609 | return CpsCost.Matcher.on(engine); | ||
610 | } | ||
611 | |||
612 | @Override | ||
613 | public CpsCost.Matcher instantiate() { | ||
614 | return CpsCost.Matcher.create(); | ||
615 | } | ||
616 | |||
617 | @Override | ||
618 | public CpsCost.Match newEmptyMatch() { | ||
619 | return CpsCost.Match.newEmptyMatch(); | ||
620 | } | ||
621 | |||
622 | @Override | ||
623 | public CpsCost.Match newMatch(final Object... parameters) { | ||
624 | return CpsCost.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem) parameters[0], (java.lang.Integer) parameters[1]); | ||
625 | } | ||
626 | |||
627 | /** | ||
628 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsCost (visibility: PUBLIC, simpleName: CpsCost, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
629 | * <b>not</b> at the class load time of the outer class, | ||
630 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsCost (visibility: PUBLIC, simpleName: CpsCost, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
631 | * | ||
632 | * <p> This workaround is required e.g. to support recursion. | ||
633 | * | ||
634 | */ | ||
635 | private static class LazyHolder { | ||
636 | private static final CpsCost INSTANCE = new CpsCost(); | ||
637 | |||
638 | /** | ||
639 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
640 | * This initialization order is required to support indirect recursion. | ||
641 | * | ||
642 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
643 | * | ||
644 | */ | ||
645 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
646 | |||
647 | public static Object ensureInitialized() { | ||
648 | INSTANCE.ensureInitializedInternal(); | ||
649 | return null; | ||
650 | } | ||
651 | } | ||
652 | |||
653 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
654 | private static final CpsCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
655 | |||
656 | private final PParameter parameter_Cps = new PParameter("Cps", "hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "CyberPhysicalSystem")), PParameterDirection.INOUT); | ||
657 | |||
658 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
659 | |||
660 | private final List<PParameter> parameters = Arrays.asList(parameter_Cps, parameter_Cost); | ||
661 | |||
662 | private GeneratedPQuery() { | ||
663 | super(PVisibility.PUBLIC); | ||
664 | } | ||
665 | |||
666 | @Override | ||
667 | public String getFullyQualifiedName() { | ||
668 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsCost"; | ||
669 | } | ||
670 | |||
671 | @Override | ||
672 | public List<String> getParameterNames() { | ||
673 | return Arrays.asList("Cps","Cost"); | ||
674 | } | ||
675 | |||
676 | @Override | ||
677 | public List<PParameter> getParameters() { | ||
678 | return parameters; | ||
679 | } | ||
680 | |||
681 | @Override | ||
682 | public Set<PBody> doGetContainedBodies() { | ||
683 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
684 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
685 | { | ||
686 | PBody body = new PBody(this); | ||
687 | PVariable var_Cps = body.getOrCreateVariableByName("Cps"); | ||
688 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
689 | PVariable var_AppCount = body.getOrCreateVariableByName("AppCount"); | ||
690 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
691 | PVariable var_HostCost = body.getOrCreateVariableByName("HostCost"); | ||
692 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
693 | PVariable var___2_ = body.getOrCreateVariableByName("_<2>"); | ||
694 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cps), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "CyberPhysicalSystem"))); | ||
695 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
696 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
697 | new ExportedParameter(body, var_Cps, parameter_Cps), | ||
698 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
699 | )); | ||
700 | // AppCount == count find cpsApplications(Cps, _) | ||
701 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
702 | new PatternMatchCounter(body, Tuples.flatTupleOf(var_Cps, var___0_), CpsApplications.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
703 | new Equality(body, var_AppCount, var__virtual_0_); | ||
704 | // HostCost == sum find hostInstanceCost(Cps, _, #_) | ||
705 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
706 | new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var_Cps, var___1_, var___2_), HostInstanceCost.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); | ||
707 | new Equality(body, var_HostCost, var__virtual_1_); | ||
708 | // Cost == eval(5 * AppCount + HostCost) | ||
709 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
710 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
711 | |||
712 | @Override | ||
713 | public String getShortDescription() { | ||
714 | return "Expression evaluation from pattern cpsCost"; | ||
715 | } | ||
716 | |||
717 | @Override | ||
718 | public Iterable<String> getInputParameterNames() { | ||
719 | return Arrays.asList("AppCount", "HostCost");} | ||
720 | |||
721 | @Override | ||
722 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
723 | Integer AppCount = (Integer) provider.getValue("AppCount"); | ||
724 | Integer HostCost = (Integer) provider.getValue("HostCost"); | ||
725 | return evaluateExpression_1_1(AppCount, HostCost); | ||
726 | } | ||
727 | }, var__virtual_2_ ); | ||
728 | new Equality(body, var_Cost, var__virtual_2_); | ||
729 | bodies.add(body); | ||
730 | } | ||
731 | return bodies; | ||
732 | } | ||
733 | } | ||
734 | |||
735 | private static int evaluateExpression_1_1(final Integer AppCount, final Integer HostCost) { | ||
736 | return ((5 * (AppCount).intValue()) + (HostCost).intValue()); | ||
737 | } | ||
738 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.java new file mode 100644 index 00000000..c889fbe0 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.java | |||
@@ -0,0 +1,218 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.Allocate; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.AllocationWithoutResourceRequirement; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeHddMetric; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeMemoryMetric; | ||
10 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CostMetric; | ||
11 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsCost; | ||
12 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CreateHostInstance; | ||
13 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.GuidanceObjective; | ||
14 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.InstanceDoesNotSatisfyRequirement; | ||
15 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableHdd; | ||
16 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableMemory; | ||
17 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.RedundantInstancesOnSameHost; | ||
18 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.RemoveHostInstance; | ||
19 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.RequirementNotSatisfied; | ||
20 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.ResourceRequirement; | ||
21 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.UnallocateAppInstance; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | ||
24 | |||
25 | /** | ||
26 | * A pattern group formed of all public patterns defined in CpsQueries.vql. | ||
27 | * | ||
28 | * <p>Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare | ||
29 | * a VIATRA Query engine for matching all patterns originally defined in file CpsQueries.vql, | ||
30 | * in order to achieve better performance than one-by-one on-demand matcher initialization. | ||
31 | * | ||
32 | * <p> From package hu.bme.mit.inf.dslreasoner.domains.cps.queries, the group contains the definition of the following patterns: <ul> | ||
33 | * <li>resourceRequirement</li> | ||
34 | * <li>allocationWithoutResourceRequirement</li> | ||
35 | * <li>notEnoughAvailableMemory</li> | ||
36 | * <li>notEnoughAvailableHdd</li> | ||
37 | * <li>instanceDoesNotSatisfyRequirement</li> | ||
38 | * <li>requirementNotSatisfied</li> | ||
39 | * <li>redundantInstancesOnSameHost</li> | ||
40 | * <li>averageFreeMemoryMetric</li> | ||
41 | * <li>averageFreeHddMetric</li> | ||
42 | * <li>costMetric</li> | ||
43 | * <li>cpsCost</li> | ||
44 | * <li>allocate</li> | ||
45 | * <li>unallocateAppInstance</li> | ||
46 | * <li>createHostInstance</li> | ||
47 | * <li>removeHostInstance</li> | ||
48 | * <li>guidanceObjective</li> | ||
49 | * </ul> | ||
50 | * | ||
51 | * @see IQueryGroup | ||
52 | * | ||
53 | */ | ||
54 | @SuppressWarnings("all") | ||
55 | public final class CpsQueries extends BaseGeneratedPatternGroup { | ||
56 | /** | ||
57 | * Access the pattern group. | ||
58 | * | ||
59 | * @return the singleton instance of the group | ||
60 | * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications | ||
61 | * | ||
62 | */ | ||
63 | public static CpsQueries instance() { | ||
64 | if (INSTANCE == null) { | ||
65 | INSTANCE = new CpsQueries(); | ||
66 | } | ||
67 | return INSTANCE; | ||
68 | } | ||
69 | |||
70 | private static CpsQueries INSTANCE; | ||
71 | |||
72 | private CpsQueries() { | ||
73 | querySpecifications.add(ResourceRequirement.instance()); | ||
74 | querySpecifications.add(AllocationWithoutResourceRequirement.instance()); | ||
75 | querySpecifications.add(NotEnoughAvailableMemory.instance()); | ||
76 | querySpecifications.add(NotEnoughAvailableHdd.instance()); | ||
77 | querySpecifications.add(InstanceDoesNotSatisfyRequirement.instance()); | ||
78 | querySpecifications.add(RequirementNotSatisfied.instance()); | ||
79 | querySpecifications.add(RedundantInstancesOnSameHost.instance()); | ||
80 | querySpecifications.add(AverageFreeMemoryMetric.instance()); | ||
81 | querySpecifications.add(AverageFreeHddMetric.instance()); | ||
82 | querySpecifications.add(CostMetric.instance()); | ||
83 | querySpecifications.add(CpsCost.instance()); | ||
84 | querySpecifications.add(Allocate.instance()); | ||
85 | querySpecifications.add(UnallocateAppInstance.instance()); | ||
86 | querySpecifications.add(CreateHostInstance.instance()); | ||
87 | querySpecifications.add(RemoveHostInstance.instance()); | ||
88 | querySpecifications.add(GuidanceObjective.instance()); | ||
89 | } | ||
90 | |||
91 | public ResourceRequirement getResourceRequirement() { | ||
92 | return ResourceRequirement.instance(); | ||
93 | } | ||
94 | |||
95 | public ResourceRequirement.Matcher getResourceRequirement(final ViatraQueryEngine engine) { | ||
96 | return ResourceRequirement.Matcher.on(engine); | ||
97 | } | ||
98 | |||
99 | public AllocationWithoutResourceRequirement getAllocationWithoutResourceRequirement() { | ||
100 | return AllocationWithoutResourceRequirement.instance(); | ||
101 | } | ||
102 | |||
103 | public AllocationWithoutResourceRequirement.Matcher getAllocationWithoutResourceRequirement(final ViatraQueryEngine engine) { | ||
104 | return AllocationWithoutResourceRequirement.Matcher.on(engine); | ||
105 | } | ||
106 | |||
107 | public NotEnoughAvailableMemory getNotEnoughAvailableMemory() { | ||
108 | return NotEnoughAvailableMemory.instance(); | ||
109 | } | ||
110 | |||
111 | public NotEnoughAvailableMemory.Matcher getNotEnoughAvailableMemory(final ViatraQueryEngine engine) { | ||
112 | return NotEnoughAvailableMemory.Matcher.on(engine); | ||
113 | } | ||
114 | |||
115 | public NotEnoughAvailableHdd getNotEnoughAvailableHdd() { | ||
116 | return NotEnoughAvailableHdd.instance(); | ||
117 | } | ||
118 | |||
119 | public NotEnoughAvailableHdd.Matcher getNotEnoughAvailableHdd(final ViatraQueryEngine engine) { | ||
120 | return NotEnoughAvailableHdd.Matcher.on(engine); | ||
121 | } | ||
122 | |||
123 | public InstanceDoesNotSatisfyRequirement getInstanceDoesNotSatisfyRequirement() { | ||
124 | return InstanceDoesNotSatisfyRequirement.instance(); | ||
125 | } | ||
126 | |||
127 | public InstanceDoesNotSatisfyRequirement.Matcher getInstanceDoesNotSatisfyRequirement(final ViatraQueryEngine engine) { | ||
128 | return InstanceDoesNotSatisfyRequirement.Matcher.on(engine); | ||
129 | } | ||
130 | |||
131 | public RequirementNotSatisfied getRequirementNotSatisfied() { | ||
132 | return RequirementNotSatisfied.instance(); | ||
133 | } | ||
134 | |||
135 | public RequirementNotSatisfied.Matcher getRequirementNotSatisfied(final ViatraQueryEngine engine) { | ||
136 | return RequirementNotSatisfied.Matcher.on(engine); | ||
137 | } | ||
138 | |||
139 | public RedundantInstancesOnSameHost getRedundantInstancesOnSameHost() { | ||
140 | return RedundantInstancesOnSameHost.instance(); | ||
141 | } | ||
142 | |||
143 | public RedundantInstancesOnSameHost.Matcher getRedundantInstancesOnSameHost(final ViatraQueryEngine engine) { | ||
144 | return RedundantInstancesOnSameHost.Matcher.on(engine); | ||
145 | } | ||
146 | |||
147 | public AverageFreeMemoryMetric getAverageFreeMemoryMetric() { | ||
148 | return AverageFreeMemoryMetric.instance(); | ||
149 | } | ||
150 | |||
151 | public AverageFreeMemoryMetric.Matcher getAverageFreeMemoryMetric(final ViatraQueryEngine engine) { | ||
152 | return AverageFreeMemoryMetric.Matcher.on(engine); | ||
153 | } | ||
154 | |||
155 | public AverageFreeHddMetric getAverageFreeHddMetric() { | ||
156 | return AverageFreeHddMetric.instance(); | ||
157 | } | ||
158 | |||
159 | public AverageFreeHddMetric.Matcher getAverageFreeHddMetric(final ViatraQueryEngine engine) { | ||
160 | return AverageFreeHddMetric.Matcher.on(engine); | ||
161 | } | ||
162 | |||
163 | public CostMetric getCostMetric() { | ||
164 | return CostMetric.instance(); | ||
165 | } | ||
166 | |||
167 | public CostMetric.Matcher getCostMetric(final ViatraQueryEngine engine) { | ||
168 | return CostMetric.Matcher.on(engine); | ||
169 | } | ||
170 | |||
171 | public CpsCost getCpsCost() { | ||
172 | return CpsCost.instance(); | ||
173 | } | ||
174 | |||
175 | public CpsCost.Matcher getCpsCost(final ViatraQueryEngine engine) { | ||
176 | return CpsCost.Matcher.on(engine); | ||
177 | } | ||
178 | |||
179 | public Allocate getAllocate() { | ||
180 | return Allocate.instance(); | ||
181 | } | ||
182 | |||
183 | public Allocate.Matcher getAllocate(final ViatraQueryEngine engine) { | ||
184 | return Allocate.Matcher.on(engine); | ||
185 | } | ||
186 | |||
187 | public UnallocateAppInstance getUnallocateAppInstance() { | ||
188 | return UnallocateAppInstance.instance(); | ||
189 | } | ||
190 | |||
191 | public UnallocateAppInstance.Matcher getUnallocateAppInstance(final ViatraQueryEngine engine) { | ||
192 | return UnallocateAppInstance.Matcher.on(engine); | ||
193 | } | ||
194 | |||
195 | public CreateHostInstance getCreateHostInstance() { | ||
196 | return CreateHostInstance.instance(); | ||
197 | } | ||
198 | |||
199 | public CreateHostInstance.Matcher getCreateHostInstance(final ViatraQueryEngine engine) { | ||
200 | return CreateHostInstance.Matcher.on(engine); | ||
201 | } | ||
202 | |||
203 | public RemoveHostInstance getRemoveHostInstance() { | ||
204 | return RemoveHostInstance.instance(); | ||
205 | } | ||
206 | |||
207 | public RemoveHostInstance.Matcher getRemoveHostInstance(final ViatraQueryEngine engine) { | ||
208 | return RemoveHostInstance.Matcher.on(engine); | ||
209 | } | ||
210 | |||
211 | public GuidanceObjective getGuidanceObjective() { | ||
212 | return GuidanceObjective.instance(); | ||
213 | } | ||
214 | |||
215 | public GuidanceObjective.Matcher getGuidanceObjective(final ViatraQueryEngine engine) { | ||
216 | return GuidanceObjective.Matcher.on(engine); | ||
217 | } | ||
218 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CreateHostInstance.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CreateHostInstance.java new file mode 100644 index 00000000..f475c9e9 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CreateHostInstance.java | |||
@@ -0,0 +1,553 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.UnallocatedAppInstance; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.Collection; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | import java.util.Optional; | ||
14 | import java.util.Set; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collectors; | ||
17 | import java.util.stream.Stream; | ||
18 | import org.apache.log4j.Logger; | ||
19 | import org.eclipse.emf.ecore.EClass; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
41 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
42 | |||
43 | /** | ||
44 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
45 | * | ||
46 | * <p>Original source: | ||
47 | * <code><pre> | ||
48 | * pattern createHostInstance(HostType : HostType) { | ||
49 | * find unallocatedAppInstance(App); | ||
50 | * ApplicationInstance.type.requirements.hostType(App, HostType); | ||
51 | * } | ||
52 | * </pre></code> | ||
53 | * | ||
54 | * @see Matcher | ||
55 | * @see Match | ||
56 | * | ||
57 | */ | ||
58 | @SuppressWarnings("all") | ||
59 | public final class CreateHostInstance extends BaseGeneratedEMFQuerySpecification<CreateHostInstance.Matcher> { | ||
60 | /** | ||
61 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.createHostInstance pattern, | ||
62 | * to be used in conjunction with {@link Matcher}. | ||
63 | * | ||
64 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
65 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
66 | * usable to represent a match of the pattern in the result of a query, | ||
67 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
68 | * | ||
69 | * @see Matcher | ||
70 | * | ||
71 | */ | ||
72 | public static abstract class Match extends BasePatternMatch { | ||
73 | private HostType fHostType; | ||
74 | |||
75 | private static List<String> parameterNames = makeImmutableList("HostType"); | ||
76 | |||
77 | private Match(final HostType pHostType) { | ||
78 | this.fHostType = pHostType; | ||
79 | } | ||
80 | |||
81 | @Override | ||
82 | public Object get(final String parameterName) { | ||
83 | if ("HostType".equals(parameterName)) return this.fHostType; | ||
84 | return null; | ||
85 | } | ||
86 | |||
87 | public HostType getHostType() { | ||
88 | return this.fHostType; | ||
89 | } | ||
90 | |||
91 | @Override | ||
92 | public boolean set(final String parameterName, final Object newValue) { | ||
93 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
94 | if ("HostType".equals(parameterName) ) { | ||
95 | this.fHostType = (HostType) newValue; | ||
96 | return true; | ||
97 | } | ||
98 | return false; | ||
99 | } | ||
100 | |||
101 | public void setHostType(final HostType pHostType) { | ||
102 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
103 | this.fHostType = pHostType; | ||
104 | } | ||
105 | |||
106 | @Override | ||
107 | public String patternName() { | ||
108 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.createHostInstance"; | ||
109 | } | ||
110 | |||
111 | @Override | ||
112 | public List<String> parameterNames() { | ||
113 | return CreateHostInstance.Match.parameterNames; | ||
114 | } | ||
115 | |||
116 | @Override | ||
117 | public Object[] toArray() { | ||
118 | return new Object[]{fHostType}; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public CreateHostInstance.Match toImmutable() { | ||
123 | return isMutable() ? newMatch(fHostType) : this; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public String prettyPrint() { | ||
128 | StringBuilder result = new StringBuilder(); | ||
129 | result.append("\"HostType\"=" + prettyPrintValue(fHostType)); | ||
130 | return result.toString(); | ||
131 | } | ||
132 | |||
133 | @Override | ||
134 | public int hashCode() { | ||
135 | return Objects.hash(fHostType); | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public boolean equals(final Object obj) { | ||
140 | if (this == obj) | ||
141 | return true; | ||
142 | if (obj == null) { | ||
143 | return false; | ||
144 | } | ||
145 | if ((obj instanceof CreateHostInstance.Match)) { | ||
146 | CreateHostInstance.Match other = (CreateHostInstance.Match) obj; | ||
147 | return Objects.equals(fHostType, other.fHostType); | ||
148 | } else { | ||
149 | // this should be infrequent | ||
150 | if (!(obj instanceof IPatternMatch)) { | ||
151 | return false; | ||
152 | } | ||
153 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
154 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | @Override | ||
159 | public CreateHostInstance specification() { | ||
160 | return CreateHostInstance.instance(); | ||
161 | } | ||
162 | |||
163 | /** | ||
164 | * Returns an empty, mutable match. | ||
165 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
166 | * | ||
167 | * @return the empty match. | ||
168 | * | ||
169 | */ | ||
170 | public static CreateHostInstance.Match newEmptyMatch() { | ||
171 | return new Mutable(null); | ||
172 | } | ||
173 | |||
174 | /** | ||
175 | * Returns a mutable (partial) match. | ||
176 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
177 | * | ||
178 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
179 | * @return the new, mutable (partial) match object. | ||
180 | * | ||
181 | */ | ||
182 | public static CreateHostInstance.Match newMutableMatch(final HostType pHostType) { | ||
183 | return new Mutable(pHostType); | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * Returns a new (partial) match. | ||
188 | * This can be used e.g. to call the matcher with a partial match. | ||
189 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
190 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
191 | * @return the (partial) match object. | ||
192 | * | ||
193 | */ | ||
194 | public static CreateHostInstance.Match newMatch(final HostType pHostType) { | ||
195 | return new Immutable(pHostType); | ||
196 | } | ||
197 | |||
198 | private static final class Mutable extends CreateHostInstance.Match { | ||
199 | Mutable(final HostType pHostType) { | ||
200 | super(pHostType); | ||
201 | } | ||
202 | |||
203 | @Override | ||
204 | public boolean isMutable() { | ||
205 | return true; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | private static final class Immutable extends CreateHostInstance.Match { | ||
210 | Immutable(final HostType pHostType) { | ||
211 | super(pHostType); | ||
212 | } | ||
213 | |||
214 | @Override | ||
215 | public boolean isMutable() { | ||
216 | return false; | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | |||
221 | /** | ||
222 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.createHostInstance pattern, | ||
223 | * providing pattern-specific query methods. | ||
224 | * | ||
225 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
226 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
227 | * | ||
228 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
229 | * | ||
230 | * <p>Original source: | ||
231 | * <code><pre> | ||
232 | * pattern createHostInstance(HostType : HostType) { | ||
233 | * find unallocatedAppInstance(App); | ||
234 | * ApplicationInstance.type.requirements.hostType(App, HostType); | ||
235 | * } | ||
236 | * </pre></code> | ||
237 | * | ||
238 | * @see Match | ||
239 | * @see CreateHostInstance | ||
240 | * | ||
241 | */ | ||
242 | public static class Matcher extends BaseMatcher<CreateHostInstance.Match> { | ||
243 | /** | ||
244 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
245 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
246 | * | ||
247 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
248 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
249 | * | ||
250 | */ | ||
251 | public static CreateHostInstance.Matcher on(final ViatraQueryEngine engine) { | ||
252 | // check if matcher already exists | ||
253 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
254 | if (matcher == null) { | ||
255 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
256 | } | ||
257 | return matcher; | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
262 | * @return an initialized matcher | ||
263 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
264 | * | ||
265 | */ | ||
266 | public static CreateHostInstance.Matcher create() { | ||
267 | return new Matcher(); | ||
268 | } | ||
269 | |||
270 | private static final int POSITION_HOSTTYPE = 0; | ||
271 | |||
272 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CreateHostInstance.Matcher.class); | ||
273 | |||
274 | /** | ||
275 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
276 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
277 | * | ||
278 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
279 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
280 | * | ||
281 | */ | ||
282 | private Matcher() { | ||
283 | super(querySpecification()); | ||
284 | } | ||
285 | |||
286 | /** | ||
287 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
288 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
289 | * @return matches represented as a Match object. | ||
290 | * | ||
291 | */ | ||
292 | public Collection<CreateHostInstance.Match> getAllMatches(final HostType pHostType) { | ||
293 | return rawStreamAllMatches(new Object[]{pHostType}).collect(Collectors.toSet()); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
298 | * </p> | ||
299 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
300 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
301 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
302 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
303 | * @return a stream of matches represented as a Match object. | ||
304 | * | ||
305 | */ | ||
306 | public Stream<CreateHostInstance.Match> streamAllMatches(final HostType pHostType) { | ||
307 | return rawStreamAllMatches(new Object[]{pHostType}); | ||
308 | } | ||
309 | |||
310 | /** | ||
311 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
312 | * Neither determinism nor randomness of selection is guaranteed. | ||
313 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
314 | * @return a match represented as a Match object, or null if no match is found. | ||
315 | * | ||
316 | */ | ||
317 | public Optional<CreateHostInstance.Match> getOneArbitraryMatch(final HostType pHostType) { | ||
318 | return rawGetOneArbitraryMatch(new Object[]{pHostType}); | ||
319 | } | ||
320 | |||
321 | /** | ||
322 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
323 | * under any possible substitution of the unspecified parameters (if any). | ||
324 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
325 | * @return true if the input is a valid (partial) match of the pattern. | ||
326 | * | ||
327 | */ | ||
328 | public boolean hasMatch(final HostType pHostType) { | ||
329 | return rawHasMatch(new Object[]{pHostType}); | ||
330 | } | ||
331 | |||
332 | /** | ||
333 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
334 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
335 | * @return the number of pattern matches found. | ||
336 | * | ||
337 | */ | ||
338 | public int countMatches(final HostType pHostType) { | ||
339 | return rawCountMatches(new Object[]{pHostType}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
344 | * Neither determinism nor randomness of selection is guaranteed. | ||
345 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
346 | * @param processor the action that will process the selected match. | ||
347 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
348 | * | ||
349 | */ | ||
350 | public boolean forOneArbitraryMatch(final HostType pHostType, final Consumer<? super CreateHostInstance.Match> processor) { | ||
351 | return rawForOneArbitraryMatch(new Object[]{pHostType}, processor); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * Returns a new (partial) match. | ||
356 | * This can be used e.g. to call the matcher with a partial match. | ||
357 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
358 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
359 | * @return the (partial) match object. | ||
360 | * | ||
361 | */ | ||
362 | public CreateHostInstance.Match newMatch(final HostType pHostType) { | ||
363 | return CreateHostInstance.Match.newMatch(pHostType); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Retrieve the set of values that occur in matches for HostType. | ||
368 | * @return the Set of all values or empty set if there are no matches | ||
369 | * | ||
370 | */ | ||
371 | protected Stream<HostType> rawStreamAllValuesOfHostType(final Object[] parameters) { | ||
372 | return rawStreamAllValues(POSITION_HOSTTYPE, parameters).map(HostType.class::cast); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * Retrieve the set of values that occur in matches for HostType. | ||
377 | * @return the Set of all values or empty set if there are no matches | ||
378 | * | ||
379 | */ | ||
380 | public Set<HostType> getAllValuesOfHostType() { | ||
381 | return rawStreamAllValuesOfHostType(emptyArray()).collect(Collectors.toSet()); | ||
382 | } | ||
383 | |||
384 | /** | ||
385 | * Retrieve the set of values that occur in matches for HostType. | ||
386 | * @return the Set of all values or empty set if there are no matches | ||
387 | * | ||
388 | */ | ||
389 | public Stream<HostType> streamAllValuesOfHostType() { | ||
390 | return rawStreamAllValuesOfHostType(emptyArray()); | ||
391 | } | ||
392 | |||
393 | @Override | ||
394 | protected CreateHostInstance.Match tupleToMatch(final Tuple t) { | ||
395 | try { | ||
396 | return CreateHostInstance.Match.newMatch((HostType) t.get(POSITION_HOSTTYPE)); | ||
397 | } catch(ClassCastException e) { | ||
398 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
399 | return null; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | @Override | ||
404 | protected CreateHostInstance.Match arrayToMatch(final Object[] match) { | ||
405 | try { | ||
406 | return CreateHostInstance.Match.newMatch((HostType) match[POSITION_HOSTTYPE]); | ||
407 | } catch(ClassCastException e) { | ||
408 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
409 | return null; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | @Override | ||
414 | protected CreateHostInstance.Match arrayToMatchMutable(final Object[] match) { | ||
415 | try { | ||
416 | return CreateHostInstance.Match.newMutableMatch((HostType) match[POSITION_HOSTTYPE]); | ||
417 | } catch(ClassCastException e) { | ||
418 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
419 | return null; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | /** | ||
424 | * @return the singleton instance of the query specification of this pattern | ||
425 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
426 | * | ||
427 | */ | ||
428 | public static IQuerySpecification<CreateHostInstance.Matcher> querySpecification() { | ||
429 | return CreateHostInstance.instance(); | ||
430 | } | ||
431 | } | ||
432 | |||
433 | private CreateHostInstance() { | ||
434 | super(GeneratedPQuery.INSTANCE); | ||
435 | } | ||
436 | |||
437 | /** | ||
438 | * @return the singleton instance of the query specification | ||
439 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
440 | * | ||
441 | */ | ||
442 | public static CreateHostInstance instance() { | ||
443 | try{ | ||
444 | return LazyHolder.INSTANCE; | ||
445 | } catch (ExceptionInInitializerError err) { | ||
446 | throw processInitializerError(err); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | @Override | ||
451 | protected CreateHostInstance.Matcher instantiate(final ViatraQueryEngine engine) { | ||
452 | return CreateHostInstance.Matcher.on(engine); | ||
453 | } | ||
454 | |||
455 | @Override | ||
456 | public CreateHostInstance.Matcher instantiate() { | ||
457 | return CreateHostInstance.Matcher.create(); | ||
458 | } | ||
459 | |||
460 | @Override | ||
461 | public CreateHostInstance.Match newEmptyMatch() { | ||
462 | return CreateHostInstance.Match.newEmptyMatch(); | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | public CreateHostInstance.Match newMatch(final Object... parameters) { | ||
467 | return CreateHostInstance.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostType) parameters[0]); | ||
468 | } | ||
469 | |||
470 | /** | ||
471 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CreateHostInstance (visibility: PUBLIC, simpleName: CreateHostInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CreateHostInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
472 | * <b>not</b> at the class load time of the outer class, | ||
473 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CreateHostInstance (visibility: PUBLIC, simpleName: CreateHostInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.CreateHostInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
474 | * | ||
475 | * <p> This workaround is required e.g. to support recursion. | ||
476 | * | ||
477 | */ | ||
478 | private static class LazyHolder { | ||
479 | private static final CreateHostInstance INSTANCE = new CreateHostInstance(); | ||
480 | |||
481 | /** | ||
482 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
483 | * This initialization order is required to support indirect recursion. | ||
484 | * | ||
485 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
486 | * | ||
487 | */ | ||
488 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
489 | |||
490 | public static Object ensureInitialized() { | ||
491 | INSTANCE.ensureInitializedInternal(); | ||
492 | return null; | ||
493 | } | ||
494 | } | ||
495 | |||
496 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
497 | private static final CreateHostInstance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
498 | |||
499 | private final PParameter parameter_HostType = new PParameter("HostType", "hu.bme.mit.inf.dslreasoner.domains.cps.HostType", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostType")), PParameterDirection.INOUT); | ||
500 | |||
501 | private final List<PParameter> parameters = Arrays.asList(parameter_HostType); | ||
502 | |||
503 | private GeneratedPQuery() { | ||
504 | super(PVisibility.PUBLIC); | ||
505 | } | ||
506 | |||
507 | @Override | ||
508 | public String getFullyQualifiedName() { | ||
509 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.createHostInstance"; | ||
510 | } | ||
511 | |||
512 | @Override | ||
513 | public List<String> getParameterNames() { | ||
514 | return Arrays.asList("HostType"); | ||
515 | } | ||
516 | |||
517 | @Override | ||
518 | public List<PParameter> getParameters() { | ||
519 | return parameters; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public Set<PBody> doGetContainedBodies() { | ||
524 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
525 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
526 | { | ||
527 | PBody body = new PBody(this); | ||
528 | PVariable var_HostType = body.getOrCreateVariableByName("HostType"); | ||
529 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
530 | new TypeConstraint(body, Tuples.flatTupleOf(var_HostType), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
531 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
532 | new ExportedParameter(body, var_HostType, parameter_HostType) | ||
533 | )); | ||
534 | // find unallocatedAppInstance(App) | ||
535 | new PositivePatternCall(body, Tuples.flatTupleOf(var_App), UnallocatedAppInstance.instance().getInternalQueryRepresentation()); | ||
536 | // ApplicationInstance.type.requirements.hostType(App, HostType) | ||
537 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
538 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
539 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "type"))); | ||
540 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationType"))); | ||
541 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
542 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationType", "requirements"))); | ||
543 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
544 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
545 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "hostType"))); | ||
546 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
547 | new Equality(body, var__virtual_2_, var_HostType); | ||
548 | bodies.add(body); | ||
549 | } | ||
550 | return bodies; | ||
551 | } | ||
552 | } | ||
553 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/GuidanceObjective.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/GuidanceObjective.java new file mode 100644 index 00000000..cfed0c4b --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/GuidanceObjective.java | |||
@@ -0,0 +1,591 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.NoHostToAllocateTo; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.RequiredAppInstances; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.UnallocatedAppInstance; | ||
9 | import java.util.Arrays; | ||
10 | import java.util.Collection; | ||
11 | import java.util.LinkedHashSet; | ||
12 | import java.util.List; | ||
13 | import java.util.Objects; | ||
14 | import java.util.Optional; | ||
15 | import java.util.Set; | ||
16 | import java.util.function.Consumer; | ||
17 | import java.util.stream.Collectors; | ||
18 | import java.util.stream.Stream; | ||
19 | import org.apache.log4j.Logger; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
44 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
45 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
46 | |||
47 | /** | ||
48 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
49 | * | ||
50 | * <p>Original source: | ||
51 | * <code><pre> | ||
52 | * pattern guidanceObjective(Value : java Integer) { | ||
53 | * UnallocatedInstances == count find unallocatedAppInstance(_); | ||
54 | * RequiredInstances == sum find requiredAppInstances(_, #_); | ||
55 | * NoHostToAllocate == count find noHostToAllocateTo(_); | ||
56 | * Value == eval(2 UnallocatedInstances + 4 RequiredInstances + NoHostToAllocate); | ||
57 | * } | ||
58 | * </pre></code> | ||
59 | * | ||
60 | * @see Matcher | ||
61 | * @see Match | ||
62 | * | ||
63 | */ | ||
64 | @SuppressWarnings("all") | ||
65 | public final class GuidanceObjective extends BaseGeneratedEMFQuerySpecification<GuidanceObjective.Matcher> { | ||
66 | /** | ||
67 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.guidanceObjective pattern, | ||
68 | * to be used in conjunction with {@link Matcher}. | ||
69 | * | ||
70 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
71 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
72 | * usable to represent a match of the pattern in the result of a query, | ||
73 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
74 | * | ||
75 | * @see Matcher | ||
76 | * | ||
77 | */ | ||
78 | public static abstract class Match extends BasePatternMatch { | ||
79 | private Integer fValue; | ||
80 | |||
81 | private static List<String> parameterNames = makeImmutableList("Value"); | ||
82 | |||
83 | private Match(final Integer pValue) { | ||
84 | this.fValue = pValue; | ||
85 | } | ||
86 | |||
87 | @Override | ||
88 | public Object get(final String parameterName) { | ||
89 | if ("Value".equals(parameterName)) return this.fValue; | ||
90 | return null; | ||
91 | } | ||
92 | |||
93 | public Integer getValue() { | ||
94 | return this.fValue; | ||
95 | } | ||
96 | |||
97 | @Override | ||
98 | public boolean set(final String parameterName, final Object newValue) { | ||
99 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
100 | if ("Value".equals(parameterName) ) { | ||
101 | this.fValue = (Integer) newValue; | ||
102 | return true; | ||
103 | } | ||
104 | return false; | ||
105 | } | ||
106 | |||
107 | public void setValue(final Integer pValue) { | ||
108 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
109 | this.fValue = pValue; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public String patternName() { | ||
114 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.guidanceObjective"; | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public List<String> parameterNames() { | ||
119 | return GuidanceObjective.Match.parameterNames; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public Object[] toArray() { | ||
124 | return new Object[]{fValue}; | ||
125 | } | ||
126 | |||
127 | @Override | ||
128 | public GuidanceObjective.Match toImmutable() { | ||
129 | return isMutable() ? newMatch(fValue) : this; | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public String prettyPrint() { | ||
134 | StringBuilder result = new StringBuilder(); | ||
135 | result.append("\"Value\"=" + prettyPrintValue(fValue)); | ||
136 | return result.toString(); | ||
137 | } | ||
138 | |||
139 | @Override | ||
140 | public int hashCode() { | ||
141 | return Objects.hash(fValue); | ||
142 | } | ||
143 | |||
144 | @Override | ||
145 | public boolean equals(final Object obj) { | ||
146 | if (this == obj) | ||
147 | return true; | ||
148 | if (obj == null) { | ||
149 | return false; | ||
150 | } | ||
151 | if ((obj instanceof GuidanceObjective.Match)) { | ||
152 | GuidanceObjective.Match other = (GuidanceObjective.Match) obj; | ||
153 | return Objects.equals(fValue, other.fValue); | ||
154 | } else { | ||
155 | // this should be infrequent | ||
156 | if (!(obj instanceof IPatternMatch)) { | ||
157 | return false; | ||
158 | } | ||
159 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
160 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | @Override | ||
165 | public GuidanceObjective specification() { | ||
166 | return GuidanceObjective.instance(); | ||
167 | } | ||
168 | |||
169 | /** | ||
170 | * Returns an empty, mutable match. | ||
171 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
172 | * | ||
173 | * @return the empty match. | ||
174 | * | ||
175 | */ | ||
176 | public static GuidanceObjective.Match newEmptyMatch() { | ||
177 | return new Mutable(null); | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * Returns a mutable (partial) match. | ||
182 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
183 | * | ||
184 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
185 | * @return the new, mutable (partial) match object. | ||
186 | * | ||
187 | */ | ||
188 | public static GuidanceObjective.Match newMutableMatch(final Integer pValue) { | ||
189 | return new Mutable(pValue); | ||
190 | } | ||
191 | |||
192 | /** | ||
193 | * Returns a new (partial) match. | ||
194 | * This can be used e.g. to call the matcher with a partial match. | ||
195 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
196 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
197 | * @return the (partial) match object. | ||
198 | * | ||
199 | */ | ||
200 | public static GuidanceObjective.Match newMatch(final Integer pValue) { | ||
201 | return new Immutable(pValue); | ||
202 | } | ||
203 | |||
204 | private static final class Mutable extends GuidanceObjective.Match { | ||
205 | Mutable(final Integer pValue) { | ||
206 | super(pValue); | ||
207 | } | ||
208 | |||
209 | @Override | ||
210 | public boolean isMutable() { | ||
211 | return true; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | private static final class Immutable extends GuidanceObjective.Match { | ||
216 | Immutable(final Integer pValue) { | ||
217 | super(pValue); | ||
218 | } | ||
219 | |||
220 | @Override | ||
221 | public boolean isMutable() { | ||
222 | return false; | ||
223 | } | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.guidanceObjective pattern, | ||
229 | * providing pattern-specific query methods. | ||
230 | * | ||
231 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
232 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
233 | * | ||
234 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
235 | * | ||
236 | * <p>Original source: | ||
237 | * <code><pre> | ||
238 | * pattern guidanceObjective(Value : java Integer) { | ||
239 | * UnallocatedInstances == count find unallocatedAppInstance(_); | ||
240 | * RequiredInstances == sum find requiredAppInstances(_, #_); | ||
241 | * NoHostToAllocate == count find noHostToAllocateTo(_); | ||
242 | * Value == eval(2 UnallocatedInstances + 4 RequiredInstances + NoHostToAllocate); | ||
243 | * } | ||
244 | * </pre></code> | ||
245 | * | ||
246 | * @see Match | ||
247 | * @see GuidanceObjective | ||
248 | * | ||
249 | */ | ||
250 | public static class Matcher extends BaseMatcher<GuidanceObjective.Match> { | ||
251 | /** | ||
252 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
253 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
254 | * | ||
255 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
256 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
257 | * | ||
258 | */ | ||
259 | public static GuidanceObjective.Matcher on(final ViatraQueryEngine engine) { | ||
260 | // check if matcher already exists | ||
261 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
262 | if (matcher == null) { | ||
263 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
264 | } | ||
265 | return matcher; | ||
266 | } | ||
267 | |||
268 | /** | ||
269 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
270 | * @return an initialized matcher | ||
271 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
272 | * | ||
273 | */ | ||
274 | public static GuidanceObjective.Matcher create() { | ||
275 | return new Matcher(); | ||
276 | } | ||
277 | |||
278 | private static final int POSITION_VALUE = 0; | ||
279 | |||
280 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(GuidanceObjective.Matcher.class); | ||
281 | |||
282 | /** | ||
283 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
284 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
285 | * | ||
286 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
287 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
288 | * | ||
289 | */ | ||
290 | private Matcher() { | ||
291 | super(querySpecification()); | ||
292 | } | ||
293 | |||
294 | /** | ||
295 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
296 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
297 | * @return matches represented as a Match object. | ||
298 | * | ||
299 | */ | ||
300 | public Collection<GuidanceObjective.Match> getAllMatches(final Integer pValue) { | ||
301 | return rawStreamAllMatches(new Object[]{pValue}).collect(Collectors.toSet()); | ||
302 | } | ||
303 | |||
304 | /** | ||
305 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
306 | * </p> | ||
307 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
308 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
309 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
310 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
311 | * @return a stream of matches represented as a Match object. | ||
312 | * | ||
313 | */ | ||
314 | public Stream<GuidanceObjective.Match> streamAllMatches(final Integer pValue) { | ||
315 | return rawStreamAllMatches(new Object[]{pValue}); | ||
316 | } | ||
317 | |||
318 | /** | ||
319 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
320 | * Neither determinism nor randomness of selection is guaranteed. | ||
321 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
322 | * @return a match represented as a Match object, or null if no match is found. | ||
323 | * | ||
324 | */ | ||
325 | public Optional<GuidanceObjective.Match> getOneArbitraryMatch(final Integer pValue) { | ||
326 | return rawGetOneArbitraryMatch(new Object[]{pValue}); | ||
327 | } | ||
328 | |||
329 | /** | ||
330 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
331 | * under any possible substitution of the unspecified parameters (if any). | ||
332 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
333 | * @return true if the input is a valid (partial) match of the pattern. | ||
334 | * | ||
335 | */ | ||
336 | public boolean hasMatch(final Integer pValue) { | ||
337 | return rawHasMatch(new Object[]{pValue}); | ||
338 | } | ||
339 | |||
340 | /** | ||
341 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
342 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
343 | * @return the number of pattern matches found. | ||
344 | * | ||
345 | */ | ||
346 | public int countMatches(final Integer pValue) { | ||
347 | return rawCountMatches(new Object[]{pValue}); | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
352 | * Neither determinism nor randomness of selection is guaranteed. | ||
353 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
354 | * @param processor the action that will process the selected match. | ||
355 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
356 | * | ||
357 | */ | ||
358 | public boolean forOneArbitraryMatch(final Integer pValue, final Consumer<? super GuidanceObjective.Match> processor) { | ||
359 | return rawForOneArbitraryMatch(new Object[]{pValue}, processor); | ||
360 | } | ||
361 | |||
362 | /** | ||
363 | * Returns a new (partial) match. | ||
364 | * This can be used e.g. to call the matcher with a partial match. | ||
365 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
366 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
367 | * @return the (partial) match object. | ||
368 | * | ||
369 | */ | ||
370 | public GuidanceObjective.Match newMatch(final Integer pValue) { | ||
371 | return GuidanceObjective.Match.newMatch(pValue); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * Retrieve the set of values that occur in matches for Value. | ||
376 | * @return the Set of all values or empty set if there are no matches | ||
377 | * | ||
378 | */ | ||
379 | protected Stream<Integer> rawStreamAllValuesOfValue(final Object[] parameters) { | ||
380 | return rawStreamAllValues(POSITION_VALUE, parameters).map(Integer.class::cast); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * Retrieve the set of values that occur in matches for Value. | ||
385 | * @return the Set of all values or empty set if there are no matches | ||
386 | * | ||
387 | */ | ||
388 | public Set<Integer> getAllValuesOfValue() { | ||
389 | return rawStreamAllValuesOfValue(emptyArray()).collect(Collectors.toSet()); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * Retrieve the set of values that occur in matches for Value. | ||
394 | * @return the Set of all values or empty set if there are no matches | ||
395 | * | ||
396 | */ | ||
397 | public Stream<Integer> streamAllValuesOfValue() { | ||
398 | return rawStreamAllValuesOfValue(emptyArray()); | ||
399 | } | ||
400 | |||
401 | @Override | ||
402 | protected GuidanceObjective.Match tupleToMatch(final Tuple t) { | ||
403 | try { | ||
404 | return GuidanceObjective.Match.newMatch((Integer) t.get(POSITION_VALUE)); | ||
405 | } catch(ClassCastException e) { | ||
406 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
407 | return null; | ||
408 | } | ||
409 | } | ||
410 | |||
411 | @Override | ||
412 | protected GuidanceObjective.Match arrayToMatch(final Object[] match) { | ||
413 | try { | ||
414 | return GuidanceObjective.Match.newMatch((Integer) match[POSITION_VALUE]); | ||
415 | } catch(ClassCastException e) { | ||
416 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
417 | return null; | ||
418 | } | ||
419 | } | ||
420 | |||
421 | @Override | ||
422 | protected GuidanceObjective.Match arrayToMatchMutable(final Object[] match) { | ||
423 | try { | ||
424 | return GuidanceObjective.Match.newMutableMatch((Integer) match[POSITION_VALUE]); | ||
425 | } catch(ClassCastException e) { | ||
426 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
427 | return null; | ||
428 | } | ||
429 | } | ||
430 | |||
431 | /** | ||
432 | * @return the singleton instance of the query specification of this pattern | ||
433 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
434 | * | ||
435 | */ | ||
436 | public static IQuerySpecification<GuidanceObjective.Matcher> querySpecification() { | ||
437 | return GuidanceObjective.instance(); | ||
438 | } | ||
439 | } | ||
440 | |||
441 | private GuidanceObjective() { | ||
442 | super(GeneratedPQuery.INSTANCE); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * @return the singleton instance of the query specification | ||
447 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
448 | * | ||
449 | */ | ||
450 | public static GuidanceObjective instance() { | ||
451 | try{ | ||
452 | return LazyHolder.INSTANCE; | ||
453 | } catch (ExceptionInInitializerError err) { | ||
454 | throw processInitializerError(err); | ||
455 | } | ||
456 | } | ||
457 | |||
458 | @Override | ||
459 | protected GuidanceObjective.Matcher instantiate(final ViatraQueryEngine engine) { | ||
460 | return GuidanceObjective.Matcher.on(engine); | ||
461 | } | ||
462 | |||
463 | @Override | ||
464 | public GuidanceObjective.Matcher instantiate() { | ||
465 | return GuidanceObjective.Matcher.create(); | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | public GuidanceObjective.Match newEmptyMatch() { | ||
470 | return GuidanceObjective.Match.newEmptyMatch(); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public GuidanceObjective.Match newMatch(final Object... parameters) { | ||
475 | return GuidanceObjective.Match.newMatch((java.lang.Integer) parameters[0]); | ||
476 | } | ||
477 | |||
478 | /** | ||
479 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.GuidanceObjective (visibility: PUBLIC, simpleName: GuidanceObjective, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.GuidanceObjective, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
480 | * <b>not</b> at the class load time of the outer class, | ||
481 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.GuidanceObjective (visibility: PUBLIC, simpleName: GuidanceObjective, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.GuidanceObjective, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
482 | * | ||
483 | * <p> This workaround is required e.g. to support recursion. | ||
484 | * | ||
485 | */ | ||
486 | private static class LazyHolder { | ||
487 | private static final GuidanceObjective INSTANCE = new GuidanceObjective(); | ||
488 | |||
489 | /** | ||
490 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
491 | * This initialization order is required to support indirect recursion. | ||
492 | * | ||
493 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
494 | * | ||
495 | */ | ||
496 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
497 | |||
498 | public static Object ensureInitialized() { | ||
499 | INSTANCE.ensureInitializedInternal(); | ||
500 | return null; | ||
501 | } | ||
502 | } | ||
503 | |||
504 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
505 | private static final GuidanceObjective.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
506 | |||
507 | private final PParameter parameter_Value = new PParameter("Value", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
508 | |||
509 | private final List<PParameter> parameters = Arrays.asList(parameter_Value); | ||
510 | |||
511 | private GeneratedPQuery() { | ||
512 | super(PVisibility.PUBLIC); | ||
513 | } | ||
514 | |||
515 | @Override | ||
516 | public String getFullyQualifiedName() { | ||
517 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.guidanceObjective"; | ||
518 | } | ||
519 | |||
520 | @Override | ||
521 | public List<String> getParameterNames() { | ||
522 | return Arrays.asList("Value"); | ||
523 | } | ||
524 | |||
525 | @Override | ||
526 | public List<PParameter> getParameters() { | ||
527 | return parameters; | ||
528 | } | ||
529 | |||
530 | @Override | ||
531 | public Set<PBody> doGetContainedBodies() { | ||
532 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
533 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
534 | { | ||
535 | PBody body = new PBody(this); | ||
536 | PVariable var_Value = body.getOrCreateVariableByName("Value"); | ||
537 | PVariable var_UnallocatedInstances = body.getOrCreateVariableByName("UnallocatedInstances"); | ||
538 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
539 | PVariable var_RequiredInstances = body.getOrCreateVariableByName("RequiredInstances"); | ||
540 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
541 | PVariable var___2_ = body.getOrCreateVariableByName("_<2>"); | ||
542 | PVariable var_NoHostToAllocate = body.getOrCreateVariableByName("NoHostToAllocate"); | ||
543 | PVariable var___3_ = body.getOrCreateVariableByName("_<3>"); | ||
544 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Value), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
545 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
546 | new ExportedParameter(body, var_Value, parameter_Value) | ||
547 | )); | ||
548 | // UnallocatedInstances == count find unallocatedAppInstance(_) | ||
549 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
550 | new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_), UnallocatedAppInstance.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
551 | new Equality(body, var_UnallocatedInstances, var__virtual_0_); | ||
552 | // RequiredInstances == sum find requiredAppInstances(_, #_) | ||
553 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
554 | new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var___1_, var___2_), RequiredAppInstances.instance().getInternalQueryRepresentation(), var__virtual_1_, 1); | ||
555 | new Equality(body, var_RequiredInstances, var__virtual_1_); | ||
556 | // NoHostToAllocate == count find noHostToAllocateTo(_) | ||
557 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
558 | new PatternMatchCounter(body, Tuples.flatTupleOf(var___3_), NoHostToAllocateTo.instance().getInternalQueryRepresentation(), var__virtual_2_); | ||
559 | new Equality(body, var_NoHostToAllocate, var__virtual_2_); | ||
560 | // Value == eval(2 * UnallocatedInstances + 4 * RequiredInstances + NoHostToAllocate) | ||
561 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
562 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
563 | |||
564 | @Override | ||
565 | public String getShortDescription() { | ||
566 | return "Expression evaluation from pattern guidanceObjective"; | ||
567 | } | ||
568 | |||
569 | @Override | ||
570 | public Iterable<String> getInputParameterNames() { | ||
571 | return Arrays.asList("NoHostToAllocate", "RequiredInstances", "UnallocatedInstances");} | ||
572 | |||
573 | @Override | ||
574 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
575 | Integer NoHostToAllocate = (Integer) provider.getValue("NoHostToAllocate"); | ||
576 | Integer RequiredInstances = (Integer) provider.getValue("RequiredInstances"); | ||
577 | Integer UnallocatedInstances = (Integer) provider.getValue("UnallocatedInstances"); | ||
578 | return evaluateExpression_1_1(NoHostToAllocate, RequiredInstances, UnallocatedInstances); | ||
579 | } | ||
580 | }, var__virtual_3_ ); | ||
581 | new Equality(body, var_Value, var__virtual_3_); | ||
582 | bodies.add(body); | ||
583 | } | ||
584 | return bodies; | ||
585 | } | ||
586 | } | ||
587 | |||
588 | private static int evaluateExpression_1_1(final Integer NoHostToAllocate, final Integer RequiredInstances, final Integer UnallocatedInstances) { | ||
589 | return (((2 * (UnallocatedInstances).intValue()) + (4 * (RequiredInstances).intValue())) + (NoHostToAllocate).intValue()); | ||
590 | } | ||
591 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/InstanceDoesNotSatisfyRequirement.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/InstanceDoesNotSatisfyRequirement.java new file mode 100644 index 00000000..14deb337 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/InstanceDoesNotSatisfyRequirement.java | |||
@@ -0,0 +1,716 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.Requirement; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.SatisfyingInstance; | ||
9 | import java.util.Arrays; | ||
10 | import java.util.Collection; | ||
11 | import java.util.LinkedHashSet; | ||
12 | import java.util.List; | ||
13 | import java.util.Objects; | ||
14 | import java.util.Optional; | ||
15 | import java.util.Set; | ||
16 | import java.util.function.Consumer; | ||
17 | import java.util.stream.Collectors; | ||
18 | import java.util.stream.Stream; | ||
19 | import org.apache.log4j.Logger; | ||
20 | import org.eclipse.emf.ecore.EClass; | ||
21 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
22 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
27 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
44 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
45 | |||
46 | /** | ||
47 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
48 | * | ||
49 | * <p>Original source: | ||
50 | * <code><pre> | ||
51 | * {@literal @}Constraint(severity = "error", key = {Req, App}, | ||
52 | * message = "Requirement must be satisfied by the required application type.") | ||
53 | * pattern instanceDoesNotSatisfyRequirement(Req : Requirement, App : ApplicationInstance) { | ||
54 | * Requirement.instances(Req, App); | ||
55 | * neg find satisfyingInstance(Req, App); | ||
56 | * } | ||
57 | * </pre></code> | ||
58 | * | ||
59 | * @see Matcher | ||
60 | * @see Match | ||
61 | * | ||
62 | */ | ||
63 | @SuppressWarnings("all") | ||
64 | public final class InstanceDoesNotSatisfyRequirement extends BaseGeneratedEMFQuerySpecification<InstanceDoesNotSatisfyRequirement.Matcher> { | ||
65 | /** | ||
66 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.instanceDoesNotSatisfyRequirement pattern, | ||
67 | * to be used in conjunction with {@link Matcher}. | ||
68 | * | ||
69 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
70 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
71 | * usable to represent a match of the pattern in the result of a query, | ||
72 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
73 | * | ||
74 | * @see Matcher | ||
75 | * | ||
76 | */ | ||
77 | public static abstract class Match extends BasePatternMatch { | ||
78 | private Requirement fReq; | ||
79 | |||
80 | private ApplicationInstance fApp; | ||
81 | |||
82 | private static List<String> parameterNames = makeImmutableList("Req", "App"); | ||
83 | |||
84 | private Match(final Requirement pReq, final ApplicationInstance pApp) { | ||
85 | this.fReq = pReq; | ||
86 | this.fApp = pApp; | ||
87 | } | ||
88 | |||
89 | @Override | ||
90 | public Object get(final String parameterName) { | ||
91 | if ("Req".equals(parameterName)) return this.fReq; | ||
92 | if ("App".equals(parameterName)) return this.fApp; | ||
93 | return null; | ||
94 | } | ||
95 | |||
96 | public Requirement getReq() { | ||
97 | return this.fReq; | ||
98 | } | ||
99 | |||
100 | public ApplicationInstance getApp() { | ||
101 | return this.fApp; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public boolean set(final String parameterName, final Object newValue) { | ||
106 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
107 | if ("Req".equals(parameterName) ) { | ||
108 | this.fReq = (Requirement) newValue; | ||
109 | return true; | ||
110 | } | ||
111 | if ("App".equals(parameterName) ) { | ||
112 | this.fApp = (ApplicationInstance) newValue; | ||
113 | return true; | ||
114 | } | ||
115 | return false; | ||
116 | } | ||
117 | |||
118 | public void setReq(final Requirement pReq) { | ||
119 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
120 | this.fReq = pReq; | ||
121 | } | ||
122 | |||
123 | public void setApp(final ApplicationInstance pApp) { | ||
124 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
125 | this.fApp = pApp; | ||
126 | } | ||
127 | |||
128 | @Override | ||
129 | public String patternName() { | ||
130 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.instanceDoesNotSatisfyRequirement"; | ||
131 | } | ||
132 | |||
133 | @Override | ||
134 | public List<String> parameterNames() { | ||
135 | return InstanceDoesNotSatisfyRequirement.Match.parameterNames; | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public Object[] toArray() { | ||
140 | return new Object[]{fReq, fApp}; | ||
141 | } | ||
142 | |||
143 | @Override | ||
144 | public InstanceDoesNotSatisfyRequirement.Match toImmutable() { | ||
145 | return isMutable() ? newMatch(fReq, fApp) : this; | ||
146 | } | ||
147 | |||
148 | @Override | ||
149 | public String prettyPrint() { | ||
150 | StringBuilder result = new StringBuilder(); | ||
151 | result.append("\"Req\"=" + prettyPrintValue(fReq) + ", "); | ||
152 | result.append("\"App\"=" + prettyPrintValue(fApp)); | ||
153 | return result.toString(); | ||
154 | } | ||
155 | |||
156 | @Override | ||
157 | public int hashCode() { | ||
158 | return Objects.hash(fReq, fApp); | ||
159 | } | ||
160 | |||
161 | @Override | ||
162 | public boolean equals(final Object obj) { | ||
163 | if (this == obj) | ||
164 | return true; | ||
165 | if (obj == null) { | ||
166 | return false; | ||
167 | } | ||
168 | if ((obj instanceof InstanceDoesNotSatisfyRequirement.Match)) { | ||
169 | InstanceDoesNotSatisfyRequirement.Match other = (InstanceDoesNotSatisfyRequirement.Match) obj; | ||
170 | return Objects.equals(fReq, other.fReq) && Objects.equals(fApp, other.fApp); | ||
171 | } else { | ||
172 | // this should be infrequent | ||
173 | if (!(obj instanceof IPatternMatch)) { | ||
174 | return false; | ||
175 | } | ||
176 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
177 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | @Override | ||
182 | public InstanceDoesNotSatisfyRequirement specification() { | ||
183 | return InstanceDoesNotSatisfyRequirement.instance(); | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * Returns an empty, mutable match. | ||
188 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
189 | * | ||
190 | * @return the empty match. | ||
191 | * | ||
192 | */ | ||
193 | public static InstanceDoesNotSatisfyRequirement.Match newEmptyMatch() { | ||
194 | return new Mutable(null, null); | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * Returns a mutable (partial) match. | ||
199 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
200 | * | ||
201 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
202 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
203 | * @return the new, mutable (partial) match object. | ||
204 | * | ||
205 | */ | ||
206 | public static InstanceDoesNotSatisfyRequirement.Match newMutableMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
207 | return new Mutable(pReq, pApp); | ||
208 | } | ||
209 | |||
210 | /** | ||
211 | * Returns a new (partial) match. | ||
212 | * This can be used e.g. to call the matcher with a partial match. | ||
213 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
214 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
215 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
216 | * @return the (partial) match object. | ||
217 | * | ||
218 | */ | ||
219 | public static InstanceDoesNotSatisfyRequirement.Match newMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
220 | return new Immutable(pReq, pApp); | ||
221 | } | ||
222 | |||
223 | private static final class Mutable extends InstanceDoesNotSatisfyRequirement.Match { | ||
224 | Mutable(final Requirement pReq, final ApplicationInstance pApp) { | ||
225 | super(pReq, pApp); | ||
226 | } | ||
227 | |||
228 | @Override | ||
229 | public boolean isMutable() { | ||
230 | return true; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | private static final class Immutable extends InstanceDoesNotSatisfyRequirement.Match { | ||
235 | Immutable(final Requirement pReq, final ApplicationInstance pApp) { | ||
236 | super(pReq, pApp); | ||
237 | } | ||
238 | |||
239 | @Override | ||
240 | public boolean isMutable() { | ||
241 | return false; | ||
242 | } | ||
243 | } | ||
244 | } | ||
245 | |||
246 | /** | ||
247 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.instanceDoesNotSatisfyRequirement pattern, | ||
248 | * providing pattern-specific query methods. | ||
249 | * | ||
250 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
251 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
252 | * | ||
253 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
254 | * | ||
255 | * <p>Original source: | ||
256 | * <code><pre> | ||
257 | * {@literal @}Constraint(severity = "error", key = {Req, App}, | ||
258 | * message = "Requirement must be satisfied by the required application type.") | ||
259 | * pattern instanceDoesNotSatisfyRequirement(Req : Requirement, App : ApplicationInstance) { | ||
260 | * Requirement.instances(Req, App); | ||
261 | * neg find satisfyingInstance(Req, App); | ||
262 | * } | ||
263 | * </pre></code> | ||
264 | * | ||
265 | * @see Match | ||
266 | * @see InstanceDoesNotSatisfyRequirement | ||
267 | * | ||
268 | */ | ||
269 | public static class Matcher extends BaseMatcher<InstanceDoesNotSatisfyRequirement.Match> { | ||
270 | /** | ||
271 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
272 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
273 | * | ||
274 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
275 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
276 | * | ||
277 | */ | ||
278 | public static InstanceDoesNotSatisfyRequirement.Matcher on(final ViatraQueryEngine engine) { | ||
279 | // check if matcher already exists | ||
280 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
281 | if (matcher == null) { | ||
282 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
283 | } | ||
284 | return matcher; | ||
285 | } | ||
286 | |||
287 | /** | ||
288 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
289 | * @return an initialized matcher | ||
290 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
291 | * | ||
292 | */ | ||
293 | public static InstanceDoesNotSatisfyRequirement.Matcher create() { | ||
294 | return new Matcher(); | ||
295 | } | ||
296 | |||
297 | private static final int POSITION_REQ = 0; | ||
298 | |||
299 | private static final int POSITION_APP = 1; | ||
300 | |||
301 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(InstanceDoesNotSatisfyRequirement.Matcher.class); | ||
302 | |||
303 | /** | ||
304 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
305 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
306 | * | ||
307 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
308 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
309 | * | ||
310 | */ | ||
311 | private Matcher() { | ||
312 | super(querySpecification()); | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
317 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
318 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
319 | * @return matches represented as a Match object. | ||
320 | * | ||
321 | */ | ||
322 | public Collection<InstanceDoesNotSatisfyRequirement.Match> getAllMatches(final Requirement pReq, final ApplicationInstance pApp) { | ||
323 | return rawStreamAllMatches(new Object[]{pReq, pApp}).collect(Collectors.toSet()); | ||
324 | } | ||
325 | |||
326 | /** | ||
327 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
328 | * </p> | ||
329 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
330 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
331 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
332 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
333 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
334 | * @return a stream of matches represented as a Match object. | ||
335 | * | ||
336 | */ | ||
337 | public Stream<InstanceDoesNotSatisfyRequirement.Match> streamAllMatches(final Requirement pReq, final ApplicationInstance pApp) { | ||
338 | return rawStreamAllMatches(new Object[]{pReq, pApp}); | ||
339 | } | ||
340 | |||
341 | /** | ||
342 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
343 | * Neither determinism nor randomness of selection is guaranteed. | ||
344 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
345 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
346 | * @return a match represented as a Match object, or null if no match is found. | ||
347 | * | ||
348 | */ | ||
349 | public Optional<InstanceDoesNotSatisfyRequirement.Match> getOneArbitraryMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
350 | return rawGetOneArbitraryMatch(new Object[]{pReq, pApp}); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
355 | * under any possible substitution of the unspecified parameters (if any). | ||
356 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
357 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
358 | * @return true if the input is a valid (partial) match of the pattern. | ||
359 | * | ||
360 | */ | ||
361 | public boolean hasMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
362 | return rawHasMatch(new Object[]{pReq, pApp}); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
367 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
368 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
369 | * @return the number of pattern matches found. | ||
370 | * | ||
371 | */ | ||
372 | public int countMatches(final Requirement pReq, final ApplicationInstance pApp) { | ||
373 | return rawCountMatches(new Object[]{pReq, pApp}); | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
378 | * Neither determinism nor randomness of selection is guaranteed. | ||
379 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
380 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
381 | * @param processor the action that will process the selected match. | ||
382 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
383 | * | ||
384 | */ | ||
385 | public boolean forOneArbitraryMatch(final Requirement pReq, final ApplicationInstance pApp, final Consumer<? super InstanceDoesNotSatisfyRequirement.Match> processor) { | ||
386 | return rawForOneArbitraryMatch(new Object[]{pReq, pApp}, processor); | ||
387 | } | ||
388 | |||
389 | /** | ||
390 | * Returns a new (partial) match. | ||
391 | * This can be used e.g. to call the matcher with a partial match. | ||
392 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
393 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
394 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
395 | * @return the (partial) match object. | ||
396 | * | ||
397 | */ | ||
398 | public InstanceDoesNotSatisfyRequirement.Match newMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
399 | return InstanceDoesNotSatisfyRequirement.Match.newMatch(pReq, pApp); | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * Retrieve the set of values that occur in matches for Req. | ||
404 | * @return the Set of all values or empty set if there are no matches | ||
405 | * | ||
406 | */ | ||
407 | protected Stream<Requirement> rawStreamAllValuesOfReq(final Object[] parameters) { | ||
408 | return rawStreamAllValues(POSITION_REQ, parameters).map(Requirement.class::cast); | ||
409 | } | ||
410 | |||
411 | /** | ||
412 | * Retrieve the set of values that occur in matches for Req. | ||
413 | * @return the Set of all values or empty set if there are no matches | ||
414 | * | ||
415 | */ | ||
416 | public Set<Requirement> getAllValuesOfReq() { | ||
417 | return rawStreamAllValuesOfReq(emptyArray()).collect(Collectors.toSet()); | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * Retrieve the set of values that occur in matches for Req. | ||
422 | * @return the Set of all values or empty set if there are no matches | ||
423 | * | ||
424 | */ | ||
425 | public Stream<Requirement> streamAllValuesOfReq() { | ||
426 | return rawStreamAllValuesOfReq(emptyArray()); | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * Retrieve the set of values that occur in matches for Req. | ||
431 | * </p> | ||
432 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
433 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
434 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
435 | * | ||
436 | * @return the Stream of all values or empty set if there are no matches | ||
437 | * | ||
438 | */ | ||
439 | public Stream<Requirement> streamAllValuesOfReq(final InstanceDoesNotSatisfyRequirement.Match partialMatch) { | ||
440 | return rawStreamAllValuesOfReq(partialMatch.toArray()); | ||
441 | } | ||
442 | |||
443 | /** | ||
444 | * Retrieve the set of values that occur in matches for Req. | ||
445 | * </p> | ||
446 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
447 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
448 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
449 | * | ||
450 | * @return the Stream of all values or empty set if there are no matches | ||
451 | * | ||
452 | */ | ||
453 | public Stream<Requirement> streamAllValuesOfReq(final ApplicationInstance pApp) { | ||
454 | return rawStreamAllValuesOfReq(new Object[]{null, pApp}); | ||
455 | } | ||
456 | |||
457 | /** | ||
458 | * Retrieve the set of values that occur in matches for Req. | ||
459 | * @return the Set of all values or empty set if there are no matches | ||
460 | * | ||
461 | */ | ||
462 | public Set<Requirement> getAllValuesOfReq(final InstanceDoesNotSatisfyRequirement.Match partialMatch) { | ||
463 | return rawStreamAllValuesOfReq(partialMatch.toArray()).collect(Collectors.toSet()); | ||
464 | } | ||
465 | |||
466 | /** | ||
467 | * Retrieve the set of values that occur in matches for Req. | ||
468 | * @return the Set of all values or empty set if there are no matches | ||
469 | * | ||
470 | */ | ||
471 | public Set<Requirement> getAllValuesOfReq(final ApplicationInstance pApp) { | ||
472 | return rawStreamAllValuesOfReq(new Object[]{null, pApp}).collect(Collectors.toSet()); | ||
473 | } | ||
474 | |||
475 | /** | ||
476 | * Retrieve the set of values that occur in matches for App. | ||
477 | * @return the Set of all values or empty set if there are no matches | ||
478 | * | ||
479 | */ | ||
480 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
481 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
482 | } | ||
483 | |||
484 | /** | ||
485 | * Retrieve the set of values that occur in matches for App. | ||
486 | * @return the Set of all values or empty set if there are no matches | ||
487 | * | ||
488 | */ | ||
489 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
490 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * Retrieve the set of values that occur in matches for App. | ||
495 | * @return the Set of all values or empty set if there are no matches | ||
496 | * | ||
497 | */ | ||
498 | public Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
499 | return rawStreamAllValuesOfApp(emptyArray()); | ||
500 | } | ||
501 | |||
502 | /** | ||
503 | * Retrieve the set of values that occur in matches for App. | ||
504 | * </p> | ||
505 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
506 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
507 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
508 | * | ||
509 | * @return the Stream of all values or empty set if there are no matches | ||
510 | * | ||
511 | */ | ||
512 | public Stream<ApplicationInstance> streamAllValuesOfApp(final InstanceDoesNotSatisfyRequirement.Match partialMatch) { | ||
513 | return rawStreamAllValuesOfApp(partialMatch.toArray()); | ||
514 | } | ||
515 | |||
516 | /** | ||
517 | * Retrieve the set of values that occur in matches for App. | ||
518 | * </p> | ||
519 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
520 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
521 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
522 | * | ||
523 | * @return the Stream of all values or empty set if there are no matches | ||
524 | * | ||
525 | */ | ||
526 | public Stream<ApplicationInstance> streamAllValuesOfApp(final Requirement pReq) { | ||
527 | return rawStreamAllValuesOfApp(new Object[]{pReq, null}); | ||
528 | } | ||
529 | |||
530 | /** | ||
531 | * Retrieve the set of values that occur in matches for App. | ||
532 | * @return the Set of all values or empty set if there are no matches | ||
533 | * | ||
534 | */ | ||
535 | public Set<ApplicationInstance> getAllValuesOfApp(final InstanceDoesNotSatisfyRequirement.Match partialMatch) { | ||
536 | return rawStreamAllValuesOfApp(partialMatch.toArray()).collect(Collectors.toSet()); | ||
537 | } | ||
538 | |||
539 | /** | ||
540 | * Retrieve the set of values that occur in matches for App. | ||
541 | * @return the Set of all values or empty set if there are no matches | ||
542 | * | ||
543 | */ | ||
544 | public Set<ApplicationInstance> getAllValuesOfApp(final Requirement pReq) { | ||
545 | return rawStreamAllValuesOfApp(new Object[]{pReq, null}).collect(Collectors.toSet()); | ||
546 | } | ||
547 | |||
548 | @Override | ||
549 | protected InstanceDoesNotSatisfyRequirement.Match tupleToMatch(final Tuple t) { | ||
550 | try { | ||
551 | return InstanceDoesNotSatisfyRequirement.Match.newMatch((Requirement) t.get(POSITION_REQ), (ApplicationInstance) t.get(POSITION_APP)); | ||
552 | } catch(ClassCastException e) { | ||
553 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
554 | return null; | ||
555 | } | ||
556 | } | ||
557 | |||
558 | @Override | ||
559 | protected InstanceDoesNotSatisfyRequirement.Match arrayToMatch(final Object[] match) { | ||
560 | try { | ||
561 | return InstanceDoesNotSatisfyRequirement.Match.newMatch((Requirement) match[POSITION_REQ], (ApplicationInstance) match[POSITION_APP]); | ||
562 | } catch(ClassCastException e) { | ||
563 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
564 | return null; | ||
565 | } | ||
566 | } | ||
567 | |||
568 | @Override | ||
569 | protected InstanceDoesNotSatisfyRequirement.Match arrayToMatchMutable(final Object[] match) { | ||
570 | try { | ||
571 | return InstanceDoesNotSatisfyRequirement.Match.newMutableMatch((Requirement) match[POSITION_REQ], (ApplicationInstance) match[POSITION_APP]); | ||
572 | } catch(ClassCastException e) { | ||
573 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
574 | return null; | ||
575 | } | ||
576 | } | ||
577 | |||
578 | /** | ||
579 | * @return the singleton instance of the query specification of this pattern | ||
580 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
581 | * | ||
582 | */ | ||
583 | public static IQuerySpecification<InstanceDoesNotSatisfyRequirement.Matcher> querySpecification() { | ||
584 | return InstanceDoesNotSatisfyRequirement.instance(); | ||
585 | } | ||
586 | } | ||
587 | |||
588 | private InstanceDoesNotSatisfyRequirement() { | ||
589 | super(GeneratedPQuery.INSTANCE); | ||
590 | } | ||
591 | |||
592 | /** | ||
593 | * @return the singleton instance of the query specification | ||
594 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
595 | * | ||
596 | */ | ||
597 | public static InstanceDoesNotSatisfyRequirement instance() { | ||
598 | try{ | ||
599 | return LazyHolder.INSTANCE; | ||
600 | } catch (ExceptionInInitializerError err) { | ||
601 | throw processInitializerError(err); | ||
602 | } | ||
603 | } | ||
604 | |||
605 | @Override | ||
606 | protected InstanceDoesNotSatisfyRequirement.Matcher instantiate(final ViatraQueryEngine engine) { | ||
607 | return InstanceDoesNotSatisfyRequirement.Matcher.on(engine); | ||
608 | } | ||
609 | |||
610 | @Override | ||
611 | public InstanceDoesNotSatisfyRequirement.Matcher instantiate() { | ||
612 | return InstanceDoesNotSatisfyRequirement.Matcher.create(); | ||
613 | } | ||
614 | |||
615 | @Override | ||
616 | public InstanceDoesNotSatisfyRequirement.Match newEmptyMatch() { | ||
617 | return InstanceDoesNotSatisfyRequirement.Match.newEmptyMatch(); | ||
618 | } | ||
619 | |||
620 | @Override | ||
621 | public InstanceDoesNotSatisfyRequirement.Match newMatch(final Object... parameters) { | ||
622 | return InstanceDoesNotSatisfyRequirement.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.Requirement) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance) parameters[1]); | ||
623 | } | ||
624 | |||
625 | /** | ||
626 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.InstanceDoesNotSatisfyRequirement (visibility: PUBLIC, simpleName: InstanceDoesNotSatisfyRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.InstanceDoesNotSatisfyRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
627 | * <b>not</b> at the class load time of the outer class, | ||
628 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.InstanceDoesNotSatisfyRequirement (visibility: PUBLIC, simpleName: InstanceDoesNotSatisfyRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.InstanceDoesNotSatisfyRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
629 | * | ||
630 | * <p> This workaround is required e.g. to support recursion. | ||
631 | * | ||
632 | */ | ||
633 | private static class LazyHolder { | ||
634 | private static final InstanceDoesNotSatisfyRequirement INSTANCE = new InstanceDoesNotSatisfyRequirement(); | ||
635 | |||
636 | /** | ||
637 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
638 | * This initialization order is required to support indirect recursion. | ||
639 | * | ||
640 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
641 | * | ||
642 | */ | ||
643 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
644 | |||
645 | public static Object ensureInitialized() { | ||
646 | INSTANCE.ensureInitializedInternal(); | ||
647 | return null; | ||
648 | } | ||
649 | } | ||
650 | |||
651 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
652 | private static final InstanceDoesNotSatisfyRequirement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
653 | |||
654 | private final PParameter parameter_Req = new PParameter("Req", "hu.bme.mit.inf.dslreasoner.domains.cps.Requirement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "Requirement")), PParameterDirection.INOUT); | ||
655 | |||
656 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
657 | |||
658 | private final List<PParameter> parameters = Arrays.asList(parameter_Req, parameter_App); | ||
659 | |||
660 | private GeneratedPQuery() { | ||
661 | super(PVisibility.PUBLIC); | ||
662 | } | ||
663 | |||
664 | @Override | ||
665 | public String getFullyQualifiedName() { | ||
666 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.instanceDoesNotSatisfyRequirement"; | ||
667 | } | ||
668 | |||
669 | @Override | ||
670 | public List<String> getParameterNames() { | ||
671 | return Arrays.asList("Req","App"); | ||
672 | } | ||
673 | |||
674 | @Override | ||
675 | public List<PParameter> getParameters() { | ||
676 | return parameters; | ||
677 | } | ||
678 | |||
679 | @Override | ||
680 | public Set<PBody> doGetContainedBodies() { | ||
681 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
682 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
683 | { | ||
684 | PBody body = new PBody(this); | ||
685 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
686 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
687 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
688 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
689 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
690 | new ExportedParameter(body, var_Req, parameter_Req), | ||
691 | new ExportedParameter(body, var_App, parameter_App) | ||
692 | )); | ||
693 | // Requirement.instances(Req, App) | ||
694 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
695 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
696 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "instances"))); | ||
697 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
698 | new Equality(body, var__virtual_0_, var_App); | ||
699 | // neg find satisfyingInstance(Req, App) | ||
700 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Req, var_App), SatisfyingInstance.instance().getInternalQueryRepresentation()); | ||
701 | bodies.add(body); | ||
702 | } | ||
703 | { | ||
704 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
705 | annotation.addAttribute("severity", "error"); | ||
706 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
707 | new ParameterReference("Req"), | ||
708 | new ParameterReference("App") | ||
709 | })); | ||
710 | annotation.addAttribute("message", "Requirement must be satisfied by the required application type."); | ||
711 | addAnnotation(annotation); | ||
712 | } | ||
713 | return bodies; | ||
714 | } | ||
715 | } | ||
716 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/NotEnoughAvailableHdd.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/NotEnoughAvailableHdd.java new file mode 100644 index 00000000..0c0d57a6 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/NotEnoughAvailableHdd.java | |||
@@ -0,0 +1,579 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableHdd; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.Collection; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | import java.util.Optional; | ||
14 | import java.util.Set; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collectors; | ||
17 | import java.util.stream.Stream; | ||
18 | import org.apache.log4j.Logger; | ||
19 | import org.eclipse.emf.ecore.EClass; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
44 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
45 | |||
46 | /** | ||
47 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
48 | * | ||
49 | * <p>Original source: | ||
50 | * <code><pre> | ||
51 | * {@literal @}Constraint(severity = "error", key = {Host}, | ||
52 | * message = "Insufficient HDD available on host.") | ||
53 | * pattern notEnoughAvailableHdd(Host : HostInstance) { | ||
54 | * find availableHdd(Host, Hdd); | ||
55 | * check(Hdd {@literal <} 0); | ||
56 | * } | ||
57 | * </pre></code> | ||
58 | * | ||
59 | * @see Matcher | ||
60 | * @see Match | ||
61 | * | ||
62 | */ | ||
63 | @SuppressWarnings("all") | ||
64 | public final class NotEnoughAvailableHdd extends BaseGeneratedEMFQuerySpecification<NotEnoughAvailableHdd.Matcher> { | ||
65 | /** | ||
66 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableHdd pattern, | ||
67 | * to be used in conjunction with {@link Matcher}. | ||
68 | * | ||
69 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
70 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
71 | * usable to represent a match of the pattern in the result of a query, | ||
72 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
73 | * | ||
74 | * @see Matcher | ||
75 | * | ||
76 | */ | ||
77 | public static abstract class Match extends BasePatternMatch { | ||
78 | private HostInstance fHost; | ||
79 | |||
80 | private static List<String> parameterNames = makeImmutableList("Host"); | ||
81 | |||
82 | private Match(final HostInstance pHost) { | ||
83 | this.fHost = pHost; | ||
84 | } | ||
85 | |||
86 | @Override | ||
87 | public Object get(final String parameterName) { | ||
88 | if ("Host".equals(parameterName)) return this.fHost; | ||
89 | return null; | ||
90 | } | ||
91 | |||
92 | public HostInstance getHost() { | ||
93 | return this.fHost; | ||
94 | } | ||
95 | |||
96 | @Override | ||
97 | public boolean set(final String parameterName, final Object newValue) { | ||
98 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
99 | if ("Host".equals(parameterName) ) { | ||
100 | this.fHost = (HostInstance) newValue; | ||
101 | return true; | ||
102 | } | ||
103 | return false; | ||
104 | } | ||
105 | |||
106 | public void setHost(final HostInstance pHost) { | ||
107 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
108 | this.fHost = pHost; | ||
109 | } | ||
110 | |||
111 | @Override | ||
112 | public String patternName() { | ||
113 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableHdd"; | ||
114 | } | ||
115 | |||
116 | @Override | ||
117 | public List<String> parameterNames() { | ||
118 | return NotEnoughAvailableHdd.Match.parameterNames; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public Object[] toArray() { | ||
123 | return new Object[]{fHost}; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public NotEnoughAvailableHdd.Match toImmutable() { | ||
128 | return isMutable() ? newMatch(fHost) : this; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public String prettyPrint() { | ||
133 | StringBuilder result = new StringBuilder(); | ||
134 | result.append("\"Host\"=" + prettyPrintValue(fHost)); | ||
135 | return result.toString(); | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public int hashCode() { | ||
140 | return Objects.hash(fHost); | ||
141 | } | ||
142 | |||
143 | @Override | ||
144 | public boolean equals(final Object obj) { | ||
145 | if (this == obj) | ||
146 | return true; | ||
147 | if (obj == null) { | ||
148 | return false; | ||
149 | } | ||
150 | if ((obj instanceof NotEnoughAvailableHdd.Match)) { | ||
151 | NotEnoughAvailableHdd.Match other = (NotEnoughAvailableHdd.Match) obj; | ||
152 | return Objects.equals(fHost, other.fHost); | ||
153 | } else { | ||
154 | // this should be infrequent | ||
155 | if (!(obj instanceof IPatternMatch)) { | ||
156 | return false; | ||
157 | } | ||
158 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
159 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | @Override | ||
164 | public NotEnoughAvailableHdd specification() { | ||
165 | return NotEnoughAvailableHdd.instance(); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * Returns an empty, mutable match. | ||
170 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
171 | * | ||
172 | * @return the empty match. | ||
173 | * | ||
174 | */ | ||
175 | public static NotEnoughAvailableHdd.Match newEmptyMatch() { | ||
176 | return new Mutable(null); | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * Returns a mutable (partial) match. | ||
181 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
182 | * | ||
183 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
184 | * @return the new, mutable (partial) match object. | ||
185 | * | ||
186 | */ | ||
187 | public static NotEnoughAvailableHdd.Match newMutableMatch(final HostInstance pHost) { | ||
188 | return new Mutable(pHost); | ||
189 | } | ||
190 | |||
191 | /** | ||
192 | * Returns a new (partial) match. | ||
193 | * This can be used e.g. to call the matcher with a partial match. | ||
194 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
195 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
196 | * @return the (partial) match object. | ||
197 | * | ||
198 | */ | ||
199 | public static NotEnoughAvailableHdd.Match newMatch(final HostInstance pHost) { | ||
200 | return new Immutable(pHost); | ||
201 | } | ||
202 | |||
203 | private static final class Mutable extends NotEnoughAvailableHdd.Match { | ||
204 | Mutable(final HostInstance pHost) { | ||
205 | super(pHost); | ||
206 | } | ||
207 | |||
208 | @Override | ||
209 | public boolean isMutable() { | ||
210 | return true; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | private static final class Immutable extends NotEnoughAvailableHdd.Match { | ||
215 | Immutable(final HostInstance pHost) { | ||
216 | super(pHost); | ||
217 | } | ||
218 | |||
219 | @Override | ||
220 | public boolean isMutable() { | ||
221 | return false; | ||
222 | } | ||
223 | } | ||
224 | } | ||
225 | |||
226 | /** | ||
227 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableHdd pattern, | ||
228 | * providing pattern-specific query methods. | ||
229 | * | ||
230 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
231 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
232 | * | ||
233 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
234 | * | ||
235 | * <p>Original source: | ||
236 | * <code><pre> | ||
237 | * {@literal @}Constraint(severity = "error", key = {Host}, | ||
238 | * message = "Insufficient HDD available on host.") | ||
239 | * pattern notEnoughAvailableHdd(Host : HostInstance) { | ||
240 | * find availableHdd(Host, Hdd); | ||
241 | * check(Hdd {@literal <} 0); | ||
242 | * } | ||
243 | * </pre></code> | ||
244 | * | ||
245 | * @see Match | ||
246 | * @see NotEnoughAvailableHdd | ||
247 | * | ||
248 | */ | ||
249 | public static class Matcher extends BaseMatcher<NotEnoughAvailableHdd.Match> { | ||
250 | /** | ||
251 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
252 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
253 | * | ||
254 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
255 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
256 | * | ||
257 | */ | ||
258 | public static NotEnoughAvailableHdd.Matcher on(final ViatraQueryEngine engine) { | ||
259 | // check if matcher already exists | ||
260 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
261 | if (matcher == null) { | ||
262 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
263 | } | ||
264 | return matcher; | ||
265 | } | ||
266 | |||
267 | /** | ||
268 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
269 | * @return an initialized matcher | ||
270 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
271 | * | ||
272 | */ | ||
273 | public static NotEnoughAvailableHdd.Matcher create() { | ||
274 | return new Matcher(); | ||
275 | } | ||
276 | |||
277 | private static final int POSITION_HOST = 0; | ||
278 | |||
279 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NotEnoughAvailableHdd.Matcher.class); | ||
280 | |||
281 | /** | ||
282 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
283 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
284 | * | ||
285 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
286 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
287 | * | ||
288 | */ | ||
289 | private Matcher() { | ||
290 | super(querySpecification()); | ||
291 | } | ||
292 | |||
293 | /** | ||
294 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
295 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
296 | * @return matches represented as a Match object. | ||
297 | * | ||
298 | */ | ||
299 | public Collection<NotEnoughAvailableHdd.Match> getAllMatches(final HostInstance pHost) { | ||
300 | return rawStreamAllMatches(new Object[]{pHost}).collect(Collectors.toSet()); | ||
301 | } | ||
302 | |||
303 | /** | ||
304 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
305 | * </p> | ||
306 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
307 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
308 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
309 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
310 | * @return a stream of matches represented as a Match object. | ||
311 | * | ||
312 | */ | ||
313 | public Stream<NotEnoughAvailableHdd.Match> streamAllMatches(final HostInstance pHost) { | ||
314 | return rawStreamAllMatches(new Object[]{pHost}); | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
319 | * Neither determinism nor randomness of selection is guaranteed. | ||
320 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
321 | * @return a match represented as a Match object, or null if no match is found. | ||
322 | * | ||
323 | */ | ||
324 | public Optional<NotEnoughAvailableHdd.Match> getOneArbitraryMatch(final HostInstance pHost) { | ||
325 | return rawGetOneArbitraryMatch(new Object[]{pHost}); | ||
326 | } | ||
327 | |||
328 | /** | ||
329 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
330 | * under any possible substitution of the unspecified parameters (if any). | ||
331 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
332 | * @return true if the input is a valid (partial) match of the pattern. | ||
333 | * | ||
334 | */ | ||
335 | public boolean hasMatch(final HostInstance pHost) { | ||
336 | return rawHasMatch(new Object[]{pHost}); | ||
337 | } | ||
338 | |||
339 | /** | ||
340 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
341 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
342 | * @return the number of pattern matches found. | ||
343 | * | ||
344 | */ | ||
345 | public int countMatches(final HostInstance pHost) { | ||
346 | return rawCountMatches(new Object[]{pHost}); | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
351 | * Neither determinism nor randomness of selection is guaranteed. | ||
352 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
353 | * @param processor the action that will process the selected match. | ||
354 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
355 | * | ||
356 | */ | ||
357 | public boolean forOneArbitraryMatch(final HostInstance pHost, final Consumer<? super NotEnoughAvailableHdd.Match> processor) { | ||
358 | return rawForOneArbitraryMatch(new Object[]{pHost}, processor); | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * Returns a new (partial) match. | ||
363 | * This can be used e.g. to call the matcher with a partial match. | ||
364 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
365 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
366 | * @return the (partial) match object. | ||
367 | * | ||
368 | */ | ||
369 | public NotEnoughAvailableHdd.Match newMatch(final HostInstance pHost) { | ||
370 | return NotEnoughAvailableHdd.Match.newMatch(pHost); | ||
371 | } | ||
372 | |||
373 | /** | ||
374 | * Retrieve the set of values that occur in matches for Host. | ||
375 | * @return the Set of all values or empty set if there are no matches | ||
376 | * | ||
377 | */ | ||
378 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
379 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
380 | } | ||
381 | |||
382 | /** | ||
383 | * Retrieve the set of values that occur in matches for Host. | ||
384 | * @return the Set of all values or empty set if there are no matches | ||
385 | * | ||
386 | */ | ||
387 | public Set<HostInstance> getAllValuesOfHost() { | ||
388 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * Retrieve the set of values that occur in matches for Host. | ||
393 | * @return the Set of all values or empty set if there are no matches | ||
394 | * | ||
395 | */ | ||
396 | public Stream<HostInstance> streamAllValuesOfHost() { | ||
397 | return rawStreamAllValuesOfHost(emptyArray()); | ||
398 | } | ||
399 | |||
400 | @Override | ||
401 | protected NotEnoughAvailableHdd.Match tupleToMatch(final Tuple t) { | ||
402 | try { | ||
403 | return NotEnoughAvailableHdd.Match.newMatch((HostInstance) t.get(POSITION_HOST)); | ||
404 | } catch(ClassCastException e) { | ||
405 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
406 | return null; | ||
407 | } | ||
408 | } | ||
409 | |||
410 | @Override | ||
411 | protected NotEnoughAvailableHdd.Match arrayToMatch(final Object[] match) { | ||
412 | try { | ||
413 | return NotEnoughAvailableHdd.Match.newMatch((HostInstance) match[POSITION_HOST]); | ||
414 | } catch(ClassCastException e) { | ||
415 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
416 | return null; | ||
417 | } | ||
418 | } | ||
419 | |||
420 | @Override | ||
421 | protected NotEnoughAvailableHdd.Match arrayToMatchMutable(final Object[] match) { | ||
422 | try { | ||
423 | return NotEnoughAvailableHdd.Match.newMutableMatch((HostInstance) match[POSITION_HOST]); | ||
424 | } catch(ClassCastException e) { | ||
425 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
426 | return null; | ||
427 | } | ||
428 | } | ||
429 | |||
430 | /** | ||
431 | * @return the singleton instance of the query specification of this pattern | ||
432 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
433 | * | ||
434 | */ | ||
435 | public static IQuerySpecification<NotEnoughAvailableHdd.Matcher> querySpecification() { | ||
436 | return NotEnoughAvailableHdd.instance(); | ||
437 | } | ||
438 | } | ||
439 | |||
440 | private NotEnoughAvailableHdd() { | ||
441 | super(GeneratedPQuery.INSTANCE); | ||
442 | } | ||
443 | |||
444 | /** | ||
445 | * @return the singleton instance of the query specification | ||
446 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
447 | * | ||
448 | */ | ||
449 | public static NotEnoughAvailableHdd instance() { | ||
450 | try{ | ||
451 | return LazyHolder.INSTANCE; | ||
452 | } catch (ExceptionInInitializerError err) { | ||
453 | throw processInitializerError(err); | ||
454 | } | ||
455 | } | ||
456 | |||
457 | @Override | ||
458 | protected NotEnoughAvailableHdd.Matcher instantiate(final ViatraQueryEngine engine) { | ||
459 | return NotEnoughAvailableHdd.Matcher.on(engine); | ||
460 | } | ||
461 | |||
462 | @Override | ||
463 | public NotEnoughAvailableHdd.Matcher instantiate() { | ||
464 | return NotEnoughAvailableHdd.Matcher.create(); | ||
465 | } | ||
466 | |||
467 | @Override | ||
468 | public NotEnoughAvailableHdd.Match newEmptyMatch() { | ||
469 | return NotEnoughAvailableHdd.Match.newEmptyMatch(); | ||
470 | } | ||
471 | |||
472 | @Override | ||
473 | public NotEnoughAvailableHdd.Match newMatch(final Object... parameters) { | ||
474 | return NotEnoughAvailableHdd.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[0]); | ||
475 | } | ||
476 | |||
477 | /** | ||
478 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableHdd (visibility: PUBLIC, simpleName: NotEnoughAvailableHdd, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableHdd, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
479 | * <b>not</b> at the class load time of the outer class, | ||
480 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableHdd (visibility: PUBLIC, simpleName: NotEnoughAvailableHdd, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableHdd, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
481 | * | ||
482 | * <p> This workaround is required e.g. to support recursion. | ||
483 | * | ||
484 | */ | ||
485 | private static class LazyHolder { | ||
486 | private static final NotEnoughAvailableHdd INSTANCE = new NotEnoughAvailableHdd(); | ||
487 | |||
488 | /** | ||
489 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
490 | * This initialization order is required to support indirect recursion. | ||
491 | * | ||
492 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
493 | * | ||
494 | */ | ||
495 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
496 | |||
497 | public static Object ensureInitialized() { | ||
498 | INSTANCE.ensureInitializedInternal(); | ||
499 | return null; | ||
500 | } | ||
501 | } | ||
502 | |||
503 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
504 | private static final NotEnoughAvailableHdd.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
505 | |||
506 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
507 | |||
508 | private final List<PParameter> parameters = Arrays.asList(parameter_Host); | ||
509 | |||
510 | private GeneratedPQuery() { | ||
511 | super(PVisibility.PUBLIC); | ||
512 | } | ||
513 | |||
514 | @Override | ||
515 | public String getFullyQualifiedName() { | ||
516 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableHdd"; | ||
517 | } | ||
518 | |||
519 | @Override | ||
520 | public List<String> getParameterNames() { | ||
521 | return Arrays.asList("Host"); | ||
522 | } | ||
523 | |||
524 | @Override | ||
525 | public List<PParameter> getParameters() { | ||
526 | return parameters; | ||
527 | } | ||
528 | |||
529 | @Override | ||
530 | public Set<PBody> doGetContainedBodies() { | ||
531 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
532 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
533 | { | ||
534 | PBody body = new PBody(this); | ||
535 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
536 | PVariable var_Hdd = body.getOrCreateVariableByName("Hdd"); | ||
537 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
538 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
539 | new ExportedParameter(body, var_Host, parameter_Host) | ||
540 | )); | ||
541 | // find availableHdd(Host, Hdd) | ||
542 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_Hdd), AvailableHdd.instance().getInternalQueryRepresentation()); | ||
543 | // check(Hdd < 0) | ||
544 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
545 | |||
546 | @Override | ||
547 | public String getShortDescription() { | ||
548 | return "Expression evaluation from pattern notEnoughAvailableHdd"; | ||
549 | } | ||
550 | |||
551 | @Override | ||
552 | public Iterable<String> getInputParameterNames() { | ||
553 | return Arrays.asList("Hdd");} | ||
554 | |||
555 | @Override | ||
556 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
557 | Integer Hdd = (Integer) provider.getValue("Hdd"); | ||
558 | return evaluateExpression_1_1(Hdd); | ||
559 | } | ||
560 | }, null); | ||
561 | bodies.add(body); | ||
562 | } | ||
563 | { | ||
564 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
565 | annotation.addAttribute("severity", "error"); | ||
566 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
567 | new ParameterReference("Host") | ||
568 | })); | ||
569 | annotation.addAttribute("message", "Insufficient HDD available on host."); | ||
570 | addAnnotation(annotation); | ||
571 | } | ||
572 | return bodies; | ||
573 | } | ||
574 | } | ||
575 | |||
576 | private static boolean evaluateExpression_1_1(final Integer Hdd) { | ||
577 | return ((Hdd).intValue() < 0); | ||
578 | } | ||
579 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/NotEnoughAvailableMemory.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/NotEnoughAvailableMemory.java new file mode 100644 index 00000000..9f091a95 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/NotEnoughAvailableMemory.java | |||
@@ -0,0 +1,579 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableMemory; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.Collection; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | import java.util.Optional; | ||
14 | import java.util.Set; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collectors; | ||
17 | import java.util.stream.Stream; | ||
18 | import org.apache.log4j.Logger; | ||
19 | import org.eclipse.emf.ecore.EClass; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
44 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
45 | |||
46 | /** | ||
47 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
48 | * | ||
49 | * <p>Original source: | ||
50 | * <code><pre> | ||
51 | * {@literal @}Constraint(severity = "error", key = {Host}, | ||
52 | * message = "Insufficient memory available on host.") | ||
53 | * pattern notEnoughAvailableMemory(Host : HostInstance) { | ||
54 | * find availableMemory(Host, Memory); | ||
55 | * check(Memory {@literal <} 0); | ||
56 | * } | ||
57 | * </pre></code> | ||
58 | * | ||
59 | * @see Matcher | ||
60 | * @see Match | ||
61 | * | ||
62 | */ | ||
63 | @SuppressWarnings("all") | ||
64 | public final class NotEnoughAvailableMemory extends BaseGeneratedEMFQuerySpecification<NotEnoughAvailableMemory.Matcher> { | ||
65 | /** | ||
66 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableMemory pattern, | ||
67 | * to be used in conjunction with {@link Matcher}. | ||
68 | * | ||
69 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
70 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
71 | * usable to represent a match of the pattern in the result of a query, | ||
72 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
73 | * | ||
74 | * @see Matcher | ||
75 | * | ||
76 | */ | ||
77 | public static abstract class Match extends BasePatternMatch { | ||
78 | private HostInstance fHost; | ||
79 | |||
80 | private static List<String> parameterNames = makeImmutableList("Host"); | ||
81 | |||
82 | private Match(final HostInstance pHost) { | ||
83 | this.fHost = pHost; | ||
84 | } | ||
85 | |||
86 | @Override | ||
87 | public Object get(final String parameterName) { | ||
88 | if ("Host".equals(parameterName)) return this.fHost; | ||
89 | return null; | ||
90 | } | ||
91 | |||
92 | public HostInstance getHost() { | ||
93 | return this.fHost; | ||
94 | } | ||
95 | |||
96 | @Override | ||
97 | public boolean set(final String parameterName, final Object newValue) { | ||
98 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
99 | if ("Host".equals(parameterName) ) { | ||
100 | this.fHost = (HostInstance) newValue; | ||
101 | return true; | ||
102 | } | ||
103 | return false; | ||
104 | } | ||
105 | |||
106 | public void setHost(final HostInstance pHost) { | ||
107 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
108 | this.fHost = pHost; | ||
109 | } | ||
110 | |||
111 | @Override | ||
112 | public String patternName() { | ||
113 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableMemory"; | ||
114 | } | ||
115 | |||
116 | @Override | ||
117 | public List<String> parameterNames() { | ||
118 | return NotEnoughAvailableMemory.Match.parameterNames; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public Object[] toArray() { | ||
123 | return new Object[]{fHost}; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public NotEnoughAvailableMemory.Match toImmutable() { | ||
128 | return isMutable() ? newMatch(fHost) : this; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public String prettyPrint() { | ||
133 | StringBuilder result = new StringBuilder(); | ||
134 | result.append("\"Host\"=" + prettyPrintValue(fHost)); | ||
135 | return result.toString(); | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public int hashCode() { | ||
140 | return Objects.hash(fHost); | ||
141 | } | ||
142 | |||
143 | @Override | ||
144 | public boolean equals(final Object obj) { | ||
145 | if (this == obj) | ||
146 | return true; | ||
147 | if (obj == null) { | ||
148 | return false; | ||
149 | } | ||
150 | if ((obj instanceof NotEnoughAvailableMemory.Match)) { | ||
151 | NotEnoughAvailableMemory.Match other = (NotEnoughAvailableMemory.Match) obj; | ||
152 | return Objects.equals(fHost, other.fHost); | ||
153 | } else { | ||
154 | // this should be infrequent | ||
155 | if (!(obj instanceof IPatternMatch)) { | ||
156 | return false; | ||
157 | } | ||
158 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
159 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | @Override | ||
164 | public NotEnoughAvailableMemory specification() { | ||
165 | return NotEnoughAvailableMemory.instance(); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * Returns an empty, mutable match. | ||
170 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
171 | * | ||
172 | * @return the empty match. | ||
173 | * | ||
174 | */ | ||
175 | public static NotEnoughAvailableMemory.Match newEmptyMatch() { | ||
176 | return new Mutable(null); | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * Returns a mutable (partial) match. | ||
181 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
182 | * | ||
183 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
184 | * @return the new, mutable (partial) match object. | ||
185 | * | ||
186 | */ | ||
187 | public static NotEnoughAvailableMemory.Match newMutableMatch(final HostInstance pHost) { | ||
188 | return new Mutable(pHost); | ||
189 | } | ||
190 | |||
191 | /** | ||
192 | * Returns a new (partial) match. | ||
193 | * This can be used e.g. to call the matcher with a partial match. | ||
194 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
195 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
196 | * @return the (partial) match object. | ||
197 | * | ||
198 | */ | ||
199 | public static NotEnoughAvailableMemory.Match newMatch(final HostInstance pHost) { | ||
200 | return new Immutable(pHost); | ||
201 | } | ||
202 | |||
203 | private static final class Mutable extends NotEnoughAvailableMemory.Match { | ||
204 | Mutable(final HostInstance pHost) { | ||
205 | super(pHost); | ||
206 | } | ||
207 | |||
208 | @Override | ||
209 | public boolean isMutable() { | ||
210 | return true; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | private static final class Immutable extends NotEnoughAvailableMemory.Match { | ||
215 | Immutable(final HostInstance pHost) { | ||
216 | super(pHost); | ||
217 | } | ||
218 | |||
219 | @Override | ||
220 | public boolean isMutable() { | ||
221 | return false; | ||
222 | } | ||
223 | } | ||
224 | } | ||
225 | |||
226 | /** | ||
227 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableMemory pattern, | ||
228 | * providing pattern-specific query methods. | ||
229 | * | ||
230 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
231 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
232 | * | ||
233 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
234 | * | ||
235 | * <p>Original source: | ||
236 | * <code><pre> | ||
237 | * {@literal @}Constraint(severity = "error", key = {Host}, | ||
238 | * message = "Insufficient memory available on host.") | ||
239 | * pattern notEnoughAvailableMemory(Host : HostInstance) { | ||
240 | * find availableMemory(Host, Memory); | ||
241 | * check(Memory {@literal <} 0); | ||
242 | * } | ||
243 | * </pre></code> | ||
244 | * | ||
245 | * @see Match | ||
246 | * @see NotEnoughAvailableMemory | ||
247 | * | ||
248 | */ | ||
249 | public static class Matcher extends BaseMatcher<NotEnoughAvailableMemory.Match> { | ||
250 | /** | ||
251 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
252 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
253 | * | ||
254 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
255 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
256 | * | ||
257 | */ | ||
258 | public static NotEnoughAvailableMemory.Matcher on(final ViatraQueryEngine engine) { | ||
259 | // check if matcher already exists | ||
260 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
261 | if (matcher == null) { | ||
262 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
263 | } | ||
264 | return matcher; | ||
265 | } | ||
266 | |||
267 | /** | ||
268 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
269 | * @return an initialized matcher | ||
270 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
271 | * | ||
272 | */ | ||
273 | public static NotEnoughAvailableMemory.Matcher create() { | ||
274 | return new Matcher(); | ||
275 | } | ||
276 | |||
277 | private static final int POSITION_HOST = 0; | ||
278 | |||
279 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NotEnoughAvailableMemory.Matcher.class); | ||
280 | |||
281 | /** | ||
282 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
283 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
284 | * | ||
285 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
286 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
287 | * | ||
288 | */ | ||
289 | private Matcher() { | ||
290 | super(querySpecification()); | ||
291 | } | ||
292 | |||
293 | /** | ||
294 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
295 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
296 | * @return matches represented as a Match object. | ||
297 | * | ||
298 | */ | ||
299 | public Collection<NotEnoughAvailableMemory.Match> getAllMatches(final HostInstance pHost) { | ||
300 | return rawStreamAllMatches(new Object[]{pHost}).collect(Collectors.toSet()); | ||
301 | } | ||
302 | |||
303 | /** | ||
304 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
305 | * </p> | ||
306 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
307 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
308 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
309 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
310 | * @return a stream of matches represented as a Match object. | ||
311 | * | ||
312 | */ | ||
313 | public Stream<NotEnoughAvailableMemory.Match> streamAllMatches(final HostInstance pHost) { | ||
314 | return rawStreamAllMatches(new Object[]{pHost}); | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
319 | * Neither determinism nor randomness of selection is guaranteed. | ||
320 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
321 | * @return a match represented as a Match object, or null if no match is found. | ||
322 | * | ||
323 | */ | ||
324 | public Optional<NotEnoughAvailableMemory.Match> getOneArbitraryMatch(final HostInstance pHost) { | ||
325 | return rawGetOneArbitraryMatch(new Object[]{pHost}); | ||
326 | } | ||
327 | |||
328 | /** | ||
329 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
330 | * under any possible substitution of the unspecified parameters (if any). | ||
331 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
332 | * @return true if the input is a valid (partial) match of the pattern. | ||
333 | * | ||
334 | */ | ||
335 | public boolean hasMatch(final HostInstance pHost) { | ||
336 | return rawHasMatch(new Object[]{pHost}); | ||
337 | } | ||
338 | |||
339 | /** | ||
340 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
341 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
342 | * @return the number of pattern matches found. | ||
343 | * | ||
344 | */ | ||
345 | public int countMatches(final HostInstance pHost) { | ||
346 | return rawCountMatches(new Object[]{pHost}); | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
351 | * Neither determinism nor randomness of selection is guaranteed. | ||
352 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
353 | * @param processor the action that will process the selected match. | ||
354 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
355 | * | ||
356 | */ | ||
357 | public boolean forOneArbitraryMatch(final HostInstance pHost, final Consumer<? super NotEnoughAvailableMemory.Match> processor) { | ||
358 | return rawForOneArbitraryMatch(new Object[]{pHost}, processor); | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * Returns a new (partial) match. | ||
363 | * This can be used e.g. to call the matcher with a partial match. | ||
364 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
365 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
366 | * @return the (partial) match object. | ||
367 | * | ||
368 | */ | ||
369 | public NotEnoughAvailableMemory.Match newMatch(final HostInstance pHost) { | ||
370 | return NotEnoughAvailableMemory.Match.newMatch(pHost); | ||
371 | } | ||
372 | |||
373 | /** | ||
374 | * Retrieve the set of values that occur in matches for Host. | ||
375 | * @return the Set of all values or empty set if there are no matches | ||
376 | * | ||
377 | */ | ||
378 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
379 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
380 | } | ||
381 | |||
382 | /** | ||
383 | * Retrieve the set of values that occur in matches for Host. | ||
384 | * @return the Set of all values or empty set if there are no matches | ||
385 | * | ||
386 | */ | ||
387 | public Set<HostInstance> getAllValuesOfHost() { | ||
388 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * Retrieve the set of values that occur in matches for Host. | ||
393 | * @return the Set of all values or empty set if there are no matches | ||
394 | * | ||
395 | */ | ||
396 | public Stream<HostInstance> streamAllValuesOfHost() { | ||
397 | return rawStreamAllValuesOfHost(emptyArray()); | ||
398 | } | ||
399 | |||
400 | @Override | ||
401 | protected NotEnoughAvailableMemory.Match tupleToMatch(final Tuple t) { | ||
402 | try { | ||
403 | return NotEnoughAvailableMemory.Match.newMatch((HostInstance) t.get(POSITION_HOST)); | ||
404 | } catch(ClassCastException e) { | ||
405 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
406 | return null; | ||
407 | } | ||
408 | } | ||
409 | |||
410 | @Override | ||
411 | protected NotEnoughAvailableMemory.Match arrayToMatch(final Object[] match) { | ||
412 | try { | ||
413 | return NotEnoughAvailableMemory.Match.newMatch((HostInstance) match[POSITION_HOST]); | ||
414 | } catch(ClassCastException e) { | ||
415 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
416 | return null; | ||
417 | } | ||
418 | } | ||
419 | |||
420 | @Override | ||
421 | protected NotEnoughAvailableMemory.Match arrayToMatchMutable(final Object[] match) { | ||
422 | try { | ||
423 | return NotEnoughAvailableMemory.Match.newMutableMatch((HostInstance) match[POSITION_HOST]); | ||
424 | } catch(ClassCastException e) { | ||
425 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
426 | return null; | ||
427 | } | ||
428 | } | ||
429 | |||
430 | /** | ||
431 | * @return the singleton instance of the query specification of this pattern | ||
432 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
433 | * | ||
434 | */ | ||
435 | public static IQuerySpecification<NotEnoughAvailableMemory.Matcher> querySpecification() { | ||
436 | return NotEnoughAvailableMemory.instance(); | ||
437 | } | ||
438 | } | ||
439 | |||
440 | private NotEnoughAvailableMemory() { | ||
441 | super(GeneratedPQuery.INSTANCE); | ||
442 | } | ||
443 | |||
444 | /** | ||
445 | * @return the singleton instance of the query specification | ||
446 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
447 | * | ||
448 | */ | ||
449 | public static NotEnoughAvailableMemory instance() { | ||
450 | try{ | ||
451 | return LazyHolder.INSTANCE; | ||
452 | } catch (ExceptionInInitializerError err) { | ||
453 | throw processInitializerError(err); | ||
454 | } | ||
455 | } | ||
456 | |||
457 | @Override | ||
458 | protected NotEnoughAvailableMemory.Matcher instantiate(final ViatraQueryEngine engine) { | ||
459 | return NotEnoughAvailableMemory.Matcher.on(engine); | ||
460 | } | ||
461 | |||
462 | @Override | ||
463 | public NotEnoughAvailableMemory.Matcher instantiate() { | ||
464 | return NotEnoughAvailableMemory.Matcher.create(); | ||
465 | } | ||
466 | |||
467 | @Override | ||
468 | public NotEnoughAvailableMemory.Match newEmptyMatch() { | ||
469 | return NotEnoughAvailableMemory.Match.newEmptyMatch(); | ||
470 | } | ||
471 | |||
472 | @Override | ||
473 | public NotEnoughAvailableMemory.Match newMatch(final Object... parameters) { | ||
474 | return NotEnoughAvailableMemory.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[0]); | ||
475 | } | ||
476 | |||
477 | /** | ||
478 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableMemory (visibility: PUBLIC, simpleName: NotEnoughAvailableMemory, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableMemory, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
479 | * <b>not</b> at the class load time of the outer class, | ||
480 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableMemory (visibility: PUBLIC, simpleName: NotEnoughAvailableMemory, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableMemory, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
481 | * | ||
482 | * <p> This workaround is required e.g. to support recursion. | ||
483 | * | ||
484 | */ | ||
485 | private static class LazyHolder { | ||
486 | private static final NotEnoughAvailableMemory INSTANCE = new NotEnoughAvailableMemory(); | ||
487 | |||
488 | /** | ||
489 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
490 | * This initialization order is required to support indirect recursion. | ||
491 | * | ||
492 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
493 | * | ||
494 | */ | ||
495 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
496 | |||
497 | public static Object ensureInitialized() { | ||
498 | INSTANCE.ensureInitializedInternal(); | ||
499 | return null; | ||
500 | } | ||
501 | } | ||
502 | |||
503 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
504 | private static final NotEnoughAvailableMemory.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
505 | |||
506 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
507 | |||
508 | private final List<PParameter> parameters = Arrays.asList(parameter_Host); | ||
509 | |||
510 | private GeneratedPQuery() { | ||
511 | super(PVisibility.PUBLIC); | ||
512 | } | ||
513 | |||
514 | @Override | ||
515 | public String getFullyQualifiedName() { | ||
516 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableMemory"; | ||
517 | } | ||
518 | |||
519 | @Override | ||
520 | public List<String> getParameterNames() { | ||
521 | return Arrays.asList("Host"); | ||
522 | } | ||
523 | |||
524 | @Override | ||
525 | public List<PParameter> getParameters() { | ||
526 | return parameters; | ||
527 | } | ||
528 | |||
529 | @Override | ||
530 | public Set<PBody> doGetContainedBodies() { | ||
531 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
532 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
533 | { | ||
534 | PBody body = new PBody(this); | ||
535 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
536 | PVariable var_Memory = body.getOrCreateVariableByName("Memory"); | ||
537 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
538 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
539 | new ExportedParameter(body, var_Host, parameter_Host) | ||
540 | )); | ||
541 | // find availableMemory(Host, Memory) | ||
542 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_Memory), AvailableMemory.instance().getInternalQueryRepresentation()); | ||
543 | // check(Memory < 0) | ||
544 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
545 | |||
546 | @Override | ||
547 | public String getShortDescription() { | ||
548 | return "Expression evaluation from pattern notEnoughAvailableMemory"; | ||
549 | } | ||
550 | |||
551 | @Override | ||
552 | public Iterable<String> getInputParameterNames() { | ||
553 | return Arrays.asList("Memory");} | ||
554 | |||
555 | @Override | ||
556 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
557 | Integer Memory = (Integer) provider.getValue("Memory"); | ||
558 | return evaluateExpression_1_1(Memory); | ||
559 | } | ||
560 | }, null); | ||
561 | bodies.add(body); | ||
562 | } | ||
563 | { | ||
564 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
565 | annotation.addAttribute("severity", "error"); | ||
566 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
567 | new ParameterReference("Host") | ||
568 | })); | ||
569 | annotation.addAttribute("message", "Insufficient memory available on host."); | ||
570 | addAnnotation(annotation); | ||
571 | } | ||
572 | return bodies; | ||
573 | } | ||
574 | } | ||
575 | |||
576 | private static boolean evaluateExpression_1_1(final Integer Memory) { | ||
577 | return ((Memory).intValue() < 0); | ||
578 | } | ||
579 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/RedundantInstancesOnSameHost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/RedundantInstancesOnSameHost.java new file mode 100644 index 00000000..bbb55158 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/RedundantInstancesOnSameHost.java | |||
@@ -0,0 +1,587 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.Requirement; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.Collection; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Objects; | ||
12 | import java.util.Optional; | ||
13 | import java.util.Set; | ||
14 | import java.util.function.Consumer; | ||
15 | import java.util.stream.Collectors; | ||
16 | import java.util.stream.Stream; | ||
17 | import org.apache.log4j.Logger; | ||
18 | import org.eclipse.emf.ecore.EClass; | ||
19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
42 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
43 | |||
44 | /** | ||
45 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
46 | * | ||
47 | * <p>Original source: | ||
48 | * <code><pre> | ||
49 | * {@literal @}Constraint(severity = "error", key = {Req}, | ||
50 | * message = "Redundant instances must not be allocated to the same host.") | ||
51 | * pattern redundantInstancesOnSameHost(Req : Requirement) { | ||
52 | * Requirement.instances(Req, App1); | ||
53 | * Requirement.instances(Req, App2); | ||
54 | * App1 != App2; | ||
55 | * ApplicationInstance.allocatedTo(App1, Host); | ||
56 | * ApplicationInstance.allocatedTo(App2, Host); | ||
57 | * } | ||
58 | * </pre></code> | ||
59 | * | ||
60 | * @see Matcher | ||
61 | * @see Match | ||
62 | * | ||
63 | */ | ||
64 | @SuppressWarnings("all") | ||
65 | public final class RedundantInstancesOnSameHost extends BaseGeneratedEMFQuerySpecification<RedundantInstancesOnSameHost.Matcher> { | ||
66 | /** | ||
67 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.redundantInstancesOnSameHost pattern, | ||
68 | * to be used in conjunction with {@link Matcher}. | ||
69 | * | ||
70 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
71 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
72 | * usable to represent a match of the pattern in the result of a query, | ||
73 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
74 | * | ||
75 | * @see Matcher | ||
76 | * | ||
77 | */ | ||
78 | public static abstract class Match extends BasePatternMatch { | ||
79 | private Requirement fReq; | ||
80 | |||
81 | private static List<String> parameterNames = makeImmutableList("Req"); | ||
82 | |||
83 | private Match(final Requirement pReq) { | ||
84 | this.fReq = pReq; | ||
85 | } | ||
86 | |||
87 | @Override | ||
88 | public Object get(final String parameterName) { | ||
89 | if ("Req".equals(parameterName)) return this.fReq; | ||
90 | return null; | ||
91 | } | ||
92 | |||
93 | public Requirement getReq() { | ||
94 | return this.fReq; | ||
95 | } | ||
96 | |||
97 | @Override | ||
98 | public boolean set(final String parameterName, final Object newValue) { | ||
99 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
100 | if ("Req".equals(parameterName) ) { | ||
101 | this.fReq = (Requirement) newValue; | ||
102 | return true; | ||
103 | } | ||
104 | return false; | ||
105 | } | ||
106 | |||
107 | public void setReq(final Requirement pReq) { | ||
108 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
109 | this.fReq = pReq; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public String patternName() { | ||
114 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.redundantInstancesOnSameHost"; | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public List<String> parameterNames() { | ||
119 | return RedundantInstancesOnSameHost.Match.parameterNames; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public Object[] toArray() { | ||
124 | return new Object[]{fReq}; | ||
125 | } | ||
126 | |||
127 | @Override | ||
128 | public RedundantInstancesOnSameHost.Match toImmutable() { | ||
129 | return isMutable() ? newMatch(fReq) : this; | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public String prettyPrint() { | ||
134 | StringBuilder result = new StringBuilder(); | ||
135 | result.append("\"Req\"=" + prettyPrintValue(fReq)); | ||
136 | return result.toString(); | ||
137 | } | ||
138 | |||
139 | @Override | ||
140 | public int hashCode() { | ||
141 | return Objects.hash(fReq); | ||
142 | } | ||
143 | |||
144 | @Override | ||
145 | public boolean equals(final Object obj) { | ||
146 | if (this == obj) | ||
147 | return true; | ||
148 | if (obj == null) { | ||
149 | return false; | ||
150 | } | ||
151 | if ((obj instanceof RedundantInstancesOnSameHost.Match)) { | ||
152 | RedundantInstancesOnSameHost.Match other = (RedundantInstancesOnSameHost.Match) obj; | ||
153 | return Objects.equals(fReq, other.fReq); | ||
154 | } else { | ||
155 | // this should be infrequent | ||
156 | if (!(obj instanceof IPatternMatch)) { | ||
157 | return false; | ||
158 | } | ||
159 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
160 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | @Override | ||
165 | public RedundantInstancesOnSameHost specification() { | ||
166 | return RedundantInstancesOnSameHost.instance(); | ||
167 | } | ||
168 | |||
169 | /** | ||
170 | * Returns an empty, mutable match. | ||
171 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
172 | * | ||
173 | * @return the empty match. | ||
174 | * | ||
175 | */ | ||
176 | public static RedundantInstancesOnSameHost.Match newEmptyMatch() { | ||
177 | return new Mutable(null); | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * Returns a mutable (partial) match. | ||
182 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
183 | * | ||
184 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
185 | * @return the new, mutable (partial) match object. | ||
186 | * | ||
187 | */ | ||
188 | public static RedundantInstancesOnSameHost.Match newMutableMatch(final Requirement pReq) { | ||
189 | return new Mutable(pReq); | ||
190 | } | ||
191 | |||
192 | /** | ||
193 | * Returns a new (partial) match. | ||
194 | * This can be used e.g. to call the matcher with a partial match. | ||
195 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
196 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
197 | * @return the (partial) match object. | ||
198 | * | ||
199 | */ | ||
200 | public static RedundantInstancesOnSameHost.Match newMatch(final Requirement pReq) { | ||
201 | return new Immutable(pReq); | ||
202 | } | ||
203 | |||
204 | private static final class Mutable extends RedundantInstancesOnSameHost.Match { | ||
205 | Mutable(final Requirement pReq) { | ||
206 | super(pReq); | ||
207 | } | ||
208 | |||
209 | @Override | ||
210 | public boolean isMutable() { | ||
211 | return true; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | private static final class Immutable extends RedundantInstancesOnSameHost.Match { | ||
216 | Immutable(final Requirement pReq) { | ||
217 | super(pReq); | ||
218 | } | ||
219 | |||
220 | @Override | ||
221 | public boolean isMutable() { | ||
222 | return false; | ||
223 | } | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.redundantInstancesOnSameHost pattern, | ||
229 | * providing pattern-specific query methods. | ||
230 | * | ||
231 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
232 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
233 | * | ||
234 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
235 | * | ||
236 | * <p>Original source: | ||
237 | * <code><pre> | ||
238 | * {@literal @}Constraint(severity = "error", key = {Req}, | ||
239 | * message = "Redundant instances must not be allocated to the same host.") | ||
240 | * pattern redundantInstancesOnSameHost(Req : Requirement) { | ||
241 | * Requirement.instances(Req, App1); | ||
242 | * Requirement.instances(Req, App2); | ||
243 | * App1 != App2; | ||
244 | * ApplicationInstance.allocatedTo(App1, Host); | ||
245 | * ApplicationInstance.allocatedTo(App2, Host); | ||
246 | * } | ||
247 | * </pre></code> | ||
248 | * | ||
249 | * @see Match | ||
250 | * @see RedundantInstancesOnSameHost | ||
251 | * | ||
252 | */ | ||
253 | public static class Matcher extends BaseMatcher<RedundantInstancesOnSameHost.Match> { | ||
254 | /** | ||
255 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
256 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
257 | * | ||
258 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
259 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
260 | * | ||
261 | */ | ||
262 | public static RedundantInstancesOnSameHost.Matcher on(final ViatraQueryEngine engine) { | ||
263 | // check if matcher already exists | ||
264 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
265 | if (matcher == null) { | ||
266 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
267 | } | ||
268 | return matcher; | ||
269 | } | ||
270 | |||
271 | /** | ||
272 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
273 | * @return an initialized matcher | ||
274 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
275 | * | ||
276 | */ | ||
277 | public static RedundantInstancesOnSameHost.Matcher create() { | ||
278 | return new Matcher(); | ||
279 | } | ||
280 | |||
281 | private static final int POSITION_REQ = 0; | ||
282 | |||
283 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(RedundantInstancesOnSameHost.Matcher.class); | ||
284 | |||
285 | /** | ||
286 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
287 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
288 | * | ||
289 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
290 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
291 | * | ||
292 | */ | ||
293 | private Matcher() { | ||
294 | super(querySpecification()); | ||
295 | } | ||
296 | |||
297 | /** | ||
298 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
299 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
300 | * @return matches represented as a Match object. | ||
301 | * | ||
302 | */ | ||
303 | public Collection<RedundantInstancesOnSameHost.Match> getAllMatches(final Requirement pReq) { | ||
304 | return rawStreamAllMatches(new Object[]{pReq}).collect(Collectors.toSet()); | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
309 | * </p> | ||
310 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
311 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
312 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
313 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
314 | * @return a stream of matches represented as a Match object. | ||
315 | * | ||
316 | */ | ||
317 | public Stream<RedundantInstancesOnSameHost.Match> streamAllMatches(final Requirement pReq) { | ||
318 | return rawStreamAllMatches(new Object[]{pReq}); | ||
319 | } | ||
320 | |||
321 | /** | ||
322 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
323 | * Neither determinism nor randomness of selection is guaranteed. | ||
324 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
325 | * @return a match represented as a Match object, or null if no match is found. | ||
326 | * | ||
327 | */ | ||
328 | public Optional<RedundantInstancesOnSameHost.Match> getOneArbitraryMatch(final Requirement pReq) { | ||
329 | return rawGetOneArbitraryMatch(new Object[]{pReq}); | ||
330 | } | ||
331 | |||
332 | /** | ||
333 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
334 | * under any possible substitution of the unspecified parameters (if any). | ||
335 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
336 | * @return true if the input is a valid (partial) match of the pattern. | ||
337 | * | ||
338 | */ | ||
339 | public boolean hasMatch(final Requirement pReq) { | ||
340 | return rawHasMatch(new Object[]{pReq}); | ||
341 | } | ||
342 | |||
343 | /** | ||
344 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
345 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
346 | * @return the number of pattern matches found. | ||
347 | * | ||
348 | */ | ||
349 | public int countMatches(final Requirement pReq) { | ||
350 | return rawCountMatches(new Object[]{pReq}); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
355 | * Neither determinism nor randomness of selection is guaranteed. | ||
356 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
357 | * @param processor the action that will process the selected match. | ||
358 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
359 | * | ||
360 | */ | ||
361 | public boolean forOneArbitraryMatch(final Requirement pReq, final Consumer<? super RedundantInstancesOnSameHost.Match> processor) { | ||
362 | return rawForOneArbitraryMatch(new Object[]{pReq}, processor); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * Returns a new (partial) match. | ||
367 | * This can be used e.g. to call the matcher with a partial match. | ||
368 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
369 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
370 | * @return the (partial) match object. | ||
371 | * | ||
372 | */ | ||
373 | public RedundantInstancesOnSameHost.Match newMatch(final Requirement pReq) { | ||
374 | return RedundantInstancesOnSameHost.Match.newMatch(pReq); | ||
375 | } | ||
376 | |||
377 | /** | ||
378 | * Retrieve the set of values that occur in matches for Req. | ||
379 | * @return the Set of all values or empty set if there are no matches | ||
380 | * | ||
381 | */ | ||
382 | protected Stream<Requirement> rawStreamAllValuesOfReq(final Object[] parameters) { | ||
383 | return rawStreamAllValues(POSITION_REQ, parameters).map(Requirement.class::cast); | ||
384 | } | ||
385 | |||
386 | /** | ||
387 | * Retrieve the set of values that occur in matches for Req. | ||
388 | * @return the Set of all values or empty set if there are no matches | ||
389 | * | ||
390 | */ | ||
391 | public Set<Requirement> getAllValuesOfReq() { | ||
392 | return rawStreamAllValuesOfReq(emptyArray()).collect(Collectors.toSet()); | ||
393 | } | ||
394 | |||
395 | /** | ||
396 | * Retrieve the set of values that occur in matches for Req. | ||
397 | * @return the Set of all values or empty set if there are no matches | ||
398 | * | ||
399 | */ | ||
400 | public Stream<Requirement> streamAllValuesOfReq() { | ||
401 | return rawStreamAllValuesOfReq(emptyArray()); | ||
402 | } | ||
403 | |||
404 | @Override | ||
405 | protected RedundantInstancesOnSameHost.Match tupleToMatch(final Tuple t) { | ||
406 | try { | ||
407 | return RedundantInstancesOnSameHost.Match.newMatch((Requirement) t.get(POSITION_REQ)); | ||
408 | } catch(ClassCastException e) { | ||
409 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
410 | return null; | ||
411 | } | ||
412 | } | ||
413 | |||
414 | @Override | ||
415 | protected RedundantInstancesOnSameHost.Match arrayToMatch(final Object[] match) { | ||
416 | try { | ||
417 | return RedundantInstancesOnSameHost.Match.newMatch((Requirement) match[POSITION_REQ]); | ||
418 | } catch(ClassCastException e) { | ||
419 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
420 | return null; | ||
421 | } | ||
422 | } | ||
423 | |||
424 | @Override | ||
425 | protected RedundantInstancesOnSameHost.Match arrayToMatchMutable(final Object[] match) { | ||
426 | try { | ||
427 | return RedundantInstancesOnSameHost.Match.newMutableMatch((Requirement) match[POSITION_REQ]); | ||
428 | } catch(ClassCastException e) { | ||
429 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
430 | return null; | ||
431 | } | ||
432 | } | ||
433 | |||
434 | /** | ||
435 | * @return the singleton instance of the query specification of this pattern | ||
436 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
437 | * | ||
438 | */ | ||
439 | public static IQuerySpecification<RedundantInstancesOnSameHost.Matcher> querySpecification() { | ||
440 | return RedundantInstancesOnSameHost.instance(); | ||
441 | } | ||
442 | } | ||
443 | |||
444 | private RedundantInstancesOnSameHost() { | ||
445 | super(GeneratedPQuery.INSTANCE); | ||
446 | } | ||
447 | |||
448 | /** | ||
449 | * @return the singleton instance of the query specification | ||
450 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
451 | * | ||
452 | */ | ||
453 | public static RedundantInstancesOnSameHost instance() { | ||
454 | try{ | ||
455 | return LazyHolder.INSTANCE; | ||
456 | } catch (ExceptionInInitializerError err) { | ||
457 | throw processInitializerError(err); | ||
458 | } | ||
459 | } | ||
460 | |||
461 | @Override | ||
462 | protected RedundantInstancesOnSameHost.Matcher instantiate(final ViatraQueryEngine engine) { | ||
463 | return RedundantInstancesOnSameHost.Matcher.on(engine); | ||
464 | } | ||
465 | |||
466 | @Override | ||
467 | public RedundantInstancesOnSameHost.Matcher instantiate() { | ||
468 | return RedundantInstancesOnSameHost.Matcher.create(); | ||
469 | } | ||
470 | |||
471 | @Override | ||
472 | public RedundantInstancesOnSameHost.Match newEmptyMatch() { | ||
473 | return RedundantInstancesOnSameHost.Match.newEmptyMatch(); | ||
474 | } | ||
475 | |||
476 | @Override | ||
477 | public RedundantInstancesOnSameHost.Match newMatch(final Object... parameters) { | ||
478 | return RedundantInstancesOnSameHost.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.Requirement) parameters[0]); | ||
479 | } | ||
480 | |||
481 | /** | ||
482 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RedundantInstancesOnSameHost (visibility: PUBLIC, simpleName: RedundantInstancesOnSameHost, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RedundantInstancesOnSameHost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
483 | * <b>not</b> at the class load time of the outer class, | ||
484 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RedundantInstancesOnSameHost (visibility: PUBLIC, simpleName: RedundantInstancesOnSameHost, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RedundantInstancesOnSameHost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
485 | * | ||
486 | * <p> This workaround is required e.g. to support recursion. | ||
487 | * | ||
488 | */ | ||
489 | private static class LazyHolder { | ||
490 | private static final RedundantInstancesOnSameHost INSTANCE = new RedundantInstancesOnSameHost(); | ||
491 | |||
492 | /** | ||
493 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
494 | * This initialization order is required to support indirect recursion. | ||
495 | * | ||
496 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
497 | * | ||
498 | */ | ||
499 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
500 | |||
501 | public static Object ensureInitialized() { | ||
502 | INSTANCE.ensureInitializedInternal(); | ||
503 | return null; | ||
504 | } | ||
505 | } | ||
506 | |||
507 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
508 | private static final RedundantInstancesOnSameHost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
509 | |||
510 | private final PParameter parameter_Req = new PParameter("Req", "hu.bme.mit.inf.dslreasoner.domains.cps.Requirement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "Requirement")), PParameterDirection.INOUT); | ||
511 | |||
512 | private final List<PParameter> parameters = Arrays.asList(parameter_Req); | ||
513 | |||
514 | private GeneratedPQuery() { | ||
515 | super(PVisibility.PUBLIC); | ||
516 | } | ||
517 | |||
518 | @Override | ||
519 | public String getFullyQualifiedName() { | ||
520 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.redundantInstancesOnSameHost"; | ||
521 | } | ||
522 | |||
523 | @Override | ||
524 | public List<String> getParameterNames() { | ||
525 | return Arrays.asList("Req"); | ||
526 | } | ||
527 | |||
528 | @Override | ||
529 | public List<PParameter> getParameters() { | ||
530 | return parameters; | ||
531 | } | ||
532 | |||
533 | @Override | ||
534 | public Set<PBody> doGetContainedBodies() { | ||
535 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
536 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
537 | { | ||
538 | PBody body = new PBody(this); | ||
539 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
540 | PVariable var_App1 = body.getOrCreateVariableByName("App1"); | ||
541 | PVariable var_App2 = body.getOrCreateVariableByName("App2"); | ||
542 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
543 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
544 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
545 | new ExportedParameter(body, var_Req, parameter_Req) | ||
546 | )); | ||
547 | // Requirement.instances(Req, App1) | ||
548 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
549 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
550 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "instances"))); | ||
551 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
552 | new Equality(body, var__virtual_0_, var_App1); | ||
553 | // Requirement.instances(Req, App2) | ||
554 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
555 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
556 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "instances"))); | ||
557 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
558 | new Equality(body, var__virtual_1_, var_App2); | ||
559 | // App1 != App2 | ||
560 | new Inequality(body, var_App1, var_App2); | ||
561 | // ApplicationInstance.allocatedTo(App1, Host) | ||
562 | new TypeConstraint(body, Tuples.flatTupleOf(var_App1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
563 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
564 | new TypeConstraint(body, Tuples.flatTupleOf(var_App1, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
565 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
566 | new Equality(body, var__virtual_2_, var_Host); | ||
567 | // ApplicationInstance.allocatedTo(App2, Host) | ||
568 | new TypeConstraint(body, Tuples.flatTupleOf(var_App2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
569 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
570 | new TypeConstraint(body, Tuples.flatTupleOf(var_App2, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
571 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
572 | new Equality(body, var__virtual_3_, var_Host); | ||
573 | bodies.add(body); | ||
574 | } | ||
575 | { | ||
576 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
577 | annotation.addAttribute("severity", "error"); | ||
578 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
579 | new ParameterReference("Req") | ||
580 | })); | ||
581 | annotation.addAttribute("message", "Redundant instances must not be allocated to the same host."); | ||
582 | addAnnotation(annotation); | ||
583 | } | ||
584 | return bodies; | ||
585 | } | ||
586 | } | ||
587 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/RemoveHostInstance.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/RemoveHostInstance.java new file mode 100644 index 00000000..1141e898 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/RemoveHostInstance.java | |||
@@ -0,0 +1,579 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.Collection; | ||
9 | import java.util.Collections; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | import java.util.Optional; | ||
14 | import java.util.Set; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collectors; | ||
17 | import java.util.stream.Stream; | ||
18 | import org.apache.log4j.Logger; | ||
19 | import org.eclipse.emf.ecore.EClass; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
41 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
42 | |||
43 | /** | ||
44 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
45 | * | ||
46 | * <p>Original source: | ||
47 | * <code><pre> | ||
48 | * pattern removeHostInstance(HostInstance : HostInstance) { | ||
49 | * neg HostInstance.applications(HostInstance, _); | ||
50 | * } | ||
51 | * </pre></code> | ||
52 | * | ||
53 | * @see Matcher | ||
54 | * @see Match | ||
55 | * | ||
56 | */ | ||
57 | @SuppressWarnings("all") | ||
58 | public final class RemoveHostInstance extends BaseGeneratedEMFQuerySpecification<RemoveHostInstance.Matcher> { | ||
59 | /** | ||
60 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.removeHostInstance pattern, | ||
61 | * to be used in conjunction with {@link Matcher}. | ||
62 | * | ||
63 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
64 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
65 | * usable to represent a match of the pattern in the result of a query, | ||
66 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
67 | * | ||
68 | * @see Matcher | ||
69 | * | ||
70 | */ | ||
71 | public static abstract class Match extends BasePatternMatch { | ||
72 | private HostInstance fHostInstance; | ||
73 | |||
74 | private static List<String> parameterNames = makeImmutableList("HostInstance"); | ||
75 | |||
76 | private Match(final HostInstance pHostInstance) { | ||
77 | this.fHostInstance = pHostInstance; | ||
78 | } | ||
79 | |||
80 | @Override | ||
81 | public Object get(final String parameterName) { | ||
82 | if ("HostInstance".equals(parameterName)) return this.fHostInstance; | ||
83 | return null; | ||
84 | } | ||
85 | |||
86 | public HostInstance getHostInstance() { | ||
87 | return this.fHostInstance; | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public boolean set(final String parameterName, final Object newValue) { | ||
92 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
93 | if ("HostInstance".equals(parameterName) ) { | ||
94 | this.fHostInstance = (HostInstance) newValue; | ||
95 | return true; | ||
96 | } | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | public void setHostInstance(final HostInstance pHostInstance) { | ||
101 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
102 | this.fHostInstance = pHostInstance; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String patternName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.removeHostInstance"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> parameterNames() { | ||
112 | return RemoveHostInstance.Match.parameterNames; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Object[] toArray() { | ||
117 | return new Object[]{fHostInstance}; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public RemoveHostInstance.Match toImmutable() { | ||
122 | return isMutable() ? newMatch(fHostInstance) : this; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public String prettyPrint() { | ||
127 | StringBuilder result = new StringBuilder(); | ||
128 | result.append("\"HostInstance\"=" + prettyPrintValue(fHostInstance)); | ||
129 | return result.toString(); | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public int hashCode() { | ||
134 | return Objects.hash(fHostInstance); | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public boolean equals(final Object obj) { | ||
139 | if (this == obj) | ||
140 | return true; | ||
141 | if (obj == null) { | ||
142 | return false; | ||
143 | } | ||
144 | if ((obj instanceof RemoveHostInstance.Match)) { | ||
145 | RemoveHostInstance.Match other = (RemoveHostInstance.Match) obj; | ||
146 | return Objects.equals(fHostInstance, other.fHostInstance); | ||
147 | } else { | ||
148 | // this should be infrequent | ||
149 | if (!(obj instanceof IPatternMatch)) { | ||
150 | return false; | ||
151 | } | ||
152 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
153 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | @Override | ||
158 | public RemoveHostInstance specification() { | ||
159 | return RemoveHostInstance.instance(); | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * Returns an empty, mutable match. | ||
164 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
165 | * | ||
166 | * @return the empty match. | ||
167 | * | ||
168 | */ | ||
169 | public static RemoveHostInstance.Match newEmptyMatch() { | ||
170 | return new Mutable(null); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * Returns a mutable (partial) match. | ||
175 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
176 | * | ||
177 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
178 | * @return the new, mutable (partial) match object. | ||
179 | * | ||
180 | */ | ||
181 | public static RemoveHostInstance.Match newMutableMatch(final HostInstance pHostInstance) { | ||
182 | return new Mutable(pHostInstance); | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | * Returns a new (partial) match. | ||
187 | * This can be used e.g. to call the matcher with a partial match. | ||
188 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
189 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
190 | * @return the (partial) match object. | ||
191 | * | ||
192 | */ | ||
193 | public static RemoveHostInstance.Match newMatch(final HostInstance pHostInstance) { | ||
194 | return new Immutable(pHostInstance); | ||
195 | } | ||
196 | |||
197 | private static final class Mutable extends RemoveHostInstance.Match { | ||
198 | Mutable(final HostInstance pHostInstance) { | ||
199 | super(pHostInstance); | ||
200 | } | ||
201 | |||
202 | @Override | ||
203 | public boolean isMutable() { | ||
204 | return true; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | private static final class Immutable extends RemoveHostInstance.Match { | ||
209 | Immutable(final HostInstance pHostInstance) { | ||
210 | super(pHostInstance); | ||
211 | } | ||
212 | |||
213 | @Override | ||
214 | public boolean isMutable() { | ||
215 | return false; | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.removeHostInstance pattern, | ||
222 | * providing pattern-specific query methods. | ||
223 | * | ||
224 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
225 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
226 | * | ||
227 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
228 | * | ||
229 | * <p>Original source: | ||
230 | * <code><pre> | ||
231 | * pattern removeHostInstance(HostInstance : HostInstance) { | ||
232 | * neg HostInstance.applications(HostInstance, _); | ||
233 | * } | ||
234 | * </pre></code> | ||
235 | * | ||
236 | * @see Match | ||
237 | * @see RemoveHostInstance | ||
238 | * | ||
239 | */ | ||
240 | public static class Matcher extends BaseMatcher<RemoveHostInstance.Match> { | ||
241 | /** | ||
242 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
243 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
244 | * | ||
245 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
246 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
247 | * | ||
248 | */ | ||
249 | public static RemoveHostInstance.Matcher on(final ViatraQueryEngine engine) { | ||
250 | // check if matcher already exists | ||
251 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
252 | if (matcher == null) { | ||
253 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
254 | } | ||
255 | return matcher; | ||
256 | } | ||
257 | |||
258 | /** | ||
259 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
260 | * @return an initialized matcher | ||
261 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
262 | * | ||
263 | */ | ||
264 | public static RemoveHostInstance.Matcher create() { | ||
265 | return new Matcher(); | ||
266 | } | ||
267 | |||
268 | private static final int POSITION_HOSTINSTANCE = 0; | ||
269 | |||
270 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(RemoveHostInstance.Matcher.class); | ||
271 | |||
272 | /** | ||
273 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
274 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
275 | * | ||
276 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
277 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
278 | * | ||
279 | */ | ||
280 | private Matcher() { | ||
281 | super(querySpecification()); | ||
282 | } | ||
283 | |||
284 | /** | ||
285 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
286 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
287 | * @return matches represented as a Match object. | ||
288 | * | ||
289 | */ | ||
290 | public Collection<RemoveHostInstance.Match> getAllMatches(final HostInstance pHostInstance) { | ||
291 | return rawStreamAllMatches(new Object[]{pHostInstance}).collect(Collectors.toSet()); | ||
292 | } | ||
293 | |||
294 | /** | ||
295 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
296 | * </p> | ||
297 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
298 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
299 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
300 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
301 | * @return a stream of matches represented as a Match object. | ||
302 | * | ||
303 | */ | ||
304 | public Stream<RemoveHostInstance.Match> streamAllMatches(final HostInstance pHostInstance) { | ||
305 | return rawStreamAllMatches(new Object[]{pHostInstance}); | ||
306 | } | ||
307 | |||
308 | /** | ||
309 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
310 | * Neither determinism nor randomness of selection is guaranteed. | ||
311 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
312 | * @return a match represented as a Match object, or null if no match is found. | ||
313 | * | ||
314 | */ | ||
315 | public Optional<RemoveHostInstance.Match> getOneArbitraryMatch(final HostInstance pHostInstance) { | ||
316 | return rawGetOneArbitraryMatch(new Object[]{pHostInstance}); | ||
317 | } | ||
318 | |||
319 | /** | ||
320 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
321 | * under any possible substitution of the unspecified parameters (if any). | ||
322 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
323 | * @return true if the input is a valid (partial) match of the pattern. | ||
324 | * | ||
325 | */ | ||
326 | public boolean hasMatch(final HostInstance pHostInstance) { | ||
327 | return rawHasMatch(new Object[]{pHostInstance}); | ||
328 | } | ||
329 | |||
330 | /** | ||
331 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
332 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
333 | * @return the number of pattern matches found. | ||
334 | * | ||
335 | */ | ||
336 | public int countMatches(final HostInstance pHostInstance) { | ||
337 | return rawCountMatches(new Object[]{pHostInstance}); | ||
338 | } | ||
339 | |||
340 | /** | ||
341 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
342 | * Neither determinism nor randomness of selection is guaranteed. | ||
343 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
344 | * @param processor the action that will process the selected match. | ||
345 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
346 | * | ||
347 | */ | ||
348 | public boolean forOneArbitraryMatch(final HostInstance pHostInstance, final Consumer<? super RemoveHostInstance.Match> processor) { | ||
349 | return rawForOneArbitraryMatch(new Object[]{pHostInstance}, processor); | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * Returns a new (partial) match. | ||
354 | * This can be used e.g. to call the matcher with a partial match. | ||
355 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
356 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
357 | * @return the (partial) match object. | ||
358 | * | ||
359 | */ | ||
360 | public RemoveHostInstance.Match newMatch(final HostInstance pHostInstance) { | ||
361 | return RemoveHostInstance.Match.newMatch(pHostInstance); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * Retrieve the set of values that occur in matches for HostInstance. | ||
366 | * @return the Set of all values or empty set if there are no matches | ||
367 | * | ||
368 | */ | ||
369 | protected Stream<HostInstance> rawStreamAllValuesOfHostInstance(final Object[] parameters) { | ||
370 | return rawStreamAllValues(POSITION_HOSTINSTANCE, parameters).map(HostInstance.class::cast); | ||
371 | } | ||
372 | |||
373 | /** | ||
374 | * Retrieve the set of values that occur in matches for HostInstance. | ||
375 | * @return the Set of all values or empty set if there are no matches | ||
376 | * | ||
377 | */ | ||
378 | public Set<HostInstance> getAllValuesOfHostInstance() { | ||
379 | return rawStreamAllValuesOfHostInstance(emptyArray()).collect(Collectors.toSet()); | ||
380 | } | ||
381 | |||
382 | /** | ||
383 | * Retrieve the set of values that occur in matches for HostInstance. | ||
384 | * @return the Set of all values or empty set if there are no matches | ||
385 | * | ||
386 | */ | ||
387 | public Stream<HostInstance> streamAllValuesOfHostInstance() { | ||
388 | return rawStreamAllValuesOfHostInstance(emptyArray()); | ||
389 | } | ||
390 | |||
391 | @Override | ||
392 | protected RemoveHostInstance.Match tupleToMatch(final Tuple t) { | ||
393 | try { | ||
394 | return RemoveHostInstance.Match.newMatch((HostInstance) t.get(POSITION_HOSTINSTANCE)); | ||
395 | } catch(ClassCastException e) { | ||
396 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
397 | return null; | ||
398 | } | ||
399 | } | ||
400 | |||
401 | @Override | ||
402 | protected RemoveHostInstance.Match arrayToMatch(final Object[] match) { | ||
403 | try { | ||
404 | return RemoveHostInstance.Match.newMatch((HostInstance) match[POSITION_HOSTINSTANCE]); | ||
405 | } catch(ClassCastException e) { | ||
406 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
407 | return null; | ||
408 | } | ||
409 | } | ||
410 | |||
411 | @Override | ||
412 | protected RemoveHostInstance.Match arrayToMatchMutable(final Object[] match) { | ||
413 | try { | ||
414 | return RemoveHostInstance.Match.newMutableMatch((HostInstance) match[POSITION_HOSTINSTANCE]); | ||
415 | } catch(ClassCastException e) { | ||
416 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
417 | return null; | ||
418 | } | ||
419 | } | ||
420 | |||
421 | /** | ||
422 | * @return the singleton instance of the query specification of this pattern | ||
423 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
424 | * | ||
425 | */ | ||
426 | public static IQuerySpecification<RemoveHostInstance.Matcher> querySpecification() { | ||
427 | return RemoveHostInstance.instance(); | ||
428 | } | ||
429 | } | ||
430 | |||
431 | private RemoveHostInstance() { | ||
432 | super(GeneratedPQuery.INSTANCE); | ||
433 | } | ||
434 | |||
435 | /** | ||
436 | * @return the singleton instance of the query specification | ||
437 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
438 | * | ||
439 | */ | ||
440 | public static RemoveHostInstance instance() { | ||
441 | try{ | ||
442 | return LazyHolder.INSTANCE; | ||
443 | } catch (ExceptionInInitializerError err) { | ||
444 | throw processInitializerError(err); | ||
445 | } | ||
446 | } | ||
447 | |||
448 | @Override | ||
449 | protected RemoveHostInstance.Matcher instantiate(final ViatraQueryEngine engine) { | ||
450 | return RemoveHostInstance.Matcher.on(engine); | ||
451 | } | ||
452 | |||
453 | @Override | ||
454 | public RemoveHostInstance.Matcher instantiate() { | ||
455 | return RemoveHostInstance.Matcher.create(); | ||
456 | } | ||
457 | |||
458 | @Override | ||
459 | public RemoveHostInstance.Match newEmptyMatch() { | ||
460 | return RemoveHostInstance.Match.newEmptyMatch(); | ||
461 | } | ||
462 | |||
463 | @Override | ||
464 | public RemoveHostInstance.Match newMatch(final Object... parameters) { | ||
465 | return RemoveHostInstance.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[0]); | ||
466 | } | ||
467 | |||
468 | /** | ||
469 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RemoveHostInstance (visibility: PUBLIC, simpleName: RemoveHostInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RemoveHostInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
470 | * <b>not</b> at the class load time of the outer class, | ||
471 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RemoveHostInstance (visibility: PUBLIC, simpleName: RemoveHostInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RemoveHostInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
472 | * | ||
473 | * <p> This workaround is required e.g. to support recursion. | ||
474 | * | ||
475 | */ | ||
476 | private static class LazyHolder { | ||
477 | private static final RemoveHostInstance INSTANCE = new RemoveHostInstance(); | ||
478 | |||
479 | /** | ||
480 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
481 | * This initialization order is required to support indirect recursion. | ||
482 | * | ||
483 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
484 | * | ||
485 | */ | ||
486 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
487 | |||
488 | public static Object ensureInitialized() { | ||
489 | INSTANCE.ensureInitializedInternal(); | ||
490 | return null; | ||
491 | } | ||
492 | } | ||
493 | |||
494 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
495 | private static final RemoveHostInstance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
496 | |||
497 | private final PParameter parameter_HostInstance = new PParameter("HostInstance", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
498 | |||
499 | private final List<PParameter> parameters = Arrays.asList(parameter_HostInstance); | ||
500 | |||
501 | private class Embedded_1_HostInstance_applications extends BaseGeneratedEMFPQuery { | ||
502 | private final PParameter parameter_p0 = new PParameter("p0", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
503 | |||
504 | private final PParameter parameter_p1 = new PParameter("p1", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
505 | |||
506 | private final List<PParameter> embeddedParameters = Arrays.asList(parameter_p0, parameter_p1); | ||
507 | |||
508 | public Embedded_1_HostInstance_applications() { | ||
509 | super(PVisibility.EMBEDDED); | ||
510 | } | ||
511 | |||
512 | @Override | ||
513 | public String getFullyQualifiedName() { | ||
514 | return GeneratedPQuery.this.getFullyQualifiedName() + "$Embedded_1_HostInstance_applications"; | ||
515 | } | ||
516 | |||
517 | @Override | ||
518 | public List<PParameter> getParameters() { | ||
519 | return embeddedParameters; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public Set<PBody> doGetContainedBodies() { | ||
524 | PBody body = new PBody(this); | ||
525 | PVariable var_p0 = body.getOrCreateVariableByName("p0"); | ||
526 | PVariable var_p1 = body.getOrCreateVariableByName("p1"); | ||
527 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
528 | new ExportedParameter(body, var_p0, parameter_p0), | ||
529 | new ExportedParameter(body, var_p1, parameter_p1) | ||
530 | )); | ||
531 | // HostInstance.applications(HostInstance, _) | ||
532 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
533 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
534 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostInstance", "applications"))); | ||
535 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
536 | new Equality(body, var__virtual_0_, var_p1); | ||
537 | return Collections.singleton(body); | ||
538 | } | ||
539 | } | ||
540 | |||
541 | private GeneratedPQuery() { | ||
542 | super(PVisibility.PUBLIC); | ||
543 | } | ||
544 | |||
545 | @Override | ||
546 | public String getFullyQualifiedName() { | ||
547 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.removeHostInstance"; | ||
548 | } | ||
549 | |||
550 | @Override | ||
551 | public List<String> getParameterNames() { | ||
552 | return Arrays.asList("HostInstance"); | ||
553 | } | ||
554 | |||
555 | @Override | ||
556 | public List<PParameter> getParameters() { | ||
557 | return parameters; | ||
558 | } | ||
559 | |||
560 | @Override | ||
561 | public Set<PBody> doGetContainedBodies() { | ||
562 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
563 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
564 | { | ||
565 | PBody body = new PBody(this); | ||
566 | PVariable var_HostInstance = body.getOrCreateVariableByName("HostInstance"); | ||
567 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
568 | new TypeConstraint(body, Tuples.flatTupleOf(var_HostInstance), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
569 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
570 | new ExportedParameter(body, var_HostInstance, parameter_HostInstance) | ||
571 | )); | ||
572 | // neg HostInstance.applications(HostInstance, _) | ||
573 | new NegativePatternCall(body, Tuples.flatTupleOf(var_HostInstance, var___0_), new RemoveHostInstance.GeneratedPQuery.Embedded_1_HostInstance_applications()); | ||
574 | bodies.add(body); | ||
575 | } | ||
576 | return bodies; | ||
577 | } | ||
578 | } | ||
579 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/RequirementNotSatisfied.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/RequirementNotSatisfied.java new file mode 100644 index 00000000..04066c50 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/RequirementNotSatisfied.java | |||
@@ -0,0 +1,597 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.Requirement; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.SatisfyingInstance; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.Collection; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | import java.util.Optional; | ||
14 | import java.util.Set; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collectors; | ||
17 | import java.util.stream.Stream; | ||
18 | import org.apache.log4j.Logger; | ||
19 | import org.eclipse.emf.ecore.EClass; | ||
20 | import org.eclipse.emf.ecore.EDataType; | ||
21 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
22 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
27 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
30 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
44 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
45 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
46 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
47 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
48 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
49 | |||
50 | /** | ||
51 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
52 | * | ||
53 | * <p>Original source: | ||
54 | * <code><pre> | ||
55 | * {@literal @}Constraint(severity = "error", key = {Req}, | ||
56 | * message = "Requirement is not satisfied by enough application instances.") | ||
57 | * pattern requirementNotSatisfied(Req : Requirement) { | ||
58 | * Instances == count find satisfyingInstance(Req, _); | ||
59 | * Requirement.count(Req, RequiredCount); | ||
60 | * check(Instances {@literal <} RequiredCount); | ||
61 | * } | ||
62 | * </pre></code> | ||
63 | * | ||
64 | * @see Matcher | ||
65 | * @see Match | ||
66 | * | ||
67 | */ | ||
68 | @SuppressWarnings("all") | ||
69 | public final class RequirementNotSatisfied extends BaseGeneratedEMFQuerySpecification<RequirementNotSatisfied.Matcher> { | ||
70 | /** | ||
71 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.requirementNotSatisfied pattern, | ||
72 | * to be used in conjunction with {@link Matcher}. | ||
73 | * | ||
74 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
75 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
76 | * usable to represent a match of the pattern in the result of a query, | ||
77 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
78 | * | ||
79 | * @see Matcher | ||
80 | * | ||
81 | */ | ||
82 | public static abstract class Match extends BasePatternMatch { | ||
83 | private Requirement fReq; | ||
84 | |||
85 | private static List<String> parameterNames = makeImmutableList("Req"); | ||
86 | |||
87 | private Match(final Requirement pReq) { | ||
88 | this.fReq = pReq; | ||
89 | } | ||
90 | |||
91 | @Override | ||
92 | public Object get(final String parameterName) { | ||
93 | if ("Req".equals(parameterName)) return this.fReq; | ||
94 | return null; | ||
95 | } | ||
96 | |||
97 | public Requirement getReq() { | ||
98 | return this.fReq; | ||
99 | } | ||
100 | |||
101 | @Override | ||
102 | public boolean set(final String parameterName, final Object newValue) { | ||
103 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
104 | if ("Req".equals(parameterName) ) { | ||
105 | this.fReq = (Requirement) newValue; | ||
106 | return true; | ||
107 | } | ||
108 | return false; | ||
109 | } | ||
110 | |||
111 | public void setReq(final Requirement pReq) { | ||
112 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
113 | this.fReq = pReq; | ||
114 | } | ||
115 | |||
116 | @Override | ||
117 | public String patternName() { | ||
118 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.requirementNotSatisfied"; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public List<String> parameterNames() { | ||
123 | return RequirementNotSatisfied.Match.parameterNames; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public Object[] toArray() { | ||
128 | return new Object[]{fReq}; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public RequirementNotSatisfied.Match toImmutable() { | ||
133 | return isMutable() ? newMatch(fReq) : this; | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public String prettyPrint() { | ||
138 | StringBuilder result = new StringBuilder(); | ||
139 | result.append("\"Req\"=" + prettyPrintValue(fReq)); | ||
140 | return result.toString(); | ||
141 | } | ||
142 | |||
143 | @Override | ||
144 | public int hashCode() { | ||
145 | return Objects.hash(fReq); | ||
146 | } | ||
147 | |||
148 | @Override | ||
149 | public boolean equals(final Object obj) { | ||
150 | if (this == obj) | ||
151 | return true; | ||
152 | if (obj == null) { | ||
153 | return false; | ||
154 | } | ||
155 | if ((obj instanceof RequirementNotSatisfied.Match)) { | ||
156 | RequirementNotSatisfied.Match other = (RequirementNotSatisfied.Match) obj; | ||
157 | return Objects.equals(fReq, other.fReq); | ||
158 | } else { | ||
159 | // this should be infrequent | ||
160 | if (!(obj instanceof IPatternMatch)) { | ||
161 | return false; | ||
162 | } | ||
163 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
164 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | @Override | ||
169 | public RequirementNotSatisfied specification() { | ||
170 | return RequirementNotSatisfied.instance(); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * Returns an empty, mutable match. | ||
175 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
176 | * | ||
177 | * @return the empty match. | ||
178 | * | ||
179 | */ | ||
180 | public static RequirementNotSatisfied.Match newEmptyMatch() { | ||
181 | return new Mutable(null); | ||
182 | } | ||
183 | |||
184 | /** | ||
185 | * Returns a mutable (partial) match. | ||
186 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
187 | * | ||
188 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
189 | * @return the new, mutable (partial) match object. | ||
190 | * | ||
191 | */ | ||
192 | public static RequirementNotSatisfied.Match newMutableMatch(final Requirement pReq) { | ||
193 | return new Mutable(pReq); | ||
194 | } | ||
195 | |||
196 | /** | ||
197 | * Returns a new (partial) match. | ||
198 | * This can be used e.g. to call the matcher with a partial match. | ||
199 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
200 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
201 | * @return the (partial) match object. | ||
202 | * | ||
203 | */ | ||
204 | public static RequirementNotSatisfied.Match newMatch(final Requirement pReq) { | ||
205 | return new Immutable(pReq); | ||
206 | } | ||
207 | |||
208 | private static final class Mutable extends RequirementNotSatisfied.Match { | ||
209 | Mutable(final Requirement pReq) { | ||
210 | super(pReq); | ||
211 | } | ||
212 | |||
213 | @Override | ||
214 | public boolean isMutable() { | ||
215 | return true; | ||
216 | } | ||
217 | } | ||
218 | |||
219 | private static final class Immutable extends RequirementNotSatisfied.Match { | ||
220 | Immutable(final Requirement pReq) { | ||
221 | super(pReq); | ||
222 | } | ||
223 | |||
224 | @Override | ||
225 | public boolean isMutable() { | ||
226 | return false; | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | |||
231 | /** | ||
232 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.requirementNotSatisfied pattern, | ||
233 | * providing pattern-specific query methods. | ||
234 | * | ||
235 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
236 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
237 | * | ||
238 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
239 | * | ||
240 | * <p>Original source: | ||
241 | * <code><pre> | ||
242 | * {@literal @}Constraint(severity = "error", key = {Req}, | ||
243 | * message = "Requirement is not satisfied by enough application instances.") | ||
244 | * pattern requirementNotSatisfied(Req : Requirement) { | ||
245 | * Instances == count find satisfyingInstance(Req, _); | ||
246 | * Requirement.count(Req, RequiredCount); | ||
247 | * check(Instances {@literal <} RequiredCount); | ||
248 | * } | ||
249 | * </pre></code> | ||
250 | * | ||
251 | * @see Match | ||
252 | * @see RequirementNotSatisfied | ||
253 | * | ||
254 | */ | ||
255 | public static class Matcher extends BaseMatcher<RequirementNotSatisfied.Match> { | ||
256 | /** | ||
257 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
258 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
259 | * | ||
260 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
261 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
262 | * | ||
263 | */ | ||
264 | public static RequirementNotSatisfied.Matcher on(final ViatraQueryEngine engine) { | ||
265 | // check if matcher already exists | ||
266 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
267 | if (matcher == null) { | ||
268 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
269 | } | ||
270 | return matcher; | ||
271 | } | ||
272 | |||
273 | /** | ||
274 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
275 | * @return an initialized matcher | ||
276 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
277 | * | ||
278 | */ | ||
279 | public static RequirementNotSatisfied.Matcher create() { | ||
280 | return new Matcher(); | ||
281 | } | ||
282 | |||
283 | private static final int POSITION_REQ = 0; | ||
284 | |||
285 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(RequirementNotSatisfied.Matcher.class); | ||
286 | |||
287 | /** | ||
288 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
289 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
290 | * | ||
291 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
292 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
293 | * | ||
294 | */ | ||
295 | private Matcher() { | ||
296 | super(querySpecification()); | ||
297 | } | ||
298 | |||
299 | /** | ||
300 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
301 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
302 | * @return matches represented as a Match object. | ||
303 | * | ||
304 | */ | ||
305 | public Collection<RequirementNotSatisfied.Match> getAllMatches(final Requirement pReq) { | ||
306 | return rawStreamAllMatches(new Object[]{pReq}).collect(Collectors.toSet()); | ||
307 | } | ||
308 | |||
309 | /** | ||
310 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
311 | * </p> | ||
312 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
313 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
314 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
315 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
316 | * @return a stream of matches represented as a Match object. | ||
317 | * | ||
318 | */ | ||
319 | public Stream<RequirementNotSatisfied.Match> streamAllMatches(final Requirement pReq) { | ||
320 | return rawStreamAllMatches(new Object[]{pReq}); | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
325 | * Neither determinism nor randomness of selection is guaranteed. | ||
326 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
327 | * @return a match represented as a Match object, or null if no match is found. | ||
328 | * | ||
329 | */ | ||
330 | public Optional<RequirementNotSatisfied.Match> getOneArbitraryMatch(final Requirement pReq) { | ||
331 | return rawGetOneArbitraryMatch(new Object[]{pReq}); | ||
332 | } | ||
333 | |||
334 | /** | ||
335 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
336 | * under any possible substitution of the unspecified parameters (if any). | ||
337 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
338 | * @return true if the input is a valid (partial) match of the pattern. | ||
339 | * | ||
340 | */ | ||
341 | public boolean hasMatch(final Requirement pReq) { | ||
342 | return rawHasMatch(new Object[]{pReq}); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
347 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
348 | * @return the number of pattern matches found. | ||
349 | * | ||
350 | */ | ||
351 | public int countMatches(final Requirement pReq) { | ||
352 | return rawCountMatches(new Object[]{pReq}); | ||
353 | } | ||
354 | |||
355 | /** | ||
356 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
357 | * Neither determinism nor randomness of selection is guaranteed. | ||
358 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
359 | * @param processor the action that will process the selected match. | ||
360 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
361 | * | ||
362 | */ | ||
363 | public boolean forOneArbitraryMatch(final Requirement pReq, final Consumer<? super RequirementNotSatisfied.Match> processor) { | ||
364 | return rawForOneArbitraryMatch(new Object[]{pReq}, processor); | ||
365 | } | ||
366 | |||
367 | /** | ||
368 | * Returns a new (partial) match. | ||
369 | * This can be used e.g. to call the matcher with a partial match. | ||
370 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
371 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
372 | * @return the (partial) match object. | ||
373 | * | ||
374 | */ | ||
375 | public RequirementNotSatisfied.Match newMatch(final Requirement pReq) { | ||
376 | return RequirementNotSatisfied.Match.newMatch(pReq); | ||
377 | } | ||
378 | |||
379 | /** | ||
380 | * Retrieve the set of values that occur in matches for Req. | ||
381 | * @return the Set of all values or empty set if there are no matches | ||
382 | * | ||
383 | */ | ||
384 | protected Stream<Requirement> rawStreamAllValuesOfReq(final Object[] parameters) { | ||
385 | return rawStreamAllValues(POSITION_REQ, parameters).map(Requirement.class::cast); | ||
386 | } | ||
387 | |||
388 | /** | ||
389 | * Retrieve the set of values that occur in matches for Req. | ||
390 | * @return the Set of all values or empty set if there are no matches | ||
391 | * | ||
392 | */ | ||
393 | public Set<Requirement> getAllValuesOfReq() { | ||
394 | return rawStreamAllValuesOfReq(emptyArray()).collect(Collectors.toSet()); | ||
395 | } | ||
396 | |||
397 | /** | ||
398 | * Retrieve the set of values that occur in matches for Req. | ||
399 | * @return the Set of all values or empty set if there are no matches | ||
400 | * | ||
401 | */ | ||
402 | public Stream<Requirement> streamAllValuesOfReq() { | ||
403 | return rawStreamAllValuesOfReq(emptyArray()); | ||
404 | } | ||
405 | |||
406 | @Override | ||
407 | protected RequirementNotSatisfied.Match tupleToMatch(final Tuple t) { | ||
408 | try { | ||
409 | return RequirementNotSatisfied.Match.newMatch((Requirement) t.get(POSITION_REQ)); | ||
410 | } catch(ClassCastException e) { | ||
411 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
412 | return null; | ||
413 | } | ||
414 | } | ||
415 | |||
416 | @Override | ||
417 | protected RequirementNotSatisfied.Match arrayToMatch(final Object[] match) { | ||
418 | try { | ||
419 | return RequirementNotSatisfied.Match.newMatch((Requirement) match[POSITION_REQ]); | ||
420 | } catch(ClassCastException e) { | ||
421 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
422 | return null; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | @Override | ||
427 | protected RequirementNotSatisfied.Match arrayToMatchMutable(final Object[] match) { | ||
428 | try { | ||
429 | return RequirementNotSatisfied.Match.newMutableMatch((Requirement) match[POSITION_REQ]); | ||
430 | } catch(ClassCastException e) { | ||
431 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
432 | return null; | ||
433 | } | ||
434 | } | ||
435 | |||
436 | /** | ||
437 | * @return the singleton instance of the query specification of this pattern | ||
438 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
439 | * | ||
440 | */ | ||
441 | public static IQuerySpecification<RequirementNotSatisfied.Matcher> querySpecification() { | ||
442 | return RequirementNotSatisfied.instance(); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | private RequirementNotSatisfied() { | ||
447 | super(GeneratedPQuery.INSTANCE); | ||
448 | } | ||
449 | |||
450 | /** | ||
451 | * @return the singleton instance of the query specification | ||
452 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
453 | * | ||
454 | */ | ||
455 | public static RequirementNotSatisfied instance() { | ||
456 | try{ | ||
457 | return LazyHolder.INSTANCE; | ||
458 | } catch (ExceptionInInitializerError err) { | ||
459 | throw processInitializerError(err); | ||
460 | } | ||
461 | } | ||
462 | |||
463 | @Override | ||
464 | protected RequirementNotSatisfied.Matcher instantiate(final ViatraQueryEngine engine) { | ||
465 | return RequirementNotSatisfied.Matcher.on(engine); | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | public RequirementNotSatisfied.Matcher instantiate() { | ||
470 | return RequirementNotSatisfied.Matcher.create(); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public RequirementNotSatisfied.Match newEmptyMatch() { | ||
475 | return RequirementNotSatisfied.Match.newEmptyMatch(); | ||
476 | } | ||
477 | |||
478 | @Override | ||
479 | public RequirementNotSatisfied.Match newMatch(final Object... parameters) { | ||
480 | return RequirementNotSatisfied.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.Requirement) parameters[0]); | ||
481 | } | ||
482 | |||
483 | /** | ||
484 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RequirementNotSatisfied (visibility: PUBLIC, simpleName: RequirementNotSatisfied, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RequirementNotSatisfied, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
485 | * <b>not</b> at the class load time of the outer class, | ||
486 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RequirementNotSatisfied (visibility: PUBLIC, simpleName: RequirementNotSatisfied, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.RequirementNotSatisfied, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
487 | * | ||
488 | * <p> This workaround is required e.g. to support recursion. | ||
489 | * | ||
490 | */ | ||
491 | private static class LazyHolder { | ||
492 | private static final RequirementNotSatisfied INSTANCE = new RequirementNotSatisfied(); | ||
493 | |||
494 | /** | ||
495 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
496 | * This initialization order is required to support indirect recursion. | ||
497 | * | ||
498 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
499 | * | ||
500 | */ | ||
501 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
502 | |||
503 | public static Object ensureInitialized() { | ||
504 | INSTANCE.ensureInitializedInternal(); | ||
505 | return null; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
510 | private static final RequirementNotSatisfied.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
511 | |||
512 | private final PParameter parameter_Req = new PParameter("Req", "hu.bme.mit.inf.dslreasoner.domains.cps.Requirement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "Requirement")), PParameterDirection.INOUT); | ||
513 | |||
514 | private final List<PParameter> parameters = Arrays.asList(parameter_Req); | ||
515 | |||
516 | private GeneratedPQuery() { | ||
517 | super(PVisibility.PUBLIC); | ||
518 | } | ||
519 | |||
520 | @Override | ||
521 | public String getFullyQualifiedName() { | ||
522 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.requirementNotSatisfied"; | ||
523 | } | ||
524 | |||
525 | @Override | ||
526 | public List<String> getParameterNames() { | ||
527 | return Arrays.asList("Req"); | ||
528 | } | ||
529 | |||
530 | @Override | ||
531 | public List<PParameter> getParameters() { | ||
532 | return parameters; | ||
533 | } | ||
534 | |||
535 | @Override | ||
536 | public Set<PBody> doGetContainedBodies() { | ||
537 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
538 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
539 | { | ||
540 | PBody body = new PBody(this); | ||
541 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
542 | PVariable var_Instances = body.getOrCreateVariableByName("Instances"); | ||
543 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
544 | PVariable var_RequiredCount = body.getOrCreateVariableByName("RequiredCount"); | ||
545 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
546 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
547 | new ExportedParameter(body, var_Req, parameter_Req) | ||
548 | )); | ||
549 | // Instances == count find satisfyingInstance(Req, _) | ||
550 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
551 | new PatternMatchCounter(body, Tuples.flatTupleOf(var_Req, var___0_), SatisfyingInstance.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
552 | new Equality(body, var_Instances, var__virtual_0_); | ||
553 | // Requirement.count(Req, RequiredCount) | ||
554 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
555 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
556 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "count"))); | ||
557 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
558 | new Equality(body, var__virtual_1_, var_RequiredCount); | ||
559 | // check(Instances < RequiredCount) | ||
560 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
561 | |||
562 | @Override | ||
563 | public String getShortDescription() { | ||
564 | return "Expression evaluation from pattern requirementNotSatisfied"; | ||
565 | } | ||
566 | |||
567 | @Override | ||
568 | public Iterable<String> getInputParameterNames() { | ||
569 | return Arrays.asList("Instances", "RequiredCount");} | ||
570 | |||
571 | @Override | ||
572 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
573 | Integer Instances = (Integer) provider.getValue("Instances"); | ||
574 | Integer RequiredCount = (Integer) provider.getValue("RequiredCount"); | ||
575 | return evaluateExpression_1_1(Instances, RequiredCount); | ||
576 | } | ||
577 | }, null); | ||
578 | bodies.add(body); | ||
579 | } | ||
580 | { | ||
581 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
582 | annotation.addAttribute("severity", "error"); | ||
583 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
584 | new ParameterReference("Req") | ||
585 | })); | ||
586 | annotation.addAttribute("message", "Requirement is not satisfied by enough application instances."); | ||
587 | addAnnotation(annotation); | ||
588 | } | ||
589 | return bodies; | ||
590 | } | ||
591 | } | ||
592 | |||
593 | private static boolean evaluateExpression_1_1(final Integer Instances, final Integer RequiredCount) { | ||
594 | boolean _lessThan = (Instances.compareTo(RequiredCount) < 0); | ||
595 | return _lessThan; | ||
596 | } | ||
597 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/ResourceRequirement.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/ResourceRequirement.java new file mode 100644 index 00000000..db7710f5 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/ResourceRequirement.java | |||
@@ -0,0 +1,829 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.Collection; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | import java.util.Optional; | ||
14 | import java.util.Set; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collectors; | ||
17 | import java.util.stream.Stream; | ||
18 | import org.apache.log4j.Logger; | ||
19 | import org.eclipse.emf.ecore.EClass; | ||
20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
21 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
22 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
40 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
41 | |||
42 | /** | ||
43 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
44 | * | ||
45 | * <p>Original source: | ||
46 | * <code><pre> | ||
47 | * pattern resourceRequirement(Host : HostInstance, App : ApplicationInstance, Req : ResourceRequirement) { | ||
48 | * ApplicationInstance.allocatedTo(App, Host); | ||
49 | * ApplicationInstance.type.requirements(App, Req); | ||
50 | * HostInstance.type(Host, HostType); | ||
51 | * ResourceRequirement.hostType(Req, HostType); | ||
52 | * } | ||
53 | * </pre></code> | ||
54 | * | ||
55 | * @see Matcher | ||
56 | * @see Match | ||
57 | * | ||
58 | */ | ||
59 | @SuppressWarnings("all") | ||
60 | public final class ResourceRequirement extends BaseGeneratedEMFQuerySpecification<ResourceRequirement.Matcher> { | ||
61 | /** | ||
62 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.resourceRequirement pattern, | ||
63 | * to be used in conjunction with {@link Matcher}. | ||
64 | * | ||
65 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
66 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
67 | * usable to represent a match of the pattern in the result of a query, | ||
68 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
69 | * | ||
70 | * @see Matcher | ||
71 | * | ||
72 | */ | ||
73 | public static abstract class Match extends BasePatternMatch { | ||
74 | private HostInstance fHost; | ||
75 | |||
76 | private ApplicationInstance fApp; | ||
77 | |||
78 | private hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement fReq; | ||
79 | |||
80 | private static List<String> parameterNames = makeImmutableList("Host", "App", "Req"); | ||
81 | |||
82 | private Match(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
83 | this.fHost = pHost; | ||
84 | this.fApp = pApp; | ||
85 | this.fReq = pReq; | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public Object get(final String parameterName) { | ||
90 | if ("Host".equals(parameterName)) return this.fHost; | ||
91 | if ("App".equals(parameterName)) return this.fApp; | ||
92 | if ("Req".equals(parameterName)) return this.fReq; | ||
93 | return null; | ||
94 | } | ||
95 | |||
96 | public HostInstance getHost() { | ||
97 | return this.fHost; | ||
98 | } | ||
99 | |||
100 | public ApplicationInstance getApp() { | ||
101 | return this.fApp; | ||
102 | } | ||
103 | |||
104 | public hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement getReq() { | ||
105 | return this.fReq; | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | public boolean set(final String parameterName, final Object newValue) { | ||
110 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
111 | if ("Host".equals(parameterName) ) { | ||
112 | this.fHost = (HostInstance) newValue; | ||
113 | return true; | ||
114 | } | ||
115 | if ("App".equals(parameterName) ) { | ||
116 | this.fApp = (ApplicationInstance) newValue; | ||
117 | return true; | ||
118 | } | ||
119 | if ("Req".equals(parameterName) ) { | ||
120 | this.fReq = (hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement) newValue; | ||
121 | return true; | ||
122 | } | ||
123 | return false; | ||
124 | } | ||
125 | |||
126 | public void setHost(final HostInstance pHost) { | ||
127 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
128 | this.fHost = pHost; | ||
129 | } | ||
130 | |||
131 | public void setApp(final ApplicationInstance pApp) { | ||
132 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
133 | this.fApp = pApp; | ||
134 | } | ||
135 | |||
136 | public void setReq(final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
137 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
138 | this.fReq = pReq; | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public String patternName() { | ||
143 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.resourceRequirement"; | ||
144 | } | ||
145 | |||
146 | @Override | ||
147 | public List<String> parameterNames() { | ||
148 | return ResourceRequirement.Match.parameterNames; | ||
149 | } | ||
150 | |||
151 | @Override | ||
152 | public Object[] toArray() { | ||
153 | return new Object[]{fHost, fApp, fReq}; | ||
154 | } | ||
155 | |||
156 | @Override | ||
157 | public ResourceRequirement.Match toImmutable() { | ||
158 | return isMutable() ? newMatch(fHost, fApp, fReq) : this; | ||
159 | } | ||
160 | |||
161 | @Override | ||
162 | public String prettyPrint() { | ||
163 | StringBuilder result = new StringBuilder(); | ||
164 | result.append("\"Host\"=" + prettyPrintValue(fHost) + ", "); | ||
165 | result.append("\"App\"=" + prettyPrintValue(fApp) + ", "); | ||
166 | result.append("\"Req\"=" + prettyPrintValue(fReq)); | ||
167 | return result.toString(); | ||
168 | } | ||
169 | |||
170 | @Override | ||
171 | public int hashCode() { | ||
172 | return Objects.hash(fHost, fApp, fReq); | ||
173 | } | ||
174 | |||
175 | @Override | ||
176 | public boolean equals(final Object obj) { | ||
177 | if (this == obj) | ||
178 | return true; | ||
179 | if (obj == null) { | ||
180 | return false; | ||
181 | } | ||
182 | if ((obj instanceof ResourceRequirement.Match)) { | ||
183 | ResourceRequirement.Match other = (ResourceRequirement.Match) obj; | ||
184 | return Objects.equals(fHost, other.fHost) && Objects.equals(fApp, other.fApp) && Objects.equals(fReq, other.fReq); | ||
185 | } else { | ||
186 | // this should be infrequent | ||
187 | if (!(obj instanceof IPatternMatch)) { | ||
188 | return false; | ||
189 | } | ||
190 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
191 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | @Override | ||
196 | public ResourceRequirement specification() { | ||
197 | return ResourceRequirement.instance(); | ||
198 | } | ||
199 | |||
200 | /** | ||
201 | * Returns an empty, mutable match. | ||
202 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
203 | * | ||
204 | * @return the empty match. | ||
205 | * | ||
206 | */ | ||
207 | public static ResourceRequirement.Match newEmptyMatch() { | ||
208 | return new Mutable(null, null, null); | ||
209 | } | ||
210 | |||
211 | /** | ||
212 | * Returns a mutable (partial) match. | ||
213 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
214 | * | ||
215 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
216 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
217 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
218 | * @return the new, mutable (partial) match object. | ||
219 | * | ||
220 | */ | ||
221 | public static ResourceRequirement.Match newMutableMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
222 | return new Mutable(pHost, pApp, pReq); | ||
223 | } | ||
224 | |||
225 | /** | ||
226 | * Returns a new (partial) match. | ||
227 | * This can be used e.g. to call the matcher with a partial match. | ||
228 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
229 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
230 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
231 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
232 | * @return the (partial) match object. | ||
233 | * | ||
234 | */ | ||
235 | public static ResourceRequirement.Match newMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
236 | return new Immutable(pHost, pApp, pReq); | ||
237 | } | ||
238 | |||
239 | private static final class Mutable extends ResourceRequirement.Match { | ||
240 | Mutable(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
241 | super(pHost, pApp, pReq); | ||
242 | } | ||
243 | |||
244 | @Override | ||
245 | public boolean isMutable() { | ||
246 | return true; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | private static final class Immutable extends ResourceRequirement.Match { | ||
251 | Immutable(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
252 | super(pHost, pApp, pReq); | ||
253 | } | ||
254 | |||
255 | @Override | ||
256 | public boolean isMutable() { | ||
257 | return false; | ||
258 | } | ||
259 | } | ||
260 | } | ||
261 | |||
262 | /** | ||
263 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.resourceRequirement pattern, | ||
264 | * providing pattern-specific query methods. | ||
265 | * | ||
266 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
267 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
268 | * | ||
269 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
270 | * | ||
271 | * <p>Original source: | ||
272 | * <code><pre> | ||
273 | * pattern resourceRequirement(Host : HostInstance, App : ApplicationInstance, Req : ResourceRequirement) { | ||
274 | * ApplicationInstance.allocatedTo(App, Host); | ||
275 | * ApplicationInstance.type.requirements(App, Req); | ||
276 | * HostInstance.type(Host, HostType); | ||
277 | * ResourceRequirement.hostType(Req, HostType); | ||
278 | * } | ||
279 | * </pre></code> | ||
280 | * | ||
281 | * @see Match | ||
282 | * @see ResourceRequirement | ||
283 | * | ||
284 | */ | ||
285 | public static class Matcher extends BaseMatcher<ResourceRequirement.Match> { | ||
286 | /** | ||
287 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
288 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
289 | * | ||
290 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
291 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
292 | * | ||
293 | */ | ||
294 | public static ResourceRequirement.Matcher on(final ViatraQueryEngine engine) { | ||
295 | // check if matcher already exists | ||
296 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
297 | if (matcher == null) { | ||
298 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
299 | } | ||
300 | return matcher; | ||
301 | } | ||
302 | |||
303 | /** | ||
304 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
305 | * @return an initialized matcher | ||
306 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
307 | * | ||
308 | */ | ||
309 | public static ResourceRequirement.Matcher create() { | ||
310 | return new Matcher(); | ||
311 | } | ||
312 | |||
313 | private static final int POSITION_HOST = 0; | ||
314 | |||
315 | private static final int POSITION_APP = 1; | ||
316 | |||
317 | private static final int POSITION_REQ = 2; | ||
318 | |||
319 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ResourceRequirement.Matcher.class); | ||
320 | |||
321 | /** | ||
322 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
323 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
324 | * | ||
325 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
326 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
327 | * | ||
328 | */ | ||
329 | private Matcher() { | ||
330 | super(querySpecification()); | ||
331 | } | ||
332 | |||
333 | /** | ||
334 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
335 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
336 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
337 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
338 | * @return matches represented as a Match object. | ||
339 | * | ||
340 | */ | ||
341 | public Collection<ResourceRequirement.Match> getAllMatches(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
342 | return rawStreamAllMatches(new Object[]{pHost, pApp, pReq}).collect(Collectors.toSet()); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
347 | * </p> | ||
348 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
349 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
350 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
351 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
352 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
353 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
354 | * @return a stream of matches represented as a Match object. | ||
355 | * | ||
356 | */ | ||
357 | public Stream<ResourceRequirement.Match> streamAllMatches(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
358 | return rawStreamAllMatches(new Object[]{pHost, pApp, pReq}); | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
363 | * Neither determinism nor randomness of selection is guaranteed. | ||
364 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
365 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
366 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
367 | * @return a match represented as a Match object, or null if no match is found. | ||
368 | * | ||
369 | */ | ||
370 | public Optional<ResourceRequirement.Match> getOneArbitraryMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
371 | return rawGetOneArbitraryMatch(new Object[]{pHost, pApp, pReq}); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
376 | * under any possible substitution of the unspecified parameters (if any). | ||
377 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
378 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
379 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
380 | * @return true if the input is a valid (partial) match of the pattern. | ||
381 | * | ||
382 | */ | ||
383 | public boolean hasMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
384 | return rawHasMatch(new Object[]{pHost, pApp, pReq}); | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
389 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
390 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
391 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
392 | * @return the number of pattern matches found. | ||
393 | * | ||
394 | */ | ||
395 | public int countMatches(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
396 | return rawCountMatches(new Object[]{pHost, pApp, pReq}); | ||
397 | } | ||
398 | |||
399 | /** | ||
400 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
401 | * Neither determinism nor randomness of selection is guaranteed. | ||
402 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
403 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
404 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
405 | * @param processor the action that will process the selected match. | ||
406 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
407 | * | ||
408 | */ | ||
409 | public boolean forOneArbitraryMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq, final Consumer<? super ResourceRequirement.Match> processor) { | ||
410 | return rawForOneArbitraryMatch(new Object[]{pHost, pApp, pReq}, processor); | ||
411 | } | ||
412 | |||
413 | /** | ||
414 | * Returns a new (partial) match. | ||
415 | * This can be used e.g. to call the matcher with a partial match. | ||
416 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
417 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
418 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
419 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
420 | * @return the (partial) match object. | ||
421 | * | ||
422 | */ | ||
423 | public ResourceRequirement.Match newMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
424 | return ResourceRequirement.Match.newMatch(pHost, pApp, pReq); | ||
425 | } | ||
426 | |||
427 | /** | ||
428 | * Retrieve the set of values that occur in matches for Host. | ||
429 | * @return the Set of all values or empty set if there are no matches | ||
430 | * | ||
431 | */ | ||
432 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
433 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
434 | } | ||
435 | |||
436 | /** | ||
437 | * Retrieve the set of values that occur in matches for Host. | ||
438 | * @return the Set of all values or empty set if there are no matches | ||
439 | * | ||
440 | */ | ||
441 | public Set<HostInstance> getAllValuesOfHost() { | ||
442 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * Retrieve the set of values that occur in matches for Host. | ||
447 | * @return the Set of all values or empty set if there are no matches | ||
448 | * | ||
449 | */ | ||
450 | public Stream<HostInstance> streamAllValuesOfHost() { | ||
451 | return rawStreamAllValuesOfHost(emptyArray()); | ||
452 | } | ||
453 | |||
454 | /** | ||
455 | * Retrieve the set of values that occur in matches for Host. | ||
456 | * </p> | ||
457 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
458 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
459 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
460 | * | ||
461 | * @return the Stream of all values or empty set if there are no matches | ||
462 | * | ||
463 | */ | ||
464 | public Stream<HostInstance> streamAllValuesOfHost(final ResourceRequirement.Match partialMatch) { | ||
465 | return rawStreamAllValuesOfHost(partialMatch.toArray()); | ||
466 | } | ||
467 | |||
468 | /** | ||
469 | * Retrieve the set of values that occur in matches for Host. | ||
470 | * </p> | ||
471 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
472 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
473 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
474 | * | ||
475 | * @return the Stream of all values or empty set if there are no matches | ||
476 | * | ||
477 | */ | ||
478 | public Stream<HostInstance> streamAllValuesOfHost(final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
479 | return rawStreamAllValuesOfHost(new Object[]{null, pApp, pReq}); | ||
480 | } | ||
481 | |||
482 | /** | ||
483 | * Retrieve the set of values that occur in matches for Host. | ||
484 | * @return the Set of all values or empty set if there are no matches | ||
485 | * | ||
486 | */ | ||
487 | public Set<HostInstance> getAllValuesOfHost(final ResourceRequirement.Match partialMatch) { | ||
488 | return rawStreamAllValuesOfHost(partialMatch.toArray()).collect(Collectors.toSet()); | ||
489 | } | ||
490 | |||
491 | /** | ||
492 | * Retrieve the set of values that occur in matches for Host. | ||
493 | * @return the Set of all values or empty set if there are no matches | ||
494 | * | ||
495 | */ | ||
496 | public Set<HostInstance> getAllValuesOfHost(final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
497 | return rawStreamAllValuesOfHost(new Object[]{null, pApp, pReq}).collect(Collectors.toSet()); | ||
498 | } | ||
499 | |||
500 | /** | ||
501 | * Retrieve the set of values that occur in matches for App. | ||
502 | * @return the Set of all values or empty set if there are no matches | ||
503 | * | ||
504 | */ | ||
505 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
506 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
507 | } | ||
508 | |||
509 | /** | ||
510 | * Retrieve the set of values that occur in matches for App. | ||
511 | * @return the Set of all values or empty set if there are no matches | ||
512 | * | ||
513 | */ | ||
514 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
515 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
516 | } | ||
517 | |||
518 | /** | ||
519 | * Retrieve the set of values that occur in matches for App. | ||
520 | * @return the Set of all values or empty set if there are no matches | ||
521 | * | ||
522 | */ | ||
523 | public Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
524 | return rawStreamAllValuesOfApp(emptyArray()); | ||
525 | } | ||
526 | |||
527 | /** | ||
528 | * Retrieve the set of values that occur in matches for App. | ||
529 | * </p> | ||
530 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
531 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
532 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
533 | * | ||
534 | * @return the Stream of all values or empty set if there are no matches | ||
535 | * | ||
536 | */ | ||
537 | public Stream<ApplicationInstance> streamAllValuesOfApp(final ResourceRequirement.Match partialMatch) { | ||
538 | return rawStreamAllValuesOfApp(partialMatch.toArray()); | ||
539 | } | ||
540 | |||
541 | /** | ||
542 | * Retrieve the set of values that occur in matches for App. | ||
543 | * </p> | ||
544 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
545 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
546 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
547 | * | ||
548 | * @return the Stream of all values or empty set if there are no matches | ||
549 | * | ||
550 | */ | ||
551 | public Stream<ApplicationInstance> streamAllValuesOfApp(final HostInstance pHost, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
552 | return rawStreamAllValuesOfApp(new Object[]{pHost, null, pReq}); | ||
553 | } | ||
554 | |||
555 | /** | ||
556 | * Retrieve the set of values that occur in matches for App. | ||
557 | * @return the Set of all values or empty set if there are no matches | ||
558 | * | ||
559 | */ | ||
560 | public Set<ApplicationInstance> getAllValuesOfApp(final ResourceRequirement.Match partialMatch) { | ||
561 | return rawStreamAllValuesOfApp(partialMatch.toArray()).collect(Collectors.toSet()); | ||
562 | } | ||
563 | |||
564 | /** | ||
565 | * Retrieve the set of values that occur in matches for App. | ||
566 | * @return the Set of all values or empty set if there are no matches | ||
567 | * | ||
568 | */ | ||
569 | public Set<ApplicationInstance> getAllValuesOfApp(final HostInstance pHost, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
570 | return rawStreamAllValuesOfApp(new Object[]{pHost, null, pReq}).collect(Collectors.toSet()); | ||
571 | } | ||
572 | |||
573 | /** | ||
574 | * Retrieve the set of values that occur in matches for Req. | ||
575 | * @return the Set of all values or empty set if there are no matches | ||
576 | * | ||
577 | */ | ||
578 | protected Stream<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> rawStreamAllValuesOfReq(final Object[] parameters) { | ||
579 | return rawStreamAllValues(POSITION_REQ, parameters).map(hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement.class::cast); | ||
580 | } | ||
581 | |||
582 | /** | ||
583 | * Retrieve the set of values that occur in matches for Req. | ||
584 | * @return the Set of all values or empty set if there are no matches | ||
585 | * | ||
586 | */ | ||
587 | public Set<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> getAllValuesOfReq() { | ||
588 | return rawStreamAllValuesOfReq(emptyArray()).collect(Collectors.toSet()); | ||
589 | } | ||
590 | |||
591 | /** | ||
592 | * Retrieve the set of values that occur in matches for Req. | ||
593 | * @return the Set of all values or empty set if there are no matches | ||
594 | * | ||
595 | */ | ||
596 | public Stream<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> streamAllValuesOfReq() { | ||
597 | return rawStreamAllValuesOfReq(emptyArray()); | ||
598 | } | ||
599 | |||
600 | /** | ||
601 | * Retrieve the set of values that occur in matches for Req. | ||
602 | * </p> | ||
603 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
604 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
605 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
606 | * | ||
607 | * @return the Stream of all values or empty set if there are no matches | ||
608 | * | ||
609 | */ | ||
610 | public Stream<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> streamAllValuesOfReq(final ResourceRequirement.Match partialMatch) { | ||
611 | return rawStreamAllValuesOfReq(partialMatch.toArray()); | ||
612 | } | ||
613 | |||
614 | /** | ||
615 | * Retrieve the set of values that occur in matches for Req. | ||
616 | * </p> | ||
617 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
618 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
619 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
620 | * | ||
621 | * @return the Stream of all values or empty set if there are no matches | ||
622 | * | ||
623 | */ | ||
624 | public Stream<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> streamAllValuesOfReq(final HostInstance pHost, final ApplicationInstance pApp) { | ||
625 | return rawStreamAllValuesOfReq(new Object[]{pHost, pApp, null}); | ||
626 | } | ||
627 | |||
628 | /** | ||
629 | * Retrieve the set of values that occur in matches for Req. | ||
630 | * @return the Set of all values or empty set if there are no matches | ||
631 | * | ||
632 | */ | ||
633 | public Set<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> getAllValuesOfReq(final ResourceRequirement.Match partialMatch) { | ||
634 | return rawStreamAllValuesOfReq(partialMatch.toArray()).collect(Collectors.toSet()); | ||
635 | } | ||
636 | |||
637 | /** | ||
638 | * Retrieve the set of values that occur in matches for Req. | ||
639 | * @return the Set of all values or empty set if there are no matches | ||
640 | * | ||
641 | */ | ||
642 | public Set<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> getAllValuesOfReq(final HostInstance pHost, final ApplicationInstance pApp) { | ||
643 | return rawStreamAllValuesOfReq(new Object[]{pHost, pApp, null}).collect(Collectors.toSet()); | ||
644 | } | ||
645 | |||
646 | @Override | ||
647 | protected ResourceRequirement.Match tupleToMatch(final Tuple t) { | ||
648 | try { | ||
649 | return ResourceRequirement.Match.newMatch((HostInstance) t.get(POSITION_HOST), (ApplicationInstance) t.get(POSITION_APP), (hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement) t.get(POSITION_REQ)); | ||
650 | } catch(ClassCastException e) { | ||
651 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
652 | return null; | ||
653 | } | ||
654 | } | ||
655 | |||
656 | @Override | ||
657 | protected ResourceRequirement.Match arrayToMatch(final Object[] match) { | ||
658 | try { | ||
659 | return ResourceRequirement.Match.newMatch((HostInstance) match[POSITION_HOST], (ApplicationInstance) match[POSITION_APP], (hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement) match[POSITION_REQ]); | ||
660 | } catch(ClassCastException e) { | ||
661 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
662 | return null; | ||
663 | } | ||
664 | } | ||
665 | |||
666 | @Override | ||
667 | protected ResourceRequirement.Match arrayToMatchMutable(final Object[] match) { | ||
668 | try { | ||
669 | return ResourceRequirement.Match.newMutableMatch((HostInstance) match[POSITION_HOST], (ApplicationInstance) match[POSITION_APP], (hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement) match[POSITION_REQ]); | ||
670 | } catch(ClassCastException e) { | ||
671 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
672 | return null; | ||
673 | } | ||
674 | } | ||
675 | |||
676 | /** | ||
677 | * @return the singleton instance of the query specification of this pattern | ||
678 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
679 | * | ||
680 | */ | ||
681 | public static IQuerySpecification<ResourceRequirement.Matcher> querySpecification() { | ||
682 | return ResourceRequirement.instance(); | ||
683 | } | ||
684 | } | ||
685 | |||
686 | private ResourceRequirement() { | ||
687 | super(GeneratedPQuery.INSTANCE); | ||
688 | } | ||
689 | |||
690 | /** | ||
691 | * @return the singleton instance of the query specification | ||
692 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
693 | * | ||
694 | */ | ||
695 | public static ResourceRequirement instance() { | ||
696 | try{ | ||
697 | return LazyHolder.INSTANCE; | ||
698 | } catch (ExceptionInInitializerError err) { | ||
699 | throw processInitializerError(err); | ||
700 | } | ||
701 | } | ||
702 | |||
703 | @Override | ||
704 | protected ResourceRequirement.Matcher instantiate(final ViatraQueryEngine engine) { | ||
705 | return ResourceRequirement.Matcher.on(engine); | ||
706 | } | ||
707 | |||
708 | @Override | ||
709 | public ResourceRequirement.Matcher instantiate() { | ||
710 | return ResourceRequirement.Matcher.create(); | ||
711 | } | ||
712 | |||
713 | @Override | ||
714 | public ResourceRequirement.Match newEmptyMatch() { | ||
715 | return ResourceRequirement.Match.newEmptyMatch(); | ||
716 | } | ||
717 | |||
718 | @Override | ||
719 | public ResourceRequirement.Match newMatch(final Object... parameters) { | ||
720 | return ResourceRequirement.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance) parameters[1], (hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement) parameters[2]); | ||
721 | } | ||
722 | |||
723 | /** | ||
724 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.ResourceRequirement (visibility: PUBLIC, simpleName: ResourceRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.ResourceRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
725 | * <b>not</b> at the class load time of the outer class, | ||
726 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.ResourceRequirement (visibility: PUBLIC, simpleName: ResourceRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.ResourceRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
727 | * | ||
728 | * <p> This workaround is required e.g. to support recursion. | ||
729 | * | ||
730 | */ | ||
731 | private static class LazyHolder { | ||
732 | private static final ResourceRequirement INSTANCE = new ResourceRequirement(); | ||
733 | |||
734 | /** | ||
735 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
736 | * This initialization order is required to support indirect recursion. | ||
737 | * | ||
738 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
739 | * | ||
740 | */ | ||
741 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
742 | |||
743 | public static Object ensureInitialized() { | ||
744 | INSTANCE.ensureInitializedInternal(); | ||
745 | return null; | ||
746 | } | ||
747 | } | ||
748 | |||
749 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
750 | private static final ResourceRequirement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
751 | |||
752 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
753 | |||
754 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
755 | |||
756 | private final PParameter parameter_Req = new PParameter("Req", "hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ResourceRequirement")), PParameterDirection.INOUT); | ||
757 | |||
758 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_App, parameter_Req); | ||
759 | |||
760 | private GeneratedPQuery() { | ||
761 | super(PVisibility.PUBLIC); | ||
762 | } | ||
763 | |||
764 | @Override | ||
765 | public String getFullyQualifiedName() { | ||
766 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.resourceRequirement"; | ||
767 | } | ||
768 | |||
769 | @Override | ||
770 | public List<String> getParameterNames() { | ||
771 | return Arrays.asList("Host","App","Req"); | ||
772 | } | ||
773 | |||
774 | @Override | ||
775 | public List<PParameter> getParameters() { | ||
776 | return parameters; | ||
777 | } | ||
778 | |||
779 | @Override | ||
780 | public Set<PBody> doGetContainedBodies() { | ||
781 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
782 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
783 | { | ||
784 | PBody body = new PBody(this); | ||
785 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
786 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
787 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
788 | PVariable var_HostType = body.getOrCreateVariableByName("HostType"); | ||
789 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
790 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
791 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
792 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
793 | new ExportedParameter(body, var_Host, parameter_Host), | ||
794 | new ExportedParameter(body, var_App, parameter_App), | ||
795 | new ExportedParameter(body, var_Req, parameter_Req) | ||
796 | )); | ||
797 | // ApplicationInstance.allocatedTo(App, Host) | ||
798 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
799 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
800 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
801 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
802 | new Equality(body, var__virtual_0_, var_Host); | ||
803 | // ApplicationInstance.type.requirements(App, Req) | ||
804 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
805 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
806 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "type"))); | ||
807 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationType"))); | ||
808 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
809 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationType", "requirements"))); | ||
810 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
811 | new Equality(body, var__virtual_2_, var_Req); | ||
812 | // HostInstance.type(Host, HostType) | ||
813 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
814 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
815 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostInstance", "type"))); | ||
816 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
817 | new Equality(body, var__virtual_3_, var_HostType); | ||
818 | // ResourceRequirement.hostType(Req, HostType) | ||
819 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
820 | PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); | ||
821 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "hostType"))); | ||
822 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
823 | new Equality(body, var__virtual_4_, var_HostType); | ||
824 | bodies.add(body); | ||
825 | } | ||
826 | return bodies; | ||
827 | } | ||
828 | } | ||
829 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/UnallocateAppInstance.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/UnallocateAppInstance.java new file mode 100644 index 00000000..ccc0ba22 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/UnallocateAppInstance.java | |||
@@ -0,0 +1,541 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.Collection; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Objects; | ||
12 | import java.util.Optional; | ||
13 | import java.util.Set; | ||
14 | import java.util.function.Consumer; | ||
15 | import java.util.stream.Collectors; | ||
16 | import java.util.stream.Stream; | ||
17 | import org.apache.log4j.Logger; | ||
18 | import org.eclipse.emf.ecore.EClass; | ||
19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
39 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
40 | |||
41 | /** | ||
42 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
43 | * | ||
44 | * <p>Original source: | ||
45 | * <code><pre> | ||
46 | * pattern unallocateAppInstance(App : ApplicationInstance) { | ||
47 | * ApplicationInstance.allocatedTo(App, _); | ||
48 | * } | ||
49 | * </pre></code> | ||
50 | * | ||
51 | * @see Matcher | ||
52 | * @see Match | ||
53 | * | ||
54 | */ | ||
55 | @SuppressWarnings("all") | ||
56 | public final class UnallocateAppInstance extends BaseGeneratedEMFQuerySpecification<UnallocateAppInstance.Matcher> { | ||
57 | /** | ||
58 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocateAppInstance pattern, | ||
59 | * to be used in conjunction with {@link Matcher}. | ||
60 | * | ||
61 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
62 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
63 | * usable to represent a match of the pattern in the result of a query, | ||
64 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
65 | * | ||
66 | * @see Matcher | ||
67 | * | ||
68 | */ | ||
69 | public static abstract class Match extends BasePatternMatch { | ||
70 | private ApplicationInstance fApp; | ||
71 | |||
72 | private static List<String> parameterNames = makeImmutableList("App"); | ||
73 | |||
74 | private Match(final ApplicationInstance pApp) { | ||
75 | this.fApp = pApp; | ||
76 | } | ||
77 | |||
78 | @Override | ||
79 | public Object get(final String parameterName) { | ||
80 | if ("App".equals(parameterName)) return this.fApp; | ||
81 | return null; | ||
82 | } | ||
83 | |||
84 | public ApplicationInstance getApp() { | ||
85 | return this.fApp; | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public boolean set(final String parameterName, final Object newValue) { | ||
90 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
91 | if ("App".equals(parameterName) ) { | ||
92 | this.fApp = (ApplicationInstance) newValue; | ||
93 | return true; | ||
94 | } | ||
95 | return false; | ||
96 | } | ||
97 | |||
98 | public void setApp(final ApplicationInstance pApp) { | ||
99 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
100 | this.fApp = pApp; | ||
101 | } | ||
102 | |||
103 | @Override | ||
104 | public String patternName() { | ||
105 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocateAppInstance"; | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | public List<String> parameterNames() { | ||
110 | return UnallocateAppInstance.Match.parameterNames; | ||
111 | } | ||
112 | |||
113 | @Override | ||
114 | public Object[] toArray() { | ||
115 | return new Object[]{fApp}; | ||
116 | } | ||
117 | |||
118 | @Override | ||
119 | public UnallocateAppInstance.Match toImmutable() { | ||
120 | return isMutable() ? newMatch(fApp) : this; | ||
121 | } | ||
122 | |||
123 | @Override | ||
124 | public String prettyPrint() { | ||
125 | StringBuilder result = new StringBuilder(); | ||
126 | result.append("\"App\"=" + prettyPrintValue(fApp)); | ||
127 | return result.toString(); | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public int hashCode() { | ||
132 | return Objects.hash(fApp); | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public boolean equals(final Object obj) { | ||
137 | if (this == obj) | ||
138 | return true; | ||
139 | if (obj == null) { | ||
140 | return false; | ||
141 | } | ||
142 | if ((obj instanceof UnallocateAppInstance.Match)) { | ||
143 | UnallocateAppInstance.Match other = (UnallocateAppInstance.Match) obj; | ||
144 | return Objects.equals(fApp, other.fApp); | ||
145 | } else { | ||
146 | // this should be infrequent | ||
147 | if (!(obj instanceof IPatternMatch)) { | ||
148 | return false; | ||
149 | } | ||
150 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
151 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
152 | } | ||
153 | } | ||
154 | |||
155 | @Override | ||
156 | public UnallocateAppInstance specification() { | ||
157 | return UnallocateAppInstance.instance(); | ||
158 | } | ||
159 | |||
160 | /** | ||
161 | * Returns an empty, mutable match. | ||
162 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
163 | * | ||
164 | * @return the empty match. | ||
165 | * | ||
166 | */ | ||
167 | public static UnallocateAppInstance.Match newEmptyMatch() { | ||
168 | return new Mutable(null); | ||
169 | } | ||
170 | |||
171 | /** | ||
172 | * Returns a mutable (partial) match. | ||
173 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
174 | * | ||
175 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
176 | * @return the new, mutable (partial) match object. | ||
177 | * | ||
178 | */ | ||
179 | public static UnallocateAppInstance.Match newMutableMatch(final ApplicationInstance pApp) { | ||
180 | return new Mutable(pApp); | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * Returns a new (partial) match. | ||
185 | * This can be used e.g. to call the matcher with a partial match. | ||
186 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
187 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
188 | * @return the (partial) match object. | ||
189 | * | ||
190 | */ | ||
191 | public static UnallocateAppInstance.Match newMatch(final ApplicationInstance pApp) { | ||
192 | return new Immutable(pApp); | ||
193 | } | ||
194 | |||
195 | private static final class Mutable extends UnallocateAppInstance.Match { | ||
196 | Mutable(final ApplicationInstance pApp) { | ||
197 | super(pApp); | ||
198 | } | ||
199 | |||
200 | @Override | ||
201 | public boolean isMutable() { | ||
202 | return true; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | private static final class Immutable extends UnallocateAppInstance.Match { | ||
207 | Immutable(final ApplicationInstance pApp) { | ||
208 | super(pApp); | ||
209 | } | ||
210 | |||
211 | @Override | ||
212 | public boolean isMutable() { | ||
213 | return false; | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | |||
218 | /** | ||
219 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocateAppInstance pattern, | ||
220 | * providing pattern-specific query methods. | ||
221 | * | ||
222 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
223 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
224 | * | ||
225 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
226 | * | ||
227 | * <p>Original source: | ||
228 | * <code><pre> | ||
229 | * pattern unallocateAppInstance(App : ApplicationInstance) { | ||
230 | * ApplicationInstance.allocatedTo(App, _); | ||
231 | * } | ||
232 | * </pre></code> | ||
233 | * | ||
234 | * @see Match | ||
235 | * @see UnallocateAppInstance | ||
236 | * | ||
237 | */ | ||
238 | public static class Matcher extends BaseMatcher<UnallocateAppInstance.Match> { | ||
239 | /** | ||
240 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
241 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
242 | * | ||
243 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
244 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
245 | * | ||
246 | */ | ||
247 | public static UnallocateAppInstance.Matcher on(final ViatraQueryEngine engine) { | ||
248 | // check if matcher already exists | ||
249 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
250 | if (matcher == null) { | ||
251 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
252 | } | ||
253 | return matcher; | ||
254 | } | ||
255 | |||
256 | /** | ||
257 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
258 | * @return an initialized matcher | ||
259 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
260 | * | ||
261 | */ | ||
262 | public static UnallocateAppInstance.Matcher create() { | ||
263 | return new Matcher(); | ||
264 | } | ||
265 | |||
266 | private static final int POSITION_APP = 0; | ||
267 | |||
268 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(UnallocateAppInstance.Matcher.class); | ||
269 | |||
270 | /** | ||
271 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
272 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
273 | * | ||
274 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
275 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
276 | * | ||
277 | */ | ||
278 | private Matcher() { | ||
279 | super(querySpecification()); | ||
280 | } | ||
281 | |||
282 | /** | ||
283 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
284 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
285 | * @return matches represented as a Match object. | ||
286 | * | ||
287 | */ | ||
288 | public Collection<UnallocateAppInstance.Match> getAllMatches(final ApplicationInstance pApp) { | ||
289 | return rawStreamAllMatches(new Object[]{pApp}).collect(Collectors.toSet()); | ||
290 | } | ||
291 | |||
292 | /** | ||
293 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
294 | * </p> | ||
295 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
296 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
297 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
298 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
299 | * @return a stream of matches represented as a Match object. | ||
300 | * | ||
301 | */ | ||
302 | public Stream<UnallocateAppInstance.Match> streamAllMatches(final ApplicationInstance pApp) { | ||
303 | return rawStreamAllMatches(new Object[]{pApp}); | ||
304 | } | ||
305 | |||
306 | /** | ||
307 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
308 | * Neither determinism nor randomness of selection is guaranteed. | ||
309 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
310 | * @return a match represented as a Match object, or null if no match is found. | ||
311 | * | ||
312 | */ | ||
313 | public Optional<UnallocateAppInstance.Match> getOneArbitraryMatch(final ApplicationInstance pApp) { | ||
314 | return rawGetOneArbitraryMatch(new Object[]{pApp}); | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
319 | * under any possible substitution of the unspecified parameters (if any). | ||
320 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
321 | * @return true if the input is a valid (partial) match of the pattern. | ||
322 | * | ||
323 | */ | ||
324 | public boolean hasMatch(final ApplicationInstance pApp) { | ||
325 | return rawHasMatch(new Object[]{pApp}); | ||
326 | } | ||
327 | |||
328 | /** | ||
329 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
330 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
331 | * @return the number of pattern matches found. | ||
332 | * | ||
333 | */ | ||
334 | public int countMatches(final ApplicationInstance pApp) { | ||
335 | return rawCountMatches(new Object[]{pApp}); | ||
336 | } | ||
337 | |||
338 | /** | ||
339 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
340 | * Neither determinism nor randomness of selection is guaranteed. | ||
341 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
342 | * @param processor the action that will process the selected match. | ||
343 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
344 | * | ||
345 | */ | ||
346 | public boolean forOneArbitraryMatch(final ApplicationInstance pApp, final Consumer<? super UnallocateAppInstance.Match> processor) { | ||
347 | return rawForOneArbitraryMatch(new Object[]{pApp}, processor); | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * Returns a new (partial) match. | ||
352 | * This can be used e.g. to call the matcher with a partial match. | ||
353 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
354 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
355 | * @return the (partial) match object. | ||
356 | * | ||
357 | */ | ||
358 | public UnallocateAppInstance.Match newMatch(final ApplicationInstance pApp) { | ||
359 | return UnallocateAppInstance.Match.newMatch(pApp); | ||
360 | } | ||
361 | |||
362 | /** | ||
363 | * Retrieve the set of values that occur in matches for App. | ||
364 | * @return the Set of all values or empty set if there are no matches | ||
365 | * | ||
366 | */ | ||
367 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
368 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
369 | } | ||
370 | |||
371 | /** | ||
372 | * Retrieve the set of values that occur in matches for App. | ||
373 | * @return the Set of all values or empty set if there are no matches | ||
374 | * | ||
375 | */ | ||
376 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
377 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
378 | } | ||
379 | |||
380 | /** | ||
381 | * Retrieve the set of values that occur in matches for App. | ||
382 | * @return the Set of all values or empty set if there are no matches | ||
383 | * | ||
384 | */ | ||
385 | public Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
386 | return rawStreamAllValuesOfApp(emptyArray()); | ||
387 | } | ||
388 | |||
389 | @Override | ||
390 | protected UnallocateAppInstance.Match tupleToMatch(final Tuple t) { | ||
391 | try { | ||
392 | return UnallocateAppInstance.Match.newMatch((ApplicationInstance) t.get(POSITION_APP)); | ||
393 | } catch(ClassCastException e) { | ||
394 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
395 | return null; | ||
396 | } | ||
397 | } | ||
398 | |||
399 | @Override | ||
400 | protected UnallocateAppInstance.Match arrayToMatch(final Object[] match) { | ||
401 | try { | ||
402 | return UnallocateAppInstance.Match.newMatch((ApplicationInstance) match[POSITION_APP]); | ||
403 | } catch(ClassCastException e) { | ||
404 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
405 | return null; | ||
406 | } | ||
407 | } | ||
408 | |||
409 | @Override | ||
410 | protected UnallocateAppInstance.Match arrayToMatchMutable(final Object[] match) { | ||
411 | try { | ||
412 | return UnallocateAppInstance.Match.newMutableMatch((ApplicationInstance) match[POSITION_APP]); | ||
413 | } catch(ClassCastException e) { | ||
414 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
415 | return null; | ||
416 | } | ||
417 | } | ||
418 | |||
419 | /** | ||
420 | * @return the singleton instance of the query specification of this pattern | ||
421 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
422 | * | ||
423 | */ | ||
424 | public static IQuerySpecification<UnallocateAppInstance.Matcher> querySpecification() { | ||
425 | return UnallocateAppInstance.instance(); | ||
426 | } | ||
427 | } | ||
428 | |||
429 | private UnallocateAppInstance() { | ||
430 | super(GeneratedPQuery.INSTANCE); | ||
431 | } | ||
432 | |||
433 | /** | ||
434 | * @return the singleton instance of the query specification | ||
435 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
436 | * | ||
437 | */ | ||
438 | public static UnallocateAppInstance instance() { | ||
439 | try{ | ||
440 | return LazyHolder.INSTANCE; | ||
441 | } catch (ExceptionInInitializerError err) { | ||
442 | throw processInitializerError(err); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | @Override | ||
447 | protected UnallocateAppInstance.Matcher instantiate(final ViatraQueryEngine engine) { | ||
448 | return UnallocateAppInstance.Matcher.on(engine); | ||
449 | } | ||
450 | |||
451 | @Override | ||
452 | public UnallocateAppInstance.Matcher instantiate() { | ||
453 | return UnallocateAppInstance.Matcher.create(); | ||
454 | } | ||
455 | |||
456 | @Override | ||
457 | public UnallocateAppInstance.Match newEmptyMatch() { | ||
458 | return UnallocateAppInstance.Match.newEmptyMatch(); | ||
459 | } | ||
460 | |||
461 | @Override | ||
462 | public UnallocateAppInstance.Match newMatch(final Object... parameters) { | ||
463 | return UnallocateAppInstance.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance) parameters[0]); | ||
464 | } | ||
465 | |||
466 | /** | ||
467 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.UnallocateAppInstance (visibility: PUBLIC, simpleName: UnallocateAppInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.UnallocateAppInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
468 | * <b>not</b> at the class load time of the outer class, | ||
469 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.UnallocateAppInstance (visibility: PUBLIC, simpleName: UnallocateAppInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.UnallocateAppInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
470 | * | ||
471 | * <p> This workaround is required e.g. to support recursion. | ||
472 | * | ||
473 | */ | ||
474 | private static class LazyHolder { | ||
475 | private static final UnallocateAppInstance INSTANCE = new UnallocateAppInstance(); | ||
476 | |||
477 | /** | ||
478 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
479 | * This initialization order is required to support indirect recursion. | ||
480 | * | ||
481 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
482 | * | ||
483 | */ | ||
484 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
485 | |||
486 | public static Object ensureInitialized() { | ||
487 | INSTANCE.ensureInitializedInternal(); | ||
488 | return null; | ||
489 | } | ||
490 | } | ||
491 | |||
492 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
493 | private static final UnallocateAppInstance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
494 | |||
495 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
496 | |||
497 | private final List<PParameter> parameters = Arrays.asList(parameter_App); | ||
498 | |||
499 | private GeneratedPQuery() { | ||
500 | super(PVisibility.PUBLIC); | ||
501 | } | ||
502 | |||
503 | @Override | ||
504 | public String getFullyQualifiedName() { | ||
505 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocateAppInstance"; | ||
506 | } | ||
507 | |||
508 | @Override | ||
509 | public List<String> getParameterNames() { | ||
510 | return Arrays.asList("App"); | ||
511 | } | ||
512 | |||
513 | @Override | ||
514 | public List<PParameter> getParameters() { | ||
515 | return parameters; | ||
516 | } | ||
517 | |||
518 | @Override | ||
519 | public Set<PBody> doGetContainedBodies() { | ||
520 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
521 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
522 | { | ||
523 | PBody body = new PBody(this); | ||
524 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
525 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
526 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
527 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
528 | new ExportedParameter(body, var_App, parameter_App) | ||
529 | )); | ||
530 | // ApplicationInstance.allocatedTo(App, _) | ||
531 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
532 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
533 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
534 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
535 | new Equality(body, var__virtual_0_, var___0_); | ||
536 | bodies.add(body); | ||
537 | } | ||
538 | return bodies; | ||
539 | } | ||
540 | } | ||
541 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/.gitignore new file mode 100644 index 00000000..a4f039d9 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/.gitignore | |||
@@ -0,0 +1,36 @@ | |||
1 | /.CpsQueriesAll.java._trace | ||
2 | /.ResourceRequirement.java._trace | ||
3 | /.MemoryRequirement.java._trace | ||
4 | /.HddRequirement.java._trace | ||
5 | /.AllocationWithoutResourceRequirement.java._trace | ||
6 | /.RequiredType.java._trace | ||
7 | /.SatisfyingInstance.java._trace | ||
8 | /.FreeMemoryPercentage.java._trace | ||
9 | /.FreeHddPercentage.java._trace | ||
10 | /.ApplicationInstance.java._trace | ||
11 | /.HostInstanceCost.java._trace | ||
12 | /.AvailableHdd.java._trace | ||
13 | /.AvailableMemory.java._trace | ||
14 | /.CpsApplications.java._trace | ||
15 | /.CpsHosts.java._trace | ||
16 | /.TotalHdd.java._trace | ||
17 | /.TotalMemory.java._trace | ||
18 | /.RequiredAppInstances.java._trace | ||
19 | /.UnallocatedAppInstance.java._trace | ||
20 | /.NoHostToAllocateTo.java._trace | ||
21 | /AvailableHdd.java | ||
22 | /AvailableMemory.java | ||
23 | /CpsApplications.java | ||
24 | /CpsHosts.java | ||
25 | /CpsQueriesAll.java | ||
26 | /FreeHddPercentage.java | ||
27 | /FreeMemoryPercentage.java | ||
28 | /HddRequirement.java | ||
29 | /HostInstanceCost.java | ||
30 | /MemoryRequirement.java | ||
31 | /NoHostToAllocateTo.java | ||
32 | /RequiredAppInstances.java | ||
33 | /SatisfyingInstance.java | ||
34 | /TotalHdd.java | ||
35 | /TotalMemory.java | ||
36 | /UnallocatedAppInstance.java | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/AvailableHdd.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/AvailableHdd.java new file mode 100644 index 00000000..7d07b83a --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/AvailableHdd.java | |||
@@ -0,0 +1,178 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HddRequirement; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalHdd; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Set; | ||
12 | import org.eclipse.emf.ecore.EClass; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
34 | |||
35 | /** | ||
36 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
37 | * | ||
38 | * <p>Original source: | ||
39 | * <code><pre> | ||
40 | * private pattern availableHdd(Host : HostInstance, Hdd : java Integer) { | ||
41 | * find totalHdd(Host, TotalHdd); | ||
42 | * RequiredHdd == sum find hddRequirement(Host, _, #_); | ||
43 | * Hdd == eval(TotalHdd - RequiredHdd); | ||
44 | * } | ||
45 | * </pre></code> | ||
46 | * | ||
47 | * @see GenericPatternMatcher | ||
48 | * @see GenericPatternMatch | ||
49 | * | ||
50 | */ | ||
51 | @SuppressWarnings("all") | ||
52 | public final class AvailableHdd extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
53 | private AvailableHdd() { | ||
54 | super(GeneratedPQuery.INSTANCE); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * @return the singleton instance of the query specification | ||
59 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
60 | * | ||
61 | */ | ||
62 | public static AvailableHdd instance() { | ||
63 | try{ | ||
64 | return LazyHolder.INSTANCE; | ||
65 | } catch (ExceptionInInitializerError err) { | ||
66 | throw processInitializerError(err); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableHdd (visibility: PUBLIC, simpleName: AvailableHdd, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableHdd, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
72 | * <b>not</b> at the class load time of the outer class, | ||
73 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableHdd (visibility: PUBLIC, simpleName: AvailableHdd, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableHdd, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
74 | * | ||
75 | * <p> This workaround is required e.g. to support recursion. | ||
76 | * | ||
77 | */ | ||
78 | private static class LazyHolder { | ||
79 | private static final AvailableHdd INSTANCE = new AvailableHdd(); | ||
80 | |||
81 | /** | ||
82 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
83 | * This initialization order is required to support indirect recursion. | ||
84 | * | ||
85 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
86 | * | ||
87 | */ | ||
88 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
89 | |||
90 | public static Object ensureInitialized() { | ||
91 | INSTANCE.ensureInitializedInternal(); | ||
92 | return null; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
97 | private static final AvailableHdd.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
98 | |||
99 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
100 | |||
101 | private final PParameter parameter_Hdd = new PParameter("Hdd", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
102 | |||
103 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_Hdd); | ||
104 | |||
105 | private GeneratedPQuery() { | ||
106 | super(PVisibility.PRIVATE); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public String getFullyQualifiedName() { | ||
111 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.availableHdd"; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public List<String> getParameterNames() { | ||
116 | return Arrays.asList("Host","Hdd"); | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public List<PParameter> getParameters() { | ||
121 | return parameters; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public Set<PBody> doGetContainedBodies() { | ||
126 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
127 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
128 | { | ||
129 | PBody body = new PBody(this); | ||
130 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
131 | PVariable var_Hdd = body.getOrCreateVariableByName("Hdd"); | ||
132 | PVariable var_TotalHdd = body.getOrCreateVariableByName("TotalHdd"); | ||
133 | PVariable var_RequiredHdd = body.getOrCreateVariableByName("RequiredHdd"); | ||
134 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
135 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
136 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
137 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Hdd), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
138 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
139 | new ExportedParameter(body, var_Host, parameter_Host), | ||
140 | new ExportedParameter(body, var_Hdd, parameter_Hdd) | ||
141 | )); | ||
142 | // find totalHdd(Host, TotalHdd) | ||
143 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_TotalHdd), TotalHdd.instance().getInternalQueryRepresentation()); | ||
144 | // RequiredHdd == sum find hddRequirement(Host, _, #_) | ||
145 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
146 | new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var_Host, var___0_, var___1_), HddRequirement.instance().getInternalQueryRepresentation(), var__virtual_0_, 2); | ||
147 | new Equality(body, var_RequiredHdd, var__virtual_0_); | ||
148 | // Hdd == eval(TotalHdd - RequiredHdd) | ||
149 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
150 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
151 | |||
152 | @Override | ||
153 | public String getShortDescription() { | ||
154 | return "Expression evaluation from pattern availableHdd"; | ||
155 | } | ||
156 | |||
157 | @Override | ||
158 | public Iterable<String> getInputParameterNames() { | ||
159 | return Arrays.asList("RequiredHdd", "TotalHdd");} | ||
160 | |||
161 | @Override | ||
162 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
163 | Integer RequiredHdd = (Integer) provider.getValue("RequiredHdd"); | ||
164 | Integer TotalHdd = (Integer) provider.getValue("TotalHdd"); | ||
165 | return evaluateExpression_1_1(RequiredHdd, TotalHdd); | ||
166 | } | ||
167 | }, var__virtual_1_ ); | ||
168 | new Equality(body, var_Hdd, var__virtual_1_); | ||
169 | bodies.add(body); | ||
170 | } | ||
171 | return bodies; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | private static int evaluateExpression_1_1(final Integer RequiredHdd, final Integer TotalHdd) { | ||
176 | return ((TotalHdd).intValue() - (RequiredHdd).intValue()); | ||
177 | } | ||
178 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/AvailableMemory.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/AvailableMemory.java new file mode 100644 index 00000000..b06544d5 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/AvailableMemory.java | |||
@@ -0,0 +1,178 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.MemoryRequirement; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalMemory; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Set; | ||
12 | import org.eclipse.emf.ecore.EClass; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
34 | |||
35 | /** | ||
36 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
37 | * | ||
38 | * <p>Original source: | ||
39 | * <code><pre> | ||
40 | * private pattern availableMemory(Host : HostInstance, Memory : java Integer) { | ||
41 | * find totalMemory(Host, TotalMemory); | ||
42 | * RequiredMemory == sum find memoryRequirement(Host, _, #_); | ||
43 | * Memory == eval(TotalMemory - RequiredMemory); | ||
44 | * } | ||
45 | * </pre></code> | ||
46 | * | ||
47 | * @see GenericPatternMatcher | ||
48 | * @see GenericPatternMatch | ||
49 | * | ||
50 | */ | ||
51 | @SuppressWarnings("all") | ||
52 | public final class AvailableMemory extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
53 | private AvailableMemory() { | ||
54 | super(GeneratedPQuery.INSTANCE); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * @return the singleton instance of the query specification | ||
59 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
60 | * | ||
61 | */ | ||
62 | public static AvailableMemory instance() { | ||
63 | try{ | ||
64 | return LazyHolder.INSTANCE; | ||
65 | } catch (ExceptionInInitializerError err) { | ||
66 | throw processInitializerError(err); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableMemory (visibility: PUBLIC, simpleName: AvailableMemory, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableMemory, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
72 | * <b>not</b> at the class load time of the outer class, | ||
73 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableMemory (visibility: PUBLIC, simpleName: AvailableMemory, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableMemory, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
74 | * | ||
75 | * <p> This workaround is required e.g. to support recursion. | ||
76 | * | ||
77 | */ | ||
78 | private static class LazyHolder { | ||
79 | private static final AvailableMemory INSTANCE = new AvailableMemory(); | ||
80 | |||
81 | /** | ||
82 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
83 | * This initialization order is required to support indirect recursion. | ||
84 | * | ||
85 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
86 | * | ||
87 | */ | ||
88 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
89 | |||
90 | public static Object ensureInitialized() { | ||
91 | INSTANCE.ensureInitializedInternal(); | ||
92 | return null; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
97 | private static final AvailableMemory.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
98 | |||
99 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
100 | |||
101 | private final PParameter parameter_Memory = new PParameter("Memory", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
102 | |||
103 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_Memory); | ||
104 | |||
105 | private GeneratedPQuery() { | ||
106 | super(PVisibility.PRIVATE); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public String getFullyQualifiedName() { | ||
111 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.availableMemory"; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public List<String> getParameterNames() { | ||
116 | return Arrays.asList("Host","Memory"); | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public List<PParameter> getParameters() { | ||
121 | return parameters; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public Set<PBody> doGetContainedBodies() { | ||
126 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
127 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
128 | { | ||
129 | PBody body = new PBody(this); | ||
130 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
131 | PVariable var_Memory = body.getOrCreateVariableByName("Memory"); | ||
132 | PVariable var_TotalMemory = body.getOrCreateVariableByName("TotalMemory"); | ||
133 | PVariable var_RequiredMemory = body.getOrCreateVariableByName("RequiredMemory"); | ||
134 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
135 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
136 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
137 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Memory), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
138 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
139 | new ExportedParameter(body, var_Host, parameter_Host), | ||
140 | new ExportedParameter(body, var_Memory, parameter_Memory) | ||
141 | )); | ||
142 | // find totalMemory(Host, TotalMemory) | ||
143 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_TotalMemory), TotalMemory.instance().getInternalQueryRepresentation()); | ||
144 | // RequiredMemory == sum find memoryRequirement(Host, _, #_) | ||
145 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
146 | new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var_Host, var___0_, var___1_), MemoryRequirement.instance().getInternalQueryRepresentation(), var__virtual_0_, 2); | ||
147 | new Equality(body, var_RequiredMemory, var__virtual_0_); | ||
148 | // Memory == eval(TotalMemory - RequiredMemory) | ||
149 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
150 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
151 | |||
152 | @Override | ||
153 | public String getShortDescription() { | ||
154 | return "Expression evaluation from pattern availableMemory"; | ||
155 | } | ||
156 | |||
157 | @Override | ||
158 | public Iterable<String> getInputParameterNames() { | ||
159 | return Arrays.asList("RequiredMemory", "TotalMemory");} | ||
160 | |||
161 | @Override | ||
162 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
163 | Integer RequiredMemory = (Integer) provider.getValue("RequiredMemory"); | ||
164 | Integer TotalMemory = (Integer) provider.getValue("TotalMemory"); | ||
165 | return evaluateExpression_1_1(RequiredMemory, TotalMemory); | ||
166 | } | ||
167 | }, var__virtual_1_ ); | ||
168 | new Equality(body, var_Memory, var__virtual_1_); | ||
169 | bodies.add(body); | ||
170 | } | ||
171 | return bodies; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | private static int evaluateExpression_1_1(final Integer RequiredMemory, final Integer TotalMemory) { | ||
176 | return ((TotalMemory).intValue() - (RequiredMemory).intValue()); | ||
177 | } | ||
178 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/CpsApplications.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/CpsApplications.java new file mode 100644 index 00000000..23867558 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/CpsApplications.java | |||
@@ -0,0 +1,141 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
25 | |||
26 | /** | ||
27 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
28 | * | ||
29 | * <p>Original source: | ||
30 | * <code><pre> | ||
31 | * private pattern cpsApplications(Cps : CyberPhysicalSystem, AppInstance : ApplicationInstance) { | ||
32 | * CyberPhysicalSystem.applicationTypes.instances(Cps, AppInstance); | ||
33 | * } | ||
34 | * </pre></code> | ||
35 | * | ||
36 | * @see GenericPatternMatcher | ||
37 | * @see GenericPatternMatch | ||
38 | * | ||
39 | */ | ||
40 | @SuppressWarnings("all") | ||
41 | public final class CpsApplications extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
42 | private CpsApplications() { | ||
43 | super(GeneratedPQuery.INSTANCE); | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * @return the singleton instance of the query specification | ||
48 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
49 | * | ||
50 | */ | ||
51 | public static CpsApplications instance() { | ||
52 | try{ | ||
53 | return LazyHolder.INSTANCE; | ||
54 | } catch (ExceptionInInitializerError err) { | ||
55 | throw processInitializerError(err); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsApplications (visibility: PUBLIC, simpleName: CpsApplications, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsApplications, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
61 | * <b>not</b> at the class load time of the outer class, | ||
62 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsApplications (visibility: PUBLIC, simpleName: CpsApplications, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsApplications, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
63 | * | ||
64 | * <p> This workaround is required e.g. to support recursion. | ||
65 | * | ||
66 | */ | ||
67 | private static class LazyHolder { | ||
68 | private static final CpsApplications INSTANCE = new CpsApplications(); | ||
69 | |||
70 | /** | ||
71 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
72 | * This initialization order is required to support indirect recursion. | ||
73 | * | ||
74 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
75 | * | ||
76 | */ | ||
77 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
78 | |||
79 | public static Object ensureInitialized() { | ||
80 | INSTANCE.ensureInitializedInternal(); | ||
81 | return null; | ||
82 | } | ||
83 | } | ||
84 | |||
85 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
86 | private static final CpsApplications.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
87 | |||
88 | private final PParameter parameter_Cps = new PParameter("Cps", "hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "CyberPhysicalSystem")), PParameterDirection.INOUT); | ||
89 | |||
90 | private final PParameter parameter_AppInstance = new PParameter("AppInstance", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
91 | |||
92 | private final List<PParameter> parameters = Arrays.asList(parameter_Cps, parameter_AppInstance); | ||
93 | |||
94 | private GeneratedPQuery() { | ||
95 | super(PVisibility.PRIVATE); | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public String getFullyQualifiedName() { | ||
100 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsApplications"; | ||
101 | } | ||
102 | |||
103 | @Override | ||
104 | public List<String> getParameterNames() { | ||
105 | return Arrays.asList("Cps","AppInstance"); | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | public List<PParameter> getParameters() { | ||
110 | return parameters; | ||
111 | } | ||
112 | |||
113 | @Override | ||
114 | public Set<PBody> doGetContainedBodies() { | ||
115 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
116 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
117 | { | ||
118 | PBody body = new PBody(this); | ||
119 | PVariable var_Cps = body.getOrCreateVariableByName("Cps"); | ||
120 | PVariable var_AppInstance = body.getOrCreateVariableByName("AppInstance"); | ||
121 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cps), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "CyberPhysicalSystem"))); | ||
122 | new TypeConstraint(body, Tuples.flatTupleOf(var_AppInstance), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
123 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
124 | new ExportedParameter(body, var_Cps, parameter_Cps), | ||
125 | new ExportedParameter(body, var_AppInstance, parameter_AppInstance) | ||
126 | )); | ||
127 | // CyberPhysicalSystem.applicationTypes.instances(Cps, AppInstance) | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cps), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "CyberPhysicalSystem"))); | ||
129 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cps, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "CyberPhysicalSystem", "applicationTypes"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationType"))); | ||
132 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationType", "instances"))); | ||
134 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
135 | new Equality(body, var__virtual_1_, var_AppInstance); | ||
136 | bodies.add(body); | ||
137 | } | ||
138 | return bodies; | ||
139 | } | ||
140 | } | ||
141 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/CpsHosts.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/CpsHosts.java new file mode 100644 index 00000000..e55bddff --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/CpsHosts.java | |||
@@ -0,0 +1,141 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
25 | |||
26 | /** | ||
27 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
28 | * | ||
29 | * <p>Original source: | ||
30 | * <code><pre> | ||
31 | * private pattern cpsHosts(Cps : CyberPhysicalSystem, HostInstance : HostInstance) { | ||
32 | * CyberPhysicalSystem.hostTypes.instances(Cps, HostInstance); | ||
33 | * } | ||
34 | * </pre></code> | ||
35 | * | ||
36 | * @see GenericPatternMatcher | ||
37 | * @see GenericPatternMatch | ||
38 | * | ||
39 | */ | ||
40 | @SuppressWarnings("all") | ||
41 | public final class CpsHosts extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
42 | private CpsHosts() { | ||
43 | super(GeneratedPQuery.INSTANCE); | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * @return the singleton instance of the query specification | ||
48 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
49 | * | ||
50 | */ | ||
51 | public static CpsHosts instance() { | ||
52 | try{ | ||
53 | return LazyHolder.INSTANCE; | ||
54 | } catch (ExceptionInInitializerError err) { | ||
55 | throw processInitializerError(err); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsHosts (visibility: PUBLIC, simpleName: CpsHosts, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsHosts, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
61 | * <b>not</b> at the class load time of the outer class, | ||
62 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsHosts (visibility: PUBLIC, simpleName: CpsHosts, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsHosts, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
63 | * | ||
64 | * <p> This workaround is required e.g. to support recursion. | ||
65 | * | ||
66 | */ | ||
67 | private static class LazyHolder { | ||
68 | private static final CpsHosts INSTANCE = new CpsHosts(); | ||
69 | |||
70 | /** | ||
71 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
72 | * This initialization order is required to support indirect recursion. | ||
73 | * | ||
74 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
75 | * | ||
76 | */ | ||
77 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
78 | |||
79 | public static Object ensureInitialized() { | ||
80 | INSTANCE.ensureInitializedInternal(); | ||
81 | return null; | ||
82 | } | ||
83 | } | ||
84 | |||
85 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
86 | private static final CpsHosts.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
87 | |||
88 | private final PParameter parameter_Cps = new PParameter("Cps", "hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "CyberPhysicalSystem")), PParameterDirection.INOUT); | ||
89 | |||
90 | private final PParameter parameter_HostInstance = new PParameter("HostInstance", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
91 | |||
92 | private final List<PParameter> parameters = Arrays.asList(parameter_Cps, parameter_HostInstance); | ||
93 | |||
94 | private GeneratedPQuery() { | ||
95 | super(PVisibility.PRIVATE); | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public String getFullyQualifiedName() { | ||
100 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsHosts"; | ||
101 | } | ||
102 | |||
103 | @Override | ||
104 | public List<String> getParameterNames() { | ||
105 | return Arrays.asList("Cps","HostInstance"); | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | public List<PParameter> getParameters() { | ||
110 | return parameters; | ||
111 | } | ||
112 | |||
113 | @Override | ||
114 | public Set<PBody> doGetContainedBodies() { | ||
115 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
116 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
117 | { | ||
118 | PBody body = new PBody(this); | ||
119 | PVariable var_Cps = body.getOrCreateVariableByName("Cps"); | ||
120 | PVariable var_HostInstance = body.getOrCreateVariableByName("HostInstance"); | ||
121 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cps), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "CyberPhysicalSystem"))); | ||
122 | new TypeConstraint(body, Tuples.flatTupleOf(var_HostInstance), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
123 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
124 | new ExportedParameter(body, var_Cps, parameter_Cps), | ||
125 | new ExportedParameter(body, var_HostInstance, parameter_HostInstance) | ||
126 | )); | ||
127 | // CyberPhysicalSystem.hostTypes.instances(Cps, HostInstance) | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cps), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "CyberPhysicalSystem"))); | ||
129 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cps, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "CyberPhysicalSystem", "hostTypes"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
132 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostType", "instances"))); | ||
134 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
135 | new Equality(body, var__virtual_1_, var_HostInstance); | ||
136 | bodies.add(body); | ||
137 | } | ||
138 | return bodies; | ||
139 | } | ||
140 | } | ||
141 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/CpsQueriesAll.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/CpsQueriesAll.java new file mode 100644 index 00000000..67f75e1d --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/CpsQueriesAll.java | |||
@@ -0,0 +1,132 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.Allocate; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.AllocationWithoutResourceRequirement; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeHddMetric; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeMemoryMetric; | ||
10 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CostMetric; | ||
11 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsCost; | ||
12 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CreateHostInstance; | ||
13 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.GuidanceObjective; | ||
14 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.InstanceDoesNotSatisfyRequirement; | ||
15 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableHdd; | ||
16 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.NotEnoughAvailableMemory; | ||
17 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.RedundantInstancesOnSameHost; | ||
18 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.RemoveHostInstance; | ||
19 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.RequirementNotSatisfied; | ||
20 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.ResourceRequirement; | ||
21 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.UnallocateAppInstance; | ||
22 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableHdd; | ||
23 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableMemory; | ||
24 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsApplications; | ||
25 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsHosts; | ||
26 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeHddPercentage; | ||
27 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeMemoryPercentage; | ||
28 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HddRequirement; | ||
29 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HostInstanceCost; | ||
30 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.MemoryRequirement; | ||
31 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.NoHostToAllocateTo; | ||
32 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.RequiredAppInstances; | ||
33 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.SatisfyingInstance; | ||
34 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalHdd; | ||
35 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalMemory; | ||
36 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.UnallocatedAppInstance; | ||
37 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | ||
38 | |||
39 | /** | ||
40 | * A pattern group formed of all patterns defined in CpsQueries.vql. | ||
41 | * | ||
42 | * <p>A private group that includes private patterns as well. Only intended use case is for pattern testing. | ||
43 | * | ||
44 | * <p> From package hu.bme.mit.inf.dslreasoner.domains.cps.queries, the group contains the definition of the following patterns: <ul> | ||
45 | * <li>cpsApplications</li> | ||
46 | * <li>cpsHosts</li> | ||
47 | * <li>totalMemory</li> | ||
48 | * <li>totalHdd</li> | ||
49 | * <li>availableMemory</li> | ||
50 | * <li>memoryRequirement</li> | ||
51 | * <li>availableHdd</li> | ||
52 | * <li>hddRequirement</li> | ||
53 | * <li>resourceRequirement</li> | ||
54 | * <li>allocationWithoutResourceRequirement</li> | ||
55 | * <li>notEnoughAvailableMemory</li> | ||
56 | * <li>notEnoughAvailableHdd</li> | ||
57 | * <li>instanceDoesNotSatisfyRequirement</li> | ||
58 | * <li>satisfyingInstance</li> | ||
59 | * <li>requirementNotSatisfied</li> | ||
60 | * <li>redundantInstancesOnSameHost</li> | ||
61 | * <li>averageFreeMemoryMetric</li> | ||
62 | * <li>freeMemoryPercentage</li> | ||
63 | * <li>averageFreeHddMetric</li> | ||
64 | * <li>freeHddPercentage</li> | ||
65 | * <li>costMetric</li> | ||
66 | * <li>cpsCost</li> | ||
67 | * <li>hostInstanceCost</li> | ||
68 | * <li>allocate</li> | ||
69 | * <li>unallocateAppInstance</li> | ||
70 | * <li>createHostInstance</li> | ||
71 | * <li>removeHostInstance</li> | ||
72 | * <li>unallocatedAppInstance</li> | ||
73 | * <li>requiredAppInstances</li> | ||
74 | * <li>noHostToAllocateTo</li> | ||
75 | * <li>guidanceObjective</li> | ||
76 | * </ul> | ||
77 | * | ||
78 | * @see IQueryGroup | ||
79 | * | ||
80 | */ | ||
81 | @SuppressWarnings("all") | ||
82 | public final class CpsQueriesAll extends BaseGeneratedPatternGroup { | ||
83 | /** | ||
84 | * Access the pattern group. | ||
85 | * | ||
86 | * @return the singleton instance of the group | ||
87 | * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications | ||
88 | * | ||
89 | */ | ||
90 | public static CpsQueriesAll instance() { | ||
91 | if (INSTANCE == null) { | ||
92 | INSTANCE = new CpsQueriesAll(); | ||
93 | } | ||
94 | return INSTANCE; | ||
95 | } | ||
96 | |||
97 | private static CpsQueriesAll INSTANCE; | ||
98 | |||
99 | private CpsQueriesAll() { | ||
100 | querySpecifications.add(CpsApplications.instance()); | ||
101 | querySpecifications.add(CpsHosts.instance()); | ||
102 | querySpecifications.add(TotalMemory.instance()); | ||
103 | querySpecifications.add(TotalHdd.instance()); | ||
104 | querySpecifications.add(AvailableMemory.instance()); | ||
105 | querySpecifications.add(MemoryRequirement.instance()); | ||
106 | querySpecifications.add(AvailableHdd.instance()); | ||
107 | querySpecifications.add(HddRequirement.instance()); | ||
108 | querySpecifications.add(ResourceRequirement.instance()); | ||
109 | querySpecifications.add(AllocationWithoutResourceRequirement.instance()); | ||
110 | querySpecifications.add(NotEnoughAvailableMemory.instance()); | ||
111 | querySpecifications.add(NotEnoughAvailableHdd.instance()); | ||
112 | querySpecifications.add(InstanceDoesNotSatisfyRequirement.instance()); | ||
113 | querySpecifications.add(SatisfyingInstance.instance()); | ||
114 | querySpecifications.add(RequirementNotSatisfied.instance()); | ||
115 | querySpecifications.add(RedundantInstancesOnSameHost.instance()); | ||
116 | querySpecifications.add(AverageFreeMemoryMetric.instance()); | ||
117 | querySpecifications.add(FreeMemoryPercentage.instance()); | ||
118 | querySpecifications.add(AverageFreeHddMetric.instance()); | ||
119 | querySpecifications.add(FreeHddPercentage.instance()); | ||
120 | querySpecifications.add(CostMetric.instance()); | ||
121 | querySpecifications.add(CpsCost.instance()); | ||
122 | querySpecifications.add(HostInstanceCost.instance()); | ||
123 | querySpecifications.add(Allocate.instance()); | ||
124 | querySpecifications.add(UnallocateAppInstance.instance()); | ||
125 | querySpecifications.add(CreateHostInstance.instance()); | ||
126 | querySpecifications.add(RemoveHostInstance.instance()); | ||
127 | querySpecifications.add(UnallocatedAppInstance.instance()); | ||
128 | querySpecifications.add(RequiredAppInstances.instance()); | ||
129 | querySpecifications.add(NoHostToAllocateTo.instance()); | ||
130 | querySpecifications.add(GuidanceObjective.instance()); | ||
131 | } | ||
132 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/FreeHddPercentage.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/FreeHddPercentage.java new file mode 100644 index 00000000..c24f46a1 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/FreeHddPercentage.java | |||
@@ -0,0 +1,172 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableHdd; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalHdd; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Set; | ||
12 | import org.eclipse.emf.ecore.EClass; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
32 | |||
33 | /** | ||
34 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
35 | * | ||
36 | * <p>Original source: | ||
37 | * <code><pre> | ||
38 | * private pattern freeHddPercentage(Host : HostInstance, Free : java Double) { | ||
39 | * find totalHdd(Host, Total); | ||
40 | * find availableHdd(Host, Available); | ||
41 | * Free == eval((Available as double) / Total); | ||
42 | * } | ||
43 | * </pre></code> | ||
44 | * | ||
45 | * @see GenericPatternMatcher | ||
46 | * @see GenericPatternMatch | ||
47 | * | ||
48 | */ | ||
49 | @SuppressWarnings("all") | ||
50 | public final class FreeHddPercentage extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
51 | private FreeHddPercentage() { | ||
52 | super(GeneratedPQuery.INSTANCE); | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * @return the singleton instance of the query specification | ||
57 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
58 | * | ||
59 | */ | ||
60 | public static FreeHddPercentage instance() { | ||
61 | try{ | ||
62 | return LazyHolder.INSTANCE; | ||
63 | } catch (ExceptionInInitializerError err) { | ||
64 | throw processInitializerError(err); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeHddPercentage (visibility: PUBLIC, simpleName: FreeHddPercentage, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeHddPercentage, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
70 | * <b>not</b> at the class load time of the outer class, | ||
71 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeHddPercentage (visibility: PUBLIC, simpleName: FreeHddPercentage, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeHddPercentage, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
72 | * | ||
73 | * <p> This workaround is required e.g. to support recursion. | ||
74 | * | ||
75 | */ | ||
76 | private static class LazyHolder { | ||
77 | private static final FreeHddPercentage INSTANCE = new FreeHddPercentage(); | ||
78 | |||
79 | /** | ||
80 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
81 | * This initialization order is required to support indirect recursion. | ||
82 | * | ||
83 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
84 | * | ||
85 | */ | ||
86 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
87 | |||
88 | public static Object ensureInitialized() { | ||
89 | INSTANCE.ensureInitializedInternal(); | ||
90 | return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
95 | private static final FreeHddPercentage.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
96 | |||
97 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final PParameter parameter_Free = new PParameter("Free", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
100 | |||
101 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_Free); | ||
102 | |||
103 | private GeneratedPQuery() { | ||
104 | super(PVisibility.PRIVATE); | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public String getFullyQualifiedName() { | ||
109 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.freeHddPercentage"; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public List<String> getParameterNames() { | ||
114 | return Arrays.asList("Host","Free"); | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public List<PParameter> getParameters() { | ||
119 | return parameters; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public Set<PBody> doGetContainedBodies() { | ||
124 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
125 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
126 | { | ||
127 | PBody body = new PBody(this); | ||
128 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
129 | PVariable var_Free = body.getOrCreateVariableByName("Free"); | ||
130 | PVariable var_Total = body.getOrCreateVariableByName("Total"); | ||
131 | PVariable var_Available = body.getOrCreateVariableByName("Available"); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
133 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Free), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
134 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
135 | new ExportedParameter(body, var_Host, parameter_Host), | ||
136 | new ExportedParameter(body, var_Free, parameter_Free) | ||
137 | )); | ||
138 | // find totalHdd(Host, Total) | ||
139 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_Total), TotalHdd.instance().getInternalQueryRepresentation()); | ||
140 | // find availableHdd(Host, Available) | ||
141 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_Available), AvailableHdd.instance().getInternalQueryRepresentation()); | ||
142 | // Free == eval((Available as double) / Total) | ||
143 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
144 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
145 | |||
146 | @Override | ||
147 | public String getShortDescription() { | ||
148 | return "Expression evaluation from pattern freeHddPercentage"; | ||
149 | } | ||
150 | |||
151 | @Override | ||
152 | public Iterable<String> getInputParameterNames() { | ||
153 | return Arrays.asList("Available", "Total");} | ||
154 | |||
155 | @Override | ||
156 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
157 | Integer Available = (Integer) provider.getValue("Available"); | ||
158 | Integer Total = (Integer) provider.getValue("Total"); | ||
159 | return evaluateExpression_1_1(Available, Total); | ||
160 | } | ||
161 | }, var__virtual_0_ ); | ||
162 | new Equality(body, var_Free, var__virtual_0_); | ||
163 | bodies.add(body); | ||
164 | } | ||
165 | return bodies; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | private static double evaluateExpression_1_1(final Integer Available, final Integer Total) { | ||
170 | return (((double) (Available).intValue()) / (Total).intValue()); | ||
171 | } | ||
172 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/FreeMemoryPercentage.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/FreeMemoryPercentage.java new file mode 100644 index 00000000..c2bb2bb3 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/FreeMemoryPercentage.java | |||
@@ -0,0 +1,172 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.AvailableMemory; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalMemory; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Set; | ||
12 | import org.eclipse.emf.ecore.EClass; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
32 | |||
33 | /** | ||
34 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
35 | * | ||
36 | * <p>Original source: | ||
37 | * <code><pre> | ||
38 | * private pattern freeMemoryPercentage(Host : HostInstance, Free : java Double) { | ||
39 | * find totalMemory(Host, Total); | ||
40 | * find availableMemory(Host, Available); | ||
41 | * Free == eval((Available as double) / Total); | ||
42 | * } | ||
43 | * </pre></code> | ||
44 | * | ||
45 | * @see GenericPatternMatcher | ||
46 | * @see GenericPatternMatch | ||
47 | * | ||
48 | */ | ||
49 | @SuppressWarnings("all") | ||
50 | public final class FreeMemoryPercentage extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
51 | private FreeMemoryPercentage() { | ||
52 | super(GeneratedPQuery.INSTANCE); | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * @return the singleton instance of the query specification | ||
57 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
58 | * | ||
59 | */ | ||
60 | public static FreeMemoryPercentage instance() { | ||
61 | try{ | ||
62 | return LazyHolder.INSTANCE; | ||
63 | } catch (ExceptionInInitializerError err) { | ||
64 | throw processInitializerError(err); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeMemoryPercentage (visibility: PUBLIC, simpleName: FreeMemoryPercentage, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeMemoryPercentage, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
70 | * <b>not</b> at the class load time of the outer class, | ||
71 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeMemoryPercentage (visibility: PUBLIC, simpleName: FreeMemoryPercentage, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.FreeMemoryPercentage, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
72 | * | ||
73 | * <p> This workaround is required e.g. to support recursion. | ||
74 | * | ||
75 | */ | ||
76 | private static class LazyHolder { | ||
77 | private static final FreeMemoryPercentage INSTANCE = new FreeMemoryPercentage(); | ||
78 | |||
79 | /** | ||
80 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
81 | * This initialization order is required to support indirect recursion. | ||
82 | * | ||
83 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
84 | * | ||
85 | */ | ||
86 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
87 | |||
88 | public static Object ensureInitialized() { | ||
89 | INSTANCE.ensureInitializedInternal(); | ||
90 | return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
95 | private static final FreeMemoryPercentage.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
96 | |||
97 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final PParameter parameter_Free = new PParameter("Free", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
100 | |||
101 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_Free); | ||
102 | |||
103 | private GeneratedPQuery() { | ||
104 | super(PVisibility.PRIVATE); | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public String getFullyQualifiedName() { | ||
109 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.freeMemoryPercentage"; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public List<String> getParameterNames() { | ||
114 | return Arrays.asList("Host","Free"); | ||
115 | } | ||
116 | |||
117 | @Override | ||
118 | public List<PParameter> getParameters() { | ||
119 | return parameters; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public Set<PBody> doGetContainedBodies() { | ||
124 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
125 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
126 | { | ||
127 | PBody body = new PBody(this); | ||
128 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
129 | PVariable var_Free = body.getOrCreateVariableByName("Free"); | ||
130 | PVariable var_Total = body.getOrCreateVariableByName("Total"); | ||
131 | PVariable var_Available = body.getOrCreateVariableByName("Available"); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
133 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Free), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
134 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
135 | new ExportedParameter(body, var_Host, parameter_Host), | ||
136 | new ExportedParameter(body, var_Free, parameter_Free) | ||
137 | )); | ||
138 | // find totalMemory(Host, Total) | ||
139 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_Total), TotalMemory.instance().getInternalQueryRepresentation()); | ||
140 | // find availableMemory(Host, Available) | ||
141 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_Available), AvailableMemory.instance().getInternalQueryRepresentation()); | ||
142 | // Free == eval((Available as double) / Total) | ||
143 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
144 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
145 | |||
146 | @Override | ||
147 | public String getShortDescription() { | ||
148 | return "Expression evaluation from pattern freeMemoryPercentage"; | ||
149 | } | ||
150 | |||
151 | @Override | ||
152 | public Iterable<String> getInputParameterNames() { | ||
153 | return Arrays.asList("Available", "Total");} | ||
154 | |||
155 | @Override | ||
156 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
157 | Integer Available = (Integer) provider.getValue("Available"); | ||
158 | Integer Total = (Integer) provider.getValue("Total"); | ||
159 | return evaluateExpression_1_1(Available, Total); | ||
160 | } | ||
161 | }, var__virtual_0_ ); | ||
162 | new Equality(body, var_Free, var__virtual_0_); | ||
163 | bodies.add(body); | ||
164 | } | ||
165 | return bodies; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | private static double evaluateExpression_1_1(final Integer Available, final Integer Total) { | ||
170 | return (((double) (Available).intValue()) / (Total).intValue()); | ||
171 | } | ||
172 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/HddRequirement.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/HddRequirement.java new file mode 100644 index 00000000..68448930 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/HddRequirement.java | |||
@@ -0,0 +1,151 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.ResourceRequirement; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
29 | |||
30 | /** | ||
31 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
32 | * | ||
33 | * <p>Original source: | ||
34 | * <code><pre> | ||
35 | * private pattern hddRequirement(Host : HostInstance, App : ApplicationInstance, Hdd : EInt) { | ||
36 | * find resourceRequirement(Host, App, Req); | ||
37 | * ResourceRequirement.requiredHdd(Req, Hdd); | ||
38 | * } | ||
39 | * </pre></code> | ||
40 | * | ||
41 | * @see GenericPatternMatcher | ||
42 | * @see GenericPatternMatch | ||
43 | * | ||
44 | */ | ||
45 | @SuppressWarnings("all") | ||
46 | public final class HddRequirement extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
47 | private HddRequirement() { | ||
48 | super(GeneratedPQuery.INSTANCE); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @return the singleton instance of the query specification | ||
53 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
54 | * | ||
55 | */ | ||
56 | public static HddRequirement instance() { | ||
57 | try{ | ||
58 | return LazyHolder.INSTANCE; | ||
59 | } catch (ExceptionInInitializerError err) { | ||
60 | throw processInitializerError(err); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HddRequirement (visibility: PUBLIC, simpleName: HddRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HddRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
66 | * <b>not</b> at the class load time of the outer class, | ||
67 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HddRequirement (visibility: PUBLIC, simpleName: HddRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HddRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
68 | * | ||
69 | * <p> This workaround is required e.g. to support recursion. | ||
70 | * | ||
71 | */ | ||
72 | private static class LazyHolder { | ||
73 | private static final HddRequirement INSTANCE = new HddRequirement(); | ||
74 | |||
75 | /** | ||
76 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
77 | * This initialization order is required to support indirect recursion. | ||
78 | * | ||
79 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
80 | * | ||
81 | */ | ||
82 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
83 | |||
84 | public static Object ensureInitialized() { | ||
85 | INSTANCE.ensureInitializedInternal(); | ||
86 | return null; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
91 | private static final HddRequirement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
92 | |||
93 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
94 | |||
95 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
96 | |||
97 | private final PParameter parameter_Hdd = new PParameter("Hdd", "java.lang.Integer", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EInt")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_App, parameter_Hdd); | ||
100 | |||
101 | private GeneratedPQuery() { | ||
102 | super(PVisibility.PRIVATE); | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String getFullyQualifiedName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.hddRequirement"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> getParameterNames() { | ||
112 | return Arrays.asList("Host","App","Hdd"); | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<PParameter> getParameters() { | ||
117 | return parameters; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public Set<PBody> doGetContainedBodies() { | ||
122 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
123 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
124 | { | ||
125 | PBody body = new PBody(this); | ||
126 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
127 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
128 | PVariable var_Hdd = body.getOrCreateVariableByName("Hdd"); | ||
129 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Hdd), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
133 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
134 | new ExportedParameter(body, var_Host, parameter_Host), | ||
135 | new ExportedParameter(body, var_App, parameter_App), | ||
136 | new ExportedParameter(body, var_Hdd, parameter_Hdd) | ||
137 | )); | ||
138 | // find resourceRequirement(Host, App, Req) | ||
139 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_App, var_Req), ResourceRequirement.instance().getInternalQueryRepresentation()); | ||
140 | // ResourceRequirement.requiredHdd(Req, Hdd) | ||
141 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
142 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
143 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "requiredHdd"))); | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
145 | new Equality(body, var__virtual_0_, var_Hdd); | ||
146 | bodies.add(body); | ||
147 | } | ||
148 | return bodies; | ||
149 | } | ||
150 | } | ||
151 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/HostInstanceCost.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/HostInstanceCost.java new file mode 100644 index 00000000..db7f7021 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/HostInstanceCost.java | |||
@@ -0,0 +1,153 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.CpsHosts; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
29 | |||
30 | /** | ||
31 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
32 | * | ||
33 | * <p>Original source: | ||
34 | * <code><pre> | ||
35 | * private pattern hostInstanceCost(Cps : CyberPhysicalSystem, Host : HostInstance, Cost : EInt) { | ||
36 | * find cpsHosts(Cps, Host); | ||
37 | * HostInstance.type.cost(Host, Cost); | ||
38 | * } | ||
39 | * </pre></code> | ||
40 | * | ||
41 | * @see GenericPatternMatcher | ||
42 | * @see GenericPatternMatch | ||
43 | * | ||
44 | */ | ||
45 | @SuppressWarnings("all") | ||
46 | public final class HostInstanceCost extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
47 | private HostInstanceCost() { | ||
48 | super(GeneratedPQuery.INSTANCE); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @return the singleton instance of the query specification | ||
53 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
54 | * | ||
55 | */ | ||
56 | public static HostInstanceCost instance() { | ||
57 | try{ | ||
58 | return LazyHolder.INSTANCE; | ||
59 | } catch (ExceptionInInitializerError err) { | ||
60 | throw processInitializerError(err); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HostInstanceCost (visibility: PUBLIC, simpleName: HostInstanceCost, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HostInstanceCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
66 | * <b>not</b> at the class load time of the outer class, | ||
67 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HostInstanceCost (visibility: PUBLIC, simpleName: HostInstanceCost, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.HostInstanceCost, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
68 | * | ||
69 | * <p> This workaround is required e.g. to support recursion. | ||
70 | * | ||
71 | */ | ||
72 | private static class LazyHolder { | ||
73 | private static final HostInstanceCost INSTANCE = new HostInstanceCost(); | ||
74 | |||
75 | /** | ||
76 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
77 | * This initialization order is required to support indirect recursion. | ||
78 | * | ||
79 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
80 | * | ||
81 | */ | ||
82 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
83 | |||
84 | public static Object ensureInitialized() { | ||
85 | INSTANCE.ensureInitializedInternal(); | ||
86 | return null; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
91 | private static final HostInstanceCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
92 | |||
93 | private final PParameter parameter_Cps = new PParameter("Cps", "hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "CyberPhysicalSystem")), PParameterDirection.INOUT); | ||
94 | |||
95 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
96 | |||
97 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Integer", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EInt")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final List<PParameter> parameters = Arrays.asList(parameter_Cps, parameter_Host, parameter_Cost); | ||
100 | |||
101 | private GeneratedPQuery() { | ||
102 | super(PVisibility.PRIVATE); | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String getFullyQualifiedName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.hostInstanceCost"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> getParameterNames() { | ||
112 | return Arrays.asList("Cps","Host","Cost"); | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<PParameter> getParameters() { | ||
117 | return parameters; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public Set<PBody> doGetContainedBodies() { | ||
122 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
123 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
124 | { | ||
125 | PBody body = new PBody(this); | ||
126 | PVariable var_Cps = body.getOrCreateVariableByName("Cps"); | ||
127 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
128 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
129 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cps), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "CyberPhysicalSystem"))); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cost), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
132 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
133 | new ExportedParameter(body, var_Cps, parameter_Cps), | ||
134 | new ExportedParameter(body, var_Host, parameter_Host), | ||
135 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
136 | )); | ||
137 | // find cpsHosts(Cps, Host) | ||
138 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Cps, var_Host), CpsHosts.instance().getInternalQueryRepresentation()); | ||
139 | // HostInstance.type.cost(Host, Cost) | ||
140 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
141 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
142 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostInstance", "type"))); | ||
143 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
144 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostType", "cost"))); | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
147 | new Equality(body, var__virtual_1_, var_Cost); | ||
148 | bodies.add(body); | ||
149 | } | ||
150 | return bodies; | ||
151 | } | ||
152 | } | ||
153 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/MemoryRequirement.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/MemoryRequirement.java new file mode 100644 index 00000000..d15f9bfa --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/MemoryRequirement.java | |||
@@ -0,0 +1,151 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.ResourceRequirement; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
29 | |||
30 | /** | ||
31 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
32 | * | ||
33 | * <p>Original source: | ||
34 | * <code><pre> | ||
35 | * private pattern memoryRequirement(Host : HostInstance, App : ApplicationInstance, Memory : EInt) { | ||
36 | * find resourceRequirement(Host, App, Req); | ||
37 | * ResourceRequirement.requiredMemory(Req, Memory); | ||
38 | * } | ||
39 | * </pre></code> | ||
40 | * | ||
41 | * @see GenericPatternMatcher | ||
42 | * @see GenericPatternMatch | ||
43 | * | ||
44 | */ | ||
45 | @SuppressWarnings("all") | ||
46 | public final class MemoryRequirement extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
47 | private MemoryRequirement() { | ||
48 | super(GeneratedPQuery.INSTANCE); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @return the singleton instance of the query specification | ||
53 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
54 | * | ||
55 | */ | ||
56 | public static MemoryRequirement instance() { | ||
57 | try{ | ||
58 | return LazyHolder.INSTANCE; | ||
59 | } catch (ExceptionInInitializerError err) { | ||
60 | throw processInitializerError(err); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.MemoryRequirement (visibility: PUBLIC, simpleName: MemoryRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.MemoryRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
66 | * <b>not</b> at the class load time of the outer class, | ||
67 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.MemoryRequirement (visibility: PUBLIC, simpleName: MemoryRequirement, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.MemoryRequirement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
68 | * | ||
69 | * <p> This workaround is required e.g. to support recursion. | ||
70 | * | ||
71 | */ | ||
72 | private static class LazyHolder { | ||
73 | private static final MemoryRequirement INSTANCE = new MemoryRequirement(); | ||
74 | |||
75 | /** | ||
76 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
77 | * This initialization order is required to support indirect recursion. | ||
78 | * | ||
79 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
80 | * | ||
81 | */ | ||
82 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
83 | |||
84 | public static Object ensureInitialized() { | ||
85 | INSTANCE.ensureInitializedInternal(); | ||
86 | return null; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
91 | private static final MemoryRequirement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
92 | |||
93 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
94 | |||
95 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
96 | |||
97 | private final PParameter parameter_Memory = new PParameter("Memory", "java.lang.Integer", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EInt")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_App, parameter_Memory); | ||
100 | |||
101 | private GeneratedPQuery() { | ||
102 | super(PVisibility.PRIVATE); | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String getFullyQualifiedName() { | ||
107 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.memoryRequirement"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<String> getParameterNames() { | ||
112 | return Arrays.asList("Host","App","Memory"); | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<PParameter> getParameters() { | ||
117 | return parameters; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public Set<PBody> doGetContainedBodies() { | ||
122 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
123 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
124 | { | ||
125 | PBody body = new PBody(this); | ||
126 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
127 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
128 | PVariable var_Memory = body.getOrCreateVariableByName("Memory"); | ||
129 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Memory), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
133 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
134 | new ExportedParameter(body, var_Host, parameter_Host), | ||
135 | new ExportedParameter(body, var_App, parameter_App), | ||
136 | new ExportedParameter(body, var_Memory, parameter_Memory) | ||
137 | )); | ||
138 | // find resourceRequirement(Host, App, Req) | ||
139 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_App, var_Req), ResourceRequirement.instance().getInternalQueryRepresentation()); | ||
140 | // ResourceRequirement.requiredMemory(Req, Memory) | ||
141 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
142 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
143 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "requiredMemory"))); | ||
144 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
145 | new Equality(body, var__virtual_0_, var_Memory); | ||
146 | bodies.add(body); | ||
147 | } | ||
148 | return bodies; | ||
149 | } | ||
150 | } | ||
151 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/NoHostToAllocateTo.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/NoHostToAllocateTo.java new file mode 100644 index 00000000..50597805 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/NoHostToAllocateTo.java | |||
@@ -0,0 +1,135 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.Allocate; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.UnallocatedAppInstance; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.LinkedHashSet; | ||
10 | import java.util.List; | ||
11 | import java.util.Set; | ||
12 | import org.eclipse.emf.ecore.EClass; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern noHostToAllocateTo(App : ApplicationInstance) { | ||
34 | * find unallocatedAppInstance(App); | ||
35 | * neg find allocate(App, _); | ||
36 | * } | ||
37 | * </pre></code> | ||
38 | * | ||
39 | * @see GenericPatternMatcher | ||
40 | * @see GenericPatternMatch | ||
41 | * | ||
42 | */ | ||
43 | @SuppressWarnings("all") | ||
44 | public final class NoHostToAllocateTo extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
45 | private NoHostToAllocateTo() { | ||
46 | super(GeneratedPQuery.INSTANCE); | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * @return the singleton instance of the query specification | ||
51 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
52 | * | ||
53 | */ | ||
54 | public static NoHostToAllocateTo instance() { | ||
55 | try{ | ||
56 | return LazyHolder.INSTANCE; | ||
57 | } catch (ExceptionInInitializerError err) { | ||
58 | throw processInitializerError(err); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.NoHostToAllocateTo (visibility: PUBLIC, simpleName: NoHostToAllocateTo, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.NoHostToAllocateTo, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
64 | * <b>not</b> at the class load time of the outer class, | ||
65 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.NoHostToAllocateTo (visibility: PUBLIC, simpleName: NoHostToAllocateTo, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.NoHostToAllocateTo, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
66 | * | ||
67 | * <p> This workaround is required e.g. to support recursion. | ||
68 | * | ||
69 | */ | ||
70 | private static class LazyHolder { | ||
71 | private static final NoHostToAllocateTo INSTANCE = new NoHostToAllocateTo(); | ||
72 | |||
73 | /** | ||
74 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
75 | * This initialization order is required to support indirect recursion. | ||
76 | * | ||
77 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
78 | * | ||
79 | */ | ||
80 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
81 | |||
82 | public static Object ensureInitialized() { | ||
83 | INSTANCE.ensureInitializedInternal(); | ||
84 | return null; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
89 | private static final NoHostToAllocateTo.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
90 | |||
91 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
92 | |||
93 | private final List<PParameter> parameters = Arrays.asList(parameter_App); | ||
94 | |||
95 | private GeneratedPQuery() { | ||
96 | super(PVisibility.PRIVATE); | ||
97 | } | ||
98 | |||
99 | @Override | ||
100 | public String getFullyQualifiedName() { | ||
101 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.noHostToAllocateTo"; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public List<String> getParameterNames() { | ||
106 | return Arrays.asList("App"); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public List<PParameter> getParameters() { | ||
111 | return parameters; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public Set<PBody> doGetContainedBodies() { | ||
116 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
117 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
118 | { | ||
119 | PBody body = new PBody(this); | ||
120 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
121 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
122 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
123 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
124 | new ExportedParameter(body, var_App, parameter_App) | ||
125 | )); | ||
126 | // find unallocatedAppInstance(App) | ||
127 | new PositivePatternCall(body, Tuples.flatTupleOf(var_App), UnallocatedAppInstance.instance().getInternalQueryRepresentation()); | ||
128 | // neg find allocate(App, _) | ||
129 | new NegativePatternCall(body, Tuples.flatTupleOf(var_App, var___0_), Allocate.instance().getInternalQueryRepresentation()); | ||
130 | bodies.add(body); | ||
131 | } | ||
132 | return bodies; | ||
133 | } | ||
134 | } | ||
135 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/RequiredAppInstances.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/RequiredAppInstances.java new file mode 100644 index 00000000..dc76cbde --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/RequiredAppInstances.java | |||
@@ -0,0 +1,181 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.SatisfyingInstance; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.emf.ecore.EDataType; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
17 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
34 | |||
35 | /** | ||
36 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
37 | * | ||
38 | * <p>Original source: | ||
39 | * <code><pre> | ||
40 | * private pattern requiredAppInstances(Req : Requirement, Remaining : java Integer) { | ||
41 | * Instances == count find satisfyingInstance(Req, _); | ||
42 | * Requirement.count(Req, RequiredCount); | ||
43 | * Remaining == eval(RequiredCount - Instances); | ||
44 | * } | ||
45 | * </pre></code> | ||
46 | * | ||
47 | * @see GenericPatternMatcher | ||
48 | * @see GenericPatternMatch | ||
49 | * | ||
50 | */ | ||
51 | @SuppressWarnings("all") | ||
52 | public final class RequiredAppInstances extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
53 | private RequiredAppInstances() { | ||
54 | super(GeneratedPQuery.INSTANCE); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * @return the singleton instance of the query specification | ||
59 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
60 | * | ||
61 | */ | ||
62 | public static RequiredAppInstances instance() { | ||
63 | try{ | ||
64 | return LazyHolder.INSTANCE; | ||
65 | } catch (ExceptionInInitializerError err) { | ||
66 | throw processInitializerError(err); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.RequiredAppInstances (visibility: PUBLIC, simpleName: RequiredAppInstances, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.RequiredAppInstances, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
72 | * <b>not</b> at the class load time of the outer class, | ||
73 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.RequiredAppInstances (visibility: PUBLIC, simpleName: RequiredAppInstances, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.RequiredAppInstances, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
74 | * | ||
75 | * <p> This workaround is required e.g. to support recursion. | ||
76 | * | ||
77 | */ | ||
78 | private static class LazyHolder { | ||
79 | private static final RequiredAppInstances INSTANCE = new RequiredAppInstances(); | ||
80 | |||
81 | /** | ||
82 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
83 | * This initialization order is required to support indirect recursion. | ||
84 | * | ||
85 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
86 | * | ||
87 | */ | ||
88 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
89 | |||
90 | public static Object ensureInitialized() { | ||
91 | INSTANCE.ensureInitializedInternal(); | ||
92 | return null; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
97 | private static final RequiredAppInstances.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
98 | |||
99 | private final PParameter parameter_Req = new PParameter("Req", "hu.bme.mit.inf.dslreasoner.domains.cps.Requirement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "Requirement")), PParameterDirection.INOUT); | ||
100 | |||
101 | private final PParameter parameter_Remaining = new PParameter("Remaining", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
102 | |||
103 | private final List<PParameter> parameters = Arrays.asList(parameter_Req, parameter_Remaining); | ||
104 | |||
105 | private GeneratedPQuery() { | ||
106 | super(PVisibility.PRIVATE); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | public String getFullyQualifiedName() { | ||
111 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.requiredAppInstances"; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | public List<String> getParameterNames() { | ||
116 | return Arrays.asList("Req","Remaining"); | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public List<PParameter> getParameters() { | ||
121 | return parameters; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public Set<PBody> doGetContainedBodies() { | ||
126 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
127 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
128 | { | ||
129 | PBody body = new PBody(this); | ||
130 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
131 | PVariable var_Remaining = body.getOrCreateVariableByName("Remaining"); | ||
132 | PVariable var_Instances = body.getOrCreateVariableByName("Instances"); | ||
133 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
134 | PVariable var_RequiredCount = body.getOrCreateVariableByName("RequiredCount"); | ||
135 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
136 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Remaining), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
137 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
138 | new ExportedParameter(body, var_Req, parameter_Req), | ||
139 | new ExportedParameter(body, var_Remaining, parameter_Remaining) | ||
140 | )); | ||
141 | // Instances == count find satisfyingInstance(Req, _) | ||
142 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
143 | new PatternMatchCounter(body, Tuples.flatTupleOf(var_Req, var___0_), SatisfyingInstance.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
144 | new Equality(body, var_Instances, var__virtual_0_); | ||
145 | // Requirement.count(Req, RequiredCount) | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
147 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
148 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "count"))); | ||
149 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
150 | new Equality(body, var__virtual_1_, var_RequiredCount); | ||
151 | // Remaining == eval(RequiredCount - Instances) | ||
152 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
153 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
154 | |||
155 | @Override | ||
156 | public String getShortDescription() { | ||
157 | return "Expression evaluation from pattern requiredAppInstances"; | ||
158 | } | ||
159 | |||
160 | @Override | ||
161 | public Iterable<String> getInputParameterNames() { | ||
162 | return Arrays.asList("Instances", "RequiredCount");} | ||
163 | |||
164 | @Override | ||
165 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
166 | Integer Instances = (Integer) provider.getValue("Instances"); | ||
167 | Integer RequiredCount = (Integer) provider.getValue("RequiredCount"); | ||
168 | return evaluateExpression_1_1(Instances, RequiredCount); | ||
169 | } | ||
170 | }, var__virtual_2_ ); | ||
171 | new Equality(body, var_Remaining, var__virtual_2_); | ||
172 | bodies.add(body); | ||
173 | } | ||
174 | return bodies; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | private static int evaluateExpression_1_1(final Integer Instances, final Integer RequiredCount) { | ||
179 | return ((RequiredCount).intValue() - (Instances).intValue()); | ||
180 | } | ||
181 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/SatisfyingInstance.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/SatisfyingInstance.java new file mode 100644 index 00000000..4285101c --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/SatisfyingInstance.java | |||
@@ -0,0 +1,153 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
13 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
25 | |||
26 | /** | ||
27 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
28 | * | ||
29 | * <p>Original source: | ||
30 | * <code><pre> | ||
31 | * private pattern satisfyingInstance(Req : Requirement, App : ApplicationInstance) { | ||
32 | * Requirement.instances(Req, App); | ||
33 | * Requirement.type(Req, Type); | ||
34 | * ApplicationInstance.type(App, Type); | ||
35 | * } | ||
36 | * </pre></code> | ||
37 | * | ||
38 | * @see GenericPatternMatcher | ||
39 | * @see GenericPatternMatch | ||
40 | * | ||
41 | */ | ||
42 | @SuppressWarnings("all") | ||
43 | public final class SatisfyingInstance extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
44 | private SatisfyingInstance() { | ||
45 | super(GeneratedPQuery.INSTANCE); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @return the singleton instance of the query specification | ||
50 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
51 | * | ||
52 | */ | ||
53 | public static SatisfyingInstance instance() { | ||
54 | try{ | ||
55 | return LazyHolder.INSTANCE; | ||
56 | } catch (ExceptionInInitializerError err) { | ||
57 | throw processInitializerError(err); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.SatisfyingInstance (visibility: PUBLIC, simpleName: SatisfyingInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.SatisfyingInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
63 | * <b>not</b> at the class load time of the outer class, | ||
64 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.SatisfyingInstance (visibility: PUBLIC, simpleName: SatisfyingInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.SatisfyingInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
65 | * | ||
66 | * <p> This workaround is required e.g. to support recursion. | ||
67 | * | ||
68 | */ | ||
69 | private static class LazyHolder { | ||
70 | private static final SatisfyingInstance INSTANCE = new SatisfyingInstance(); | ||
71 | |||
72 | /** | ||
73 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
74 | * This initialization order is required to support indirect recursion. | ||
75 | * | ||
76 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
77 | * | ||
78 | */ | ||
79 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
80 | |||
81 | public static Object ensureInitialized() { | ||
82 | INSTANCE.ensureInitializedInternal(); | ||
83 | return null; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
88 | private static final SatisfyingInstance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
89 | |||
90 | private final PParameter parameter_Req = new PParameter("Req", "hu.bme.mit.inf.dslreasoner.domains.cps.Requirement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "Requirement")), PParameterDirection.INOUT); | ||
91 | |||
92 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
93 | |||
94 | private final List<PParameter> parameters = Arrays.asList(parameter_Req, parameter_App); | ||
95 | |||
96 | private GeneratedPQuery() { | ||
97 | super(PVisibility.PRIVATE); | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public String getFullyQualifiedName() { | ||
102 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.satisfyingInstance"; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public List<String> getParameterNames() { | ||
107 | return Arrays.asList("Req","App"); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<PParameter> getParameters() { | ||
112 | return parameters; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Set<PBody> doGetContainedBodies() { | ||
117 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
118 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
119 | { | ||
120 | PBody body = new PBody(this); | ||
121 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
122 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
123 | PVariable var_Type = body.getOrCreateVariableByName("Type"); | ||
124 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
125 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
126 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
127 | new ExportedParameter(body, var_Req, parameter_Req), | ||
128 | new ExportedParameter(body, var_App, parameter_App) | ||
129 | )); | ||
130 | // Requirement.instances(Req, App) | ||
131 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
132 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "instances"))); | ||
134 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
135 | new Equality(body, var__virtual_0_, var_App); | ||
136 | // Requirement.type(Req, Type) | ||
137 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
138 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
139 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "type"))); | ||
140 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationType"))); | ||
141 | new Equality(body, var__virtual_1_, var_Type); | ||
142 | // ApplicationInstance.type(App, Type) | ||
143 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
144 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
145 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "type"))); | ||
146 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationType"))); | ||
147 | new Equality(body, var__virtual_2_, var_Type); | ||
148 | bodies.add(body); | ||
149 | } | ||
150 | return bodies; | ||
151 | } | ||
152 | } | ||
153 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/TotalHdd.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/TotalHdd.java new file mode 100644 index 00000000..f250f76d --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/TotalHdd.java | |||
@@ -0,0 +1,143 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern totalHdd(Host : HostInstance, Hdd : EInt) { | ||
34 | * HostInstance.type.defaultHdd(Host, Hdd); | ||
35 | * } | ||
36 | * </pre></code> | ||
37 | * | ||
38 | * @see GenericPatternMatcher | ||
39 | * @see GenericPatternMatch | ||
40 | * | ||
41 | */ | ||
42 | @SuppressWarnings("all") | ||
43 | public final class TotalHdd extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
44 | private TotalHdd() { | ||
45 | super(GeneratedPQuery.INSTANCE); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @return the singleton instance of the query specification | ||
50 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
51 | * | ||
52 | */ | ||
53 | public static TotalHdd instance() { | ||
54 | try{ | ||
55 | return LazyHolder.INSTANCE; | ||
56 | } catch (ExceptionInInitializerError err) { | ||
57 | throw processInitializerError(err); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalHdd (visibility: PUBLIC, simpleName: TotalHdd, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalHdd, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
63 | * <b>not</b> at the class load time of the outer class, | ||
64 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalHdd (visibility: PUBLIC, simpleName: TotalHdd, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalHdd, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
65 | * | ||
66 | * <p> This workaround is required e.g. to support recursion. | ||
67 | * | ||
68 | */ | ||
69 | private static class LazyHolder { | ||
70 | private static final TotalHdd INSTANCE = new TotalHdd(); | ||
71 | |||
72 | /** | ||
73 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
74 | * This initialization order is required to support indirect recursion. | ||
75 | * | ||
76 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
77 | * | ||
78 | */ | ||
79 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
80 | |||
81 | public static Object ensureInitialized() { | ||
82 | INSTANCE.ensureInitializedInternal(); | ||
83 | return null; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
88 | private static final TotalHdd.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
89 | |||
90 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
91 | |||
92 | private final PParameter parameter_Hdd = new PParameter("Hdd", "java.lang.Integer", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EInt")), PParameterDirection.INOUT); | ||
93 | |||
94 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_Hdd); | ||
95 | |||
96 | private GeneratedPQuery() { | ||
97 | super(PVisibility.PRIVATE); | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public String getFullyQualifiedName() { | ||
102 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.totalHdd"; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public List<String> getParameterNames() { | ||
107 | return Arrays.asList("Host","Hdd"); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<PParameter> getParameters() { | ||
112 | return parameters; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Set<PBody> doGetContainedBodies() { | ||
117 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
118 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
119 | { | ||
120 | PBody body = new PBody(this); | ||
121 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
122 | PVariable var_Hdd = body.getOrCreateVariableByName("Hdd"); | ||
123 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
124 | new TypeConstraint(body, Tuples.flatTupleOf(var_Hdd), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
125 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
126 | new ExportedParameter(body, var_Host, parameter_Host), | ||
127 | new ExportedParameter(body, var_Hdd, parameter_Hdd) | ||
128 | )); | ||
129 | // HostInstance.type.defaultHdd(Host, Hdd) | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
131 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostInstance", "type"))); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
134 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
135 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostType", "defaultHdd"))); | ||
136 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
137 | new Equality(body, var__virtual_1_, var_Hdd); | ||
138 | bodies.add(body); | ||
139 | } | ||
140 | return bodies; | ||
141 | } | ||
142 | } | ||
143 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/TotalMemory.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/TotalMemory.java new file mode 100644 index 00000000..aecd97e2 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/TotalMemory.java | |||
@@ -0,0 +1,143 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.LinkedHashSet; | ||
8 | import java.util.List; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EClass; | ||
11 | import org.eclipse.emf.ecore.EDataType; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern totalMemory(Host : HostInstance, Memory : EInt) { | ||
34 | * HostInstance.type.defaultMemory(Host, Memory); | ||
35 | * } | ||
36 | * </pre></code> | ||
37 | * | ||
38 | * @see GenericPatternMatcher | ||
39 | * @see GenericPatternMatch | ||
40 | * | ||
41 | */ | ||
42 | @SuppressWarnings("all") | ||
43 | public final class TotalMemory extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
44 | private TotalMemory() { | ||
45 | super(GeneratedPQuery.INSTANCE); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @return the singleton instance of the query specification | ||
50 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
51 | * | ||
52 | */ | ||
53 | public static TotalMemory instance() { | ||
54 | try{ | ||
55 | return LazyHolder.INSTANCE; | ||
56 | } catch (ExceptionInInitializerError err) { | ||
57 | throw processInitializerError(err); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalMemory (visibility: PUBLIC, simpleName: TotalMemory, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalMemory, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
63 | * <b>not</b> at the class load time of the outer class, | ||
64 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalMemory (visibility: PUBLIC, simpleName: TotalMemory, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.TotalMemory, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
65 | * | ||
66 | * <p> This workaround is required e.g. to support recursion. | ||
67 | * | ||
68 | */ | ||
69 | private static class LazyHolder { | ||
70 | private static final TotalMemory INSTANCE = new TotalMemory(); | ||
71 | |||
72 | /** | ||
73 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
74 | * This initialization order is required to support indirect recursion. | ||
75 | * | ||
76 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
77 | * | ||
78 | */ | ||
79 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
80 | |||
81 | public static Object ensureInitialized() { | ||
82 | INSTANCE.ensureInitializedInternal(); | ||
83 | return null; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
88 | private static final TotalMemory.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
89 | |||
90 | private final PParameter parameter_Host = new PParameter("Host", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
91 | |||
92 | private final PParameter parameter_Memory = new PParameter("Memory", "java.lang.Integer", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EInt")), PParameterDirection.INOUT); | ||
93 | |||
94 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_Memory); | ||
95 | |||
96 | private GeneratedPQuery() { | ||
97 | super(PVisibility.PRIVATE); | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public String getFullyQualifiedName() { | ||
102 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.totalMemory"; | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public List<String> getParameterNames() { | ||
107 | return Arrays.asList("Host","Memory"); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<PParameter> getParameters() { | ||
112 | return parameters; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Set<PBody> doGetContainedBodies() { | ||
117 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
118 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
119 | { | ||
120 | PBody body = new PBody(this); | ||
121 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
122 | PVariable var_Memory = body.getOrCreateVariableByName("Memory"); | ||
123 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
124 | new TypeConstraint(body, Tuples.flatTupleOf(var_Memory), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
125 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
126 | new ExportedParameter(body, var_Host, parameter_Host), | ||
127 | new ExportedParameter(body, var_Memory, parameter_Memory) | ||
128 | )); | ||
129 | // HostInstance.type.defaultMemory(Host, Memory) | ||
130 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
131 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
132 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostInstance", "type"))); | ||
133 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
134 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
135 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostType", "defaultMemory"))); | ||
136 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
137 | new Equality(body, var__virtual_1_, var_Memory); | ||
138 | bodies.add(body); | ||
139 | } | ||
140 | return bodies; | ||
141 | } | ||
142 | } | ||
143 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/UnallocatedAppInstance.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/UnallocatedAppInstance.java new file mode 100644 index 00000000..a20b534c --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src-gen/hu/bme/mit/inf/dslreasoner/domains/cps/queries/internal/UnallocatedAppInstance.java | |||
@@ -0,0 +1,172 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.Collections; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Set; | ||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
13 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
14 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
15 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
27 | |||
28 | /** | ||
29 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
30 | * | ||
31 | * <p>Original source: | ||
32 | * <code><pre> | ||
33 | * private pattern unallocatedAppInstance(App : ApplicationInstance) { | ||
34 | * neg ApplicationInstance.allocatedTo(App, _); | ||
35 | * } | ||
36 | * </pre></code> | ||
37 | * | ||
38 | * @see GenericPatternMatcher | ||
39 | * @see GenericPatternMatch | ||
40 | * | ||
41 | */ | ||
42 | @SuppressWarnings("all") | ||
43 | public final class UnallocatedAppInstance extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
44 | private UnallocatedAppInstance() { | ||
45 | super(GeneratedPQuery.INSTANCE); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @return the singleton instance of the query specification | ||
50 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
51 | * | ||
52 | */ | ||
53 | public static UnallocatedAppInstance instance() { | ||
54 | try{ | ||
55 | return LazyHolder.INSTANCE; | ||
56 | } catch (ExceptionInInitializerError err) { | ||
57 | throw processInitializerError(err); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.UnallocatedAppInstance (visibility: PUBLIC, simpleName: UnallocatedAppInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.UnallocatedAppInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
63 | * <b>not</b> at the class load time of the outer class, | ||
64 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.UnallocatedAppInstance (visibility: PUBLIC, simpleName: UnallocatedAppInstance, identifier: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal.UnallocatedAppInstance, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
65 | * | ||
66 | * <p> This workaround is required e.g. to support recursion. | ||
67 | * | ||
68 | */ | ||
69 | private static class LazyHolder { | ||
70 | private static final UnallocatedAppInstance INSTANCE = new UnallocatedAppInstance(); | ||
71 | |||
72 | /** | ||
73 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
74 | * This initialization order is required to support indirect recursion. | ||
75 | * | ||
76 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
77 | * | ||
78 | */ | ||
79 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
80 | |||
81 | public static Object ensureInitialized() { | ||
82 | INSTANCE.ensureInitializedInternal(); | ||
83 | return null; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
88 | private static final UnallocatedAppInstance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
89 | |||
90 | private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
91 | |||
92 | private final List<PParameter> parameters = Arrays.asList(parameter_App); | ||
93 | |||
94 | private class Embedded_1_ApplicationInstance_allocatedTo extends BaseGeneratedEMFPQuery { | ||
95 | private final PParameter parameter_p0 = new PParameter("p0", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); | ||
96 | |||
97 | private final PParameter parameter_p1 = new PParameter("p1", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); | ||
98 | |||
99 | private final List<PParameter> embeddedParameters = Arrays.asList(parameter_p0, parameter_p1); | ||
100 | |||
101 | public Embedded_1_ApplicationInstance_allocatedTo() { | ||
102 | super(PVisibility.EMBEDDED); | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | public String getFullyQualifiedName() { | ||
107 | return GeneratedPQuery.this.getFullyQualifiedName() + "$Embedded_1_ApplicationInstance_allocatedTo"; | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public List<PParameter> getParameters() { | ||
112 | return embeddedParameters; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Set<PBody> doGetContainedBodies() { | ||
117 | PBody body = new PBody(this); | ||
118 | PVariable var_p0 = body.getOrCreateVariableByName("p0"); | ||
119 | PVariable var_p1 = body.getOrCreateVariableByName("p1"); | ||
120 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
121 | new ExportedParameter(body, var_p0, parameter_p0), | ||
122 | new ExportedParameter(body, var_p1, parameter_p1) | ||
123 | )); | ||
124 | // ApplicationInstance.allocatedTo(App, _) | ||
125 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
126 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
127 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
128 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
129 | new Equality(body, var__virtual_0_, var_p1); | ||
130 | return Collections.singleton(body); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | private GeneratedPQuery() { | ||
135 | super(PVisibility.PRIVATE); | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public String getFullyQualifiedName() { | ||
140 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocatedAppInstance"; | ||
141 | } | ||
142 | |||
143 | @Override | ||
144 | public List<String> getParameterNames() { | ||
145 | return Arrays.asList("App"); | ||
146 | } | ||
147 | |||
148 | @Override | ||
149 | public List<PParameter> getParameters() { | ||
150 | return parameters; | ||
151 | } | ||
152 | |||
153 | @Override | ||
154 | public Set<PBody> doGetContainedBodies() { | ||
155 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
156 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
157 | { | ||
158 | PBody body = new PBody(this); | ||
159 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
160 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
161 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
162 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
163 | new ExportedParameter(body, var_App, parameter_App) | ||
164 | )); | ||
165 | // neg ApplicationInstance.allocatedTo(App, _) | ||
166 | new NegativePatternCall(body, Tuples.flatTupleOf(var_App, var___0_), new UnallocatedAppInstance.GeneratedPQuery.Embedded_1_ApplicationInstance_allocatedTo()); | ||
167 | bodies.add(body); | ||
168 | } | ||
169 | return bodies; | ||
170 | } | ||
171 | } | ||
172 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/cplex/CbcCpsMain.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/cplex/CbcCpsMain.xtend new file mode 100644 index 00000000..1a07e26e --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/cplex/CbcCpsMain.xtend | |||
@@ -0,0 +1,67 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.cplex | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.cps.generator.CpsGenerator | ||
5 | import java.io.BufferedReader | ||
6 | import java.io.BufferedWriter | ||
7 | import java.io.FileReader | ||
8 | import java.io.FileWriter | ||
9 | import java.util.concurrent.TimeUnit | ||
10 | import java.util.regex.Pattern | ||
11 | import org.eclipse.emf.ecore.EPackage | ||
12 | import org.eclipse.emf.ecore.resource.Resource | ||
13 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | ||
14 | |||
15 | class CbcCpsMain { | ||
16 | static val PROBLEM_FILE = "problem.lp" | ||
17 | static val SOLUTION_FILE = "solution.txt" | ||
18 | static val VALUE_REGEX = Pattern.compile("Optimal - objective value\\s*([0-9]+(\\.[0-9]+)?)") | ||
19 | |||
20 | private new() { | ||
21 | new IllegalStateException("This is a static utility class and should not be instantiated directly.") | ||
22 | } | ||
23 | |||
24 | public static def void main(String[] args) { | ||
25 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, | ||
26 | new XMIResourceFactoryImpl) | ||
27 | EPackage.Registry.INSTANCE.put(CpsPackage.eNS_URI, CpsPackage.eINSTANCE) | ||
28 | val generator = new CpsGenerator(1, 4, 1) | ||
29 | val problem = generator.generateCpsProblem | ||
30 | val toLp = new CpsToLpTranslator(problem, 10, true) | ||
31 | val lp = toLp.lpProblem | ||
32 | val writer = new BufferedWriter(new FileWriter(PROBLEM_FILE)) | ||
33 | try { | ||
34 | writer.append(lp) | ||
35 | } finally { | ||
36 | writer.close | ||
37 | } | ||
38 | val process = new ProcessBuilder().inheritIO.command("cbc", PROBLEM_FILE, "solve", "solu", SOLUTION_FILE).start | ||
39 | if (!process.waitFor(120, TimeUnit.SECONDS)) { | ||
40 | System.err.println("Timeout reached") | ||
41 | process.destroyForcibly | ||
42 | System.exit(-1) | ||
43 | } | ||
44 | if (process.exitValue != 0) { | ||
45 | System.err.println("Unexpected exit value " + process.exitValue) | ||
46 | System.exit(-1) | ||
47 | } | ||
48 | val reader = new BufferedReader(new FileReader(SOLUTION_FILE)) | ||
49 | var double value = Double.NaN | ||
50 | try { | ||
51 | var String line | ||
52 | while ((line = reader.readLine) !== null) { | ||
53 | println(line) | ||
54 | val matcher = VALUE_REGEX.matcher(line) | ||
55 | if (matcher.matches) { | ||
56 | value = Double.parseDouble(matcher.group(1)) | ||
57 | } | ||
58 | } | ||
59 | } finally { | ||
60 | reader.close | ||
61 | } | ||
62 | val applicationCost = problem.requests.flatMap[requirements.map[count]].reduce[p1, p2|p1 + p2] * 5 | ||
63 | val cost = applicationCost + value | ||
64 | println | ||
65 | println("Cost: " + cost) | ||
66 | } | ||
67 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/cplex/CpsToLpTranslator.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/cplex/CpsToLpTranslator.xtend new file mode 100644 index 00000000..c38af3a0 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/cplex/CpsToLpTranslator.xtend | |||
@@ -0,0 +1,171 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.cplex | ||
2 | |||
3 | import com.google.common.collect.ImmutableList | ||
4 | import com.google.common.collect.ImmutableMap | ||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationType | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.Requirement | ||
9 | import java.util.List | ||
10 | import java.util.Map | ||
11 | |||
12 | class CpsToLpTranslator { | ||
13 | static val MINIMUM_MEMORY_USAGE = 0.25 | ||
14 | static val MINIMUM_HDD_USAGE = 0.25 | ||
15 | |||
16 | val CyberPhysicalSystem cps | ||
17 | val Map<Requirement, ? extends List<String>> appInstances | ||
18 | val Map<HostType, ? extends List<String>> hostInstances | ||
19 | val boolean breakSymmetry | ||
20 | |||
21 | new(CyberPhysicalSystem cps, int hostInstanceCount, boolean breakSymmetry) { | ||
22 | this.cps = cps | ||
23 | appInstances = createAppInstances | ||
24 | hostInstances = createHostInstances(hostInstanceCount) | ||
25 | this.breakSymmetry = breakSymmetry | ||
26 | } | ||
27 | |||
28 | private def createAppInstances() { | ||
29 | val builder = ImmutableMap.builder | ||
30 | var int i = 0 | ||
31 | for (req : requirements) { | ||
32 | val listBuilder = ImmutableList.builder | ||
33 | for (var int j = 0; j < req.count; j++) { | ||
34 | listBuilder.add('''r«i»a«j»''') | ||
35 | } | ||
36 | builder.put(req, listBuilder.build) | ||
37 | i++ | ||
38 | } | ||
39 | builder.build | ||
40 | } | ||
41 | |||
42 | private def createHostInstances(int hostInstanceCount) { | ||
43 | val builder = ImmutableMap.builder | ||
44 | var int i = 0 | ||
45 | for (hostType : cps.hostTypes) { | ||
46 | val listBuilder = ImmutableList.builder | ||
47 | for (var int j = 0; j < hostInstanceCount; j++) { | ||
48 | listBuilder.add('''h«i»i«j»''') | ||
49 | } | ||
50 | builder.put(hostType, listBuilder.build) | ||
51 | i++ | ||
52 | } | ||
53 | builder.build | ||
54 | } | ||
55 | |||
56 | def getLpProblem() { | ||
57 | ''' | ||
58 | Minimize | ||
59 | total_cost: «objective» | ||
60 | Subject To | ||
61 | «constraints» | ||
62 | Bounds | ||
63 | «bounds» | ||
64 | Binary | ||
65 | «binaryVariables» | ||
66 | End | ||
67 | ''' | ||
68 | } | ||
69 | |||
70 | private def getObjective() { | ||
71 | '''«FOR pair : hostInstancesWithType SEPARATOR " + "»«pair.key.cost» «pair.value.existsVariable»«ENDFOR»''' | ||
72 | } | ||
73 | |||
74 | private def getConstraints() { | ||
75 | ''' | ||
76 | «FOR appPair : appInstancesWithType» | ||
77 | «appPair.value»_allocated: «FOR host : appPair.key.possibleHostInstances SEPARATOR " + "»«getAllocatedToVariable(appPair.value, host)»«ENDFOR» = 1 | ||
78 | «FOR host : appPair.key.possibleHostInstances» | ||
79 | «appPair.value»_to_«host»_exists: «host.existsVariable» - «getAllocatedToVariable(appPair.value, host)» >= 0 | ||
80 | «ENDFOR» | ||
81 | «ENDFOR» | ||
82 | «FOR hostPair : hostInstancesWithType» | ||
83 | «hostPair.value»_mem_use: «FOR appPair : hostPair.key.possibleAppInstancesWithRequirements SEPARATOR " + "»«appPair.key.requiredMemory» «getAllocatedToVariable(appPair.value, hostPair.value)»«ENDFOR» - «hostPair.key.defaultMemory» «hostPair.value.memoryUsageVariable» = 0 | ||
84 | «hostPair.value»_hdd_use: «FOR appPair : hostPair.key.possibleAppInstancesWithRequirements SEPARATOR " + "»«appPair.key.requiredHdd» «getAllocatedToVariable(appPair.value, hostPair.value)»«ENDFOR» - «hostPair.key.defaultHdd» «hostPair.value.hddUsageVariable» = 0 | ||
85 | «ENDFOR» | ||
86 | average_mem: «FOR host : allHostInstances SEPARATOR " + "»«host.memoryUsageVariable» - «MINIMUM_MEMORY_USAGE» «host.existsVariable»«ENDFOR» >= 0 | ||
87 | average_hdd: «FOR host : allHostInstances SEPARATOR " + "»«host.memoryUsageVariable» - «MINIMUM_HDD_USAGE» «host.existsVariable»«ENDFOR» >= 0 | ||
88 | «FOR reqPair : requirements.filter[count > 1].indexed» | ||
89 | «FOR host : reqPair.value.type.requirements.flatMap[hostInstances.get(hostType)]» | ||
90 | r«reqPair.key»_«host»_redundant: «FOR app : appInstances.get(reqPair.value) SEPARATOR " + "»«getAllocatedToVariable(app, host)»«ENDFOR» <= 1 | ||
91 | «ENDFOR» | ||
92 | «ENDFOR» | ||
93 | «IF breakSymmetry» | ||
94 | «FOR hosts : hostInstances.values» | ||
95 | «FOR i : 0 ..< (hosts.size - 1)» | ||
96 | «hosts.get(i + 1)»_after_«hosts.get(i)»: «hosts.get(i).existsVariable» - «hosts.get(i + 1).existsVariable» >= 0 | ||
97 | «ENDFOR» | ||
98 | «ENDFOR» | ||
99 | «ENDIF» | ||
100 | ''' | ||
101 | } | ||
102 | |||
103 | private def getBounds() { | ||
104 | ''' | ||
105 | «FOR host : allHostInstances» | ||
106 | 0 <= «host.memoryUsageVariable» <= 1 | ||
107 | 0 <= «host.hddUsageVariable» <= 1 | ||
108 | «ENDFOR» | ||
109 | ''' | ||
110 | } | ||
111 | |||
112 | private def getBinaryVariables() { | ||
113 | ''' | ||
114 | «FOR host : allHostInstances» | ||
115 | «host.existsVariable» | ||
116 | «ENDFOR» | ||
117 | «FOR appPair : appInstancesWithType» | ||
118 | «FOR host : appPair.key.possibleHostInstances» | ||
119 | «getAllocatedToVariable(appPair.value, host)» | ||
120 | «ENDFOR» | ||
121 | «ENDFOR» | ||
122 | ''' | ||
123 | } | ||
124 | |||
125 | private def getRequirements() { | ||
126 | cps.requests.flatMap[requirements] | ||
127 | } | ||
128 | |||
129 | private def getAllHostInstances() { | ||
130 | hostInstances.values.flatMap[it] | ||
131 | } | ||
132 | |||
133 | private def getHostInstancesWithType() { | ||
134 | hostInstances.entrySet.flatMap[pair|pair.value.map[pair.key -> it]] | ||
135 | } | ||
136 | |||
137 | private def getAppInstancesWithType() { | ||
138 | appInstances.entrySet.flatMap[pair|pair.value.map[pair.key.type -> it]] | ||
139 | } | ||
140 | |||
141 | private def getPossibleHostInstances(ApplicationType appType) { | ||
142 | appType.requirements.flatMap[req|hostInstances.get(req.hostType)] | ||
143 | } | ||
144 | |||
145 | private def getPossibleAppInstancesWithRequirements(HostType hostType) { | ||
146 | appInstances.entrySet.flatMap [ pair | | ||
147 | val resourceReq = pair.key.type.requirements.findFirst[it.hostType == hostType] | ||
148 | if (resourceReq === null) { | ||
149 | emptyList | ||
150 | } else { | ||
151 | pair.value.map[resourceReq -> it] | ||
152 | } | ||
153 | ] | ||
154 | } | ||
155 | |||
156 | private def getExistsVariable(String hostInstance) { | ||
157 | '''«hostInstance»_exists''' | ||
158 | } | ||
159 | |||
160 | private def getMemoryUsageVariable(String hostInstance) { | ||
161 | '''«hostInstance»_mem''' | ||
162 | } | ||
163 | |||
164 | private def getHddUsageVariable(String hostInstance) { | ||
165 | '''«hostInstance»_hdd''' | ||
166 | } | ||
167 | |||
168 | private def getAllocatedToVariable(String appInstance, String hostInstance) { | ||
169 | '''«appInstance»_to_«hostInstance»''' | ||
170 | } | ||
171 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/CpsStateCoder.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/CpsStateCoder.xtend new file mode 100644 index 00000000..223cee03 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/CpsStateCoder.xtend | |||
@@ -0,0 +1,134 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.dse | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.Request | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.Requirement | ||
9 | import org.eclipse.emf.common.notify.Notifier | ||
10 | import org.eclipse.emf.ecore.resource.Resource | ||
11 | import org.eclipse.emf.ecore.resource.ResourceSet | ||
12 | import org.eclipse.viatra.dse.statecode.IStateCoder | ||
13 | import org.eclipse.viatra.dse.statecode.IStateCoderFactory | ||
14 | import org.eclipse.viatra.query.runtime.api.IPatternMatch | ||
15 | import org.eclipse.xtend2.lib.StringConcatenationClient | ||
16 | |||
17 | class CpsStateCoder implements IStateCoder { | ||
18 | CyberPhysicalSystem cps | ||
19 | |||
20 | protected new() { | ||
21 | } | ||
22 | |||
23 | override init(Notifier notifier) { | ||
24 | cps = switch (notifier) { | ||
25 | ResourceSet: getCpsFromResourceSet(notifier) | ||
26 | Resource: getCpsFromResource(notifier) | ||
27 | CyberPhysicalSystem: notifier | ||
28 | default: throw new IllegalArgumentException("notifier is not a CyberPhysicalSystem") | ||
29 | } | ||
30 | } | ||
31 | |||
32 | private def getCpsFromResourceSet(ResourceSet resourceSet) { | ||
33 | if (resourceSet.resources.empty) { | ||
34 | throw new IllegalArgumentException("No Resource in ResourceSet") | ||
35 | } | ||
36 | val resource = resourceSet.resources.head | ||
37 | getCpsFromResource(resource) | ||
38 | } | ||
39 | |||
40 | private def getCpsFromResource(Resource resource) { | ||
41 | if (resource.contents.empty) { | ||
42 | throw new IllegalArgumentException("No EObject in Resource") | ||
43 | } | ||
44 | val cps = resource.contents.head | ||
45 | if (cps instanceof CyberPhysicalSystem) { | ||
46 | cps | ||
47 | } else { | ||
48 | throw new IllegalArgumentException("EObject in Resource is not a CyberPhysicalSystem") | ||
49 | } | ||
50 | } | ||
51 | |||
52 | override String createStateCode() { | ||
53 | '''«createRequestsCode»«createHostTypesCode»''' | ||
54 | } | ||
55 | |||
56 | private def StringConcatenationClient createRequestsCode() { | ||
57 | '''«FOR request : cps.requests»«createRequestCode(request)»«ENDFOR»''' | ||
58 | } | ||
59 | |||
60 | private def StringConcatenationClient createRequestCode(Request request) { | ||
61 | '''[«FOR requirement : request.requirements»«createRequirementCode(requirement)»«ENDFOR»]''' | ||
62 | } | ||
63 | |||
64 | private def StringConcatenationClient createRequirementCode(Requirement requirement) { | ||
65 | '''[«FOR app : requirement.instances SEPARATOR ","»«createAppCode(app)»«ENDFOR»]''' | ||
66 | } | ||
67 | |||
68 | private def createAppCode(ApplicationInstance app) { | ||
69 | if (app.allocatedTo === null) { | ||
70 | "-" | ||
71 | } else { | ||
72 | createMatchArgumentCode(app.allocatedTo) | ||
73 | } | ||
74 | } | ||
75 | |||
76 | private def createHostTypesCode() { | ||
77 | '''(«FOR hostType : cps.hostTypes SEPARATOR ","»«hostType.instances.size»«ENDFOR»)''' | ||
78 | } | ||
79 | |||
80 | override String createActivationCode(IPatternMatch match) { | ||
81 | '''«match.specification.simpleName»(«FOR arg : match.toArray SEPARATOR ","»«createMatchArgumentCode(arg)»«ENDFOR»)''' | ||
82 | } | ||
83 | |||
84 | protected dispatch def String createMatchArgumentCode(Requirement requirement) { | ||
85 | val request = requirement.eContainer | ||
86 | if (request instanceof Request) { | ||
87 | if (request.eContainer != cps) { | ||
88 | throw new IllegalArgumentException("Request is not contained in the CPS") | ||
89 | } | ||
90 | val requestIndex = cps.requests.indexOf(request) | ||
91 | val requirementIndex = request.requirements.indexOf(requirement) | ||
92 | requestIndex + "." + requirementIndex | ||
93 | } else { | ||
94 | throw new IllegalArgumentException("Requirement is not contained in a request") | ||
95 | } | ||
96 | } | ||
97 | |||
98 | protected dispatch def String createMatchArgumentCode(ApplicationInstance app) { | ||
99 | val requirement = app.requirement | ||
100 | if (requirement === null) { | ||
101 | throw new IllegalArgumentException("Application instance is not associated with a requirement") | ||
102 | } | ||
103 | val instanceIndex = requirement.instances.indexOf(app) | ||
104 | createMatchArgumentCode(requirement) + "." + instanceIndex | ||
105 | } | ||
106 | |||
107 | protected dispatch def String createMatchArgumentCode(HostInstance host) { | ||
108 | val hostType = host.eContainer | ||
109 | if (hostType instanceof HostType) { | ||
110 | val hostIndex = hostType.instances.indexOf(host) | ||
111 | createMatchArgumentCode(hostType) + "." + hostIndex | ||
112 | } else { | ||
113 | throw new IllegalArgumentException("Host is not contained in a host type") | ||
114 | } | ||
115 | } | ||
116 | |||
117 | protected dispatch def String createMatchArgumentCode(HostType hostType) { | ||
118 | if (hostType.eContainer != cps) { | ||
119 | throw new IllegalArgumentException("Host type is not contained in the CPS") | ||
120 | } | ||
121 | val hostTypeIndex = cps.hostTypes.indexOf(hostType) | ||
122 | hostTypeIndex.toString | ||
123 | } | ||
124 | |||
125 | protected dispatch def createMatchArgumentCode(Object object) { | ||
126 | throw new IllegalArgumentException("Unknown match argument: ") | ||
127 | } | ||
128 | |||
129 | static class Factory implements IStateCoderFactory { | ||
130 | override createStateCoder() { | ||
131 | new CpsStateCoder | ||
132 | } | ||
133 | } | ||
134 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsMain.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsMain.xtend new file mode 100644 index 00000000..35b3b1df --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsMain.xtend | |||
@@ -0,0 +1,39 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.dse | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.cps.generator.CpsGenerator | ||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CpsQueries | ||
6 | import org.eclipse.emf.ecore.EPackage | ||
7 | import org.eclipse.emf.ecore.EStructuralFeature | ||
8 | import org.eclipse.emf.ecore.resource.Resource | ||
9 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | ||
10 | import org.eclipse.viatra.addon.querybasedfeatures.runtime.QueryBasedFeatureSettingDelegateFactory | ||
11 | import org.eclipse.viatra.addon.querybasedfeatures.runtime.handler.QueryBasedFeatures | ||
12 | import org.eclipse.viatra.dse.api.DesignSpaceExplorer | ||
13 | import org.eclipse.viatra.dse.api.DesignSpaceExplorer.DseLoggingLevel | ||
14 | import org.eclipse.viatra.query.runtime.extensibility.SingletonQueryGroupProvider | ||
15 | import org.eclipse.viatra.query.runtime.registry.QuerySpecificationRegistry | ||
16 | import org.eclipse.viatra.query.runtime.registry.connector.QueryGroupProviderSourceConnector | ||
17 | |||
18 | class RuleBasedCpsMain { | ||
19 | private new() { | ||
20 | new IllegalStateException("This is a static utility class and should not be instantiated directly.") | ||
21 | } | ||
22 | |||
23 | public static def void main(String[] args) { | ||
24 | DesignSpaceExplorer.turnOnLogging(DseLoggingLevel.VERBOSE_FULL) | ||
25 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, | ||
26 | new XMIResourceFactoryImpl) | ||
27 | EStructuralFeature.Internal.SettingDelegate.Factory.Registry.INSTANCE.put(QueryBasedFeatures.ANNOTATION_SOURCE, | ||
28 | new QueryBasedFeatureSettingDelegateFactory) | ||
29 | EPackage.Registry.INSTANCE.put(CpsPackage.eNS_URI, CpsPackage.eINSTANCE) | ||
30 | QuerySpecificationRegistry.instance.addSource( | ||
31 | new QueryGroupProviderSourceConnector("CpsQueries", new SingletonQueryGroupProvider(CpsQueries.instance), | ||
32 | true)) | ||
33 | val generator = new CpsGenerator(1, 4, 1) | ||
34 | val problem = generator.generateCpsProblem | ||
35 | // problem.eResource.save(emptyMap) | ||
36 | val solver = new RuleBasedCpsSolver | ||
37 | solver.solve(problem) | ||
38 | } | ||
39 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsSolver.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsSolver.xtend new file mode 100644 index 00000000..503c06ea --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsSolver.xtend | |||
@@ -0,0 +1,74 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.dse | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsFactory | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage | ||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.Allocate | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeHddMetric | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.AverageFreeMemoryMetric | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CostMetric | ||
10 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.CreateHostInstance | ||
11 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.GuidanceObjective | ||
12 | import hu.bme.mit.inf.dslreasoner.domains.cps.queries.RequirementNotSatisfied | ||
13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.optimization.CompositeDirectionalThresholdObjective | ||
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.optimization.ObjectiveKind | ||
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.optimization.ObjectiveThreshold | ||
16 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.optimization.QueryBasedObjective | ||
17 | import org.eclipse.viatra.dse.api.DesignSpaceExplorer | ||
18 | import org.eclipse.viatra.dse.evolutionary.EvolutionaryStrategyBuilder | ||
19 | import org.eclipse.viatra.transformation.runtime.emf.rules.batch.BatchTransformationRuleFactory | ||
20 | |||
21 | class RuleBasedCpsSolver { | ||
22 | extension val BatchTransformationRuleFactory = new BatchTransformationRuleFactory | ||
23 | extension val CpsFactory = CpsFactory.eINSTANCE | ||
24 | |||
25 | def solve(CyberPhysicalSystem problem) { | ||
26 | // for (request : problem.requests) { | ||
27 | // for (req : request.requirements) { | ||
28 | // for (i : 0 ..< req.count) { | ||
29 | // val app = createApplicationInstance | ||
30 | // req.type.instances += app | ||
31 | // req.instances += app | ||
32 | // } | ||
33 | // } | ||
34 | // } | ||
35 | val dse = new DesignSpaceExplorer | ||
36 | dse.addMetaModelPackage(CpsPackage.eINSTANCE) | ||
37 | dse.initialModel = problem.eResource.resourceSet | ||
38 | dse.addTransformationRule(createRule.precondition(RequirementNotSatisfied.instance).action [ | ||
39 | val app = createApplicationInstance | ||
40 | req.type.instances += app | ||
41 | req.instances += app | ||
42 | ].build) | ||
43 | dse.addTransformationRule(createRule.precondition(Allocate.instance).action [ | ||
44 | app.allocatedTo = host | ||
45 | ].build) | ||
46 | // dse.addTransformationRule(createRule(UnallocateAppInstance.instance).action [ | ||
47 | // app.allocatedTo = null | ||
48 | // ].build) | ||
49 | dse.addTransformationRule(createRule.precondition(CreateHostInstance.instance).action [ | ||
50 | hostType.instances += createHostInstance | ||
51 | ].build) | ||
52 | // dse.addTransformationRule(createRule(RemoveHostInstance.instance).action [ | ||
53 | // hostInstance.type.instances -= hostInstance | ||
54 | // ].build) | ||
55 | dse.addObjective( | ||
56 | new CompositeDirectionalThresholdObjective("Composite", | ||
57 | new QueryBasedObjective(GuidanceObjective.instance, ObjectiveKind.LOWER_IS_BETTER, | ||
58 | new ObjectiveThreshold.Inclusive(0), 0), | ||
59 | new QueryBasedObjective(AverageFreeMemoryMetric.instance, ObjectiveKind.LOWER_IS_BETTER, | ||
60 | new ObjectiveThreshold.Inclusive(0.75), 0), | ||
61 | new QueryBasedObjective(AverageFreeHddMetric.instance, ObjectiveKind.LOWER_IS_BETTER, | ||
62 | new ObjectiveThreshold.Inclusive(0.75), 0))) | ||
63 | dse.addObjective( | ||
64 | new QueryBasedObjective(CostMetric.instance, ObjectiveKind.LOWER_IS_BETTER, | ||
65 | ObjectiveThreshold.NO_THRESHOLD, 0)) | ||
66 | dse.maxNumberOfThreads = 1 | ||
67 | dse.stateCoderFactory = new CpsStateCoder.Factory | ||
68 | val strategy = EvolutionaryStrategyBuilder.createNsga2Strategy(25) | ||
69 | dse.startExplorationWithTimeout(strategy, 2 * 60 * 1000) | ||
70 | for (solution : dse.solutions) { | ||
71 | println("Found solution: " + solution.stateCode + " " + solution.arbitraryTrajectory.fitness) | ||
72 | } | ||
73 | } | ||
74 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend new file mode 100644 index 00000000..e8d29949 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend | |||
@@ -0,0 +1,117 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.generator | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsFactory | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType | ||
6 | import java.util.Collection | ||
7 | import java.util.Random | ||
8 | import org.eclipse.emf.common.util.URI | ||
9 | import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl | ||
10 | |||
11 | class CpsGenerator { | ||
12 | extension val CpsFactory = CpsFactory.eINSTANCE | ||
13 | |||
14 | static val MIN_MEMORY = 1 | ||
15 | static val MAX_MEMORY = 6 | ||
16 | static val MIN_HDD = 1 | ||
17 | static val MAX_HDD = 30 | ||
18 | static val HIGH_CPU_FRACTION = 4 | ||
19 | static val MIN_REPLICAS = 1 | ||
20 | static val MAX_REPLICAS = 4 | ||
21 | |||
22 | val Random random | ||
23 | val int applicationTypeCount | ||
24 | val int demandFactor | ||
25 | val boolean populateAppInstances | ||
26 | |||
27 | new(long randomSeed, int applicationTypeCount, int demandFactor) { | ||
28 | this(randomSeed, applicationTypeCount, demandFactor, false) | ||
29 | } | ||
30 | |||
31 | new(long randomSeed, int applicationTypeCount, int demandFactor, boolean populateAppInstances) { | ||
32 | this.random = new Random(randomSeed) | ||
33 | this.applicationTypeCount = applicationTypeCount | ||
34 | this.demandFactor = demandFactor | ||
35 | this.populateAppInstances = populateAppInstances | ||
36 | } | ||
37 | |||
38 | def generateCpsProblem() { | ||
39 | val resourceSet = new ResourceSetImpl | ||
40 | val resource = resourceSet.createResource(URI.createFileURI("dummy.dummyext")) | ||
41 | createCyberPhysicalSystem => [ | ||
42 | val cps = it | ||
43 | resource.contents += cps | ||
44 | createLowCpuHostTypes | ||
45 | val highCpuHostTypes = createHighCpuHostTypes | ||
46 | for (var int i = 0; i < applicationTypeCount; i++) { | ||
47 | if (i % HIGH_CPU_FRACTION == 0) { | ||
48 | createRandomApplicationType(highCpuHostTypes) | ||
49 | } else { | ||
50 | createRandomApplicationType(hostTypes) | ||
51 | } | ||
52 | } | ||
53 | for (var int i = 0; i < demandFactor; i++) { | ||
54 | requests += createRequest => [ | ||
55 | for (appType : cps.applicationTypes) { | ||
56 | requirements += createRequirement => [ | ||
57 | count = nextInt(CpsGenerator.MIN_REPLICAS, CpsGenerator.MAX_REPLICAS) | ||
58 | type = appType | ||
59 | if (populateAppInstances) { | ||
60 | for (j : 0 ..< count) { | ||
61 | val app = createApplicationInstance | ||
62 | app.type = appType | ||
63 | appType.instances += app | ||
64 | instances += app | ||
65 | } | ||
66 | } | ||
67 | ] | ||
68 | } | ||
69 | ] | ||
70 | } | ||
71 | ] | ||
72 | } | ||
73 | |||
74 | private def void createRandomApplicationType(CyberPhysicalSystem it, Collection<HostType> allowedHostTypes) { | ||
75 | val appType = createApplicationType | ||
76 | val memory = nextInt(MIN_MEMORY, MAX_MEMORY) | ||
77 | val hdd = nextInt(MIN_HDD, MAX_HDD) | ||
78 | for (hostType : allowedHostTypes) { | ||
79 | appType.requirements += createResourceRequirement => [ | ||
80 | it.hostType = hostType | ||
81 | requiredMemory = memory | ||
82 | requiredHdd = hdd | ||
83 | ] | ||
84 | } | ||
85 | applicationTypes += appType | ||
86 | } | ||
87 | |||
88 | private def createLowCpuHostTypes(CyberPhysicalSystem it) { | ||
89 | #[ | ||
90 | createHostType(2, 8, 75), // m5d.large | ||
91 | createHostType(4, 16, 150), // m5d.xlarge | ||
92 | createHostType(3, 16, 75), // r5d.large | ||
93 | createHostType(6, 32, 150) // r5d.xlarge | ||
94 | ] | ||
95 | } | ||
96 | |||
97 | private def createHighCpuHostTypes(CyberPhysicalSystem it) { | ||
98 | #[ | ||
99 | createHostType(2, 4, 50), // c5d.large | ||
100 | createHostType(4, 8, 100) // c5d.xlarge | ||
101 | ] | ||
102 | } | ||
103 | |||
104 | private def createHostType(CyberPhysicalSystem it, int cost, int memory, int hdd) { | ||
105 | val hostType = createHostType => [ | ||
106 | it.cost = cost | ||
107 | defaultMemory = memory | ||
108 | defaultHdd = hdd | ||
109 | ] | ||
110 | hostTypes += hostType | ||
111 | hostType | ||
112 | } | ||
113 | |||
114 | private def nextInt(int lower, int upper) { | ||
115 | lower + random.nextInt(upper - lower + 1) | ||
116 | } | ||
117 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/CpsMdeOptimiserMain.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/CpsMdeOptimiserMain.xtend new file mode 100644 index 00000000..4a4b7a87 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/CpsMdeOptimiserMain.xtend | |||
@@ -0,0 +1,57 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.cps.generator.CpsGenerator | ||
5 | import java.io.BufferedReader | ||
6 | import java.io.BufferedWriter | ||
7 | import java.io.FileReader | ||
8 | import java.io.FileWriter | ||
9 | import java.util.Map | ||
10 | import org.eclipse.emf.common.util.URI | ||
11 | import org.eclipse.emf.ecore.EPackage | ||
12 | import org.eclipse.emf.ecore.resource.Resource | ||
13 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | ||
14 | import uk.ac.kcl.inf.mdeoptimiser.interfaces.cli.Run | ||
15 | |||
16 | class CpsMdeOptimiserMain { | ||
17 | static val PROJECT_PATH = "." | ||
18 | static val PROBLEM_PATH = "model/problem.xmi" | ||
19 | static val MOPT_PATH = "src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/cps.mopt" | ||
20 | |||
21 | private new() { | ||
22 | new IllegalStateException("This is a static utility class and should not be instantiated directly.") | ||
23 | } | ||
24 | |||
25 | public static def void main(String[] args) { | ||
26 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, | ||
27 | new XMIResourceFactoryImpl) | ||
28 | EPackage.Registry.INSTANCE.put(CpsPackage.eNS_URI, CpsPackage.eINSTANCE) | ||
29 | val generator = new CpsGenerator(1, 4, 1) | ||
30 | val problem = generator.generateCpsProblem | ||
31 | problem.eResource.URI = URI.createFileURI(PROBLEM_PATH) | ||
32 | problem.eResource.save(emptyMap) | ||
33 | fixupHenshinModel("model/cps.henshin", "model/cps_fixup.henshin", #{"cps.ecore" -> CpsPackage.eNS_URI}) | ||
34 | Run.main(#["-p", PROJECT_PATH, "-m", MOPT_PATH]) | ||
35 | } | ||
36 | |||
37 | private def static void fixupHenshinModel(String originalPath, String outputPath, Map<String, String> remapMap) { | ||
38 | val reader = new BufferedReader(new FileReader(originalPath)) | ||
39 | try { | ||
40 | val writer = new BufferedWriter(new FileWriter(outputPath)) | ||
41 | try { | ||
42 | var String line | ||
43 | while ((line = reader.readLine) !== null) { | ||
44 | for (entry : remapMap.entrySet) { | ||
45 | line = line.replace(entry.key, entry.value) | ||
46 | } | ||
47 | writer.write(line) | ||
48 | writer.write("\n") | ||
49 | } | ||
50 | } finally { | ||
51 | writer.close | ||
52 | } | ||
53 | } finally { | ||
54 | reader.close | ||
55 | } | ||
56 | } | ||
57 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/NonRedundantAllocationsConstraint.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/NonRedundantAllocationsConstraint.xtend new file mode 100644 index 00000000..1a9286b3 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/NonRedundantAllocationsConstraint.xtend | |||
@@ -0,0 +1,29 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
4 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction | ||
5 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution | ||
6 | import com.google.common.collect.HashMultiset | ||
7 | |||
8 | class NonRedundantAllocationsConstraint implements IGuidanceFunction { | ||
9 | override getName() { | ||
10 | "NonRedundantAllocations" | ||
11 | } | ||
12 | |||
13 | override computeFitness(Solution solution) { | ||
14 | val cps = solution.model as CyberPhysicalSystem | ||
15 | var int cost = 0 | ||
16 | for (hostType : cps.hostTypes) { | ||
17 | for (host : hostType.instances) { | ||
18 | val bins = HashMultiset.create | ||
19 | for (app : host.applications) { | ||
20 | bins.add(app.requirement) | ||
21 | } | ||
22 | for (entry : bins.entrySet) { | ||
23 | cost += entry.count - 1 | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | cost | ||
28 | } | ||
29 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/NotAllocatedAppInstancesConstraint.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/NotAllocatedAppInstancesConstraint.xtend new file mode 100644 index 00000000..663aa26c --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/NotAllocatedAppInstancesConstraint.xtend | |||
@@ -0,0 +1,24 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
4 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction | ||
5 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution | ||
6 | |||
7 | class NotAllocatedAppInstancesConstraint implements IGuidanceFunction { | ||
8 | override getName() { | ||
9 | "NotAllocatedAppInstances" | ||
10 | } | ||
11 | |||
12 | override computeFitness(Solution solution) { | ||
13 | val cps = solution.model as CyberPhysicalSystem | ||
14 | var int cost = 0 | ||
15 | for (appType : cps.applicationTypes) { | ||
16 | for (app : appType.instances) { | ||
17 | if (app.allocatedTo === null || !appType.requirements.exists[hostType == app.allocatedTo.type]) { | ||
18 | cost++ | ||
19 | } | ||
20 | } | ||
21 | } | ||
22 | cost | ||
23 | } | ||
24 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/NotSatisfiedRequirementsConstraint.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/NotSatisfiedRequirementsConstraint.xtend new file mode 100644 index 00000000..e44381ec --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/NotSatisfiedRequirementsConstraint.xtend | |||
@@ -0,0 +1,27 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
4 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction | ||
5 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution | ||
6 | |||
7 | class NotSatisfiedRequirementsConstraint implements IGuidanceFunction { | ||
8 | override getName() { | ||
9 | "NotSatisfiedRequirements" | ||
10 | } | ||
11 | |||
12 | override computeFitness(Solution solution) { | ||
13 | val cps = solution.model as CyberPhysicalSystem | ||
14 | var int cost = 0 | ||
15 | for (request : cps.requests) { | ||
16 | for (requirement : request.requirements) { | ||
17 | cost += Math.abs(requirement.count - requirement.instances.size) | ||
18 | for (app : requirement.instances) { | ||
19 | if (app.type != requirement.type) { | ||
20 | cost++ | ||
21 | } | ||
22 | } | ||
23 | } | ||
24 | } | ||
25 | cost | ||
26 | } | ||
27 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/ResourceUtilizationUtil.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/ResourceUtilizationUtil.xtend new file mode 100644 index 00000000..fc1d666f --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/ResourceUtilizationUtil.xtend | |||
@@ -0,0 +1,31 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance | ||
4 | |||
5 | class ResourceUtilizationUtil { | ||
6 | private new() { | ||
7 | new IllegalStateException("This is a static utility class and should not be instantiated directly.") | ||
8 | } | ||
9 | |||
10 | static def getMemoryUtilization(HostInstance host) { | ||
11 | var int utilization = 0 | ||
12 | for (app : host.applications) { | ||
13 | val req = app.type.requirements.findFirst[hostType == host.type] | ||
14 | if (req !== null) { | ||
15 | utilization += req.requiredMemory | ||
16 | } | ||
17 | } | ||
18 | utilization | ||
19 | } | ||
20 | |||
21 | static def getHddUtilization(HostInstance host) { | ||
22 | var int utilization = 0 | ||
23 | for (app : host.applications) { | ||
24 | val req = app.type.requirements.findFirst[hostType == host.type] | ||
25 | if (req !== null) { | ||
26 | utilization += req.requiredHdd | ||
27 | } | ||
28 | } | ||
29 | utilization | ||
30 | } | ||
31 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageHddConstraint.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageHddConstraint.xtend new file mode 100644 index 00000000..85cc8115 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageHddConstraint.xtend | |||
@@ -0,0 +1,33 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
4 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction | ||
5 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution | ||
6 | |||
7 | class TooLowAverageHddConstraint implements IGuidanceFunction { | ||
8 | static val THRESHOLD = 0.25 | ||
9 | |||
10 | override getName() { | ||
11 | "TooLowAverageHdd" | ||
12 | } | ||
13 | |||
14 | override computeFitness(Solution solution) { | ||
15 | val cps = solution.model as CyberPhysicalSystem | ||
16 | var double sumUtilization | ||
17 | var int numHosts | ||
18 | for (hostType : cps.hostTypes) { | ||
19 | numHosts += hostType.instances.size | ||
20 | for (host : hostType.instances) { | ||
21 | val utilization = ResourceUtilizationUtil.getHddUtilization(host) | ||
22 | sumUtilization += (utilization as double) / hostType.defaultHdd | ||
23 | } | ||
24 | } | ||
25 | val averageUtilization = sumUtilization / numHosts | ||
26 | val difference = THRESHOLD - averageUtilization | ||
27 | if (difference > 0) { | ||
28 | difference | ||
29 | } else { | ||
30 | 0 | ||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageMemoryConstraint.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageMemoryConstraint.xtend new file mode 100644 index 00000000..e9b47d4c --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageMemoryConstraint.xtend | |||
@@ -0,0 +1,33 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
4 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction | ||
5 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution | ||
6 | |||
7 | class TooLowAverageMemoryConstraint implements IGuidanceFunction { | ||
8 | static val THRESHOLD = 0.25 | ||
9 | |||
10 | override getName() { | ||
11 | "TooLowAverageMemory" | ||
12 | } | ||
13 | |||
14 | override computeFitness(Solution solution) { | ||
15 | val cps = solution.model as CyberPhysicalSystem | ||
16 | var double sumUtilization | ||
17 | var int numHosts | ||
18 | for (hostType : cps.hostTypes) { | ||
19 | numHosts += hostType.instances.size | ||
20 | for (host : hostType.instances) { | ||
21 | val utilization = ResourceUtilizationUtil.getMemoryUtilization(host) | ||
22 | sumUtilization += (utilization as double) / hostType.defaultMemory | ||
23 | } | ||
24 | } | ||
25 | val averageUtilization = sumUtilization / numHosts | ||
26 | val difference = THRESHOLD - averageUtilization | ||
27 | if (difference > 0) { | ||
28 | difference | ||
29 | } else { | ||
30 | 0 | ||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TotalCostFitnessFunction.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TotalCostFitnessFunction.xtend new file mode 100644 index 00000000..af65e442 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TotalCostFitnessFunction.xtend | |||
@@ -0,0 +1,23 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
4 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction | ||
5 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution | ||
6 | |||
7 | class TotalCostFitnessFunction implements IGuidanceFunction { | ||
8 | override getName() { | ||
9 | "TotalCost" | ||
10 | } | ||
11 | |||
12 | override computeFitness(Solution solution) { | ||
13 | val cps = solution.model as CyberPhysicalSystem | ||
14 | var int cost = 0 | ||
15 | for (appType : cps.applicationTypes) { | ||
16 | cost += 5 * appType.instances.size | ||
17 | } | ||
18 | for (hostType : cps.hostTypes) { | ||
19 | cost += hostType.cost * hostType.instances.size | ||
20 | } | ||
21 | cost | ||
22 | } | ||
23 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/UnavailableHddConstraint.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/UnavailableHddConstraint.xtend new file mode 100644 index 00000000..08450f45 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/UnavailableHddConstraint.xtend | |||
@@ -0,0 +1,27 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
4 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction | ||
5 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution | ||
6 | |||
7 | class UnavailableHddConstraint implements IGuidanceFunction { | ||
8 | override getName() { | ||
9 | "UnavailableHdd" | ||
10 | } | ||
11 | |||
12 | override computeFitness(Solution solution) { | ||
13 | val cps = solution.model as CyberPhysicalSystem | ||
14 | var int cost = 0 | ||
15 | for (hostType : cps.hostTypes) { | ||
16 | for (host : hostType.instances) { | ||
17 | val utilization = ResourceUtilizationUtil.getHddUtilization(host) | ||
18 | val difference = utilization - hostType.defaultHdd | ||
19 | if (difference > 0) { | ||
20 | cost += difference | ||
21 | } | ||
22 | } | ||
23 | } | ||
24 | cost | ||
25 | } | ||
26 | |||
27 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/UnavailableMemoryConstraint.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/UnavailableMemoryConstraint.xtend new file mode 100644 index 00000000..e46d59a6 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/UnavailableMemoryConstraint.xtend | |||
@@ -0,0 +1,27 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | ||
4 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction | ||
5 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution | ||
6 | |||
7 | class UnavailableMemoryConstraint implements IGuidanceFunction { | ||
8 | override getName() { | ||
9 | "UnavailableMemory" | ||
10 | } | ||
11 | |||
12 | override computeFitness(Solution solution) { | ||
13 | val cps = solution.model as CyberPhysicalSystem | ||
14 | var int cost = 0 | ||
15 | for (hostType : cps.hostTypes) { | ||
16 | for (host : hostType.instances) { | ||
17 | val utilization = ResourceUtilizationUtil.getMemoryUtilization(host) | ||
18 | val difference = utilization - hostType.defaultMemory | ||
19 | if (difference > 0) { | ||
20 | cost += difference | ||
21 | } | ||
22 | } | ||
23 | } | ||
24 | cost | ||
25 | } | ||
26 | |||
27 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/cps.mopt b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/cps.mopt new file mode 100644 index 00000000..67fe7508 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/cps.mopt | |||
@@ -0,0 +1,43 @@ | |||
1 | problem { | ||
2 | basepath <model> | ||
3 | metamodel <hu.bme.mit.inf.dslreasoner.domains.cps.CpsPackage> | ||
4 | model <problem.xmi> | ||
5 | } | ||
6 | |||
7 | goal { | ||
8 | objective TotalCost minimise java { "hu.bme.mit.inf.dslreasoner.domains.cps.mdeo.TotalCostFitnessFunction" } | ||
9 | constraint NotSatisfiedRequriements java { "hu.bme.mit.inf.dslreasoner.domains.cps.mdeo.NotSatisfiedRequirementsConstraint" } | ||
10 | constraint NotAllocatedAppInstances java { "hu.bme.mit.inf.dslreasoner.domains.cps.mdeo.NotAllocatedAppInstancesConstraint" } | ||
11 | constraint NonRedundantAllocations java { "hu.bme.mit.inf.dslreasoner.domains.cps.mdeo.NonRedundantAllocationsConstraint" } | ||
12 | constraint UnavailableMemory java { "hu.bme.mit.inf.dslreasoner.domains.cps.mdeo.UnavailableMemoryConstraint" } | ||
13 | constraint UnavailableHdd java { "hu.bme.mit.inf.dslreasoner.domains.cps.mdeo.UnavailableHddConstraint" } | ||
14 | constraint TooLowAverageMemory java { "hu.bme.mit.inf.dslreasoner.domains.cps.mdeo.TooLowAverageMemoryConstraint" } | ||
15 | constraint TooLowAverageHdd java { "hu.bme.mit.inf.dslreasoner.domains.cps.mdeo.TooLowAverageHddConstraint" } | ||
16 | } | ||
17 | |||
18 | search { | ||
19 | // mutate using <cps_fixup.henshin> unit "createAppInstance" | ||
20 | // mutate using <cps_fixup.henshin> unit "deleteAppInstance" | ||
21 | // mutate using <cps_fixup.henshin> unit "createHostInstance" | ||
22 | // mutate using <cps_fixup.henshin> unit "deleteHostInstance" | ||
23 | // mutate using <cps_fixup.henshin> unit "allocate" | ||
24 | // mutate using <cps_fixup.henshin> unit "unallocate" | ||
25 | // mutate using <cps_fixup.henshin> unit "reallocate" | ||
26 | mutate { "ApplicationInstance" } | ||
27 | mutate { "HostInstance" } | ||
28 | } | ||
29 | |||
30 | solver { | ||
31 | optimisation provider moea algorithm NSGAII { | ||
32 | variation: mutation | ||
33 | population: 25 | ||
34 | mutation.step: 3 | ||
35 | mutation.strategy: random | ||
36 | } | ||
37 | |||
38 | termination { | ||
39 | time: 120 | ||
40 | } | ||
41 | |||
42 | batches 1 | ||
43 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql new file mode 100644 index 00000000..aa78dc38 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql | |||
@@ -0,0 +1,198 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.queries | ||
2 | |||
3 | import "http://www.eclipse.org/emf/2002/Ecore" | ||
4 | import "http://www.example.org/cps" | ||
5 | |||
6 | private pattern cpsApplications(Cps : CyberPhysicalSystem, AppInstance : ApplicationInstance) { | ||
7 | CyberPhysicalSystem.applicationTypes.instances(Cps, AppInstance); | ||
8 | } | ||
9 | |||
10 | private pattern cpsHosts(Cps : CyberPhysicalSystem, HostInstance : HostInstance) { | ||
11 | CyberPhysicalSystem.hostTypes.instances(Cps, HostInstance); | ||
12 | } | ||
13 | |||
14 | private pattern totalMemory(Host : HostInstance, Memory : EInt) { | ||
15 | HostInstance.type.defaultMemory(Host, Memory); | ||
16 | } | ||
17 | |||
18 | private pattern totalHdd(Host : HostInstance, Hdd : EInt) { | ||
19 | HostInstance.type.defaultHdd(Host, Hdd); | ||
20 | } | ||
21 | |||
22 | private pattern availableMemory(Host : HostInstance, Memory : java Integer) { | ||
23 | find totalMemory(Host, TotalMemory); | ||
24 | RequiredMemory == sum find memoryRequirement(Host, _, #_); | ||
25 | Memory == eval(TotalMemory - RequiredMemory); | ||
26 | } | ||
27 | |||
28 | private pattern memoryRequirement(Host : HostInstance, App : ApplicationInstance, Memory : EInt) { | ||
29 | find resourceRequirement(Host, App, Req); | ||
30 | ResourceRequirement.requiredMemory(Req, Memory); | ||
31 | } | ||
32 | |||
33 | private pattern availableHdd(Host : HostInstance, Hdd : java Integer) { | ||
34 | find totalHdd(Host, TotalHdd); | ||
35 | RequiredHdd == sum find hddRequirement(Host, _, #_); | ||
36 | Hdd == eval(TotalHdd - RequiredHdd); | ||
37 | } | ||
38 | |||
39 | private pattern hddRequirement(Host : HostInstance, App : ApplicationInstance, Hdd : EInt) { | ||
40 | find resourceRequirement(Host, App, Req); | ||
41 | ResourceRequirement.requiredHdd(Req, Hdd); | ||
42 | } | ||
43 | |||
44 | pattern resourceRequirement(Host : HostInstance, App : ApplicationInstance, Req : ResourceRequirement) { | ||
45 | ApplicationInstance.allocatedTo(App, Host); | ||
46 | ApplicationInstance.type.requirements(App, Req); | ||
47 | HostInstance.type(Host, HostType); | ||
48 | ResourceRequirement.hostType(Req, HostType); | ||
49 | } | ||
50 | |||
51 | @Constraint(severity = "error", key = {Host, App}, | ||
52 | message = "Application instance must be allocated to a supported host type.") | ||
53 | pattern allocationWithoutResourceRequirement(Host : HostInstance, App : ApplicationInstance) { | ||
54 | ApplicationInstance.allocatedTo(App, Host); | ||
55 | neg find resourceRequirement(Host, App, _); | ||
56 | } | ||
57 | |||
58 | @Constraint(severity = "error", key = {Host}, | ||
59 | message = "Insufficient memory available on host.") | ||
60 | pattern notEnoughAvailableMemory(Host : HostInstance) { | ||
61 | find availableMemory(Host, Memory); | ||
62 | check(Memory < 0); | ||
63 | } | ||
64 | |||
65 | @Constraint(severity = "error", key = {Host}, | ||
66 | message = "Insufficient HDD available on host.") | ||
67 | pattern notEnoughAvailableHdd(Host : HostInstance) { | ||
68 | find availableHdd(Host, Hdd); | ||
69 | check(Hdd < 0); | ||
70 | } | ||
71 | |||
72 | @Constraint(severity = "error", key = {Req, App}, | ||
73 | message = "Requirement must be satisfied by the required application type.") | ||
74 | pattern instanceDoesNotSatisfyRequirement(Req : Requirement, App : ApplicationInstance) { | ||
75 | Requirement.instances(Req, App); | ||
76 | neg find satisfyingInstance(Req, App); | ||
77 | } | ||
78 | |||
79 | private pattern satisfyingInstance(Req : Requirement, App : ApplicationInstance) { | ||
80 | Requirement.instances(Req, App); | ||
81 | Requirement.type(Req, Type); | ||
82 | ApplicationInstance.type(App, Type); | ||
83 | } | ||
84 | |||
85 | @Constraint(severity = "error", key = {Req}, | ||
86 | message = "Requirement is not satisfied by enough application instances.") | ||
87 | pattern requirementNotSatisfied(Req : Requirement) { | ||
88 | Instances == count find satisfyingInstance(Req, _); | ||
89 | Requirement.count(Req, RequiredCount); | ||
90 | check(Instances < RequiredCount); | ||
91 | } | ||
92 | |||
93 | @Constraint(severity = "error", key = {Req}, | ||
94 | message = "Redundant instances must not be allocated to the same host.") | ||
95 | pattern redundantInstancesOnSameHost(Req : Requirement) { | ||
96 | Requirement.instances(Req, App1); | ||
97 | Requirement.instances(Req, App2); | ||
98 | App1 != App2; | ||
99 | ApplicationInstance.allocatedTo(App1, Host); | ||
100 | ApplicationInstance.allocatedTo(App2, Host); | ||
101 | } | ||
102 | |||
103 | // | ||
104 | // Metrics | ||
105 | // | ||
106 | |||
107 | // Free memory | ||
108 | |||
109 | pattern averageFreeMemoryMetric(Average : java Double) { | ||
110 | Average == avg find freeMemoryPercentage(_, #_); | ||
111 | } | ||
112 | |||
113 | private pattern freeMemoryPercentage(Host : HostInstance, Free : java Double) { | ||
114 | find totalMemory(Host, Total); | ||
115 | find availableMemory(Host, Available); | ||
116 | Free == eval((Available as double) / Total); | ||
117 | } | ||
118 | |||
119 | // Free HDD | ||
120 | |||
121 | pattern averageFreeHddMetric(Average : java Double) { | ||
122 | Average == avg find freeHddPercentage(_, #_); | ||
123 | } | ||
124 | |||
125 | private pattern freeHddPercentage(Host : HostInstance, Free : java Double) { | ||
126 | find totalHdd(Host, Total); | ||
127 | find availableHdd(Host, Available); | ||
128 | Free == eval((Available as double) / Total); | ||
129 | } | ||
130 | |||
131 | // Total cost | ||
132 | |||
133 | pattern costMetric(Cost : java Integer) { | ||
134 | Cost == sum find cpsCost(_, #_); | ||
135 | } | ||
136 | |||
137 | pattern cpsCost(Cps : CyberPhysicalSystem, Cost : java Integer) { | ||
138 | AppCount == count find cpsApplications(Cps, _); | ||
139 | HostCost == sum find hostInstanceCost(Cps, _, #_); | ||
140 | Cost == eval(5 * AppCount + HostCost); | ||
141 | } | ||
142 | |||
143 | private pattern hostInstanceCost(Cps : CyberPhysicalSystem, Host : HostInstance, Cost : EInt) { | ||
144 | find cpsHosts(Cps, Host); | ||
145 | HostInstance.type.cost(Host, Cost); | ||
146 | } | ||
147 | |||
148 | // | ||
149 | // Transformation rule preconditions for rule-based DSE | ||
150 | // | ||
151 | |||
152 | pattern allocate(App : ApplicationInstance, Host : HostInstance) { | ||
153 | ApplicationInstance.type.requirements(App, Req); | ||
154 | ResourceRequirement.hostType.instances(Req, Host); | ||
155 | find unallocatedAppInstance(App); | ||
156 | find availableMemory(Host, AvailableMem); | ||
157 | find availableHdd(Host, AvailableHdd); | ||
158 | ResourceRequirement.requiredMemory(Req, RequiredMem); | ||
159 | ResourceRequirement.requiredHdd(Req, RequiredHdd); | ||
160 | check(AvailableMem >= RequiredMem); | ||
161 | check(AvailableHdd >= RequiredHdd); | ||
162 | neg ApplicationInstance.requirement.instances.allocatedTo(App, Host); | ||
163 | } | ||
164 | |||
165 | pattern unallocateAppInstance(App : ApplicationInstance) { | ||
166 | ApplicationInstance.allocatedTo(App, _); | ||
167 | } | ||
168 | |||
169 | pattern createHostInstance(HostType : HostType) { | ||
170 | find unallocatedAppInstance(App); | ||
171 | ApplicationInstance.type.requirements.hostType(App, HostType); | ||
172 | } | ||
173 | |||
174 | pattern removeHostInstance(HostInstance : HostInstance) { | ||
175 | neg HostInstance.applications(HostInstance, _); | ||
176 | } | ||
177 | |||
178 | private pattern unallocatedAppInstance(App : ApplicationInstance) { | ||
179 | neg ApplicationInstance.allocatedTo(App, _); | ||
180 | } | ||
181 | |||
182 | private pattern requiredAppInstances(Req : Requirement, Remaining : java Integer) { | ||
183 | Instances == count find satisfyingInstance(Req, _); | ||
184 | Requirement.count(Req, RequiredCount); | ||
185 | Remaining == eval(RequiredCount - Instances); | ||
186 | } | ||
187 | |||
188 | private pattern noHostToAllocateTo(App : ApplicationInstance) { | ||
189 | find unallocatedAppInstance(App); | ||
190 | neg find allocate(App, _); | ||
191 | } | ||
192 | |||
193 | pattern guidanceObjective(Value : java Integer) { | ||
194 | UnallocatedInstances == count find unallocatedAppInstance(_); | ||
195 | RequiredInstances == sum find requiredAppInstances(_, #_); | ||
196 | NoHostToAllocate == count find noHostToAllocateTo(_); | ||
197 | Value == eval(2 * UnallocatedInstances + 4 * RequiredInstances + NoHostToAllocate); | ||
198 | } | ||