diff options
author | Kristóf Marussy <marussy@mit.bme.hu> | 2020-06-25 19:55:10 +0200 |
---|---|---|
committer | Kristóf Marussy <marussy@mit.bme.hu> | 2020-06-25 19:55:10 +0200 |
commit | c3a6d4b9cf3657070d180aa65ddbf0459e880329 (patch) | |
tree | 780c4fc61578dcb309af53fb0c164c7627e51676 /Domains/hu.bme.mit.inf.dslreasoner.domains.cps | |
parent | New configuration language parser WIP (diff) | |
parent | Scope unsat benchmarks (diff) | |
download | VIATRA-Generator-c3a6d4b9cf3657070d180aa65ddbf0459e880329.tar.gz VIATRA-Generator-c3a6d4b9cf3657070d180aa65ddbf0459e880329.tar.zst VIATRA-Generator-c3a6d4b9cf3657070d180aa65ddbf0459e880329.zip |
Merge branch 'kris'
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.cps')
78 files changed, 21478 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..275a988a --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,30 @@ | |||
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 | Import-Package: org.apache.log4j | ||
28 | Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.domains.cps | ||
29 | Bundle-ActivationPolicy: lazy | ||
30 | 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..1fc70124 --- /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,873 @@ | |||
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 | switch(parameterName) { | ||
109 | case "App": return this.fApp; | ||
110 | case "Host": return this.fHost; | ||
111 | default: return null; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public Object get(final int index) { | ||
117 | switch(index) { | ||
118 | case 0: return this.fApp; | ||
119 | case 1: return this.fHost; | ||
120 | default: return null; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | public ApplicationInstance getApp() { | ||
125 | return this.fApp; | ||
126 | } | ||
127 | |||
128 | public HostInstance getHost() { | ||
129 | return this.fHost; | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public boolean set(final String parameterName, final Object newValue) { | ||
134 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
135 | if ("App".equals(parameterName) ) { | ||
136 | this.fApp = (ApplicationInstance) newValue; | ||
137 | return true; | ||
138 | } | ||
139 | if ("Host".equals(parameterName) ) { | ||
140 | this.fHost = (HostInstance) newValue; | ||
141 | return true; | ||
142 | } | ||
143 | return false; | ||
144 | } | ||
145 | |||
146 | public void setApp(final ApplicationInstance pApp) { | ||
147 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
148 | this.fApp = pApp; | ||
149 | } | ||
150 | |||
151 | public void setHost(final HostInstance pHost) { | ||
152 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
153 | this.fHost = pHost; | ||
154 | } | ||
155 | |||
156 | @Override | ||
157 | public String patternName() { | ||
158 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocate"; | ||
159 | } | ||
160 | |||
161 | @Override | ||
162 | public List<String> parameterNames() { | ||
163 | return Allocate.Match.parameterNames; | ||
164 | } | ||
165 | |||
166 | @Override | ||
167 | public Object[] toArray() { | ||
168 | return new Object[]{fApp, fHost}; | ||
169 | } | ||
170 | |||
171 | @Override | ||
172 | public Allocate.Match toImmutable() { | ||
173 | return isMutable() ? newMatch(fApp, fHost) : this; | ||
174 | } | ||
175 | |||
176 | @Override | ||
177 | public String prettyPrint() { | ||
178 | StringBuilder result = new StringBuilder(); | ||
179 | result.append("\"App\"=" + prettyPrintValue(fApp) + ", "); | ||
180 | result.append("\"Host\"=" + prettyPrintValue(fHost)); | ||
181 | return result.toString(); | ||
182 | } | ||
183 | |||
184 | @Override | ||
185 | public int hashCode() { | ||
186 | return Objects.hash(fApp, fHost); | ||
187 | } | ||
188 | |||
189 | @Override | ||
190 | public boolean equals(final Object obj) { | ||
191 | if (this == obj) | ||
192 | return true; | ||
193 | if (obj == null) { | ||
194 | return false; | ||
195 | } | ||
196 | if ((obj instanceof Allocate.Match)) { | ||
197 | Allocate.Match other = (Allocate.Match) obj; | ||
198 | return Objects.equals(fApp, other.fApp) && Objects.equals(fHost, other.fHost); | ||
199 | } else { | ||
200 | // this should be infrequent | ||
201 | if (!(obj instanceof IPatternMatch)) { | ||
202 | return false; | ||
203 | } | ||
204 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
205 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | @Override | ||
210 | public Allocate specification() { | ||
211 | return Allocate.instance(); | ||
212 | } | ||
213 | |||
214 | /** | ||
215 | * Returns an empty, mutable match. | ||
216 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
217 | * | ||
218 | * @return the empty match. | ||
219 | * | ||
220 | */ | ||
221 | public static Allocate.Match newEmptyMatch() { | ||
222 | return new Mutable(null, null); | ||
223 | } | ||
224 | |||
225 | /** | ||
226 | * Returns a mutable (partial) match. | ||
227 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
228 | * | ||
229 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
230 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
231 | * @return the new, mutable (partial) match object. | ||
232 | * | ||
233 | */ | ||
234 | public static Allocate.Match newMutableMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
235 | return new Mutable(pApp, pHost); | ||
236 | } | ||
237 | |||
238 | /** | ||
239 | * Returns a new (partial) match. | ||
240 | * This can be used e.g. to call the matcher with a partial match. | ||
241 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
242 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
243 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
244 | * @return the (partial) match object. | ||
245 | * | ||
246 | */ | ||
247 | public static Allocate.Match newMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
248 | return new Immutable(pApp, pHost); | ||
249 | } | ||
250 | |||
251 | private static final class Mutable extends Allocate.Match { | ||
252 | Mutable(final ApplicationInstance pApp, final HostInstance pHost) { | ||
253 | super(pApp, pHost); | ||
254 | } | ||
255 | |||
256 | @Override | ||
257 | public boolean isMutable() { | ||
258 | return true; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | private static final class Immutable extends Allocate.Match { | ||
263 | Immutable(final ApplicationInstance pApp, final HostInstance pHost) { | ||
264 | super(pApp, pHost); | ||
265 | } | ||
266 | |||
267 | @Override | ||
268 | public boolean isMutable() { | ||
269 | return false; | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | |||
274 | /** | ||
275 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocate pattern, | ||
276 | * providing pattern-specific query methods. | ||
277 | * | ||
278 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
279 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
280 | * | ||
281 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
282 | * | ||
283 | * <p>Original source: | ||
284 | * <code><pre> | ||
285 | * // | ||
286 | * // Transformation rule preconditions for rule-based DSE | ||
287 | * // | ||
288 | * | ||
289 | * pattern allocate(App : ApplicationInstance, Host : HostInstance) { | ||
290 | * ApplicationInstance.type.requirements(App, Req); | ||
291 | * ResourceRequirement.hostType.instances(Req, Host); | ||
292 | * find unallocatedAppInstance(App); | ||
293 | * find availableMemory(Host, AvailableMem); | ||
294 | * find availableHdd(Host, AvailableHdd); | ||
295 | * ResourceRequirement.requiredMemory(Req, RequiredMem); | ||
296 | * ResourceRequirement.requiredHdd(Req, RequiredHdd); | ||
297 | * check(AvailableMem {@literal >}= RequiredMem); | ||
298 | * check(AvailableHdd {@literal >}= RequiredHdd); | ||
299 | * neg ApplicationInstance.requirement.instances.allocatedTo(App, Host); | ||
300 | * } | ||
301 | * </pre></code> | ||
302 | * | ||
303 | * @see Match | ||
304 | * @see Allocate | ||
305 | * | ||
306 | */ | ||
307 | public static class Matcher extends BaseMatcher<Allocate.Match> { | ||
308 | /** | ||
309 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
310 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
311 | * | ||
312 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
313 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
314 | * | ||
315 | */ | ||
316 | public static Allocate.Matcher on(final ViatraQueryEngine engine) { | ||
317 | // check if matcher already exists | ||
318 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
319 | if (matcher == null) { | ||
320 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
321 | } | ||
322 | return matcher; | ||
323 | } | ||
324 | |||
325 | /** | ||
326 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
327 | * @return an initialized matcher | ||
328 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
329 | * | ||
330 | */ | ||
331 | public static Allocate.Matcher create() { | ||
332 | return new Matcher(); | ||
333 | } | ||
334 | |||
335 | private static final int POSITION_APP = 0; | ||
336 | |||
337 | private static final int POSITION_HOST = 1; | ||
338 | |||
339 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Allocate.Matcher.class); | ||
340 | |||
341 | /** | ||
342 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
343 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
344 | * | ||
345 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
346 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
347 | * | ||
348 | */ | ||
349 | private Matcher() { | ||
350 | super(querySpecification()); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
355 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
356 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
357 | * @return matches represented as a Match object. | ||
358 | * | ||
359 | */ | ||
360 | public Collection<Allocate.Match> getAllMatches(final ApplicationInstance pApp, final HostInstance pHost) { | ||
361 | return rawStreamAllMatches(new Object[]{pApp, pHost}).collect(Collectors.toSet()); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
366 | * </p> | ||
367 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
368 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
369 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
370 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
371 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
372 | * @return a stream of matches represented as a Match object. | ||
373 | * | ||
374 | */ | ||
375 | public Stream<Allocate.Match> streamAllMatches(final ApplicationInstance pApp, final HostInstance pHost) { | ||
376 | return rawStreamAllMatches(new Object[]{pApp, pHost}); | ||
377 | } | ||
378 | |||
379 | /** | ||
380 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
381 | * Neither determinism nor randomness of selection is guaranteed. | ||
382 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
383 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
384 | * @return a match represented as a Match object, or null if no match is found. | ||
385 | * | ||
386 | */ | ||
387 | public Optional<Allocate.Match> getOneArbitraryMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
388 | return rawGetOneArbitraryMatch(new Object[]{pApp, pHost}); | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
393 | * under any possible substitution of the unspecified parameters (if any). | ||
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 true if the input is a valid (partial) match of the pattern. | ||
397 | * | ||
398 | */ | ||
399 | public boolean hasMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
400 | return rawHasMatch(new Object[]{pApp, pHost}); | ||
401 | } | ||
402 | |||
403 | /** | ||
404 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
405 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
406 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
407 | * @return the number of pattern matches found. | ||
408 | * | ||
409 | */ | ||
410 | public int countMatches(final ApplicationInstance pApp, final HostInstance pHost) { | ||
411 | return rawCountMatches(new Object[]{pApp, pHost}); | ||
412 | } | ||
413 | |||
414 | /** | ||
415 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
416 | * Neither determinism nor randomness of selection is guaranteed. | ||
417 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
418 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
419 | * @param processor the action that will process the selected match. | ||
420 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
421 | * | ||
422 | */ | ||
423 | public boolean forOneArbitraryMatch(final ApplicationInstance pApp, final HostInstance pHost, final Consumer<? super Allocate.Match> processor) { | ||
424 | return rawForOneArbitraryMatch(new Object[]{pApp, pHost}, processor); | ||
425 | } | ||
426 | |||
427 | /** | ||
428 | * Returns a new (partial) match. | ||
429 | * This can be used e.g. to call the matcher with a partial match. | ||
430 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
431 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
432 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
433 | * @return the (partial) match object. | ||
434 | * | ||
435 | */ | ||
436 | public Allocate.Match newMatch(final ApplicationInstance pApp, final HostInstance pHost) { | ||
437 | return Allocate.Match.newMatch(pApp, pHost); | ||
438 | } | ||
439 | |||
440 | /** | ||
441 | * Retrieve the set of values that occur in matches for App. | ||
442 | * @return the Set of all values or empty set if there are no matches | ||
443 | * | ||
444 | */ | ||
445 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
446 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
447 | } | ||
448 | |||
449 | /** | ||
450 | * Retrieve the set of values that occur in matches for App. | ||
451 | * @return the Set of all values or empty set if there are no matches | ||
452 | * | ||
453 | */ | ||
454 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
455 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
456 | } | ||
457 | |||
458 | /** | ||
459 | * Retrieve the set of values that occur in matches for App. | ||
460 | * @return the Set of all values or empty set if there are no matches | ||
461 | * | ||
462 | */ | ||
463 | public Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
464 | return rawStreamAllValuesOfApp(emptyArray()); | ||
465 | } | ||
466 | |||
467 | /** | ||
468 | * Retrieve the set of values that occur in matches for App. | ||
469 | * </p> | ||
470 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
471 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
472 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
473 | * | ||
474 | * @return the Stream of all values or empty set if there are no matches | ||
475 | * | ||
476 | */ | ||
477 | public Stream<ApplicationInstance> streamAllValuesOfApp(final Allocate.Match partialMatch) { | ||
478 | return rawStreamAllValuesOfApp(partialMatch.toArray()); | ||
479 | } | ||
480 | |||
481 | /** | ||
482 | * Retrieve the set of values that occur in matches for App. | ||
483 | * </p> | ||
484 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
485 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
486 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
487 | * | ||
488 | * @return the Stream of all values or empty set if there are no matches | ||
489 | * | ||
490 | */ | ||
491 | public Stream<ApplicationInstance> streamAllValuesOfApp(final HostInstance pHost) { | ||
492 | return rawStreamAllValuesOfApp(new Object[]{null, pHost}); | ||
493 | } | ||
494 | |||
495 | /** | ||
496 | * Retrieve the set of values that occur in matches for App. | ||
497 | * @return the Set of all values or empty set if there are no matches | ||
498 | * | ||
499 | */ | ||
500 | public Set<ApplicationInstance> getAllValuesOfApp(final Allocate.Match partialMatch) { | ||
501 | return rawStreamAllValuesOfApp(partialMatch.toArray()).collect(Collectors.toSet()); | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * Retrieve the set of values that occur in matches for App. | ||
506 | * @return the Set of all values or empty set if there are no matches | ||
507 | * | ||
508 | */ | ||
509 | public Set<ApplicationInstance> getAllValuesOfApp(final HostInstance pHost) { | ||
510 | return rawStreamAllValuesOfApp(new Object[]{null, pHost}).collect(Collectors.toSet()); | ||
511 | } | ||
512 | |||
513 | /** | ||
514 | * Retrieve the set of values that occur in matches for Host. | ||
515 | * @return the Set of all values or empty set if there are no matches | ||
516 | * | ||
517 | */ | ||
518 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
519 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
520 | } | ||
521 | |||
522 | /** | ||
523 | * Retrieve the set of values that occur in matches for Host. | ||
524 | * @return the Set of all values or empty set if there are no matches | ||
525 | * | ||
526 | */ | ||
527 | public Set<HostInstance> getAllValuesOfHost() { | ||
528 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
529 | } | ||
530 | |||
531 | /** | ||
532 | * Retrieve the set of values that occur in matches for Host. | ||
533 | * @return the Set of all values or empty set if there are no matches | ||
534 | * | ||
535 | */ | ||
536 | public Stream<HostInstance> streamAllValuesOfHost() { | ||
537 | return rawStreamAllValuesOfHost(emptyArray()); | ||
538 | } | ||
539 | |||
540 | /** | ||
541 | * Retrieve the set of values that occur in matches for Host. | ||
542 | * </p> | ||
543 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
544 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
545 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
546 | * | ||
547 | * @return the Stream of all values or empty set if there are no matches | ||
548 | * | ||
549 | */ | ||
550 | public Stream<HostInstance> streamAllValuesOfHost(final Allocate.Match partialMatch) { | ||
551 | return rawStreamAllValuesOfHost(partialMatch.toArray()); | ||
552 | } | ||
553 | |||
554 | /** | ||
555 | * Retrieve the set of values that occur in matches for Host. | ||
556 | * </p> | ||
557 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
558 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
559 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
560 | * | ||
561 | * @return the Stream of all values or empty set if there are no matches | ||
562 | * | ||
563 | */ | ||
564 | public Stream<HostInstance> streamAllValuesOfHost(final ApplicationInstance pApp) { | ||
565 | return rawStreamAllValuesOfHost(new Object[]{pApp, null}); | ||
566 | } | ||
567 | |||
568 | /** | ||
569 | * Retrieve the set of values that occur in matches for Host. | ||
570 | * @return the Set of all values or empty set if there are no matches | ||
571 | * | ||
572 | */ | ||
573 | public Set<HostInstance> getAllValuesOfHost(final Allocate.Match partialMatch) { | ||
574 | return rawStreamAllValuesOfHost(partialMatch.toArray()).collect(Collectors.toSet()); | ||
575 | } | ||
576 | |||
577 | /** | ||
578 | * Retrieve the set of values that occur in matches for Host. | ||
579 | * @return the Set of all values or empty set if there are no matches | ||
580 | * | ||
581 | */ | ||
582 | public Set<HostInstance> getAllValuesOfHost(final ApplicationInstance pApp) { | ||
583 | return rawStreamAllValuesOfHost(new Object[]{pApp, null}).collect(Collectors.toSet()); | ||
584 | } | ||
585 | |||
586 | @Override | ||
587 | protected Allocate.Match tupleToMatch(final Tuple t) { | ||
588 | try { | ||
589 | return Allocate.Match.newMatch((ApplicationInstance) t.get(POSITION_APP), (HostInstance) t.get(POSITION_HOST)); | ||
590 | } catch(ClassCastException e) { | ||
591 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
592 | return null; | ||
593 | } | ||
594 | } | ||
595 | |||
596 | @Override | ||
597 | protected Allocate.Match arrayToMatch(final Object[] match) { | ||
598 | try { | ||
599 | return Allocate.Match.newMatch((ApplicationInstance) match[POSITION_APP], (HostInstance) match[POSITION_HOST]); | ||
600 | } catch(ClassCastException e) { | ||
601 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
602 | return null; | ||
603 | } | ||
604 | } | ||
605 | |||
606 | @Override | ||
607 | protected Allocate.Match arrayToMatchMutable(final Object[] match) { | ||
608 | try { | ||
609 | return Allocate.Match.newMutableMatch((ApplicationInstance) match[POSITION_APP], (HostInstance) match[POSITION_HOST]); | ||
610 | } catch(ClassCastException e) { | ||
611 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
612 | return null; | ||
613 | } | ||
614 | } | ||
615 | |||
616 | /** | ||
617 | * @return the singleton instance of the query specification of this pattern | ||
618 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
619 | * | ||
620 | */ | ||
621 | public static IQuerySpecification<Allocate.Matcher> querySpecification() { | ||
622 | return Allocate.instance(); | ||
623 | } | ||
624 | } | ||
625 | |||
626 | private Allocate() { | ||
627 | super(GeneratedPQuery.INSTANCE); | ||
628 | } | ||
629 | |||
630 | /** | ||
631 | * @return the singleton instance of the query specification | ||
632 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
633 | * | ||
634 | */ | ||
635 | public static Allocate instance() { | ||
636 | try{ | ||
637 | return LazyHolder.INSTANCE; | ||
638 | } catch (ExceptionInInitializerError err) { | ||
639 | throw processInitializerError(err); | ||
640 | } | ||
641 | } | ||
642 | |||
643 | @Override | ||
644 | protected Allocate.Matcher instantiate(final ViatraQueryEngine engine) { | ||
645 | return Allocate.Matcher.on(engine); | ||
646 | } | ||
647 | |||
648 | @Override | ||
649 | public Allocate.Matcher instantiate() { | ||
650 | return Allocate.Matcher.create(); | ||
651 | } | ||
652 | |||
653 | @Override | ||
654 | public Allocate.Match newEmptyMatch() { | ||
655 | return Allocate.Match.newEmptyMatch(); | ||
656 | } | ||
657 | |||
658 | @Override | ||
659 | public Allocate.Match newMatch(final Object... parameters) { | ||
660 | return Allocate.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[1]); | ||
661 | } | ||
662 | |||
663 | /** | ||
664 | * Inner class allowing the singleton instance of {@link Allocate} to be created | ||
665 | * <b>not</b> at the class load time of the outer class, | ||
666 | * but rather at the first call to {@link Allocate#instance()}. | ||
667 | * | ||
668 | * <p> This workaround is required e.g. to support recursion. | ||
669 | * | ||
670 | */ | ||
671 | private static class LazyHolder { | ||
672 | private static final Allocate INSTANCE = new Allocate(); | ||
673 | |||
674 | /** | ||
675 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
676 | * This initialization order is required to support indirect recursion. | ||
677 | * | ||
678 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
679 | * | ||
680 | */ | ||
681 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
682 | |||
683 | public static Object ensureInitialized() { | ||
684 | INSTANCE.ensureInitializedInternal(); | ||
685 | return null; | ||
686 | } | ||
687 | } | ||
688 | |||
689 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
690 | private static final Allocate.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
691 | |||
692 | 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); | ||
693 | |||
694 | 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); | ||
695 | |||
696 | private final List<PParameter> parameters = Arrays.asList(parameter_App, parameter_Host); | ||
697 | |||
698 | private class Embedded_1_ApplicationInstance_requirement_instances_allocatedTo extends BaseGeneratedEMFPQuery { | ||
699 | 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); | ||
700 | |||
701 | 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); | ||
702 | |||
703 | private final List<PParameter> embeddedParameters = Arrays.asList(parameter_p0, parameter_p1); | ||
704 | |||
705 | public Embedded_1_ApplicationInstance_requirement_instances_allocatedTo() { | ||
706 | super(PVisibility.EMBEDDED); | ||
707 | } | ||
708 | |||
709 | @Override | ||
710 | public String getFullyQualifiedName() { | ||
711 | return GeneratedPQuery.this.getFullyQualifiedName() + "$Embedded_1_ApplicationInstance_requirement_instances_allocatedTo"; | ||
712 | } | ||
713 | |||
714 | @Override | ||
715 | public List<PParameter> getParameters() { | ||
716 | return embeddedParameters; | ||
717 | } | ||
718 | |||
719 | @Override | ||
720 | public Set<PBody> doGetContainedBodies() { | ||
721 | PBody body = new PBody(this); | ||
722 | PVariable var_p0 = body.getOrCreateVariableByName("p0"); | ||
723 | PVariable var_p1 = body.getOrCreateVariableByName("p1"); | ||
724 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
725 | new ExportedParameter(body, var_p0, parameter_p0), | ||
726 | new ExportedParameter(body, var_p1, parameter_p1) | ||
727 | )); | ||
728 | // ApplicationInstance.requirement.instances.allocatedTo(App, Host) | ||
729 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
730 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
731 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "requirement"))); | ||
732 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
733 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
734 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "instances"))); | ||
735 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
736 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
737 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
738 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
739 | new Equality(body, var__virtual_2_, var_p1); | ||
740 | return Collections.singleton(body); | ||
741 | } | ||
742 | } | ||
743 | |||
744 | private GeneratedPQuery() { | ||
745 | super(PVisibility.PUBLIC); | ||
746 | } | ||
747 | |||
748 | @Override | ||
749 | public String getFullyQualifiedName() { | ||
750 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocate"; | ||
751 | } | ||
752 | |||
753 | @Override | ||
754 | public List<String> getParameterNames() { | ||
755 | return Arrays.asList("App","Host"); | ||
756 | } | ||
757 | |||
758 | @Override | ||
759 | public List<PParameter> getParameters() { | ||
760 | return parameters; | ||
761 | } | ||
762 | |||
763 | @Override | ||
764 | public Set<PBody> doGetContainedBodies() { | ||
765 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
766 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
767 | { | ||
768 | PBody body = new PBody(this); | ||
769 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
770 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
771 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
772 | PVariable var_AvailableMem = body.getOrCreateVariableByName("AvailableMem"); | ||
773 | PVariable var_AvailableHdd = body.getOrCreateVariableByName("AvailableHdd"); | ||
774 | PVariable var_RequiredMem = body.getOrCreateVariableByName("RequiredMem"); | ||
775 | PVariable var_RequiredHdd = body.getOrCreateVariableByName("RequiredHdd"); | ||
776 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
777 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
778 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
779 | new ExportedParameter(body, var_App, parameter_App), | ||
780 | new ExportedParameter(body, var_Host, parameter_Host) | ||
781 | )); | ||
782 | // ApplicationInstance.type.requirements(App, Req) | ||
783 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
784 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
785 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "type"))); | ||
786 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationType"))); | ||
787 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
788 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationType", "requirements"))); | ||
789 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
790 | new Equality(body, var__virtual_1_, var_Req); | ||
791 | // ResourceRequirement.hostType.instances(Req, Host) | ||
792 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
793 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
794 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "hostType"))); | ||
795 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
796 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
797 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostType", "instances"))); | ||
798 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
799 | new Equality(body, var__virtual_3_, var_Host); | ||
800 | // find unallocatedAppInstance(App) | ||
801 | new PositivePatternCall(body, Tuples.flatTupleOf(var_App), UnallocatedAppInstance.instance().getInternalQueryRepresentation()); | ||
802 | // find availableMemory(Host, AvailableMem) | ||
803 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_AvailableMem), AvailableMemory.instance().getInternalQueryRepresentation()); | ||
804 | // find availableHdd(Host, AvailableHdd) | ||
805 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_AvailableHdd), AvailableHdd.instance().getInternalQueryRepresentation()); | ||
806 | // ResourceRequirement.requiredMemory(Req, RequiredMem) | ||
807 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
808 | PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); | ||
809 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "requiredMemory"))); | ||
810 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
811 | new Equality(body, var__virtual_4_, var_RequiredMem); | ||
812 | // ResourceRequirement.requiredHdd(Req, RequiredHdd) | ||
813 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
814 | PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); | ||
815 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "requiredHdd"))); | ||
816 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
817 | new Equality(body, var__virtual_5_, var_RequiredHdd); | ||
818 | // check(AvailableMem >= RequiredMem) | ||
819 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
820 | |||
821 | @Override | ||
822 | public String getShortDescription() { | ||
823 | return "Expression evaluation from pattern allocate"; | ||
824 | } | ||
825 | |||
826 | @Override | ||
827 | public Iterable<String> getInputParameterNames() { | ||
828 | return Arrays.asList("AvailableMem", "RequiredMem");} | ||
829 | |||
830 | @Override | ||
831 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
832 | Integer AvailableMem = (Integer) provider.getValue("AvailableMem"); | ||
833 | Integer RequiredMem = (Integer) provider.getValue("RequiredMem"); | ||
834 | return evaluateExpression_1_1(AvailableMem, RequiredMem); | ||
835 | } | ||
836 | }, null); | ||
837 | // check(AvailableHdd >= RequiredHdd) | ||
838 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
839 | |||
840 | @Override | ||
841 | public String getShortDescription() { | ||
842 | return "Expression evaluation from pattern allocate"; | ||
843 | } | ||
844 | |||
845 | @Override | ||
846 | public Iterable<String> getInputParameterNames() { | ||
847 | return Arrays.asList("AvailableHdd", "RequiredHdd");} | ||
848 | |||
849 | @Override | ||
850 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
851 | Integer AvailableHdd = (Integer) provider.getValue("AvailableHdd"); | ||
852 | Integer RequiredHdd = (Integer) provider.getValue("RequiredHdd"); | ||
853 | return evaluateExpression_1_2(AvailableHdd, RequiredHdd); | ||
854 | } | ||
855 | }, null); | ||
856 | // neg ApplicationInstance.requirement.instances.allocatedTo(App, Host) | ||
857 | new NegativePatternCall(body, Tuples.flatTupleOf(var_App, var_Host), new Allocate.GeneratedPQuery.Embedded_1_ApplicationInstance_requirement_instances_allocatedTo()); | ||
858 | bodies.add(body); | ||
859 | } | ||
860 | return bodies; | ||
861 | } | ||
862 | } | ||
863 | |||
864 | private static boolean evaluateExpression_1_1(final Integer AvailableMem, final Integer RequiredMem) { | ||
865 | boolean _greaterEqualsThan = (AvailableMem.compareTo(RequiredMem) >= 0); | ||
866 | return _greaterEqualsThan; | ||
867 | } | ||
868 | |||
869 | private static boolean evaluateExpression_1_2(final Integer AvailableHdd, final Integer RequiredHdd) { | ||
870 | boolean _greaterEqualsThan = (AvailableHdd.compareTo(RequiredHdd) >= 0); | ||
871 | return _greaterEqualsThan; | ||
872 | } | ||
873 | } | ||
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..b49fee74 --- /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,728 @@ | |||
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 | switch(parameterName) { | ||
92 | case "Host": return this.fHost; | ||
93 | case "App": return this.fApp; | ||
94 | default: return null; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public Object get(final int index) { | ||
100 | switch(index) { | ||
101 | case 0: return this.fHost; | ||
102 | case 1: return this.fApp; | ||
103 | default: return null; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | public HostInstance getHost() { | ||
108 | return this.fHost; | ||
109 | } | ||
110 | |||
111 | public ApplicationInstance getApp() { | ||
112 | return this.fApp; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public boolean set(final String parameterName, final Object newValue) { | ||
117 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
118 | if ("Host".equals(parameterName) ) { | ||
119 | this.fHost = (HostInstance) newValue; | ||
120 | return true; | ||
121 | } | ||
122 | if ("App".equals(parameterName) ) { | ||
123 | this.fApp = (ApplicationInstance) newValue; | ||
124 | return true; | ||
125 | } | ||
126 | return false; | ||
127 | } | ||
128 | |||
129 | public void setHost(final HostInstance pHost) { | ||
130 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
131 | this.fHost = pHost; | ||
132 | } | ||
133 | |||
134 | public void setApp(final ApplicationInstance pApp) { | ||
135 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
136 | this.fApp = pApp; | ||
137 | } | ||
138 | |||
139 | @Override | ||
140 | public String patternName() { | ||
141 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocationWithoutResourceRequirement"; | ||
142 | } | ||
143 | |||
144 | @Override | ||
145 | public List<String> parameterNames() { | ||
146 | return AllocationWithoutResourceRequirement.Match.parameterNames; | ||
147 | } | ||
148 | |||
149 | @Override | ||
150 | public Object[] toArray() { | ||
151 | return new Object[]{fHost, fApp}; | ||
152 | } | ||
153 | |||
154 | @Override | ||
155 | public AllocationWithoutResourceRequirement.Match toImmutable() { | ||
156 | return isMutable() ? newMatch(fHost, fApp) : this; | ||
157 | } | ||
158 | |||
159 | @Override | ||
160 | public String prettyPrint() { | ||
161 | StringBuilder result = new StringBuilder(); | ||
162 | result.append("\"Host\"=" + prettyPrintValue(fHost) + ", "); | ||
163 | result.append("\"App\"=" + prettyPrintValue(fApp)); | ||
164 | return result.toString(); | ||
165 | } | ||
166 | |||
167 | @Override | ||
168 | public int hashCode() { | ||
169 | return Objects.hash(fHost, fApp); | ||
170 | } | ||
171 | |||
172 | @Override | ||
173 | public boolean equals(final Object obj) { | ||
174 | if (this == obj) | ||
175 | return true; | ||
176 | if (obj == null) { | ||
177 | return false; | ||
178 | } | ||
179 | if ((obj instanceof AllocationWithoutResourceRequirement.Match)) { | ||
180 | AllocationWithoutResourceRequirement.Match other = (AllocationWithoutResourceRequirement.Match) obj; | ||
181 | return Objects.equals(fHost, other.fHost) && Objects.equals(fApp, other.fApp); | ||
182 | } else { | ||
183 | // this should be infrequent | ||
184 | if (!(obj instanceof IPatternMatch)) { | ||
185 | return false; | ||
186 | } | ||
187 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
188 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
189 | } | ||
190 | } | ||
191 | |||
192 | @Override | ||
193 | public AllocationWithoutResourceRequirement specification() { | ||
194 | return AllocationWithoutResourceRequirement.instance(); | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * Returns an empty, mutable match. | ||
199 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
200 | * | ||
201 | * @return the empty match. | ||
202 | * | ||
203 | */ | ||
204 | public static AllocationWithoutResourceRequirement.Match newEmptyMatch() { | ||
205 | return new Mutable(null, null); | ||
206 | } | ||
207 | |||
208 | /** | ||
209 | * Returns a mutable (partial) match. | ||
210 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
211 | * | ||
212 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
213 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
214 | * @return the new, mutable (partial) match object. | ||
215 | * | ||
216 | */ | ||
217 | public static AllocationWithoutResourceRequirement.Match newMutableMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
218 | return new Mutable(pHost, pApp); | ||
219 | } | ||
220 | |||
221 | /** | ||
222 | * Returns a new (partial) match. | ||
223 | * This can be used e.g. to call the matcher with a partial match. | ||
224 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
225 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
226 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
227 | * @return the (partial) match object. | ||
228 | * | ||
229 | */ | ||
230 | public static AllocationWithoutResourceRequirement.Match newMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
231 | return new Immutable(pHost, pApp); | ||
232 | } | ||
233 | |||
234 | private static final class Mutable extends AllocationWithoutResourceRequirement.Match { | ||
235 | Mutable(final HostInstance pHost, final ApplicationInstance pApp) { | ||
236 | super(pHost, pApp); | ||
237 | } | ||
238 | |||
239 | @Override | ||
240 | public boolean isMutable() { | ||
241 | return true; | ||
242 | } | ||
243 | } | ||
244 | |||
245 | private static final class Immutable extends AllocationWithoutResourceRequirement.Match { | ||
246 | Immutable(final HostInstance pHost, final ApplicationInstance pApp) { | ||
247 | super(pHost, pApp); | ||
248 | } | ||
249 | |||
250 | @Override | ||
251 | public boolean isMutable() { | ||
252 | return false; | ||
253 | } | ||
254 | } | ||
255 | } | ||
256 | |||
257 | /** | ||
258 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocationWithoutResourceRequirement pattern, | ||
259 | * providing pattern-specific query methods. | ||
260 | * | ||
261 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
262 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
263 | * | ||
264 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
265 | * | ||
266 | * <p>Original source: | ||
267 | * <code><pre> | ||
268 | * {@literal @}Constraint(severity = "error", key = {Host, App}, | ||
269 | * message = "Application instance must be allocated to a supported host type.") | ||
270 | * pattern allocationWithoutResourceRequirement(Host : HostInstance, App : ApplicationInstance) { | ||
271 | * ApplicationInstance.allocatedTo(App, Host); | ||
272 | * neg find resourceRequirement(Host, App, _); | ||
273 | * } | ||
274 | * </pre></code> | ||
275 | * | ||
276 | * @see Match | ||
277 | * @see AllocationWithoutResourceRequirement | ||
278 | * | ||
279 | */ | ||
280 | public static class Matcher extends BaseMatcher<AllocationWithoutResourceRequirement.Match> { | ||
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 | public static AllocationWithoutResourceRequirement.Matcher on(final ViatraQueryEngine engine) { | ||
290 | // check if matcher already exists | ||
291 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
292 | if (matcher == null) { | ||
293 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
294 | } | ||
295 | return matcher; | ||
296 | } | ||
297 | |||
298 | /** | ||
299 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
300 | * @return an initialized matcher | ||
301 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
302 | * | ||
303 | */ | ||
304 | public static AllocationWithoutResourceRequirement.Matcher create() { | ||
305 | return new Matcher(); | ||
306 | } | ||
307 | |||
308 | private static final int POSITION_HOST = 0; | ||
309 | |||
310 | private static final int POSITION_APP = 1; | ||
311 | |||
312 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AllocationWithoutResourceRequirement.Matcher.class); | ||
313 | |||
314 | /** | ||
315 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
316 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
317 | * | ||
318 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
319 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
320 | * | ||
321 | */ | ||
322 | private Matcher() { | ||
323 | super(querySpecification()); | ||
324 | } | ||
325 | |||
326 | /** | ||
327 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
328 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
329 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
330 | * @return matches represented as a Match object. | ||
331 | * | ||
332 | */ | ||
333 | public Collection<AllocationWithoutResourceRequirement.Match> getAllMatches(final HostInstance pHost, final ApplicationInstance pApp) { | ||
334 | return rawStreamAllMatches(new Object[]{pHost, pApp}).collect(Collectors.toSet()); | ||
335 | } | ||
336 | |||
337 | /** | ||
338 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
339 | * </p> | ||
340 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
341 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
342 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
343 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
344 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
345 | * @return a stream of matches represented as a Match object. | ||
346 | * | ||
347 | */ | ||
348 | public Stream<AllocationWithoutResourceRequirement.Match> streamAllMatches(final HostInstance pHost, final ApplicationInstance pApp) { | ||
349 | return rawStreamAllMatches(new Object[]{pHost, pApp}); | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
354 | * Neither determinism nor randomness of selection is guaranteed. | ||
355 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
356 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
357 | * @return a match represented as a Match object, or null if no match is found. | ||
358 | * | ||
359 | */ | ||
360 | public Optional<AllocationWithoutResourceRequirement.Match> getOneArbitraryMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
361 | return rawGetOneArbitraryMatch(new Object[]{pHost, pApp}); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
366 | * under any possible substitution of the unspecified parameters (if any). | ||
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 true if the input is a valid (partial) match of the pattern. | ||
370 | * | ||
371 | */ | ||
372 | public boolean hasMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
373 | return rawHasMatch(new Object[]{pHost, pApp}); | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
378 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
379 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
380 | * @return the number of pattern matches found. | ||
381 | * | ||
382 | */ | ||
383 | public int countMatches(final HostInstance pHost, final ApplicationInstance pApp) { | ||
384 | return rawCountMatches(new Object[]{pHost, pApp}); | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
389 | * Neither determinism nor randomness of selection is guaranteed. | ||
390 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
391 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
392 | * @param processor the action that will process the selected match. | ||
393 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
394 | * | ||
395 | */ | ||
396 | public boolean forOneArbitraryMatch(final HostInstance pHost, final ApplicationInstance pApp, final Consumer<? super AllocationWithoutResourceRequirement.Match> processor) { | ||
397 | return rawForOneArbitraryMatch(new Object[]{pHost, pApp}, processor); | ||
398 | } | ||
399 | |||
400 | /** | ||
401 | * Returns a new (partial) match. | ||
402 | * This can be used e.g. to call the matcher with a partial match. | ||
403 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
404 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
405 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
406 | * @return the (partial) match object. | ||
407 | * | ||
408 | */ | ||
409 | public AllocationWithoutResourceRequirement.Match newMatch(final HostInstance pHost, final ApplicationInstance pApp) { | ||
410 | return AllocationWithoutResourceRequirement.Match.newMatch(pHost, pApp); | ||
411 | } | ||
412 | |||
413 | /** | ||
414 | * Retrieve the set of values that occur in matches for Host. | ||
415 | * @return the Set of all values or empty set if there are no matches | ||
416 | * | ||
417 | */ | ||
418 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
419 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
420 | } | ||
421 | |||
422 | /** | ||
423 | * Retrieve the set of values that occur in matches for Host. | ||
424 | * @return the Set of all values or empty set if there are no matches | ||
425 | * | ||
426 | */ | ||
427 | public Set<HostInstance> getAllValuesOfHost() { | ||
428 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
429 | } | ||
430 | |||
431 | /** | ||
432 | * Retrieve the set of values that occur in matches for Host. | ||
433 | * @return the Set of all values or empty set if there are no matches | ||
434 | * | ||
435 | */ | ||
436 | public Stream<HostInstance> streamAllValuesOfHost() { | ||
437 | return rawStreamAllValuesOfHost(emptyArray()); | ||
438 | } | ||
439 | |||
440 | /** | ||
441 | * Retrieve the set of values that occur in matches for Host. | ||
442 | * </p> | ||
443 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
444 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
445 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
446 | * | ||
447 | * @return the Stream of all values or empty set if there are no matches | ||
448 | * | ||
449 | */ | ||
450 | public Stream<HostInstance> streamAllValuesOfHost(final AllocationWithoutResourceRequirement.Match partialMatch) { | ||
451 | return rawStreamAllValuesOfHost(partialMatch.toArray()); | ||
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 ApplicationInstance pApp) { | ||
465 | return rawStreamAllValuesOfHost(new Object[]{null, pApp}); | ||
466 | } | ||
467 | |||
468 | /** | ||
469 | * Retrieve the set of values that occur in matches for Host. | ||
470 | * @return the Set of all values or empty set if there are no matches | ||
471 | * | ||
472 | */ | ||
473 | public Set<HostInstance> getAllValuesOfHost(final AllocationWithoutResourceRequirement.Match partialMatch) { | ||
474 | return rawStreamAllValuesOfHost(partialMatch.toArray()).collect(Collectors.toSet()); | ||
475 | } | ||
476 | |||
477 | /** | ||
478 | * Retrieve the set of values that occur in matches for Host. | ||
479 | * @return the Set of all values or empty set if there are no matches | ||
480 | * | ||
481 | */ | ||
482 | public Set<HostInstance> getAllValuesOfHost(final ApplicationInstance pApp) { | ||
483 | return rawStreamAllValuesOfHost(new Object[]{null, pApp}).collect(Collectors.toSet()); | ||
484 | } | ||
485 | |||
486 | /** | ||
487 | * Retrieve the set of values that occur in matches for App. | ||
488 | * @return the Set of all values or empty set if there are no matches | ||
489 | * | ||
490 | */ | ||
491 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
492 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
493 | } | ||
494 | |||
495 | /** | ||
496 | * Retrieve the set of values that occur in matches for App. | ||
497 | * @return the Set of all values or empty set if there are no matches | ||
498 | * | ||
499 | */ | ||
500 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
501 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * Retrieve the set of values that occur in matches for App. | ||
506 | * @return the Set of all values or empty set if there are no matches | ||
507 | * | ||
508 | */ | ||
509 | public Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
510 | return rawStreamAllValuesOfApp(emptyArray()); | ||
511 | } | ||
512 | |||
513 | /** | ||
514 | * Retrieve the set of values that occur in matches for App. | ||
515 | * </p> | ||
516 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
517 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
518 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
519 | * | ||
520 | * @return the Stream of all values or empty set if there are no matches | ||
521 | * | ||
522 | */ | ||
523 | public Stream<ApplicationInstance> streamAllValuesOfApp(final AllocationWithoutResourceRequirement.Match partialMatch) { | ||
524 | return rawStreamAllValuesOfApp(partialMatch.toArray()); | ||
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 HostInstance pHost) { | ||
538 | return rawStreamAllValuesOfApp(new Object[]{pHost, null}); | ||
539 | } | ||
540 | |||
541 | /** | ||
542 | * Retrieve the set of values that occur in matches for App. | ||
543 | * @return the Set of all values or empty set if there are no matches | ||
544 | * | ||
545 | */ | ||
546 | public Set<ApplicationInstance> getAllValuesOfApp(final AllocationWithoutResourceRequirement.Match partialMatch) { | ||
547 | return rawStreamAllValuesOfApp(partialMatch.toArray()).collect(Collectors.toSet()); | ||
548 | } | ||
549 | |||
550 | /** | ||
551 | * Retrieve the set of values that occur in matches for App. | ||
552 | * @return the Set of all values or empty set if there are no matches | ||
553 | * | ||
554 | */ | ||
555 | public Set<ApplicationInstance> getAllValuesOfApp(final HostInstance pHost) { | ||
556 | return rawStreamAllValuesOfApp(new Object[]{pHost, null}).collect(Collectors.toSet()); | ||
557 | } | ||
558 | |||
559 | @Override | ||
560 | protected AllocationWithoutResourceRequirement.Match tupleToMatch(final Tuple t) { | ||
561 | try { | ||
562 | return AllocationWithoutResourceRequirement.Match.newMatch((HostInstance) t.get(POSITION_HOST), (ApplicationInstance) t.get(POSITION_APP)); | ||
563 | } catch(ClassCastException e) { | ||
564 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
565 | return null; | ||
566 | } | ||
567 | } | ||
568 | |||
569 | @Override | ||
570 | protected AllocationWithoutResourceRequirement.Match arrayToMatch(final Object[] match) { | ||
571 | try { | ||
572 | return AllocationWithoutResourceRequirement.Match.newMatch((HostInstance) match[POSITION_HOST], (ApplicationInstance) match[POSITION_APP]); | ||
573 | } catch(ClassCastException e) { | ||
574 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
575 | return null; | ||
576 | } | ||
577 | } | ||
578 | |||
579 | @Override | ||
580 | protected AllocationWithoutResourceRequirement.Match arrayToMatchMutable(final Object[] match) { | ||
581 | try { | ||
582 | return AllocationWithoutResourceRequirement.Match.newMutableMatch((HostInstance) match[POSITION_HOST], (ApplicationInstance) match[POSITION_APP]); | ||
583 | } catch(ClassCastException e) { | ||
584 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
585 | return null; | ||
586 | } | ||
587 | } | ||
588 | |||
589 | /** | ||
590 | * @return the singleton instance of the query specification of this pattern | ||
591 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
592 | * | ||
593 | */ | ||
594 | public static IQuerySpecification<AllocationWithoutResourceRequirement.Matcher> querySpecification() { | ||
595 | return AllocationWithoutResourceRequirement.instance(); | ||
596 | } | ||
597 | } | ||
598 | |||
599 | private AllocationWithoutResourceRequirement() { | ||
600 | super(GeneratedPQuery.INSTANCE); | ||
601 | } | ||
602 | |||
603 | /** | ||
604 | * @return the singleton instance of the query specification | ||
605 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
606 | * | ||
607 | */ | ||
608 | public static AllocationWithoutResourceRequirement instance() { | ||
609 | try{ | ||
610 | return LazyHolder.INSTANCE; | ||
611 | } catch (ExceptionInInitializerError err) { | ||
612 | throw processInitializerError(err); | ||
613 | } | ||
614 | } | ||
615 | |||
616 | @Override | ||
617 | protected AllocationWithoutResourceRequirement.Matcher instantiate(final ViatraQueryEngine engine) { | ||
618 | return AllocationWithoutResourceRequirement.Matcher.on(engine); | ||
619 | } | ||
620 | |||
621 | @Override | ||
622 | public AllocationWithoutResourceRequirement.Matcher instantiate() { | ||
623 | return AllocationWithoutResourceRequirement.Matcher.create(); | ||
624 | } | ||
625 | |||
626 | @Override | ||
627 | public AllocationWithoutResourceRequirement.Match newEmptyMatch() { | ||
628 | return AllocationWithoutResourceRequirement.Match.newEmptyMatch(); | ||
629 | } | ||
630 | |||
631 | @Override | ||
632 | public AllocationWithoutResourceRequirement.Match newMatch(final Object... parameters) { | ||
633 | return AllocationWithoutResourceRequirement.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance) parameters[1]); | ||
634 | } | ||
635 | |||
636 | /** | ||
637 | * Inner class allowing the singleton instance of {@link AllocationWithoutResourceRequirement} to be created | ||
638 | * <b>not</b> at the class load time of the outer class, | ||
639 | * but rather at the first call to {@link AllocationWithoutResourceRequirement#instance()}. | ||
640 | * | ||
641 | * <p> This workaround is required e.g. to support recursion. | ||
642 | * | ||
643 | */ | ||
644 | private static class LazyHolder { | ||
645 | private static final AllocationWithoutResourceRequirement INSTANCE = new AllocationWithoutResourceRequirement(); | ||
646 | |||
647 | /** | ||
648 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
649 | * This initialization order is required to support indirect recursion. | ||
650 | * | ||
651 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
652 | * | ||
653 | */ | ||
654 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
655 | |||
656 | public static Object ensureInitialized() { | ||
657 | INSTANCE.ensureInitializedInternal(); | ||
658 | return null; | ||
659 | } | ||
660 | } | ||
661 | |||
662 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
663 | private static final AllocationWithoutResourceRequirement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
664 | |||
665 | 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); | ||
666 | |||
667 | 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); | ||
668 | |||
669 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_App); | ||
670 | |||
671 | private GeneratedPQuery() { | ||
672 | super(PVisibility.PUBLIC); | ||
673 | } | ||
674 | |||
675 | @Override | ||
676 | public String getFullyQualifiedName() { | ||
677 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.allocationWithoutResourceRequirement"; | ||
678 | } | ||
679 | |||
680 | @Override | ||
681 | public List<String> getParameterNames() { | ||
682 | return Arrays.asList("Host","App"); | ||
683 | } | ||
684 | |||
685 | @Override | ||
686 | public List<PParameter> getParameters() { | ||
687 | return parameters; | ||
688 | } | ||
689 | |||
690 | @Override | ||
691 | public Set<PBody> doGetContainedBodies() { | ||
692 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
693 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
694 | { | ||
695 | PBody body = new PBody(this); | ||
696 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
697 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
698 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
699 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
700 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
701 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
702 | new ExportedParameter(body, var_Host, parameter_Host), | ||
703 | new ExportedParameter(body, var_App, parameter_App) | ||
704 | )); | ||
705 | // ApplicationInstance.allocatedTo(App, Host) | ||
706 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
707 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
708 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
709 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
710 | new Equality(body, var__virtual_0_, var_Host); | ||
711 | // neg find resourceRequirement(Host, App, _) | ||
712 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Host, var_App, var___0_), ResourceRequirement.instance().getInternalQueryRepresentation()); | ||
713 | bodies.add(body); | ||
714 | } | ||
715 | { | ||
716 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
717 | annotation.addAttribute("severity", "error"); | ||
718 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
719 | new ParameterReference("Host"), | ||
720 | new ParameterReference("App") | ||
721 | })); | ||
722 | annotation.addAttribute("message", "Application instance must be allocated to a supported host type."); | ||
723 | addAnnotation(annotation); | ||
724 | } | ||
725 | return bodies; | ||
726 | } | ||
727 | } | ||
728 | } | ||
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..607854bf --- /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,554 @@ | |||
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 | switch(parameterName) { | ||
83 | case "Average": return this.fAverage; | ||
84 | default: return null; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public Object get(final int index) { | ||
90 | switch(index) { | ||
91 | case 0: return this.fAverage; | ||
92 | default: return null; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public Double getAverage() { | ||
97 | return this.fAverage; | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public boolean set(final String parameterName, final Object newValue) { | ||
102 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
103 | if ("Average".equals(parameterName) ) { | ||
104 | this.fAverage = (Double) newValue; | ||
105 | return true; | ||
106 | } | ||
107 | return false; | ||
108 | } | ||
109 | |||
110 | public void setAverage(final Double pAverage) { | ||
111 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
112 | this.fAverage = pAverage; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public String patternName() { | ||
117 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeHddMetric"; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<String> parameterNames() { | ||
122 | return AverageFreeHddMetric.Match.parameterNames; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Object[] toArray() { | ||
127 | return new Object[]{fAverage}; | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public AverageFreeHddMetric.Match toImmutable() { | ||
132 | return isMutable() ? newMatch(fAverage) : this; | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public String prettyPrint() { | ||
137 | StringBuilder result = new StringBuilder(); | ||
138 | result.append("\"Average\"=" + prettyPrintValue(fAverage)); | ||
139 | return result.toString(); | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public int hashCode() { | ||
144 | return Objects.hash(fAverage); | ||
145 | } | ||
146 | |||
147 | @Override | ||
148 | public boolean equals(final Object obj) { | ||
149 | if (this == obj) | ||
150 | return true; | ||
151 | if (obj == null) { | ||
152 | return false; | ||
153 | } | ||
154 | if ((obj instanceof AverageFreeHddMetric.Match)) { | ||
155 | AverageFreeHddMetric.Match other = (AverageFreeHddMetric.Match) obj; | ||
156 | return Objects.equals(fAverage, other.fAverage); | ||
157 | } else { | ||
158 | // this should be infrequent | ||
159 | if (!(obj instanceof IPatternMatch)) { | ||
160 | return false; | ||
161 | } | ||
162 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
163 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
164 | } | ||
165 | } | ||
166 | |||
167 | @Override | ||
168 | public AverageFreeHddMetric specification() { | ||
169 | return AverageFreeHddMetric.instance(); | ||
170 | } | ||
171 | |||
172 | /** | ||
173 | * Returns an empty, mutable match. | ||
174 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
175 | * | ||
176 | * @return the empty match. | ||
177 | * | ||
178 | */ | ||
179 | public static AverageFreeHddMetric.Match newEmptyMatch() { | ||
180 | return new Mutable(null); | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * Returns a mutable (partial) match. | ||
185 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
186 | * | ||
187 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
188 | * @return the new, mutable (partial) match object. | ||
189 | * | ||
190 | */ | ||
191 | public static AverageFreeHddMetric.Match newMutableMatch(final Double pAverage) { | ||
192 | return new Mutable(pAverage); | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * Returns a new (partial) match. | ||
197 | * This can be used e.g. to call the matcher with a partial match. | ||
198 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
199 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
200 | * @return the (partial) match object. | ||
201 | * | ||
202 | */ | ||
203 | public static AverageFreeHddMetric.Match newMatch(final Double pAverage) { | ||
204 | return new Immutable(pAverage); | ||
205 | } | ||
206 | |||
207 | private static final class Mutable extends AverageFreeHddMetric.Match { | ||
208 | Mutable(final Double pAverage) { | ||
209 | super(pAverage); | ||
210 | } | ||
211 | |||
212 | @Override | ||
213 | public boolean isMutable() { | ||
214 | return true; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | private static final class Immutable extends AverageFreeHddMetric.Match { | ||
219 | Immutable(final Double pAverage) { | ||
220 | super(pAverage); | ||
221 | } | ||
222 | |||
223 | @Override | ||
224 | public boolean isMutable() { | ||
225 | return false; | ||
226 | } | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /** | ||
231 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeHddMetric pattern, | ||
232 | * providing pattern-specific query methods. | ||
233 | * | ||
234 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
235 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
236 | * | ||
237 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
238 | * | ||
239 | * <p>Original source: | ||
240 | * <code><pre> | ||
241 | * // Free HDD | ||
242 | * | ||
243 | * pattern averageFreeHddMetric(Average : java Double) { | ||
244 | * Average == avg find freeHddPercentage(_, #_); | ||
245 | * } | ||
246 | * </pre></code> | ||
247 | * | ||
248 | * @see Match | ||
249 | * @see AverageFreeHddMetric | ||
250 | * | ||
251 | */ | ||
252 | public static class Matcher extends BaseMatcher<AverageFreeHddMetric.Match> { | ||
253 | /** | ||
254 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
255 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
256 | * | ||
257 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
258 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
259 | * | ||
260 | */ | ||
261 | public static AverageFreeHddMetric.Matcher on(final ViatraQueryEngine engine) { | ||
262 | // check if matcher already exists | ||
263 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
264 | if (matcher == null) { | ||
265 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
266 | } | ||
267 | return matcher; | ||
268 | } | ||
269 | |||
270 | /** | ||
271 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
272 | * @return an initialized matcher | ||
273 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
274 | * | ||
275 | */ | ||
276 | public static AverageFreeHddMetric.Matcher create() { | ||
277 | return new Matcher(); | ||
278 | } | ||
279 | |||
280 | private static final int POSITION_AVERAGE = 0; | ||
281 | |||
282 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AverageFreeHddMetric.Matcher.class); | ||
283 | |||
284 | /** | ||
285 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
286 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
287 | * | ||
288 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
289 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
290 | * | ||
291 | */ | ||
292 | private Matcher() { | ||
293 | super(querySpecification()); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
298 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
299 | * @return matches represented as a Match object. | ||
300 | * | ||
301 | */ | ||
302 | public Collection<AverageFreeHddMetric.Match> getAllMatches(final Double pAverage) { | ||
303 | return rawStreamAllMatches(new Object[]{pAverage}).collect(Collectors.toSet()); | ||
304 | } | ||
305 | |||
306 | /** | ||
307 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
308 | * </p> | ||
309 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
310 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
311 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
312 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
313 | * @return a stream of matches represented as a Match object. | ||
314 | * | ||
315 | */ | ||
316 | public Stream<AverageFreeHddMetric.Match> streamAllMatches(final Double pAverage) { | ||
317 | return rawStreamAllMatches(new Object[]{pAverage}); | ||
318 | } | ||
319 | |||
320 | /** | ||
321 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
322 | * Neither determinism nor randomness of selection is guaranteed. | ||
323 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
324 | * @return a match represented as a Match object, or null if no match is found. | ||
325 | * | ||
326 | */ | ||
327 | public Optional<AverageFreeHddMetric.Match> getOneArbitraryMatch(final Double pAverage) { | ||
328 | return rawGetOneArbitraryMatch(new Object[]{pAverage}); | ||
329 | } | ||
330 | |||
331 | /** | ||
332 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
333 | * under any possible substitution of the unspecified parameters (if any). | ||
334 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
335 | * @return true if the input is a valid (partial) match of the pattern. | ||
336 | * | ||
337 | */ | ||
338 | public boolean hasMatch(final Double pAverage) { | ||
339 | return rawHasMatch(new Object[]{pAverage}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
344 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
345 | * @return the number of pattern matches found. | ||
346 | * | ||
347 | */ | ||
348 | public int countMatches(final Double pAverage) { | ||
349 | return rawCountMatches(new Object[]{pAverage}); | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
354 | * Neither determinism nor randomness of selection is guaranteed. | ||
355 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
356 | * @param processor the action that will process the selected match. | ||
357 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
358 | * | ||
359 | */ | ||
360 | public boolean forOneArbitraryMatch(final Double pAverage, final Consumer<? super AverageFreeHddMetric.Match> processor) { | ||
361 | return rawForOneArbitraryMatch(new Object[]{pAverage}, processor); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * Returns a new (partial) match. | ||
366 | * This can be used e.g. to call the matcher with a partial match. | ||
367 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
368 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
369 | * @return the (partial) match object. | ||
370 | * | ||
371 | */ | ||
372 | public AverageFreeHddMetric.Match newMatch(final Double pAverage) { | ||
373 | return AverageFreeHddMetric.Match.newMatch(pAverage); | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * Retrieve the set of values that occur in matches for Average. | ||
378 | * @return the Set of all values or empty set if there are no matches | ||
379 | * | ||
380 | */ | ||
381 | protected Stream<Double> rawStreamAllValuesOfAverage(final Object[] parameters) { | ||
382 | return rawStreamAllValues(POSITION_AVERAGE, parameters).map(Double.class::cast); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * Retrieve the set of values that occur in matches for Average. | ||
387 | * @return the Set of all values or empty set if there are no matches | ||
388 | * | ||
389 | */ | ||
390 | public Set<Double> getAllValuesOfAverage() { | ||
391 | return rawStreamAllValuesOfAverage(emptyArray()).collect(Collectors.toSet()); | ||
392 | } | ||
393 | |||
394 | /** | ||
395 | * Retrieve the set of values that occur in matches for Average. | ||
396 | * @return the Set of all values or empty set if there are no matches | ||
397 | * | ||
398 | */ | ||
399 | public Stream<Double> streamAllValuesOfAverage() { | ||
400 | return rawStreamAllValuesOfAverage(emptyArray()); | ||
401 | } | ||
402 | |||
403 | @Override | ||
404 | protected AverageFreeHddMetric.Match tupleToMatch(final Tuple t) { | ||
405 | try { | ||
406 | return AverageFreeHddMetric.Match.newMatch((Double) t.get(POSITION_AVERAGE)); | ||
407 | } catch(ClassCastException e) { | ||
408 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
409 | return null; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | @Override | ||
414 | protected AverageFreeHddMetric.Match arrayToMatch(final Object[] match) { | ||
415 | try { | ||
416 | return AverageFreeHddMetric.Match.newMatch((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 | @Override | ||
424 | protected AverageFreeHddMetric.Match arrayToMatchMutable(final Object[] match) { | ||
425 | try { | ||
426 | return AverageFreeHddMetric.Match.newMutableMatch((Double) match[POSITION_AVERAGE]); | ||
427 | } catch(ClassCastException e) { | ||
428 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
429 | return null; | ||
430 | } | ||
431 | } | ||
432 | |||
433 | /** | ||
434 | * @return the singleton instance of the query specification of this pattern | ||
435 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
436 | * | ||
437 | */ | ||
438 | public static IQuerySpecification<AverageFreeHddMetric.Matcher> querySpecification() { | ||
439 | return AverageFreeHddMetric.instance(); | ||
440 | } | ||
441 | } | ||
442 | |||
443 | private AverageFreeHddMetric() { | ||
444 | super(GeneratedPQuery.INSTANCE); | ||
445 | } | ||
446 | |||
447 | /** | ||
448 | * @return the singleton instance of the query specification | ||
449 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
450 | * | ||
451 | */ | ||
452 | public static AverageFreeHddMetric instance() { | ||
453 | try{ | ||
454 | return LazyHolder.INSTANCE; | ||
455 | } catch (ExceptionInInitializerError err) { | ||
456 | throw processInitializerError(err); | ||
457 | } | ||
458 | } | ||
459 | |||
460 | @Override | ||
461 | protected AverageFreeHddMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
462 | return AverageFreeHddMetric.Matcher.on(engine); | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | public AverageFreeHddMetric.Matcher instantiate() { | ||
467 | return AverageFreeHddMetric.Matcher.create(); | ||
468 | } | ||
469 | |||
470 | @Override | ||
471 | public AverageFreeHddMetric.Match newEmptyMatch() { | ||
472 | return AverageFreeHddMetric.Match.newEmptyMatch(); | ||
473 | } | ||
474 | |||
475 | @Override | ||
476 | public AverageFreeHddMetric.Match newMatch(final Object... parameters) { | ||
477 | return AverageFreeHddMetric.Match.newMatch((java.lang.Double) parameters[0]); | ||
478 | } | ||
479 | |||
480 | /** | ||
481 | * Inner class allowing the singleton instance of {@link AverageFreeHddMetric} to be created | ||
482 | * <b>not</b> at the class load time of the outer class, | ||
483 | * but rather at the first call to {@link AverageFreeHddMetric#instance()}. | ||
484 | * | ||
485 | * <p> This workaround is required e.g. to support recursion. | ||
486 | * | ||
487 | */ | ||
488 | private static class LazyHolder { | ||
489 | private static final AverageFreeHddMetric INSTANCE = new AverageFreeHddMetric(); | ||
490 | |||
491 | /** | ||
492 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
493 | * This initialization order is required to support indirect recursion. | ||
494 | * | ||
495 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
496 | * | ||
497 | */ | ||
498 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
499 | |||
500 | public static Object ensureInitialized() { | ||
501 | INSTANCE.ensureInitializedInternal(); | ||
502 | return null; | ||
503 | } | ||
504 | } | ||
505 | |||
506 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
507 | private static final AverageFreeHddMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
508 | |||
509 | private final PParameter parameter_Average = new PParameter("Average", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
510 | |||
511 | private final List<PParameter> parameters = Arrays.asList(parameter_Average); | ||
512 | |||
513 | private GeneratedPQuery() { | ||
514 | super(PVisibility.PUBLIC); | ||
515 | } | ||
516 | |||
517 | @Override | ||
518 | public String getFullyQualifiedName() { | ||
519 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeHddMetric"; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public List<String> getParameterNames() { | ||
524 | return Arrays.asList("Average"); | ||
525 | } | ||
526 | |||
527 | @Override | ||
528 | public List<PParameter> getParameters() { | ||
529 | return parameters; | ||
530 | } | ||
531 | |||
532 | @Override | ||
533 | public Set<PBody> doGetContainedBodies() { | ||
534 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
535 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
536 | { | ||
537 | PBody body = new PBody(this); | ||
538 | PVariable var_Average = body.getOrCreateVariableByName("Average"); | ||
539 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
540 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
541 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Average), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
542 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
543 | new ExportedParameter(body, var_Average, parameter_Average) | ||
544 | )); | ||
545 | // Average == avg find freeHddPercentage(_, #_) | ||
546 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
547 | new AggregatorConstraint(new avg().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), FreeHddPercentage.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
548 | new Equality(body, var_Average, var__virtual_0_); | ||
549 | bodies.add(body); | ||
550 | } | ||
551 | return bodies; | ||
552 | } | ||
553 | } | ||
554 | } | ||
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..627a5f89 --- /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,562 @@ | |||
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 | switch(parameterName) { | ||
87 | case "Average": return this.fAverage; | ||
88 | default: return null; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | @Override | ||
93 | public Object get(final int index) { | ||
94 | switch(index) { | ||
95 | case 0: return this.fAverage; | ||
96 | default: return null; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | public Double getAverage() { | ||
101 | return this.fAverage; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public boolean set(final String parameterName, final Object newValue) { | ||
106 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
107 | if ("Average".equals(parameterName) ) { | ||
108 | this.fAverage = (Double) newValue; | ||
109 | return true; | ||
110 | } | ||
111 | return false; | ||
112 | } | ||
113 | |||
114 | public void setAverage(final Double pAverage) { | ||
115 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
116 | this.fAverage = pAverage; | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public String patternName() { | ||
121 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeMemoryMetric"; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public List<String> parameterNames() { | ||
126 | return AverageFreeMemoryMetric.Match.parameterNames; | ||
127 | } | ||
128 | |||
129 | @Override | ||
130 | public Object[] toArray() { | ||
131 | return new Object[]{fAverage}; | ||
132 | } | ||
133 | |||
134 | @Override | ||
135 | public AverageFreeMemoryMetric.Match toImmutable() { | ||
136 | return isMutable() ? newMatch(fAverage) : this; | ||
137 | } | ||
138 | |||
139 | @Override | ||
140 | public String prettyPrint() { | ||
141 | StringBuilder result = new StringBuilder(); | ||
142 | result.append("\"Average\"=" + prettyPrintValue(fAverage)); | ||
143 | return result.toString(); | ||
144 | } | ||
145 | |||
146 | @Override | ||
147 | public int hashCode() { | ||
148 | return Objects.hash(fAverage); | ||
149 | } | ||
150 | |||
151 | @Override | ||
152 | public boolean equals(final Object obj) { | ||
153 | if (this == obj) | ||
154 | return true; | ||
155 | if (obj == null) { | ||
156 | return false; | ||
157 | } | ||
158 | if ((obj instanceof AverageFreeMemoryMetric.Match)) { | ||
159 | AverageFreeMemoryMetric.Match other = (AverageFreeMemoryMetric.Match) obj; | ||
160 | return Objects.equals(fAverage, other.fAverage); | ||
161 | } else { | ||
162 | // this should be infrequent | ||
163 | if (!(obj instanceof IPatternMatch)) { | ||
164 | return false; | ||
165 | } | ||
166 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
167 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | @Override | ||
172 | public AverageFreeMemoryMetric specification() { | ||
173 | return AverageFreeMemoryMetric.instance(); | ||
174 | } | ||
175 | |||
176 | /** | ||
177 | * Returns an empty, mutable match. | ||
178 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
179 | * | ||
180 | * @return the empty match. | ||
181 | * | ||
182 | */ | ||
183 | public static AverageFreeMemoryMetric.Match newEmptyMatch() { | ||
184 | return new Mutable(null); | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * Returns a mutable (partial) match. | ||
189 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
190 | * | ||
191 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
192 | * @return the new, mutable (partial) match object. | ||
193 | * | ||
194 | */ | ||
195 | public static AverageFreeMemoryMetric.Match newMutableMatch(final Double pAverage) { | ||
196 | return new Mutable(pAverage); | ||
197 | } | ||
198 | |||
199 | /** | ||
200 | * Returns a new (partial) match. | ||
201 | * This can be used e.g. to call the matcher with a partial match. | ||
202 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
203 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
204 | * @return the (partial) match object. | ||
205 | * | ||
206 | */ | ||
207 | public static AverageFreeMemoryMetric.Match newMatch(final Double pAverage) { | ||
208 | return new Immutable(pAverage); | ||
209 | } | ||
210 | |||
211 | private static final class Mutable extends AverageFreeMemoryMetric.Match { | ||
212 | Mutable(final Double pAverage) { | ||
213 | super(pAverage); | ||
214 | } | ||
215 | |||
216 | @Override | ||
217 | public boolean isMutable() { | ||
218 | return true; | ||
219 | } | ||
220 | } | ||
221 | |||
222 | private static final class Immutable extends AverageFreeMemoryMetric.Match { | ||
223 | Immutable(final Double pAverage) { | ||
224 | super(pAverage); | ||
225 | } | ||
226 | |||
227 | @Override | ||
228 | public boolean isMutable() { | ||
229 | return false; | ||
230 | } | ||
231 | } | ||
232 | } | ||
233 | |||
234 | /** | ||
235 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeMemoryMetric pattern, | ||
236 | * providing pattern-specific query methods. | ||
237 | * | ||
238 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
239 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
240 | * | ||
241 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
242 | * | ||
243 | * <p>Original source: | ||
244 | * <code><pre> | ||
245 | * // | ||
246 | * // Metrics | ||
247 | * // | ||
248 | * | ||
249 | * // Free memory | ||
250 | * | ||
251 | * pattern averageFreeMemoryMetric(Average : java Double) { | ||
252 | * Average == avg find freeMemoryPercentage(_, #_); | ||
253 | * } | ||
254 | * </pre></code> | ||
255 | * | ||
256 | * @see Match | ||
257 | * @see AverageFreeMemoryMetric | ||
258 | * | ||
259 | */ | ||
260 | public static class Matcher extends BaseMatcher<AverageFreeMemoryMetric.Match> { | ||
261 | /** | ||
262 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
263 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
264 | * | ||
265 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
266 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
267 | * | ||
268 | */ | ||
269 | public static AverageFreeMemoryMetric.Matcher on(final ViatraQueryEngine engine) { | ||
270 | // check if matcher already exists | ||
271 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
272 | if (matcher == null) { | ||
273 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
274 | } | ||
275 | return matcher; | ||
276 | } | ||
277 | |||
278 | /** | ||
279 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
280 | * @return an initialized matcher | ||
281 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
282 | * | ||
283 | */ | ||
284 | public static AverageFreeMemoryMetric.Matcher create() { | ||
285 | return new Matcher(); | ||
286 | } | ||
287 | |||
288 | private static final int POSITION_AVERAGE = 0; | ||
289 | |||
290 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AverageFreeMemoryMetric.Matcher.class); | ||
291 | |||
292 | /** | ||
293 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
294 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
295 | * | ||
296 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
297 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
298 | * | ||
299 | */ | ||
300 | private Matcher() { | ||
301 | super(querySpecification()); | ||
302 | } | ||
303 | |||
304 | /** | ||
305 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
306 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
307 | * @return matches represented as a Match object. | ||
308 | * | ||
309 | */ | ||
310 | public Collection<AverageFreeMemoryMetric.Match> getAllMatches(final Double pAverage) { | ||
311 | return rawStreamAllMatches(new Object[]{pAverage}).collect(Collectors.toSet()); | ||
312 | } | ||
313 | |||
314 | /** | ||
315 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
316 | * </p> | ||
317 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
318 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
319 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
320 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
321 | * @return a stream of matches represented as a Match object. | ||
322 | * | ||
323 | */ | ||
324 | public Stream<AverageFreeMemoryMetric.Match> streamAllMatches(final Double pAverage) { | ||
325 | return rawStreamAllMatches(new Object[]{pAverage}); | ||
326 | } | ||
327 | |||
328 | /** | ||
329 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
330 | * Neither determinism nor randomness of selection is guaranteed. | ||
331 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
332 | * @return a match represented as a Match object, or null if no match is found. | ||
333 | * | ||
334 | */ | ||
335 | public Optional<AverageFreeMemoryMetric.Match> getOneArbitraryMatch(final Double pAverage) { | ||
336 | return rawGetOneArbitraryMatch(new Object[]{pAverage}); | ||
337 | } | ||
338 | |||
339 | /** | ||
340 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
341 | * under any possible substitution of the unspecified parameters (if any). | ||
342 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
343 | * @return true if the input is a valid (partial) match of the pattern. | ||
344 | * | ||
345 | */ | ||
346 | public boolean hasMatch(final Double pAverage) { | ||
347 | return rawHasMatch(new Object[]{pAverage}); | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
352 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
353 | * @return the number of pattern matches found. | ||
354 | * | ||
355 | */ | ||
356 | public int countMatches(final Double pAverage) { | ||
357 | return rawCountMatches(new Object[]{pAverage}); | ||
358 | } | ||
359 | |||
360 | /** | ||
361 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
362 | * Neither determinism nor randomness of selection is guaranteed. | ||
363 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
364 | * @param processor the action that will process the selected match. | ||
365 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
366 | * | ||
367 | */ | ||
368 | public boolean forOneArbitraryMatch(final Double pAverage, final Consumer<? super AverageFreeMemoryMetric.Match> processor) { | ||
369 | return rawForOneArbitraryMatch(new Object[]{pAverage}, processor); | ||
370 | } | ||
371 | |||
372 | /** | ||
373 | * Returns a new (partial) match. | ||
374 | * This can be used e.g. to call the matcher with a partial match. | ||
375 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
376 | * @param pAverage the fixed value of pattern parameter Average, or null if not bound. | ||
377 | * @return the (partial) match object. | ||
378 | * | ||
379 | */ | ||
380 | public AverageFreeMemoryMetric.Match newMatch(final Double pAverage) { | ||
381 | return AverageFreeMemoryMetric.Match.newMatch(pAverage); | ||
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 | protected Stream<Double> rawStreamAllValuesOfAverage(final Object[] parameters) { | ||
390 | return rawStreamAllValues(POSITION_AVERAGE, parameters).map(Double.class::cast); | ||
391 | } | ||
392 | |||
393 | /** | ||
394 | * Retrieve the set of values that occur in matches for Average. | ||
395 | * @return the Set of all values or empty set if there are no matches | ||
396 | * | ||
397 | */ | ||
398 | public Set<Double> getAllValuesOfAverage() { | ||
399 | return rawStreamAllValuesOfAverage(emptyArray()).collect(Collectors.toSet()); | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * Retrieve the set of values that occur in matches for Average. | ||
404 | * @return the Set of all values or empty set if there are no matches | ||
405 | * | ||
406 | */ | ||
407 | public Stream<Double> streamAllValuesOfAverage() { | ||
408 | return rawStreamAllValuesOfAverage(emptyArray()); | ||
409 | } | ||
410 | |||
411 | @Override | ||
412 | protected AverageFreeMemoryMetric.Match tupleToMatch(final Tuple t) { | ||
413 | try { | ||
414 | return AverageFreeMemoryMetric.Match.newMatch((Double) t.get(POSITION_AVERAGE)); | ||
415 | } catch(ClassCastException e) { | ||
416 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
417 | return null; | ||
418 | } | ||
419 | } | ||
420 | |||
421 | @Override | ||
422 | protected AverageFreeMemoryMetric.Match arrayToMatch(final Object[] match) { | ||
423 | try { | ||
424 | return AverageFreeMemoryMetric.Match.newMatch((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 | @Override | ||
432 | protected AverageFreeMemoryMetric.Match arrayToMatchMutable(final Object[] match) { | ||
433 | try { | ||
434 | return AverageFreeMemoryMetric.Match.newMutableMatch((Double) match[POSITION_AVERAGE]); | ||
435 | } catch(ClassCastException e) { | ||
436 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
437 | return null; | ||
438 | } | ||
439 | } | ||
440 | |||
441 | /** | ||
442 | * @return the singleton instance of the query specification of this pattern | ||
443 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
444 | * | ||
445 | */ | ||
446 | public static IQuerySpecification<AverageFreeMemoryMetric.Matcher> querySpecification() { | ||
447 | return AverageFreeMemoryMetric.instance(); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | private AverageFreeMemoryMetric() { | ||
452 | super(GeneratedPQuery.INSTANCE); | ||
453 | } | ||
454 | |||
455 | /** | ||
456 | * @return the singleton instance of the query specification | ||
457 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
458 | * | ||
459 | */ | ||
460 | public static AverageFreeMemoryMetric instance() { | ||
461 | try{ | ||
462 | return LazyHolder.INSTANCE; | ||
463 | } catch (ExceptionInInitializerError err) { | ||
464 | throw processInitializerError(err); | ||
465 | } | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | protected AverageFreeMemoryMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
470 | return AverageFreeMemoryMetric.Matcher.on(engine); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public AverageFreeMemoryMetric.Matcher instantiate() { | ||
475 | return AverageFreeMemoryMetric.Matcher.create(); | ||
476 | } | ||
477 | |||
478 | @Override | ||
479 | public AverageFreeMemoryMetric.Match newEmptyMatch() { | ||
480 | return AverageFreeMemoryMetric.Match.newEmptyMatch(); | ||
481 | } | ||
482 | |||
483 | @Override | ||
484 | public AverageFreeMemoryMetric.Match newMatch(final Object... parameters) { | ||
485 | return AverageFreeMemoryMetric.Match.newMatch((java.lang.Double) parameters[0]); | ||
486 | } | ||
487 | |||
488 | /** | ||
489 | * Inner class allowing the singleton instance of {@link AverageFreeMemoryMetric} to be created | ||
490 | * <b>not</b> at the class load time of the outer class, | ||
491 | * but rather at the first call to {@link AverageFreeMemoryMetric#instance()}. | ||
492 | * | ||
493 | * <p> This workaround is required e.g. to support recursion. | ||
494 | * | ||
495 | */ | ||
496 | private static class LazyHolder { | ||
497 | private static final AverageFreeMemoryMetric INSTANCE = new AverageFreeMemoryMetric(); | ||
498 | |||
499 | /** | ||
500 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
501 | * This initialization order is required to support indirect recursion. | ||
502 | * | ||
503 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
504 | * | ||
505 | */ | ||
506 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
507 | |||
508 | public static Object ensureInitialized() { | ||
509 | INSTANCE.ensureInitializedInternal(); | ||
510 | return null; | ||
511 | } | ||
512 | } | ||
513 | |||
514 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
515 | private static final AverageFreeMemoryMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
516 | |||
517 | private final PParameter parameter_Average = new PParameter("Average", "java.lang.Double", new JavaTransitiveInstancesKey(java.lang.Double.class), PParameterDirection.INOUT); | ||
518 | |||
519 | private final List<PParameter> parameters = Arrays.asList(parameter_Average); | ||
520 | |||
521 | private GeneratedPQuery() { | ||
522 | super(PVisibility.PUBLIC); | ||
523 | } | ||
524 | |||
525 | @Override | ||
526 | public String getFullyQualifiedName() { | ||
527 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.averageFreeMemoryMetric"; | ||
528 | } | ||
529 | |||
530 | @Override | ||
531 | public List<String> getParameterNames() { | ||
532 | return Arrays.asList("Average"); | ||
533 | } | ||
534 | |||
535 | @Override | ||
536 | public List<PParameter> getParameters() { | ||
537 | return parameters; | ||
538 | } | ||
539 | |||
540 | @Override | ||
541 | public Set<PBody> doGetContainedBodies() { | ||
542 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
543 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
544 | { | ||
545 | PBody body = new PBody(this); | ||
546 | PVariable var_Average = body.getOrCreateVariableByName("Average"); | ||
547 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
548 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
549 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Average), new JavaTransitiveInstancesKey(java.lang.Double.class)); | ||
550 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
551 | new ExportedParameter(body, var_Average, parameter_Average) | ||
552 | )); | ||
553 | // Average == avg find freeMemoryPercentage(_, #_) | ||
554 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
555 | new AggregatorConstraint(new avg().getAggregatorLogic(Double.class), body, Tuples.flatTupleOf(var___0_, var___1_), FreeMemoryPercentage.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
556 | new Equality(body, var_Average, var__virtual_0_); | ||
557 | bodies.add(body); | ||
558 | } | ||
559 | return bodies; | ||
560 | } | ||
561 | } | ||
562 | } | ||
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..eff44f0a --- /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,554 @@ | |||
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 | switch(parameterName) { | ||
83 | case "Cost": return this.fCost; | ||
84 | default: return null; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public Object get(final int index) { | ||
90 | switch(index) { | ||
91 | case 0: return this.fCost; | ||
92 | default: return null; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public Integer getCost() { | ||
97 | return this.fCost; | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public boolean set(final String parameterName, final Object newValue) { | ||
102 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
103 | if ("Cost".equals(parameterName) ) { | ||
104 | this.fCost = (Integer) newValue; | ||
105 | return true; | ||
106 | } | ||
107 | return false; | ||
108 | } | ||
109 | |||
110 | public void setCost(final Integer pCost) { | ||
111 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
112 | this.fCost = pCost; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public String patternName() { | ||
117 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.costMetric"; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<String> parameterNames() { | ||
122 | return CostMetric.Match.parameterNames; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Object[] toArray() { | ||
127 | return new Object[]{fCost}; | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public CostMetric.Match toImmutable() { | ||
132 | return isMutable() ? newMatch(fCost) : this; | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public String prettyPrint() { | ||
137 | StringBuilder result = new StringBuilder(); | ||
138 | result.append("\"Cost\"=" + prettyPrintValue(fCost)); | ||
139 | return result.toString(); | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public int hashCode() { | ||
144 | return Objects.hash(fCost); | ||
145 | } | ||
146 | |||
147 | @Override | ||
148 | public boolean equals(final Object obj) { | ||
149 | if (this == obj) | ||
150 | return true; | ||
151 | if (obj == null) { | ||
152 | return false; | ||
153 | } | ||
154 | if ((obj instanceof CostMetric.Match)) { | ||
155 | CostMetric.Match other = (CostMetric.Match) obj; | ||
156 | return Objects.equals(fCost, other.fCost); | ||
157 | } else { | ||
158 | // this should be infrequent | ||
159 | if (!(obj instanceof IPatternMatch)) { | ||
160 | return false; | ||
161 | } | ||
162 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
163 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
164 | } | ||
165 | } | ||
166 | |||
167 | @Override | ||
168 | public CostMetric specification() { | ||
169 | return CostMetric.instance(); | ||
170 | } | ||
171 | |||
172 | /** | ||
173 | * Returns an empty, mutable match. | ||
174 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
175 | * | ||
176 | * @return the empty match. | ||
177 | * | ||
178 | */ | ||
179 | public static CostMetric.Match newEmptyMatch() { | ||
180 | return new Mutable(null); | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * Returns a mutable (partial) match. | ||
185 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
186 | * | ||
187 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
188 | * @return the new, mutable (partial) match object. | ||
189 | * | ||
190 | */ | ||
191 | public static CostMetric.Match newMutableMatch(final Integer pCost) { | ||
192 | return new Mutable(pCost); | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * Returns a new (partial) match. | ||
197 | * This can be used e.g. to call the matcher with a partial match. | ||
198 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
199 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
200 | * @return the (partial) match object. | ||
201 | * | ||
202 | */ | ||
203 | public static CostMetric.Match newMatch(final Integer pCost) { | ||
204 | return new Immutable(pCost); | ||
205 | } | ||
206 | |||
207 | private static final class Mutable extends CostMetric.Match { | ||
208 | Mutable(final Integer pCost) { | ||
209 | super(pCost); | ||
210 | } | ||
211 | |||
212 | @Override | ||
213 | public boolean isMutable() { | ||
214 | return true; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | private static final class Immutable extends CostMetric.Match { | ||
219 | Immutable(final Integer pCost) { | ||
220 | super(pCost); | ||
221 | } | ||
222 | |||
223 | @Override | ||
224 | public boolean isMutable() { | ||
225 | return false; | ||
226 | } | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /** | ||
231 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.costMetric pattern, | ||
232 | * providing pattern-specific query methods. | ||
233 | * | ||
234 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
235 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
236 | * | ||
237 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
238 | * | ||
239 | * <p>Original source: | ||
240 | * <code><pre> | ||
241 | * // Total cost | ||
242 | * | ||
243 | * pattern costMetric(Cost : java Integer) { | ||
244 | * Cost == sum find cpsCost(_, #_); | ||
245 | * } | ||
246 | * </pre></code> | ||
247 | * | ||
248 | * @see Match | ||
249 | * @see CostMetric | ||
250 | * | ||
251 | */ | ||
252 | public static class Matcher extends BaseMatcher<CostMetric.Match> { | ||
253 | /** | ||
254 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
255 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
256 | * | ||
257 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
258 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
259 | * | ||
260 | */ | ||
261 | public static CostMetric.Matcher on(final ViatraQueryEngine engine) { | ||
262 | // check if matcher already exists | ||
263 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
264 | if (matcher == null) { | ||
265 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
266 | } | ||
267 | return matcher; | ||
268 | } | ||
269 | |||
270 | /** | ||
271 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
272 | * @return an initialized matcher | ||
273 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
274 | * | ||
275 | */ | ||
276 | public static CostMetric.Matcher create() { | ||
277 | return new Matcher(); | ||
278 | } | ||
279 | |||
280 | private static final int POSITION_COST = 0; | ||
281 | |||
282 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CostMetric.Matcher.class); | ||
283 | |||
284 | /** | ||
285 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
286 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
287 | * | ||
288 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
289 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
290 | * | ||
291 | */ | ||
292 | private Matcher() { | ||
293 | super(querySpecification()); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
298 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
299 | * @return matches represented as a Match object. | ||
300 | * | ||
301 | */ | ||
302 | public Collection<CostMetric.Match> getAllMatches(final Integer pCost) { | ||
303 | return rawStreamAllMatches(new Object[]{pCost}).collect(Collectors.toSet()); | ||
304 | } | ||
305 | |||
306 | /** | ||
307 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
308 | * </p> | ||
309 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
310 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
311 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
312 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
313 | * @return a stream of matches represented as a Match object. | ||
314 | * | ||
315 | */ | ||
316 | public Stream<CostMetric.Match> streamAllMatches(final Integer pCost) { | ||
317 | return rawStreamAllMatches(new Object[]{pCost}); | ||
318 | } | ||
319 | |||
320 | /** | ||
321 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
322 | * Neither determinism nor randomness of selection is guaranteed. | ||
323 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
324 | * @return a match represented as a Match object, or null if no match is found. | ||
325 | * | ||
326 | */ | ||
327 | public Optional<CostMetric.Match> getOneArbitraryMatch(final Integer pCost) { | ||
328 | return rawGetOneArbitraryMatch(new Object[]{pCost}); | ||
329 | } | ||
330 | |||
331 | /** | ||
332 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
333 | * under any possible substitution of the unspecified parameters (if any). | ||
334 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
335 | * @return true if the input is a valid (partial) match of the pattern. | ||
336 | * | ||
337 | */ | ||
338 | public boolean hasMatch(final Integer pCost) { | ||
339 | return rawHasMatch(new Object[]{pCost}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
344 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
345 | * @return the number of pattern matches found. | ||
346 | * | ||
347 | */ | ||
348 | public int countMatches(final Integer pCost) { | ||
349 | return rawCountMatches(new Object[]{pCost}); | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
354 | * Neither determinism nor randomness of selection is guaranteed. | ||
355 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
356 | * @param processor the action that will process the selected match. | ||
357 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
358 | * | ||
359 | */ | ||
360 | public boolean forOneArbitraryMatch(final Integer pCost, final Consumer<? super CostMetric.Match> processor) { | ||
361 | return rawForOneArbitraryMatch(new Object[]{pCost}, processor); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * Returns a new (partial) match. | ||
366 | * This can be used e.g. to call the matcher with a partial match. | ||
367 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
368 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
369 | * @return the (partial) match object. | ||
370 | * | ||
371 | */ | ||
372 | public CostMetric.Match newMatch(final Integer pCost) { | ||
373 | return CostMetric.Match.newMatch(pCost); | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * Retrieve the set of values that occur in matches for Cost. | ||
378 | * @return the Set of all values or empty set if there are no matches | ||
379 | * | ||
380 | */ | ||
381 | protected Stream<Integer> rawStreamAllValuesOfCost(final Object[] parameters) { | ||
382 | return rawStreamAllValues(POSITION_COST, parameters).map(Integer.class::cast); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * Retrieve the set of values that occur in matches for Cost. | ||
387 | * @return the Set of all values or empty set if there are no matches | ||
388 | * | ||
389 | */ | ||
390 | public Set<Integer> getAllValuesOfCost() { | ||
391 | return rawStreamAllValuesOfCost(emptyArray()).collect(Collectors.toSet()); | ||
392 | } | ||
393 | |||
394 | /** | ||
395 | * Retrieve the set of values that occur in matches for Cost. | ||
396 | * @return the Set of all values or empty set if there are no matches | ||
397 | * | ||
398 | */ | ||
399 | public Stream<Integer> streamAllValuesOfCost() { | ||
400 | return rawStreamAllValuesOfCost(emptyArray()); | ||
401 | } | ||
402 | |||
403 | @Override | ||
404 | protected CostMetric.Match tupleToMatch(final Tuple t) { | ||
405 | try { | ||
406 | return CostMetric.Match.newMatch((Integer) t.get(POSITION_COST)); | ||
407 | } catch(ClassCastException e) { | ||
408 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
409 | return null; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | @Override | ||
414 | protected CostMetric.Match arrayToMatch(final Object[] match) { | ||
415 | try { | ||
416 | return CostMetric.Match.newMatch((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 | @Override | ||
424 | protected CostMetric.Match arrayToMatchMutable(final Object[] match) { | ||
425 | try { | ||
426 | return CostMetric.Match.newMutableMatch((Integer) match[POSITION_COST]); | ||
427 | } catch(ClassCastException e) { | ||
428 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
429 | return null; | ||
430 | } | ||
431 | } | ||
432 | |||
433 | /** | ||
434 | * @return the singleton instance of the query specification of this pattern | ||
435 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
436 | * | ||
437 | */ | ||
438 | public static IQuerySpecification<CostMetric.Matcher> querySpecification() { | ||
439 | return CostMetric.instance(); | ||
440 | } | ||
441 | } | ||
442 | |||
443 | private CostMetric() { | ||
444 | super(GeneratedPQuery.INSTANCE); | ||
445 | } | ||
446 | |||
447 | /** | ||
448 | * @return the singleton instance of the query specification | ||
449 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
450 | * | ||
451 | */ | ||
452 | public static CostMetric instance() { | ||
453 | try{ | ||
454 | return LazyHolder.INSTANCE; | ||
455 | } catch (ExceptionInInitializerError err) { | ||
456 | throw processInitializerError(err); | ||
457 | } | ||
458 | } | ||
459 | |||
460 | @Override | ||
461 | protected CostMetric.Matcher instantiate(final ViatraQueryEngine engine) { | ||
462 | return CostMetric.Matcher.on(engine); | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | public CostMetric.Matcher instantiate() { | ||
467 | return CostMetric.Matcher.create(); | ||
468 | } | ||
469 | |||
470 | @Override | ||
471 | public CostMetric.Match newEmptyMatch() { | ||
472 | return CostMetric.Match.newEmptyMatch(); | ||
473 | } | ||
474 | |||
475 | @Override | ||
476 | public CostMetric.Match newMatch(final Object... parameters) { | ||
477 | return CostMetric.Match.newMatch((java.lang.Integer) parameters[0]); | ||
478 | } | ||
479 | |||
480 | /** | ||
481 | * Inner class allowing the singleton instance of {@link CostMetric} to be created | ||
482 | * <b>not</b> at the class load time of the outer class, | ||
483 | * but rather at the first call to {@link CostMetric#instance()}. | ||
484 | * | ||
485 | * <p> This workaround is required e.g. to support recursion. | ||
486 | * | ||
487 | */ | ||
488 | private static class LazyHolder { | ||
489 | private static final CostMetric INSTANCE = new CostMetric(); | ||
490 | |||
491 | /** | ||
492 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
493 | * This initialization order is required to support indirect recursion. | ||
494 | * | ||
495 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
496 | * | ||
497 | */ | ||
498 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
499 | |||
500 | public static Object ensureInitialized() { | ||
501 | INSTANCE.ensureInitializedInternal(); | ||
502 | return null; | ||
503 | } | ||
504 | } | ||
505 | |||
506 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
507 | private static final CostMetric.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
508 | |||
509 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
510 | |||
511 | private final List<PParameter> parameters = Arrays.asList(parameter_Cost); | ||
512 | |||
513 | private GeneratedPQuery() { | ||
514 | super(PVisibility.PUBLIC); | ||
515 | } | ||
516 | |||
517 | @Override | ||
518 | public String getFullyQualifiedName() { | ||
519 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.costMetric"; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public List<String> getParameterNames() { | ||
524 | return Arrays.asList("Cost"); | ||
525 | } | ||
526 | |||
527 | @Override | ||
528 | public List<PParameter> getParameters() { | ||
529 | return parameters; | ||
530 | } | ||
531 | |||
532 | @Override | ||
533 | public Set<PBody> doGetContainedBodies() { | ||
534 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
535 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
536 | { | ||
537 | PBody body = new PBody(this); | ||
538 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
539 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
540 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
541 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
542 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
543 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
544 | )); | ||
545 | // Cost == sum find cpsCost(_, #_) | ||
546 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
547 | new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var___0_, var___1_), CpsCost.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); | ||
548 | new Equality(body, var_Cost, var__virtual_0_); | ||
549 | bodies.add(body); | ||
550 | } | ||
551 | return bodies; | ||
552 | } | ||
553 | } | ||
554 | } | ||
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..1cf09b0d --- /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,749 @@ | |||
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 | switch(parameterName) { | ||
95 | case "Cps": return this.fCps; | ||
96 | case "Cost": return this.fCost; | ||
97 | default: return null; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | @Override | ||
102 | public Object get(final int index) { | ||
103 | switch(index) { | ||
104 | case 0: return this.fCps; | ||
105 | case 1: return this.fCost; | ||
106 | default: return null; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | public CyberPhysicalSystem getCps() { | ||
111 | return this.fCps; | ||
112 | } | ||
113 | |||
114 | public Integer getCost() { | ||
115 | return this.fCost; | ||
116 | } | ||
117 | |||
118 | @Override | ||
119 | public boolean set(final String parameterName, final Object newValue) { | ||
120 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
121 | if ("Cps".equals(parameterName) ) { | ||
122 | this.fCps = (CyberPhysicalSystem) newValue; | ||
123 | return true; | ||
124 | } | ||
125 | if ("Cost".equals(parameterName) ) { | ||
126 | this.fCost = (Integer) newValue; | ||
127 | return true; | ||
128 | } | ||
129 | return false; | ||
130 | } | ||
131 | |||
132 | public void setCps(final CyberPhysicalSystem pCps) { | ||
133 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
134 | this.fCps = pCps; | ||
135 | } | ||
136 | |||
137 | public void setCost(final Integer pCost) { | ||
138 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
139 | this.fCost = pCost; | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public String patternName() { | ||
144 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsCost"; | ||
145 | } | ||
146 | |||
147 | @Override | ||
148 | public List<String> parameterNames() { | ||
149 | return CpsCost.Match.parameterNames; | ||
150 | } | ||
151 | |||
152 | @Override | ||
153 | public Object[] toArray() { | ||
154 | return new Object[]{fCps, fCost}; | ||
155 | } | ||
156 | |||
157 | @Override | ||
158 | public CpsCost.Match toImmutable() { | ||
159 | return isMutable() ? newMatch(fCps, fCost) : this; | ||
160 | } | ||
161 | |||
162 | @Override | ||
163 | public String prettyPrint() { | ||
164 | StringBuilder result = new StringBuilder(); | ||
165 | result.append("\"Cps\"=" + prettyPrintValue(fCps) + ", "); | ||
166 | result.append("\"Cost\"=" + prettyPrintValue(fCost)); | ||
167 | return result.toString(); | ||
168 | } | ||
169 | |||
170 | @Override | ||
171 | public int hashCode() { | ||
172 | return Objects.hash(fCps, fCost); | ||
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 CpsCost.Match)) { | ||
183 | CpsCost.Match other = (CpsCost.Match) obj; | ||
184 | return Objects.equals(fCps, other.fCps) && Objects.equals(fCost, other.fCost); | ||
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 CpsCost specification() { | ||
197 | return CpsCost.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 CpsCost.Match newEmptyMatch() { | ||
208 | return new Mutable(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 pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
216 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
217 | * @return the new, mutable (partial) match object. | ||
218 | * | ||
219 | */ | ||
220 | public static CpsCost.Match newMutableMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
221 | return new Mutable(pCps, pCost); | ||
222 | } | ||
223 | |||
224 | /** | ||
225 | * Returns a new (partial) match. | ||
226 | * This can be used e.g. to call the matcher with a partial match. | ||
227 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
228 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
229 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
230 | * @return the (partial) match object. | ||
231 | * | ||
232 | */ | ||
233 | public static CpsCost.Match newMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
234 | return new Immutable(pCps, pCost); | ||
235 | } | ||
236 | |||
237 | private static final class Mutable extends CpsCost.Match { | ||
238 | Mutable(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
239 | super(pCps, pCost); | ||
240 | } | ||
241 | |||
242 | @Override | ||
243 | public boolean isMutable() { | ||
244 | return true; | ||
245 | } | ||
246 | } | ||
247 | |||
248 | private static final class Immutable extends CpsCost.Match { | ||
249 | Immutable(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
250 | super(pCps, pCost); | ||
251 | } | ||
252 | |||
253 | @Override | ||
254 | public boolean isMutable() { | ||
255 | return false; | ||
256 | } | ||
257 | } | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsCost pattern, | ||
262 | * providing pattern-specific query methods. | ||
263 | * | ||
264 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
265 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
266 | * | ||
267 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
268 | * | ||
269 | * <p>Original source: | ||
270 | * <code><pre> | ||
271 | * pattern cpsCost(Cps : CyberPhysicalSystem, Cost : java Integer) { | ||
272 | * AppCount == count find cpsApplications(Cps, _); | ||
273 | * HostCost == sum find hostInstanceCost(Cps, _, #_); | ||
274 | * Cost == eval(5 AppCount + HostCost); | ||
275 | * } | ||
276 | * </pre></code> | ||
277 | * | ||
278 | * @see Match | ||
279 | * @see CpsCost | ||
280 | * | ||
281 | */ | ||
282 | public static class Matcher extends BaseMatcher<CpsCost.Match> { | ||
283 | /** | ||
284 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
285 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
286 | * | ||
287 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
288 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
289 | * | ||
290 | */ | ||
291 | public static CpsCost.Matcher on(final ViatraQueryEngine engine) { | ||
292 | // check if matcher already exists | ||
293 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
294 | if (matcher == null) { | ||
295 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
296 | } | ||
297 | return matcher; | ||
298 | } | ||
299 | |||
300 | /** | ||
301 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
302 | * @return an initialized matcher | ||
303 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
304 | * | ||
305 | */ | ||
306 | public static CpsCost.Matcher create() { | ||
307 | return new Matcher(); | ||
308 | } | ||
309 | |||
310 | private static final int POSITION_CPS = 0; | ||
311 | |||
312 | private static final int POSITION_COST = 1; | ||
313 | |||
314 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CpsCost.Matcher.class); | ||
315 | |||
316 | /** | ||
317 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
318 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
319 | * | ||
320 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
321 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
322 | * | ||
323 | */ | ||
324 | private Matcher() { | ||
325 | super(querySpecification()); | ||
326 | } | ||
327 | |||
328 | /** | ||
329 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
330 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
331 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
332 | * @return matches represented as a Match object. | ||
333 | * | ||
334 | */ | ||
335 | public Collection<CpsCost.Match> getAllMatches(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
336 | return rawStreamAllMatches(new Object[]{pCps, pCost}).collect(Collectors.toSet()); | ||
337 | } | ||
338 | |||
339 | /** | ||
340 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
341 | * </p> | ||
342 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
343 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
344 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
345 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
346 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
347 | * @return a stream of matches represented as a Match object. | ||
348 | * | ||
349 | */ | ||
350 | public Stream<CpsCost.Match> streamAllMatches(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
351 | return rawStreamAllMatches(new Object[]{pCps, pCost}); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
356 | * Neither determinism nor randomness of selection is guaranteed. | ||
357 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
358 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
359 | * @return a match represented as a Match object, or null if no match is found. | ||
360 | * | ||
361 | */ | ||
362 | public Optional<CpsCost.Match> getOneArbitraryMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
363 | return rawGetOneArbitraryMatch(new Object[]{pCps, pCost}); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
368 | * under any possible substitution of the unspecified parameters (if any). | ||
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 true if the input is a valid (partial) match of the pattern. | ||
372 | * | ||
373 | */ | ||
374 | public boolean hasMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
375 | return rawHasMatch(new Object[]{pCps, pCost}); | ||
376 | } | ||
377 | |||
378 | /** | ||
379 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
380 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
381 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
382 | * @return the number of pattern matches found. | ||
383 | * | ||
384 | */ | ||
385 | public int countMatches(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
386 | return rawCountMatches(new Object[]{pCps, pCost}); | ||
387 | } | ||
388 | |||
389 | /** | ||
390 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
391 | * Neither determinism nor randomness of selection is guaranteed. | ||
392 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
393 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
394 | * @param processor the action that will process the selected match. | ||
395 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
396 | * | ||
397 | */ | ||
398 | public boolean forOneArbitraryMatch(final CyberPhysicalSystem pCps, final Integer pCost, final Consumer<? super CpsCost.Match> processor) { | ||
399 | return rawForOneArbitraryMatch(new Object[]{pCps, pCost}, processor); | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * Returns a new (partial) match. | ||
404 | * This can be used e.g. to call the matcher with a partial match. | ||
405 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
406 | * @param pCps the fixed value of pattern parameter Cps, or null if not bound. | ||
407 | * @param pCost the fixed value of pattern parameter Cost, or null if not bound. | ||
408 | * @return the (partial) match object. | ||
409 | * | ||
410 | */ | ||
411 | public CpsCost.Match newMatch(final CyberPhysicalSystem pCps, final Integer pCost) { | ||
412 | return CpsCost.Match.newMatch(pCps, pCost); | ||
413 | } | ||
414 | |||
415 | /** | ||
416 | * Retrieve the set of values that occur in matches for Cps. | ||
417 | * @return the Set of all values or empty set if there are no matches | ||
418 | * | ||
419 | */ | ||
420 | protected Stream<CyberPhysicalSystem> rawStreamAllValuesOfCps(final Object[] parameters) { | ||
421 | return rawStreamAllValues(POSITION_CPS, parameters).map(CyberPhysicalSystem.class::cast); | ||
422 | } | ||
423 | |||
424 | /** | ||
425 | * Retrieve the set of values that occur in matches for Cps. | ||
426 | * @return the Set of all values or empty set if there are no matches | ||
427 | * | ||
428 | */ | ||
429 | public Set<CyberPhysicalSystem> getAllValuesOfCps() { | ||
430 | return rawStreamAllValuesOfCps(emptyArray()).collect(Collectors.toSet()); | ||
431 | } | ||
432 | |||
433 | /** | ||
434 | * Retrieve the set of values that occur in matches for Cps. | ||
435 | * @return the Set of all values or empty set if there are no matches | ||
436 | * | ||
437 | */ | ||
438 | public Stream<CyberPhysicalSystem> streamAllValuesOfCps() { | ||
439 | return rawStreamAllValuesOfCps(emptyArray()); | ||
440 | } | ||
441 | |||
442 | /** | ||
443 | * Retrieve the set of values that occur in matches for Cps. | ||
444 | * </p> | ||
445 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
446 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
447 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
448 | * | ||
449 | * @return the Stream of all values or empty set if there are no matches | ||
450 | * | ||
451 | */ | ||
452 | public Stream<CyberPhysicalSystem> streamAllValuesOfCps(final CpsCost.Match partialMatch) { | ||
453 | return rawStreamAllValuesOfCps(partialMatch.toArray()); | ||
454 | } | ||
455 | |||
456 | /** | ||
457 | * Retrieve the set of values that occur in matches for Cps. | ||
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<CyberPhysicalSystem> streamAllValuesOfCps(final Integer pCost) { | ||
467 | return rawStreamAllValuesOfCps(new Object[]{null, pCost}); | ||
468 | } | ||
469 | |||
470 | /** | ||
471 | * Retrieve the set of values that occur in matches for Cps. | ||
472 | * @return the Set of all values or empty set if there are no matches | ||
473 | * | ||
474 | */ | ||
475 | public Set<CyberPhysicalSystem> getAllValuesOfCps(final CpsCost.Match partialMatch) { | ||
476 | return rawStreamAllValuesOfCps(partialMatch.toArray()).collect(Collectors.toSet()); | ||
477 | } | ||
478 | |||
479 | /** | ||
480 | * Retrieve the set of values that occur in matches for Cps. | ||
481 | * @return the Set of all values or empty set if there are no matches | ||
482 | * | ||
483 | */ | ||
484 | public Set<CyberPhysicalSystem> getAllValuesOfCps(final Integer pCost) { | ||
485 | return rawStreamAllValuesOfCps(new Object[]{null, pCost}).collect(Collectors.toSet()); | ||
486 | } | ||
487 | |||
488 | /** | ||
489 | * Retrieve the set of values that occur in matches for Cost. | ||
490 | * @return the Set of all values or empty set if there are no matches | ||
491 | * | ||
492 | */ | ||
493 | protected Stream<Integer> rawStreamAllValuesOfCost(final Object[] parameters) { | ||
494 | return rawStreamAllValues(POSITION_COST, parameters).map(Integer.class::cast); | ||
495 | } | ||
496 | |||
497 | /** | ||
498 | * Retrieve the set of values that occur in matches for Cost. | ||
499 | * @return the Set of all values or empty set if there are no matches | ||
500 | * | ||
501 | */ | ||
502 | public Set<Integer> getAllValuesOfCost() { | ||
503 | return rawStreamAllValuesOfCost(emptyArray()).collect(Collectors.toSet()); | ||
504 | } | ||
505 | |||
506 | /** | ||
507 | * Retrieve the set of values that occur in matches for Cost. | ||
508 | * @return the Set of all values or empty set if there are no matches | ||
509 | * | ||
510 | */ | ||
511 | public Stream<Integer> streamAllValuesOfCost() { | ||
512 | return rawStreamAllValuesOfCost(emptyArray()); | ||
513 | } | ||
514 | |||
515 | /** | ||
516 | * Retrieve the set of values that occur in matches for Cost. | ||
517 | * </p> | ||
518 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
519 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
520 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
521 | * | ||
522 | * @return the Stream of all values or empty set if there are no matches | ||
523 | * | ||
524 | */ | ||
525 | public Stream<Integer> streamAllValuesOfCost(final CpsCost.Match partialMatch) { | ||
526 | return rawStreamAllValuesOfCost(partialMatch.toArray()); | ||
527 | } | ||
528 | |||
529 | /** | ||
530 | * Retrieve the set of values that occur in matches for Cost. | ||
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<Integer> streamAllValuesOfCost(final CyberPhysicalSystem pCps) { | ||
540 | return rawStreamAllValuesOfCost(new Object[]{pCps, null}); | ||
541 | } | ||
542 | |||
543 | /** | ||
544 | * Retrieve the set of values that occur in matches for Cost. | ||
545 | * @return the Set of all values or empty set if there are no matches | ||
546 | * | ||
547 | */ | ||
548 | public Set<Integer> getAllValuesOfCost(final CpsCost.Match partialMatch) { | ||
549 | return rawStreamAllValuesOfCost(partialMatch.toArray()).collect(Collectors.toSet()); | ||
550 | } | ||
551 | |||
552 | /** | ||
553 | * Retrieve the set of values that occur in matches for Cost. | ||
554 | * @return the Set of all values or empty set if there are no matches | ||
555 | * | ||
556 | */ | ||
557 | public Set<Integer> getAllValuesOfCost(final CyberPhysicalSystem pCps) { | ||
558 | return rawStreamAllValuesOfCost(new Object[]{pCps, null}).collect(Collectors.toSet()); | ||
559 | } | ||
560 | |||
561 | @Override | ||
562 | protected CpsCost.Match tupleToMatch(final Tuple t) { | ||
563 | try { | ||
564 | return CpsCost.Match.newMatch((CyberPhysicalSystem) t.get(POSITION_CPS), (Integer) t.get(POSITION_COST)); | ||
565 | } catch(ClassCastException e) { | ||
566 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
567 | return null; | ||
568 | } | ||
569 | } | ||
570 | |||
571 | @Override | ||
572 | protected CpsCost.Match arrayToMatch(final Object[] match) { | ||
573 | try { | ||
574 | return CpsCost.Match.newMatch((CyberPhysicalSystem) match[POSITION_CPS], (Integer) match[POSITION_COST]); | ||
575 | } catch(ClassCastException e) { | ||
576 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
577 | return null; | ||
578 | } | ||
579 | } | ||
580 | |||
581 | @Override | ||
582 | protected CpsCost.Match arrayToMatchMutable(final Object[] match) { | ||
583 | try { | ||
584 | return CpsCost.Match.newMutableMatch((CyberPhysicalSystem) match[POSITION_CPS], (Integer) match[POSITION_COST]); | ||
585 | } catch(ClassCastException e) { | ||
586 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
587 | return null; | ||
588 | } | ||
589 | } | ||
590 | |||
591 | /** | ||
592 | * @return the singleton instance of the query specification of this pattern | ||
593 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
594 | * | ||
595 | */ | ||
596 | public static IQuerySpecification<CpsCost.Matcher> querySpecification() { | ||
597 | return CpsCost.instance(); | ||
598 | } | ||
599 | } | ||
600 | |||
601 | private CpsCost() { | ||
602 | super(GeneratedPQuery.INSTANCE); | ||
603 | } | ||
604 | |||
605 | /** | ||
606 | * @return the singleton instance of the query specification | ||
607 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
608 | * | ||
609 | */ | ||
610 | public static CpsCost instance() { | ||
611 | try{ | ||
612 | return LazyHolder.INSTANCE; | ||
613 | } catch (ExceptionInInitializerError err) { | ||
614 | throw processInitializerError(err); | ||
615 | } | ||
616 | } | ||
617 | |||
618 | @Override | ||
619 | protected CpsCost.Matcher instantiate(final ViatraQueryEngine engine) { | ||
620 | return CpsCost.Matcher.on(engine); | ||
621 | } | ||
622 | |||
623 | @Override | ||
624 | public CpsCost.Matcher instantiate() { | ||
625 | return CpsCost.Matcher.create(); | ||
626 | } | ||
627 | |||
628 | @Override | ||
629 | public CpsCost.Match newEmptyMatch() { | ||
630 | return CpsCost.Match.newEmptyMatch(); | ||
631 | } | ||
632 | |||
633 | @Override | ||
634 | public CpsCost.Match newMatch(final Object... parameters) { | ||
635 | return CpsCost.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem) parameters[0], (java.lang.Integer) parameters[1]); | ||
636 | } | ||
637 | |||
638 | /** | ||
639 | * Inner class allowing the singleton instance of {@link CpsCost} to be created | ||
640 | * <b>not</b> at the class load time of the outer class, | ||
641 | * but rather at the first call to {@link CpsCost#instance()}. | ||
642 | * | ||
643 | * <p> This workaround is required e.g. to support recursion. | ||
644 | * | ||
645 | */ | ||
646 | private static class LazyHolder { | ||
647 | private static final CpsCost INSTANCE = new CpsCost(); | ||
648 | |||
649 | /** | ||
650 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
651 | * This initialization order is required to support indirect recursion. | ||
652 | * | ||
653 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
654 | * | ||
655 | */ | ||
656 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
657 | |||
658 | public static Object ensureInitialized() { | ||
659 | INSTANCE.ensureInitializedInternal(); | ||
660 | return null; | ||
661 | } | ||
662 | } | ||
663 | |||
664 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
665 | private static final CpsCost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
666 | |||
667 | 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); | ||
668 | |||
669 | private final PParameter parameter_Cost = new PParameter("Cost", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
670 | |||
671 | private final List<PParameter> parameters = Arrays.asList(parameter_Cps, parameter_Cost); | ||
672 | |||
673 | private GeneratedPQuery() { | ||
674 | super(PVisibility.PUBLIC); | ||
675 | } | ||
676 | |||
677 | @Override | ||
678 | public String getFullyQualifiedName() { | ||
679 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.cpsCost"; | ||
680 | } | ||
681 | |||
682 | @Override | ||
683 | public List<String> getParameterNames() { | ||
684 | return Arrays.asList("Cps","Cost"); | ||
685 | } | ||
686 | |||
687 | @Override | ||
688 | public List<PParameter> getParameters() { | ||
689 | return parameters; | ||
690 | } | ||
691 | |||
692 | @Override | ||
693 | public Set<PBody> doGetContainedBodies() { | ||
694 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
695 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
696 | { | ||
697 | PBody body = new PBody(this); | ||
698 | PVariable var_Cps = body.getOrCreateVariableByName("Cps"); | ||
699 | PVariable var_Cost = body.getOrCreateVariableByName("Cost"); | ||
700 | PVariable var_AppCount = body.getOrCreateVariableByName("AppCount"); | ||
701 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
702 | PVariable var_HostCost = body.getOrCreateVariableByName("HostCost"); | ||
703 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
704 | PVariable var___2_ = body.getOrCreateVariableByName("_<2>"); | ||
705 | new TypeConstraint(body, Tuples.flatTupleOf(var_Cps), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "CyberPhysicalSystem"))); | ||
706 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Cost), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
707 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
708 | new ExportedParameter(body, var_Cps, parameter_Cps), | ||
709 | new ExportedParameter(body, var_Cost, parameter_Cost) | ||
710 | )); | ||
711 | // AppCount == count find cpsApplications(Cps, _) | ||
712 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
713 | new PatternMatchCounter(body, Tuples.flatTupleOf(var_Cps, var___0_), CpsApplications.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
714 | new Equality(body, var_AppCount, var__virtual_0_); | ||
715 | // HostCost == sum find hostInstanceCost(Cps, _, #_) | ||
716 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
717 | new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var_Cps, var___1_, var___2_), HostInstanceCost.instance().getInternalQueryRepresentation(), var__virtual_1_, 2); | ||
718 | new Equality(body, var_HostCost, var__virtual_1_); | ||
719 | // Cost == eval(5 * AppCount + HostCost) | ||
720 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
721 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
722 | |||
723 | @Override | ||
724 | public String getShortDescription() { | ||
725 | return "Expression evaluation from pattern cpsCost"; | ||
726 | } | ||
727 | |||
728 | @Override | ||
729 | public Iterable<String> getInputParameterNames() { | ||
730 | return Arrays.asList("AppCount", "HostCost");} | ||
731 | |||
732 | @Override | ||
733 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
734 | Integer AppCount = (Integer) provider.getValue("AppCount"); | ||
735 | Integer HostCost = (Integer) provider.getValue("HostCost"); | ||
736 | return evaluateExpression_1_1(AppCount, HostCost); | ||
737 | } | ||
738 | }, var__virtual_2_ ); | ||
739 | new Equality(body, var_Cost, var__virtual_2_); | ||
740 | bodies.add(body); | ||
741 | } | ||
742 | return bodies; | ||
743 | } | ||
744 | } | ||
745 | |||
746 | private static int evaluateExpression_1_1(final Integer AppCount, final Integer HostCost) { | ||
747 | return ((5 * (AppCount).intValue()) + (HostCost).intValue()); | ||
748 | } | ||
749 | } | ||
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..04036e11 --- /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,563 @@ | |||
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 | switch(parameterName) { | ||
84 | case "HostType": return this.fHostType; | ||
85 | default: return null; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | @Override | ||
90 | public Object get(final int index) { | ||
91 | switch(index) { | ||
92 | case 0: return this.fHostType; | ||
93 | default: return null; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | public HostType getHostType() { | ||
98 | return this.fHostType; | ||
99 | } | ||
100 | |||
101 | @Override | ||
102 | public boolean set(final String parameterName, final Object newValue) { | ||
103 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
104 | if ("HostType".equals(parameterName) ) { | ||
105 | this.fHostType = (HostType) newValue; | ||
106 | return true; | ||
107 | } | ||
108 | return false; | ||
109 | } | ||
110 | |||
111 | public void setHostType(final HostType pHostType) { | ||
112 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
113 | this.fHostType = pHostType; | ||
114 | } | ||
115 | |||
116 | @Override | ||
117 | public String patternName() { | ||
118 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.createHostInstance"; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public List<String> parameterNames() { | ||
123 | return CreateHostInstance.Match.parameterNames; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public Object[] toArray() { | ||
128 | return new Object[]{fHostType}; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public CreateHostInstance.Match toImmutable() { | ||
133 | return isMutable() ? newMatch(fHostType) : this; | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public String prettyPrint() { | ||
138 | StringBuilder result = new StringBuilder(); | ||
139 | result.append("\"HostType\"=" + prettyPrintValue(fHostType)); | ||
140 | return result.toString(); | ||
141 | } | ||
142 | |||
143 | @Override | ||
144 | public int hashCode() { | ||
145 | return Objects.hash(fHostType); | ||
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 CreateHostInstance.Match)) { | ||
156 | CreateHostInstance.Match other = (CreateHostInstance.Match) obj; | ||
157 | return Objects.equals(fHostType, other.fHostType); | ||
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 CreateHostInstance specification() { | ||
170 | return CreateHostInstance.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 CreateHostInstance.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 pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
189 | * @return the new, mutable (partial) match object. | ||
190 | * | ||
191 | */ | ||
192 | public static CreateHostInstance.Match newMutableMatch(final HostType pHostType) { | ||
193 | return new Mutable(pHostType); | ||
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 pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
201 | * @return the (partial) match object. | ||
202 | * | ||
203 | */ | ||
204 | public static CreateHostInstance.Match newMatch(final HostType pHostType) { | ||
205 | return new Immutable(pHostType); | ||
206 | } | ||
207 | |||
208 | private static final class Mutable extends CreateHostInstance.Match { | ||
209 | Mutable(final HostType pHostType) { | ||
210 | super(pHostType); | ||
211 | } | ||
212 | |||
213 | @Override | ||
214 | public boolean isMutable() { | ||
215 | return true; | ||
216 | } | ||
217 | } | ||
218 | |||
219 | private static final class Immutable extends CreateHostInstance.Match { | ||
220 | Immutable(final HostType pHostType) { | ||
221 | super(pHostType); | ||
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.createHostInstance 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 | * pattern createHostInstance(HostType : HostType) { | ||
243 | * find unallocatedAppInstance(App); | ||
244 | * ApplicationInstance.type.requirements.hostType(App, HostType); | ||
245 | * } | ||
246 | * </pre></code> | ||
247 | * | ||
248 | * @see Match | ||
249 | * @see CreateHostInstance | ||
250 | * | ||
251 | */ | ||
252 | public static class Matcher extends BaseMatcher<CreateHostInstance.Match> { | ||
253 | /** | ||
254 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
255 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
256 | * | ||
257 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
258 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
259 | * | ||
260 | */ | ||
261 | public static CreateHostInstance.Matcher on(final ViatraQueryEngine engine) { | ||
262 | // check if matcher already exists | ||
263 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
264 | if (matcher == null) { | ||
265 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
266 | } | ||
267 | return matcher; | ||
268 | } | ||
269 | |||
270 | /** | ||
271 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
272 | * @return an initialized matcher | ||
273 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
274 | * | ||
275 | */ | ||
276 | public static CreateHostInstance.Matcher create() { | ||
277 | return new Matcher(); | ||
278 | } | ||
279 | |||
280 | private static final int POSITION_HOSTTYPE = 0; | ||
281 | |||
282 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CreateHostInstance.Matcher.class); | ||
283 | |||
284 | /** | ||
285 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
286 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
287 | * | ||
288 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
289 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
290 | * | ||
291 | */ | ||
292 | private Matcher() { | ||
293 | super(querySpecification()); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
298 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
299 | * @return matches represented as a Match object. | ||
300 | * | ||
301 | */ | ||
302 | public Collection<CreateHostInstance.Match> getAllMatches(final HostType pHostType) { | ||
303 | return rawStreamAllMatches(new Object[]{pHostType}).collect(Collectors.toSet()); | ||
304 | } | ||
305 | |||
306 | /** | ||
307 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
308 | * </p> | ||
309 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
310 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
311 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
312 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
313 | * @return a stream of matches represented as a Match object. | ||
314 | * | ||
315 | */ | ||
316 | public Stream<CreateHostInstance.Match> streamAllMatches(final HostType pHostType) { | ||
317 | return rawStreamAllMatches(new Object[]{pHostType}); | ||
318 | } | ||
319 | |||
320 | /** | ||
321 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
322 | * Neither determinism nor randomness of selection is guaranteed. | ||
323 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
324 | * @return a match represented as a Match object, or null if no match is found. | ||
325 | * | ||
326 | */ | ||
327 | public Optional<CreateHostInstance.Match> getOneArbitraryMatch(final HostType pHostType) { | ||
328 | return rawGetOneArbitraryMatch(new Object[]{pHostType}); | ||
329 | } | ||
330 | |||
331 | /** | ||
332 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
333 | * under any possible substitution of the unspecified parameters (if any). | ||
334 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
335 | * @return true if the input is a valid (partial) match of the pattern. | ||
336 | * | ||
337 | */ | ||
338 | public boolean hasMatch(final HostType pHostType) { | ||
339 | return rawHasMatch(new Object[]{pHostType}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
344 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
345 | * @return the number of pattern matches found. | ||
346 | * | ||
347 | */ | ||
348 | public int countMatches(final HostType pHostType) { | ||
349 | return rawCountMatches(new Object[]{pHostType}); | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
354 | * Neither determinism nor randomness of selection is guaranteed. | ||
355 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
356 | * @param processor the action that will process the selected match. | ||
357 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
358 | * | ||
359 | */ | ||
360 | public boolean forOneArbitraryMatch(final HostType pHostType, final Consumer<? super CreateHostInstance.Match> processor) { | ||
361 | return rawForOneArbitraryMatch(new Object[]{pHostType}, processor); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * Returns a new (partial) match. | ||
366 | * This can be used e.g. to call the matcher with a partial match. | ||
367 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
368 | * @param pHostType the fixed value of pattern parameter HostType, or null if not bound. | ||
369 | * @return the (partial) match object. | ||
370 | * | ||
371 | */ | ||
372 | public CreateHostInstance.Match newMatch(final HostType pHostType) { | ||
373 | return CreateHostInstance.Match.newMatch(pHostType); | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * Retrieve the set of values that occur in matches for HostType. | ||
378 | * @return the Set of all values or empty set if there are no matches | ||
379 | * | ||
380 | */ | ||
381 | protected Stream<HostType> rawStreamAllValuesOfHostType(final Object[] parameters) { | ||
382 | return rawStreamAllValues(POSITION_HOSTTYPE, parameters).map(HostType.class::cast); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * Retrieve the set of values that occur in matches for HostType. | ||
387 | * @return the Set of all values or empty set if there are no matches | ||
388 | * | ||
389 | */ | ||
390 | public Set<HostType> getAllValuesOfHostType() { | ||
391 | return rawStreamAllValuesOfHostType(emptyArray()).collect(Collectors.toSet()); | ||
392 | } | ||
393 | |||
394 | /** | ||
395 | * Retrieve the set of values that occur in matches for HostType. | ||
396 | * @return the Set of all values or empty set if there are no matches | ||
397 | * | ||
398 | */ | ||
399 | public Stream<HostType> streamAllValuesOfHostType() { | ||
400 | return rawStreamAllValuesOfHostType(emptyArray()); | ||
401 | } | ||
402 | |||
403 | @Override | ||
404 | protected CreateHostInstance.Match tupleToMatch(final Tuple t) { | ||
405 | try { | ||
406 | return CreateHostInstance.Match.newMatch((HostType) t.get(POSITION_HOSTTYPE)); | ||
407 | } catch(ClassCastException e) { | ||
408 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
409 | return null; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | @Override | ||
414 | protected CreateHostInstance.Match arrayToMatch(final Object[] match) { | ||
415 | try { | ||
416 | return CreateHostInstance.Match.newMatch((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 | @Override | ||
424 | protected CreateHostInstance.Match arrayToMatchMutable(final Object[] match) { | ||
425 | try { | ||
426 | return CreateHostInstance.Match.newMutableMatch((HostType) match[POSITION_HOSTTYPE]); | ||
427 | } catch(ClassCastException e) { | ||
428 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
429 | return null; | ||
430 | } | ||
431 | } | ||
432 | |||
433 | /** | ||
434 | * @return the singleton instance of the query specification of this pattern | ||
435 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
436 | * | ||
437 | */ | ||
438 | public static IQuerySpecification<CreateHostInstance.Matcher> querySpecification() { | ||
439 | return CreateHostInstance.instance(); | ||
440 | } | ||
441 | } | ||
442 | |||
443 | private CreateHostInstance() { | ||
444 | super(GeneratedPQuery.INSTANCE); | ||
445 | } | ||
446 | |||
447 | /** | ||
448 | * @return the singleton instance of the query specification | ||
449 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
450 | * | ||
451 | */ | ||
452 | public static CreateHostInstance instance() { | ||
453 | try{ | ||
454 | return LazyHolder.INSTANCE; | ||
455 | } catch (ExceptionInInitializerError err) { | ||
456 | throw processInitializerError(err); | ||
457 | } | ||
458 | } | ||
459 | |||
460 | @Override | ||
461 | protected CreateHostInstance.Matcher instantiate(final ViatraQueryEngine engine) { | ||
462 | return CreateHostInstance.Matcher.on(engine); | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | public CreateHostInstance.Matcher instantiate() { | ||
467 | return CreateHostInstance.Matcher.create(); | ||
468 | } | ||
469 | |||
470 | @Override | ||
471 | public CreateHostInstance.Match newEmptyMatch() { | ||
472 | return CreateHostInstance.Match.newEmptyMatch(); | ||
473 | } | ||
474 | |||
475 | @Override | ||
476 | public CreateHostInstance.Match newMatch(final Object... parameters) { | ||
477 | return CreateHostInstance.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostType) parameters[0]); | ||
478 | } | ||
479 | |||
480 | /** | ||
481 | * Inner class allowing the singleton instance of {@link CreateHostInstance} to be created | ||
482 | * <b>not</b> at the class load time of the outer class, | ||
483 | * but rather at the first call to {@link CreateHostInstance#instance()}. | ||
484 | * | ||
485 | * <p> This workaround is required e.g. to support recursion. | ||
486 | * | ||
487 | */ | ||
488 | private static class LazyHolder { | ||
489 | private static final CreateHostInstance INSTANCE = new CreateHostInstance(); | ||
490 | |||
491 | /** | ||
492 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
493 | * This initialization order is required to support indirect recursion. | ||
494 | * | ||
495 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
496 | * | ||
497 | */ | ||
498 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
499 | |||
500 | public static Object ensureInitialized() { | ||
501 | INSTANCE.ensureInitializedInternal(); | ||
502 | return null; | ||
503 | } | ||
504 | } | ||
505 | |||
506 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
507 | private static final CreateHostInstance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
508 | |||
509 | 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); | ||
510 | |||
511 | private final List<PParameter> parameters = Arrays.asList(parameter_HostType); | ||
512 | |||
513 | private GeneratedPQuery() { | ||
514 | super(PVisibility.PUBLIC); | ||
515 | } | ||
516 | |||
517 | @Override | ||
518 | public String getFullyQualifiedName() { | ||
519 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.createHostInstance"; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public List<String> getParameterNames() { | ||
524 | return Arrays.asList("HostType"); | ||
525 | } | ||
526 | |||
527 | @Override | ||
528 | public List<PParameter> getParameters() { | ||
529 | return parameters; | ||
530 | } | ||
531 | |||
532 | @Override | ||
533 | public Set<PBody> doGetContainedBodies() { | ||
534 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
535 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
536 | { | ||
537 | PBody body = new PBody(this); | ||
538 | PVariable var_HostType = body.getOrCreateVariableByName("HostType"); | ||
539 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
540 | new TypeConstraint(body, Tuples.flatTupleOf(var_HostType), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
541 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
542 | new ExportedParameter(body, var_HostType, parameter_HostType) | ||
543 | )); | ||
544 | // find unallocatedAppInstance(App) | ||
545 | new PositivePatternCall(body, Tuples.flatTupleOf(var_App), UnallocatedAppInstance.instance().getInternalQueryRepresentation()); | ||
546 | // ApplicationInstance.type.requirements.hostType(App, HostType) | ||
547 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
548 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
549 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "type"))); | ||
550 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationType"))); | ||
551 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
552 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationType", "requirements"))); | ||
553 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
554 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
555 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "hostType"))); | ||
556 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
557 | new Equality(body, var__virtual_2_, var_HostType); | ||
558 | bodies.add(body); | ||
559 | } | ||
560 | return bodies; | ||
561 | } | ||
562 | } | ||
563 | } | ||
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..1ed6c9cc --- /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,601 @@ | |||
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 | switch(parameterName) { | ||
90 | case "Value": return this.fValue; | ||
91 | default: return null; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | @Override | ||
96 | public Object get(final int index) { | ||
97 | switch(index) { | ||
98 | case 0: return this.fValue; | ||
99 | default: return null; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | public Integer getValue() { | ||
104 | return this.fValue; | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public boolean set(final String parameterName, final Object newValue) { | ||
109 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
110 | if ("Value".equals(parameterName) ) { | ||
111 | this.fValue = (Integer) newValue; | ||
112 | return true; | ||
113 | } | ||
114 | return false; | ||
115 | } | ||
116 | |||
117 | public void setValue(final Integer pValue) { | ||
118 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
119 | this.fValue = pValue; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public String patternName() { | ||
124 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.guidanceObjective"; | ||
125 | } | ||
126 | |||
127 | @Override | ||
128 | public List<String> parameterNames() { | ||
129 | return GuidanceObjective.Match.parameterNames; | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public Object[] toArray() { | ||
134 | return new Object[]{fValue}; | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public GuidanceObjective.Match toImmutable() { | ||
139 | return isMutable() ? newMatch(fValue) : this; | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public String prettyPrint() { | ||
144 | StringBuilder result = new StringBuilder(); | ||
145 | result.append("\"Value\"=" + prettyPrintValue(fValue)); | ||
146 | return result.toString(); | ||
147 | } | ||
148 | |||
149 | @Override | ||
150 | public int hashCode() { | ||
151 | return Objects.hash(fValue); | ||
152 | } | ||
153 | |||
154 | @Override | ||
155 | public boolean equals(final Object obj) { | ||
156 | if (this == obj) | ||
157 | return true; | ||
158 | if (obj == null) { | ||
159 | return false; | ||
160 | } | ||
161 | if ((obj instanceof GuidanceObjective.Match)) { | ||
162 | GuidanceObjective.Match other = (GuidanceObjective.Match) obj; | ||
163 | return Objects.equals(fValue, other.fValue); | ||
164 | } else { | ||
165 | // this should be infrequent | ||
166 | if (!(obj instanceof IPatternMatch)) { | ||
167 | return false; | ||
168 | } | ||
169 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
170 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | @Override | ||
175 | public GuidanceObjective specification() { | ||
176 | return GuidanceObjective.instance(); | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * Returns an empty, mutable match. | ||
181 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
182 | * | ||
183 | * @return the empty match. | ||
184 | * | ||
185 | */ | ||
186 | public static GuidanceObjective.Match newEmptyMatch() { | ||
187 | return new Mutable(null); | ||
188 | } | ||
189 | |||
190 | /** | ||
191 | * Returns a mutable (partial) match. | ||
192 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
193 | * | ||
194 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
195 | * @return the new, mutable (partial) match object. | ||
196 | * | ||
197 | */ | ||
198 | public static GuidanceObjective.Match newMutableMatch(final Integer pValue) { | ||
199 | return new Mutable(pValue); | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * Returns a new (partial) match. | ||
204 | * This can be used e.g. to call the matcher with a partial match. | ||
205 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
206 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
207 | * @return the (partial) match object. | ||
208 | * | ||
209 | */ | ||
210 | public static GuidanceObjective.Match newMatch(final Integer pValue) { | ||
211 | return new Immutable(pValue); | ||
212 | } | ||
213 | |||
214 | private static final class Mutable extends GuidanceObjective.Match { | ||
215 | Mutable(final Integer pValue) { | ||
216 | super(pValue); | ||
217 | } | ||
218 | |||
219 | @Override | ||
220 | public boolean isMutable() { | ||
221 | return true; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | private static final class Immutable extends GuidanceObjective.Match { | ||
226 | Immutable(final Integer pValue) { | ||
227 | super(pValue); | ||
228 | } | ||
229 | |||
230 | @Override | ||
231 | public boolean isMutable() { | ||
232 | return false; | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | |||
237 | /** | ||
238 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.guidanceObjective pattern, | ||
239 | * providing pattern-specific query methods. | ||
240 | * | ||
241 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
242 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
243 | * | ||
244 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
245 | * | ||
246 | * <p>Original source: | ||
247 | * <code><pre> | ||
248 | * pattern guidanceObjective(Value : java Integer) { | ||
249 | * UnallocatedInstances == count find unallocatedAppInstance(_); | ||
250 | * RequiredInstances == sum find requiredAppInstances(_, #_); | ||
251 | * NoHostToAllocate == count find noHostToAllocateTo(_); | ||
252 | * Value == eval(2 UnallocatedInstances + 4 RequiredInstances + NoHostToAllocate); | ||
253 | * } | ||
254 | * </pre></code> | ||
255 | * | ||
256 | * @see Match | ||
257 | * @see GuidanceObjective | ||
258 | * | ||
259 | */ | ||
260 | public static class Matcher extends BaseMatcher<GuidanceObjective.Match> { | ||
261 | /** | ||
262 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
263 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
264 | * | ||
265 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
266 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
267 | * | ||
268 | */ | ||
269 | public static GuidanceObjective.Matcher on(final ViatraQueryEngine engine) { | ||
270 | // check if matcher already exists | ||
271 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
272 | if (matcher == null) { | ||
273 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
274 | } | ||
275 | return matcher; | ||
276 | } | ||
277 | |||
278 | /** | ||
279 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
280 | * @return an initialized matcher | ||
281 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
282 | * | ||
283 | */ | ||
284 | public static GuidanceObjective.Matcher create() { | ||
285 | return new Matcher(); | ||
286 | } | ||
287 | |||
288 | private static final int POSITION_VALUE = 0; | ||
289 | |||
290 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(GuidanceObjective.Matcher.class); | ||
291 | |||
292 | /** | ||
293 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
294 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
295 | * | ||
296 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
297 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
298 | * | ||
299 | */ | ||
300 | private Matcher() { | ||
301 | super(querySpecification()); | ||
302 | } | ||
303 | |||
304 | /** | ||
305 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
306 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
307 | * @return matches represented as a Match object. | ||
308 | * | ||
309 | */ | ||
310 | public Collection<GuidanceObjective.Match> getAllMatches(final Integer pValue) { | ||
311 | return rawStreamAllMatches(new Object[]{pValue}).collect(Collectors.toSet()); | ||
312 | } | ||
313 | |||
314 | /** | ||
315 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
316 | * </p> | ||
317 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
318 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
319 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
320 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
321 | * @return a stream of matches represented as a Match object. | ||
322 | * | ||
323 | */ | ||
324 | public Stream<GuidanceObjective.Match> streamAllMatches(final Integer pValue) { | ||
325 | return rawStreamAllMatches(new Object[]{pValue}); | ||
326 | } | ||
327 | |||
328 | /** | ||
329 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
330 | * Neither determinism nor randomness of selection is guaranteed. | ||
331 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
332 | * @return a match represented as a Match object, or null if no match is found. | ||
333 | * | ||
334 | */ | ||
335 | public Optional<GuidanceObjective.Match> getOneArbitraryMatch(final Integer pValue) { | ||
336 | return rawGetOneArbitraryMatch(new Object[]{pValue}); | ||
337 | } | ||
338 | |||
339 | /** | ||
340 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
341 | * under any possible substitution of the unspecified parameters (if any). | ||
342 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
343 | * @return true if the input is a valid (partial) match of the pattern. | ||
344 | * | ||
345 | */ | ||
346 | public boolean hasMatch(final Integer pValue) { | ||
347 | return rawHasMatch(new Object[]{pValue}); | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
352 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
353 | * @return the number of pattern matches found. | ||
354 | * | ||
355 | */ | ||
356 | public int countMatches(final Integer pValue) { | ||
357 | return rawCountMatches(new Object[]{pValue}); | ||
358 | } | ||
359 | |||
360 | /** | ||
361 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
362 | * Neither determinism nor randomness of selection is guaranteed. | ||
363 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
364 | * @param processor the action that will process the selected match. | ||
365 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
366 | * | ||
367 | */ | ||
368 | public boolean forOneArbitraryMatch(final Integer pValue, final Consumer<? super GuidanceObjective.Match> processor) { | ||
369 | return rawForOneArbitraryMatch(new Object[]{pValue}, processor); | ||
370 | } | ||
371 | |||
372 | /** | ||
373 | * Returns a new (partial) match. | ||
374 | * This can be used e.g. to call the matcher with a partial match. | ||
375 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
376 | * @param pValue the fixed value of pattern parameter Value, or null if not bound. | ||
377 | * @return the (partial) match object. | ||
378 | * | ||
379 | */ | ||
380 | public GuidanceObjective.Match newMatch(final Integer pValue) { | ||
381 | return GuidanceObjective.Match.newMatch(pValue); | ||
382 | } | ||
383 | |||
384 | /** | ||
385 | * Retrieve the set of values that occur in matches for Value. | ||
386 | * @return the Set of all values or empty set if there are no matches | ||
387 | * | ||
388 | */ | ||
389 | protected Stream<Integer> rawStreamAllValuesOfValue(final Object[] parameters) { | ||
390 | return rawStreamAllValues(POSITION_VALUE, parameters).map(Integer.class::cast); | ||
391 | } | ||
392 | |||
393 | /** | ||
394 | * Retrieve the set of values that occur in matches for Value. | ||
395 | * @return the Set of all values or empty set if there are no matches | ||
396 | * | ||
397 | */ | ||
398 | public Set<Integer> getAllValuesOfValue() { | ||
399 | return rawStreamAllValuesOfValue(emptyArray()).collect(Collectors.toSet()); | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * Retrieve the set of values that occur in matches for Value. | ||
404 | * @return the Set of all values or empty set if there are no matches | ||
405 | * | ||
406 | */ | ||
407 | public Stream<Integer> streamAllValuesOfValue() { | ||
408 | return rawStreamAllValuesOfValue(emptyArray()); | ||
409 | } | ||
410 | |||
411 | @Override | ||
412 | protected GuidanceObjective.Match tupleToMatch(final Tuple t) { | ||
413 | try { | ||
414 | return GuidanceObjective.Match.newMatch((Integer) t.get(POSITION_VALUE)); | ||
415 | } catch(ClassCastException e) { | ||
416 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
417 | return null; | ||
418 | } | ||
419 | } | ||
420 | |||
421 | @Override | ||
422 | protected GuidanceObjective.Match arrayToMatch(final Object[] match) { | ||
423 | try { | ||
424 | return GuidanceObjective.Match.newMatch((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 | @Override | ||
432 | protected GuidanceObjective.Match arrayToMatchMutable(final Object[] match) { | ||
433 | try { | ||
434 | return GuidanceObjective.Match.newMutableMatch((Integer) match[POSITION_VALUE]); | ||
435 | } catch(ClassCastException e) { | ||
436 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
437 | return null; | ||
438 | } | ||
439 | } | ||
440 | |||
441 | /** | ||
442 | * @return the singleton instance of the query specification of this pattern | ||
443 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
444 | * | ||
445 | */ | ||
446 | public static IQuerySpecification<GuidanceObjective.Matcher> querySpecification() { | ||
447 | return GuidanceObjective.instance(); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | private GuidanceObjective() { | ||
452 | super(GeneratedPQuery.INSTANCE); | ||
453 | } | ||
454 | |||
455 | /** | ||
456 | * @return the singleton instance of the query specification | ||
457 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
458 | * | ||
459 | */ | ||
460 | public static GuidanceObjective instance() { | ||
461 | try{ | ||
462 | return LazyHolder.INSTANCE; | ||
463 | } catch (ExceptionInInitializerError err) { | ||
464 | throw processInitializerError(err); | ||
465 | } | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | protected GuidanceObjective.Matcher instantiate(final ViatraQueryEngine engine) { | ||
470 | return GuidanceObjective.Matcher.on(engine); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public GuidanceObjective.Matcher instantiate() { | ||
475 | return GuidanceObjective.Matcher.create(); | ||
476 | } | ||
477 | |||
478 | @Override | ||
479 | public GuidanceObjective.Match newEmptyMatch() { | ||
480 | return GuidanceObjective.Match.newEmptyMatch(); | ||
481 | } | ||
482 | |||
483 | @Override | ||
484 | public GuidanceObjective.Match newMatch(final Object... parameters) { | ||
485 | return GuidanceObjective.Match.newMatch((java.lang.Integer) parameters[0]); | ||
486 | } | ||
487 | |||
488 | /** | ||
489 | * Inner class allowing the singleton instance of {@link GuidanceObjective} to be created | ||
490 | * <b>not</b> at the class load time of the outer class, | ||
491 | * but rather at the first call to {@link GuidanceObjective#instance()}. | ||
492 | * | ||
493 | * <p> This workaround is required e.g. to support recursion. | ||
494 | * | ||
495 | */ | ||
496 | private static class LazyHolder { | ||
497 | private static final GuidanceObjective INSTANCE = new GuidanceObjective(); | ||
498 | |||
499 | /** | ||
500 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
501 | * This initialization order is required to support indirect recursion. | ||
502 | * | ||
503 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
504 | * | ||
505 | */ | ||
506 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
507 | |||
508 | public static Object ensureInitialized() { | ||
509 | INSTANCE.ensureInitializedInternal(); | ||
510 | return null; | ||
511 | } | ||
512 | } | ||
513 | |||
514 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
515 | private static final GuidanceObjective.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
516 | |||
517 | private final PParameter parameter_Value = new PParameter("Value", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
518 | |||
519 | private final List<PParameter> parameters = Arrays.asList(parameter_Value); | ||
520 | |||
521 | private GeneratedPQuery() { | ||
522 | super(PVisibility.PUBLIC); | ||
523 | } | ||
524 | |||
525 | @Override | ||
526 | public String getFullyQualifiedName() { | ||
527 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.guidanceObjective"; | ||
528 | } | ||
529 | |||
530 | @Override | ||
531 | public List<String> getParameterNames() { | ||
532 | return Arrays.asList("Value"); | ||
533 | } | ||
534 | |||
535 | @Override | ||
536 | public List<PParameter> getParameters() { | ||
537 | return parameters; | ||
538 | } | ||
539 | |||
540 | @Override | ||
541 | public Set<PBody> doGetContainedBodies() { | ||
542 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
543 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
544 | { | ||
545 | PBody body = new PBody(this); | ||
546 | PVariable var_Value = body.getOrCreateVariableByName("Value"); | ||
547 | PVariable var_UnallocatedInstances = body.getOrCreateVariableByName("UnallocatedInstances"); | ||
548 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
549 | PVariable var_RequiredInstances = body.getOrCreateVariableByName("RequiredInstances"); | ||
550 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
551 | PVariable var___2_ = body.getOrCreateVariableByName("_<2>"); | ||
552 | PVariable var_NoHostToAllocate = body.getOrCreateVariableByName("NoHostToAllocate"); | ||
553 | PVariable var___3_ = body.getOrCreateVariableByName("_<3>"); | ||
554 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Value), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
555 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
556 | new ExportedParameter(body, var_Value, parameter_Value) | ||
557 | )); | ||
558 | // UnallocatedInstances == count find unallocatedAppInstance(_) | ||
559 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
560 | new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_), UnallocatedAppInstance.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
561 | new Equality(body, var_UnallocatedInstances, var__virtual_0_); | ||
562 | // RequiredInstances == sum find requiredAppInstances(_, #_) | ||
563 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
564 | new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var___1_, var___2_), RequiredAppInstances.instance().getInternalQueryRepresentation(), var__virtual_1_, 1); | ||
565 | new Equality(body, var_RequiredInstances, var__virtual_1_); | ||
566 | // NoHostToAllocate == count find noHostToAllocateTo(_) | ||
567 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
568 | new PatternMatchCounter(body, Tuples.flatTupleOf(var___3_), NoHostToAllocateTo.instance().getInternalQueryRepresentation(), var__virtual_2_); | ||
569 | new Equality(body, var_NoHostToAllocate, var__virtual_2_); | ||
570 | // Value == eval(2 * UnallocatedInstances + 4 * RequiredInstances + NoHostToAllocate) | ||
571 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
572 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
573 | |||
574 | @Override | ||
575 | public String getShortDescription() { | ||
576 | return "Expression evaluation from pattern guidanceObjective"; | ||
577 | } | ||
578 | |||
579 | @Override | ||
580 | public Iterable<String> getInputParameterNames() { | ||
581 | return Arrays.asList("NoHostToAllocate", "RequiredInstances", "UnallocatedInstances");} | ||
582 | |||
583 | @Override | ||
584 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
585 | Integer NoHostToAllocate = (Integer) provider.getValue("NoHostToAllocate"); | ||
586 | Integer RequiredInstances = (Integer) provider.getValue("RequiredInstances"); | ||
587 | Integer UnallocatedInstances = (Integer) provider.getValue("UnallocatedInstances"); | ||
588 | return evaluateExpression_1_1(NoHostToAllocate, RequiredInstances, UnallocatedInstances); | ||
589 | } | ||
590 | }, var__virtual_3_ ); | ||
591 | new Equality(body, var_Value, var__virtual_3_); | ||
592 | bodies.add(body); | ||
593 | } | ||
594 | return bodies; | ||
595 | } | ||
596 | } | ||
597 | |||
598 | private static int evaluateExpression_1_1(final Integer NoHostToAllocate, final Integer RequiredInstances, final Integer UnallocatedInstances) { | ||
599 | return (((2 * (UnallocatedInstances).intValue()) + (4 * (RequiredInstances).intValue())) + (NoHostToAllocate).intValue()); | ||
600 | } | ||
601 | } | ||
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..932501ff --- /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,727 @@ | |||
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 | switch(parameterName) { | ||
92 | case "Req": return this.fReq; | ||
93 | case "App": return this.fApp; | ||
94 | default: return null; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public Object get(final int index) { | ||
100 | switch(index) { | ||
101 | case 0: return this.fReq; | ||
102 | case 1: return this.fApp; | ||
103 | default: return null; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | public Requirement getReq() { | ||
108 | return this.fReq; | ||
109 | } | ||
110 | |||
111 | public ApplicationInstance getApp() { | ||
112 | return this.fApp; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public boolean set(final String parameterName, final Object newValue) { | ||
117 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
118 | if ("Req".equals(parameterName) ) { | ||
119 | this.fReq = (Requirement) newValue; | ||
120 | return true; | ||
121 | } | ||
122 | if ("App".equals(parameterName) ) { | ||
123 | this.fApp = (ApplicationInstance) newValue; | ||
124 | return true; | ||
125 | } | ||
126 | return false; | ||
127 | } | ||
128 | |||
129 | public void setReq(final Requirement pReq) { | ||
130 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
131 | this.fReq = pReq; | ||
132 | } | ||
133 | |||
134 | public void setApp(final ApplicationInstance pApp) { | ||
135 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
136 | this.fApp = pApp; | ||
137 | } | ||
138 | |||
139 | @Override | ||
140 | public String patternName() { | ||
141 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.instanceDoesNotSatisfyRequirement"; | ||
142 | } | ||
143 | |||
144 | @Override | ||
145 | public List<String> parameterNames() { | ||
146 | return InstanceDoesNotSatisfyRequirement.Match.parameterNames; | ||
147 | } | ||
148 | |||
149 | @Override | ||
150 | public Object[] toArray() { | ||
151 | return new Object[]{fReq, fApp}; | ||
152 | } | ||
153 | |||
154 | @Override | ||
155 | public InstanceDoesNotSatisfyRequirement.Match toImmutable() { | ||
156 | return isMutable() ? newMatch(fReq, fApp) : this; | ||
157 | } | ||
158 | |||
159 | @Override | ||
160 | public String prettyPrint() { | ||
161 | StringBuilder result = new StringBuilder(); | ||
162 | result.append("\"Req\"=" + prettyPrintValue(fReq) + ", "); | ||
163 | result.append("\"App\"=" + prettyPrintValue(fApp)); | ||
164 | return result.toString(); | ||
165 | } | ||
166 | |||
167 | @Override | ||
168 | public int hashCode() { | ||
169 | return Objects.hash(fReq, fApp); | ||
170 | } | ||
171 | |||
172 | @Override | ||
173 | public boolean equals(final Object obj) { | ||
174 | if (this == obj) | ||
175 | return true; | ||
176 | if (obj == null) { | ||
177 | return false; | ||
178 | } | ||
179 | if ((obj instanceof InstanceDoesNotSatisfyRequirement.Match)) { | ||
180 | InstanceDoesNotSatisfyRequirement.Match other = (InstanceDoesNotSatisfyRequirement.Match) obj; | ||
181 | return Objects.equals(fReq, other.fReq) && Objects.equals(fApp, other.fApp); | ||
182 | } else { | ||
183 | // this should be infrequent | ||
184 | if (!(obj instanceof IPatternMatch)) { | ||
185 | return false; | ||
186 | } | ||
187 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
188 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
189 | } | ||
190 | } | ||
191 | |||
192 | @Override | ||
193 | public InstanceDoesNotSatisfyRequirement specification() { | ||
194 | return InstanceDoesNotSatisfyRequirement.instance(); | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * Returns an empty, mutable match. | ||
199 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
200 | * | ||
201 | * @return the empty match. | ||
202 | * | ||
203 | */ | ||
204 | public static InstanceDoesNotSatisfyRequirement.Match newEmptyMatch() { | ||
205 | return new Mutable(null, null); | ||
206 | } | ||
207 | |||
208 | /** | ||
209 | * Returns a mutable (partial) match. | ||
210 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
211 | * | ||
212 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
213 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
214 | * @return the new, mutable (partial) match object. | ||
215 | * | ||
216 | */ | ||
217 | public static InstanceDoesNotSatisfyRequirement.Match newMutableMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
218 | return new Mutable(pReq, pApp); | ||
219 | } | ||
220 | |||
221 | /** | ||
222 | * Returns a new (partial) match. | ||
223 | * This can be used e.g. to call the matcher with a partial match. | ||
224 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
225 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
226 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
227 | * @return the (partial) match object. | ||
228 | * | ||
229 | */ | ||
230 | public static InstanceDoesNotSatisfyRequirement.Match newMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
231 | return new Immutable(pReq, pApp); | ||
232 | } | ||
233 | |||
234 | private static final class Mutable extends InstanceDoesNotSatisfyRequirement.Match { | ||
235 | Mutable(final Requirement pReq, final ApplicationInstance pApp) { | ||
236 | super(pReq, pApp); | ||
237 | } | ||
238 | |||
239 | @Override | ||
240 | public boolean isMutable() { | ||
241 | return true; | ||
242 | } | ||
243 | } | ||
244 | |||
245 | private static final class Immutable extends InstanceDoesNotSatisfyRequirement.Match { | ||
246 | Immutable(final Requirement pReq, final ApplicationInstance pApp) { | ||
247 | super(pReq, pApp); | ||
248 | } | ||
249 | |||
250 | @Override | ||
251 | public boolean isMutable() { | ||
252 | return false; | ||
253 | } | ||
254 | } | ||
255 | } | ||
256 | |||
257 | /** | ||
258 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.instanceDoesNotSatisfyRequirement pattern, | ||
259 | * providing pattern-specific query methods. | ||
260 | * | ||
261 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
262 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
263 | * | ||
264 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
265 | * | ||
266 | * <p>Original source: | ||
267 | * <code><pre> | ||
268 | * {@literal @}Constraint(severity = "error", key = {Req, App}, | ||
269 | * message = "Requirement must be satisfied by the required application type.") | ||
270 | * pattern instanceDoesNotSatisfyRequirement(Req : Requirement, App : ApplicationInstance) { | ||
271 | * Requirement.instances(Req, App); | ||
272 | * neg find satisfyingInstance(Req, App); | ||
273 | * } | ||
274 | * </pre></code> | ||
275 | * | ||
276 | * @see Match | ||
277 | * @see InstanceDoesNotSatisfyRequirement | ||
278 | * | ||
279 | */ | ||
280 | public static class Matcher extends BaseMatcher<InstanceDoesNotSatisfyRequirement.Match> { | ||
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 | public static InstanceDoesNotSatisfyRequirement.Matcher on(final ViatraQueryEngine engine) { | ||
290 | // check if matcher already exists | ||
291 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
292 | if (matcher == null) { | ||
293 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
294 | } | ||
295 | return matcher; | ||
296 | } | ||
297 | |||
298 | /** | ||
299 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
300 | * @return an initialized matcher | ||
301 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
302 | * | ||
303 | */ | ||
304 | public static InstanceDoesNotSatisfyRequirement.Matcher create() { | ||
305 | return new Matcher(); | ||
306 | } | ||
307 | |||
308 | private static final int POSITION_REQ = 0; | ||
309 | |||
310 | private static final int POSITION_APP = 1; | ||
311 | |||
312 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(InstanceDoesNotSatisfyRequirement.Matcher.class); | ||
313 | |||
314 | /** | ||
315 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
316 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
317 | * | ||
318 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
319 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
320 | * | ||
321 | */ | ||
322 | private Matcher() { | ||
323 | super(querySpecification()); | ||
324 | } | ||
325 | |||
326 | /** | ||
327 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
328 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
329 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
330 | * @return matches represented as a Match object. | ||
331 | * | ||
332 | */ | ||
333 | public Collection<InstanceDoesNotSatisfyRequirement.Match> getAllMatches(final Requirement pReq, final ApplicationInstance pApp) { | ||
334 | return rawStreamAllMatches(new Object[]{pReq, pApp}).collect(Collectors.toSet()); | ||
335 | } | ||
336 | |||
337 | /** | ||
338 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
339 | * </p> | ||
340 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
341 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
342 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
343 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
344 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
345 | * @return a stream of matches represented as a Match object. | ||
346 | * | ||
347 | */ | ||
348 | public Stream<InstanceDoesNotSatisfyRequirement.Match> streamAllMatches(final Requirement pReq, final ApplicationInstance pApp) { | ||
349 | return rawStreamAllMatches(new Object[]{pReq, pApp}); | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
354 | * Neither determinism nor randomness of selection is guaranteed. | ||
355 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
356 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
357 | * @return a match represented as a Match object, or null if no match is found. | ||
358 | * | ||
359 | */ | ||
360 | public Optional<InstanceDoesNotSatisfyRequirement.Match> getOneArbitraryMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
361 | return rawGetOneArbitraryMatch(new Object[]{pReq, pApp}); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
366 | * under any possible substitution of the unspecified parameters (if any). | ||
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 true if the input is a valid (partial) match of the pattern. | ||
370 | * | ||
371 | */ | ||
372 | public boolean hasMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
373 | return rawHasMatch(new Object[]{pReq, pApp}); | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
378 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
379 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
380 | * @return the number of pattern matches found. | ||
381 | * | ||
382 | */ | ||
383 | public int countMatches(final Requirement pReq, final ApplicationInstance pApp) { | ||
384 | return rawCountMatches(new Object[]{pReq, pApp}); | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
389 | * Neither determinism nor randomness of selection is guaranteed. | ||
390 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
391 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
392 | * @param processor the action that will process the selected match. | ||
393 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
394 | * | ||
395 | */ | ||
396 | public boolean forOneArbitraryMatch(final Requirement pReq, final ApplicationInstance pApp, final Consumer<? super InstanceDoesNotSatisfyRequirement.Match> processor) { | ||
397 | return rawForOneArbitraryMatch(new Object[]{pReq, pApp}, processor); | ||
398 | } | ||
399 | |||
400 | /** | ||
401 | * Returns a new (partial) match. | ||
402 | * This can be used e.g. to call the matcher with a partial match. | ||
403 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
404 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
405 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
406 | * @return the (partial) match object. | ||
407 | * | ||
408 | */ | ||
409 | public InstanceDoesNotSatisfyRequirement.Match newMatch(final Requirement pReq, final ApplicationInstance pApp) { | ||
410 | return InstanceDoesNotSatisfyRequirement.Match.newMatch(pReq, pApp); | ||
411 | } | ||
412 | |||
413 | /** | ||
414 | * Retrieve the set of values that occur in matches for Req. | ||
415 | * @return the Set of all values or empty set if there are no matches | ||
416 | * | ||
417 | */ | ||
418 | protected Stream<Requirement> rawStreamAllValuesOfReq(final Object[] parameters) { | ||
419 | return rawStreamAllValues(POSITION_REQ, parameters).map(Requirement.class::cast); | ||
420 | } | ||
421 | |||
422 | /** | ||
423 | * Retrieve the set of values that occur in matches for Req. | ||
424 | * @return the Set of all values or empty set if there are no matches | ||
425 | * | ||
426 | */ | ||
427 | public Set<Requirement> getAllValuesOfReq() { | ||
428 | return rawStreamAllValuesOfReq(emptyArray()).collect(Collectors.toSet()); | ||
429 | } | ||
430 | |||
431 | /** | ||
432 | * Retrieve the set of values that occur in matches for Req. | ||
433 | * @return the Set of all values or empty set if there are no matches | ||
434 | * | ||
435 | */ | ||
436 | public Stream<Requirement> streamAllValuesOfReq() { | ||
437 | return rawStreamAllValuesOfReq(emptyArray()); | ||
438 | } | ||
439 | |||
440 | /** | ||
441 | * Retrieve the set of values that occur in matches for Req. | ||
442 | * </p> | ||
443 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
444 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
445 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
446 | * | ||
447 | * @return the Stream of all values or empty set if there are no matches | ||
448 | * | ||
449 | */ | ||
450 | public Stream<Requirement> streamAllValuesOfReq(final InstanceDoesNotSatisfyRequirement.Match partialMatch) { | ||
451 | return rawStreamAllValuesOfReq(partialMatch.toArray()); | ||
452 | } | ||
453 | |||
454 | /** | ||
455 | * Retrieve the set of values that occur in matches for Req. | ||
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<Requirement> streamAllValuesOfReq(final ApplicationInstance pApp) { | ||
465 | return rawStreamAllValuesOfReq(new Object[]{null, pApp}); | ||
466 | } | ||
467 | |||
468 | /** | ||
469 | * Retrieve the set of values that occur in matches for Req. | ||
470 | * @return the Set of all values or empty set if there are no matches | ||
471 | * | ||
472 | */ | ||
473 | public Set<Requirement> getAllValuesOfReq(final InstanceDoesNotSatisfyRequirement.Match partialMatch) { | ||
474 | return rawStreamAllValuesOfReq(partialMatch.toArray()).collect(Collectors.toSet()); | ||
475 | } | ||
476 | |||
477 | /** | ||
478 | * Retrieve the set of values that occur in matches for Req. | ||
479 | * @return the Set of all values or empty set if there are no matches | ||
480 | * | ||
481 | */ | ||
482 | public Set<Requirement> getAllValuesOfReq(final ApplicationInstance pApp) { | ||
483 | return rawStreamAllValuesOfReq(new Object[]{null, pApp}).collect(Collectors.toSet()); | ||
484 | } | ||
485 | |||
486 | /** | ||
487 | * Retrieve the set of values that occur in matches for App. | ||
488 | * @return the Set of all values or empty set if there are no matches | ||
489 | * | ||
490 | */ | ||
491 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
492 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
493 | } | ||
494 | |||
495 | /** | ||
496 | * Retrieve the set of values that occur in matches for App. | ||
497 | * @return the Set of all values or empty set if there are no matches | ||
498 | * | ||
499 | */ | ||
500 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
501 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * Retrieve the set of values that occur in matches for App. | ||
506 | * @return the Set of all values or empty set if there are no matches | ||
507 | * | ||
508 | */ | ||
509 | public Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
510 | return rawStreamAllValuesOfApp(emptyArray()); | ||
511 | } | ||
512 | |||
513 | /** | ||
514 | * Retrieve the set of values that occur in matches for App. | ||
515 | * </p> | ||
516 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
517 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
518 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
519 | * | ||
520 | * @return the Stream of all values or empty set if there are no matches | ||
521 | * | ||
522 | */ | ||
523 | public Stream<ApplicationInstance> streamAllValuesOfApp(final InstanceDoesNotSatisfyRequirement.Match partialMatch) { | ||
524 | return rawStreamAllValuesOfApp(partialMatch.toArray()); | ||
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 Requirement pReq) { | ||
538 | return rawStreamAllValuesOfApp(new Object[]{pReq, null}); | ||
539 | } | ||
540 | |||
541 | /** | ||
542 | * Retrieve the set of values that occur in matches for App. | ||
543 | * @return the Set of all values or empty set if there are no matches | ||
544 | * | ||
545 | */ | ||
546 | public Set<ApplicationInstance> getAllValuesOfApp(final InstanceDoesNotSatisfyRequirement.Match partialMatch) { | ||
547 | return rawStreamAllValuesOfApp(partialMatch.toArray()).collect(Collectors.toSet()); | ||
548 | } | ||
549 | |||
550 | /** | ||
551 | * Retrieve the set of values that occur in matches for App. | ||
552 | * @return the Set of all values or empty set if there are no matches | ||
553 | * | ||
554 | */ | ||
555 | public Set<ApplicationInstance> getAllValuesOfApp(final Requirement pReq) { | ||
556 | return rawStreamAllValuesOfApp(new Object[]{pReq, null}).collect(Collectors.toSet()); | ||
557 | } | ||
558 | |||
559 | @Override | ||
560 | protected InstanceDoesNotSatisfyRequirement.Match tupleToMatch(final Tuple t) { | ||
561 | try { | ||
562 | return InstanceDoesNotSatisfyRequirement.Match.newMatch((Requirement) t.get(POSITION_REQ), (ApplicationInstance) t.get(POSITION_APP)); | ||
563 | } catch(ClassCastException e) { | ||
564 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
565 | return null; | ||
566 | } | ||
567 | } | ||
568 | |||
569 | @Override | ||
570 | protected InstanceDoesNotSatisfyRequirement.Match arrayToMatch(final Object[] match) { | ||
571 | try { | ||
572 | return InstanceDoesNotSatisfyRequirement.Match.newMatch((Requirement) match[POSITION_REQ], (ApplicationInstance) match[POSITION_APP]); | ||
573 | } catch(ClassCastException e) { | ||
574 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
575 | return null; | ||
576 | } | ||
577 | } | ||
578 | |||
579 | @Override | ||
580 | protected InstanceDoesNotSatisfyRequirement.Match arrayToMatchMutable(final Object[] match) { | ||
581 | try { | ||
582 | return InstanceDoesNotSatisfyRequirement.Match.newMutableMatch((Requirement) match[POSITION_REQ], (ApplicationInstance) match[POSITION_APP]); | ||
583 | } catch(ClassCastException e) { | ||
584 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
585 | return null; | ||
586 | } | ||
587 | } | ||
588 | |||
589 | /** | ||
590 | * @return the singleton instance of the query specification of this pattern | ||
591 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
592 | * | ||
593 | */ | ||
594 | public static IQuerySpecification<InstanceDoesNotSatisfyRequirement.Matcher> querySpecification() { | ||
595 | return InstanceDoesNotSatisfyRequirement.instance(); | ||
596 | } | ||
597 | } | ||
598 | |||
599 | private InstanceDoesNotSatisfyRequirement() { | ||
600 | super(GeneratedPQuery.INSTANCE); | ||
601 | } | ||
602 | |||
603 | /** | ||
604 | * @return the singleton instance of the query specification | ||
605 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
606 | * | ||
607 | */ | ||
608 | public static InstanceDoesNotSatisfyRequirement instance() { | ||
609 | try{ | ||
610 | return LazyHolder.INSTANCE; | ||
611 | } catch (ExceptionInInitializerError err) { | ||
612 | throw processInitializerError(err); | ||
613 | } | ||
614 | } | ||
615 | |||
616 | @Override | ||
617 | protected InstanceDoesNotSatisfyRequirement.Matcher instantiate(final ViatraQueryEngine engine) { | ||
618 | return InstanceDoesNotSatisfyRequirement.Matcher.on(engine); | ||
619 | } | ||
620 | |||
621 | @Override | ||
622 | public InstanceDoesNotSatisfyRequirement.Matcher instantiate() { | ||
623 | return InstanceDoesNotSatisfyRequirement.Matcher.create(); | ||
624 | } | ||
625 | |||
626 | @Override | ||
627 | public InstanceDoesNotSatisfyRequirement.Match newEmptyMatch() { | ||
628 | return InstanceDoesNotSatisfyRequirement.Match.newEmptyMatch(); | ||
629 | } | ||
630 | |||
631 | @Override | ||
632 | public InstanceDoesNotSatisfyRequirement.Match newMatch(final Object... parameters) { | ||
633 | return InstanceDoesNotSatisfyRequirement.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.Requirement) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance) parameters[1]); | ||
634 | } | ||
635 | |||
636 | /** | ||
637 | * Inner class allowing the singleton instance of {@link InstanceDoesNotSatisfyRequirement} to be created | ||
638 | * <b>not</b> at the class load time of the outer class, | ||
639 | * but rather at the first call to {@link InstanceDoesNotSatisfyRequirement#instance()}. | ||
640 | * | ||
641 | * <p> This workaround is required e.g. to support recursion. | ||
642 | * | ||
643 | */ | ||
644 | private static class LazyHolder { | ||
645 | private static final InstanceDoesNotSatisfyRequirement INSTANCE = new InstanceDoesNotSatisfyRequirement(); | ||
646 | |||
647 | /** | ||
648 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
649 | * This initialization order is required to support indirect recursion. | ||
650 | * | ||
651 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
652 | * | ||
653 | */ | ||
654 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
655 | |||
656 | public static Object ensureInitialized() { | ||
657 | INSTANCE.ensureInitializedInternal(); | ||
658 | return null; | ||
659 | } | ||
660 | } | ||
661 | |||
662 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
663 | private static final InstanceDoesNotSatisfyRequirement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
664 | |||
665 | 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); | ||
666 | |||
667 | 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); | ||
668 | |||
669 | private final List<PParameter> parameters = Arrays.asList(parameter_Req, parameter_App); | ||
670 | |||
671 | private GeneratedPQuery() { | ||
672 | super(PVisibility.PUBLIC); | ||
673 | } | ||
674 | |||
675 | @Override | ||
676 | public String getFullyQualifiedName() { | ||
677 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.instanceDoesNotSatisfyRequirement"; | ||
678 | } | ||
679 | |||
680 | @Override | ||
681 | public List<String> getParameterNames() { | ||
682 | return Arrays.asList("Req","App"); | ||
683 | } | ||
684 | |||
685 | @Override | ||
686 | public List<PParameter> getParameters() { | ||
687 | return parameters; | ||
688 | } | ||
689 | |||
690 | @Override | ||
691 | public Set<PBody> doGetContainedBodies() { | ||
692 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
693 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
694 | { | ||
695 | PBody body = new PBody(this); | ||
696 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
697 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
698 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
699 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
700 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
701 | new ExportedParameter(body, var_Req, parameter_Req), | ||
702 | new ExportedParameter(body, var_App, parameter_App) | ||
703 | )); | ||
704 | // Requirement.instances(Req, App) | ||
705 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
706 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
707 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "instances"))); | ||
708 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
709 | new Equality(body, var__virtual_0_, var_App); | ||
710 | // neg find satisfyingInstance(Req, App) | ||
711 | new NegativePatternCall(body, Tuples.flatTupleOf(var_Req, var_App), SatisfyingInstance.instance().getInternalQueryRepresentation()); | ||
712 | bodies.add(body); | ||
713 | } | ||
714 | { | ||
715 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
716 | annotation.addAttribute("severity", "error"); | ||
717 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
718 | new ParameterReference("Req"), | ||
719 | new ParameterReference("App") | ||
720 | })); | ||
721 | annotation.addAttribute("message", "Requirement must be satisfied by the required application type."); | ||
722 | addAnnotation(annotation); | ||
723 | } | ||
724 | return bodies; | ||
725 | } | ||
726 | } | ||
727 | } | ||
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..4077c103 --- /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,589 @@ | |||
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 | switch(parameterName) { | ||
89 | case "Host": return this.fHost; | ||
90 | default: return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | @Override | ||
95 | public Object get(final int index) { | ||
96 | switch(index) { | ||
97 | case 0: return this.fHost; | ||
98 | default: return null; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public HostInstance getHost() { | ||
103 | return this.fHost; | ||
104 | } | ||
105 | |||
106 | @Override | ||
107 | public boolean set(final String parameterName, final Object newValue) { | ||
108 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
109 | if ("Host".equals(parameterName) ) { | ||
110 | this.fHost = (HostInstance) newValue; | ||
111 | return true; | ||
112 | } | ||
113 | return false; | ||
114 | } | ||
115 | |||
116 | public void setHost(final HostInstance pHost) { | ||
117 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
118 | this.fHost = pHost; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public String patternName() { | ||
123 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableHdd"; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public List<String> parameterNames() { | ||
128 | return NotEnoughAvailableHdd.Match.parameterNames; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public Object[] toArray() { | ||
133 | return new Object[]{fHost}; | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public NotEnoughAvailableHdd.Match toImmutable() { | ||
138 | return isMutable() ? newMatch(fHost) : this; | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public String prettyPrint() { | ||
143 | StringBuilder result = new StringBuilder(); | ||
144 | result.append("\"Host\"=" + prettyPrintValue(fHost)); | ||
145 | return result.toString(); | ||
146 | } | ||
147 | |||
148 | @Override | ||
149 | public int hashCode() { | ||
150 | return Objects.hash(fHost); | ||
151 | } | ||
152 | |||
153 | @Override | ||
154 | public boolean equals(final Object obj) { | ||
155 | if (this == obj) | ||
156 | return true; | ||
157 | if (obj == null) { | ||
158 | return false; | ||
159 | } | ||
160 | if ((obj instanceof NotEnoughAvailableHdd.Match)) { | ||
161 | NotEnoughAvailableHdd.Match other = (NotEnoughAvailableHdd.Match) obj; | ||
162 | return Objects.equals(fHost, other.fHost); | ||
163 | } else { | ||
164 | // this should be infrequent | ||
165 | if (!(obj instanceof IPatternMatch)) { | ||
166 | return false; | ||
167 | } | ||
168 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
169 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | @Override | ||
174 | public NotEnoughAvailableHdd specification() { | ||
175 | return NotEnoughAvailableHdd.instance(); | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * Returns an empty, mutable match. | ||
180 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
181 | * | ||
182 | * @return the empty match. | ||
183 | * | ||
184 | */ | ||
185 | public static NotEnoughAvailableHdd.Match newEmptyMatch() { | ||
186 | return new Mutable(null); | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * Returns a mutable (partial) match. | ||
191 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
192 | * | ||
193 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
194 | * @return the new, mutable (partial) match object. | ||
195 | * | ||
196 | */ | ||
197 | public static NotEnoughAvailableHdd.Match newMutableMatch(final HostInstance pHost) { | ||
198 | return new Mutable(pHost); | ||
199 | } | ||
200 | |||
201 | /** | ||
202 | * Returns a new (partial) match. | ||
203 | * This can be used e.g. to call the matcher with a partial match. | ||
204 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
205 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
206 | * @return the (partial) match object. | ||
207 | * | ||
208 | */ | ||
209 | public static NotEnoughAvailableHdd.Match newMatch(final HostInstance pHost) { | ||
210 | return new Immutable(pHost); | ||
211 | } | ||
212 | |||
213 | private static final class Mutable extends NotEnoughAvailableHdd.Match { | ||
214 | Mutable(final HostInstance pHost) { | ||
215 | super(pHost); | ||
216 | } | ||
217 | |||
218 | @Override | ||
219 | public boolean isMutable() { | ||
220 | return true; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | private static final class Immutable extends NotEnoughAvailableHdd.Match { | ||
225 | Immutable(final HostInstance pHost) { | ||
226 | super(pHost); | ||
227 | } | ||
228 | |||
229 | @Override | ||
230 | public boolean isMutable() { | ||
231 | return false; | ||
232 | } | ||
233 | } | ||
234 | } | ||
235 | |||
236 | /** | ||
237 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableHdd pattern, | ||
238 | * providing pattern-specific query methods. | ||
239 | * | ||
240 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
241 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
242 | * | ||
243 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
244 | * | ||
245 | * <p>Original source: | ||
246 | * <code><pre> | ||
247 | * {@literal @}Constraint(severity = "error", key = {Host}, | ||
248 | * message = "Insufficient HDD available on host.") | ||
249 | * pattern notEnoughAvailableHdd(Host : HostInstance) { | ||
250 | * find availableHdd(Host, Hdd); | ||
251 | * check(Hdd {@literal <} 0); | ||
252 | * } | ||
253 | * </pre></code> | ||
254 | * | ||
255 | * @see Match | ||
256 | * @see NotEnoughAvailableHdd | ||
257 | * | ||
258 | */ | ||
259 | public static class Matcher extends BaseMatcher<NotEnoughAvailableHdd.Match> { | ||
260 | /** | ||
261 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
262 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
263 | * | ||
264 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
265 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
266 | * | ||
267 | */ | ||
268 | public static NotEnoughAvailableHdd.Matcher on(final ViatraQueryEngine engine) { | ||
269 | // check if matcher already exists | ||
270 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
271 | if (matcher == null) { | ||
272 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
273 | } | ||
274 | return matcher; | ||
275 | } | ||
276 | |||
277 | /** | ||
278 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
279 | * @return an initialized matcher | ||
280 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
281 | * | ||
282 | */ | ||
283 | public static NotEnoughAvailableHdd.Matcher create() { | ||
284 | return new Matcher(); | ||
285 | } | ||
286 | |||
287 | private static final int POSITION_HOST = 0; | ||
288 | |||
289 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NotEnoughAvailableHdd.Matcher.class); | ||
290 | |||
291 | /** | ||
292 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
293 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
294 | * | ||
295 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
296 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
297 | * | ||
298 | */ | ||
299 | private Matcher() { | ||
300 | super(querySpecification()); | ||
301 | } | ||
302 | |||
303 | /** | ||
304 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
305 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
306 | * @return matches represented as a Match object. | ||
307 | * | ||
308 | */ | ||
309 | public Collection<NotEnoughAvailableHdd.Match> getAllMatches(final HostInstance pHost) { | ||
310 | return rawStreamAllMatches(new Object[]{pHost}).collect(Collectors.toSet()); | ||
311 | } | ||
312 | |||
313 | /** | ||
314 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
315 | * </p> | ||
316 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
317 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
318 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
319 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
320 | * @return a stream of matches represented as a Match object. | ||
321 | * | ||
322 | */ | ||
323 | public Stream<NotEnoughAvailableHdd.Match> streamAllMatches(final HostInstance pHost) { | ||
324 | return rawStreamAllMatches(new Object[]{pHost}); | ||
325 | } | ||
326 | |||
327 | /** | ||
328 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
329 | * Neither determinism nor randomness of selection is guaranteed. | ||
330 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
331 | * @return a match represented as a Match object, or null if no match is found. | ||
332 | * | ||
333 | */ | ||
334 | public Optional<NotEnoughAvailableHdd.Match> getOneArbitraryMatch(final HostInstance pHost) { | ||
335 | return rawGetOneArbitraryMatch(new Object[]{pHost}); | ||
336 | } | ||
337 | |||
338 | /** | ||
339 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
340 | * under any possible substitution of the unspecified parameters (if any). | ||
341 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
342 | * @return true if the input is a valid (partial) match of the pattern. | ||
343 | * | ||
344 | */ | ||
345 | public boolean hasMatch(final HostInstance pHost) { | ||
346 | return rawHasMatch(new Object[]{pHost}); | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
351 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
352 | * @return the number of pattern matches found. | ||
353 | * | ||
354 | */ | ||
355 | public int countMatches(final HostInstance pHost) { | ||
356 | return rawCountMatches(new Object[]{pHost}); | ||
357 | } | ||
358 | |||
359 | /** | ||
360 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
361 | * Neither determinism nor randomness of selection is guaranteed. | ||
362 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
363 | * @param processor the action that will process the selected match. | ||
364 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
365 | * | ||
366 | */ | ||
367 | public boolean forOneArbitraryMatch(final HostInstance pHost, final Consumer<? super NotEnoughAvailableHdd.Match> processor) { | ||
368 | return rawForOneArbitraryMatch(new Object[]{pHost}, processor); | ||
369 | } | ||
370 | |||
371 | /** | ||
372 | * Returns a new (partial) match. | ||
373 | * This can be used e.g. to call the matcher with a partial match. | ||
374 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
375 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
376 | * @return the (partial) match object. | ||
377 | * | ||
378 | */ | ||
379 | public NotEnoughAvailableHdd.Match newMatch(final HostInstance pHost) { | ||
380 | return NotEnoughAvailableHdd.Match.newMatch(pHost); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * Retrieve the set of values that occur in matches for Host. | ||
385 | * @return the Set of all values or empty set if there are no matches | ||
386 | * | ||
387 | */ | ||
388 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
389 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * Retrieve the set of values that occur in matches for Host. | ||
394 | * @return the Set of all values or empty set if there are no matches | ||
395 | * | ||
396 | */ | ||
397 | public Set<HostInstance> getAllValuesOfHost() { | ||
398 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
399 | } | ||
400 | |||
401 | /** | ||
402 | * Retrieve the set of values that occur in matches for Host. | ||
403 | * @return the Set of all values or empty set if there are no matches | ||
404 | * | ||
405 | */ | ||
406 | public Stream<HostInstance> streamAllValuesOfHost() { | ||
407 | return rawStreamAllValuesOfHost(emptyArray()); | ||
408 | } | ||
409 | |||
410 | @Override | ||
411 | protected NotEnoughAvailableHdd.Match tupleToMatch(final Tuple t) { | ||
412 | try { | ||
413 | return NotEnoughAvailableHdd.Match.newMatch((HostInstance) t.get(POSITION_HOST)); | ||
414 | } catch(ClassCastException e) { | ||
415 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
416 | return null; | ||
417 | } | ||
418 | } | ||
419 | |||
420 | @Override | ||
421 | protected NotEnoughAvailableHdd.Match arrayToMatch(final Object[] match) { | ||
422 | try { | ||
423 | return NotEnoughAvailableHdd.Match.newMatch((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 | @Override | ||
431 | protected NotEnoughAvailableHdd.Match arrayToMatchMutable(final Object[] match) { | ||
432 | try { | ||
433 | return NotEnoughAvailableHdd.Match.newMutableMatch((HostInstance) match[POSITION_HOST]); | ||
434 | } catch(ClassCastException e) { | ||
435 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
436 | return null; | ||
437 | } | ||
438 | } | ||
439 | |||
440 | /** | ||
441 | * @return the singleton instance of the query specification of this pattern | ||
442 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
443 | * | ||
444 | */ | ||
445 | public static IQuerySpecification<NotEnoughAvailableHdd.Matcher> querySpecification() { | ||
446 | return NotEnoughAvailableHdd.instance(); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | private NotEnoughAvailableHdd() { | ||
451 | super(GeneratedPQuery.INSTANCE); | ||
452 | } | ||
453 | |||
454 | /** | ||
455 | * @return the singleton instance of the query specification | ||
456 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
457 | * | ||
458 | */ | ||
459 | public static NotEnoughAvailableHdd instance() { | ||
460 | try{ | ||
461 | return LazyHolder.INSTANCE; | ||
462 | } catch (ExceptionInInitializerError err) { | ||
463 | throw processInitializerError(err); | ||
464 | } | ||
465 | } | ||
466 | |||
467 | @Override | ||
468 | protected NotEnoughAvailableHdd.Matcher instantiate(final ViatraQueryEngine engine) { | ||
469 | return NotEnoughAvailableHdd.Matcher.on(engine); | ||
470 | } | ||
471 | |||
472 | @Override | ||
473 | public NotEnoughAvailableHdd.Matcher instantiate() { | ||
474 | return NotEnoughAvailableHdd.Matcher.create(); | ||
475 | } | ||
476 | |||
477 | @Override | ||
478 | public NotEnoughAvailableHdd.Match newEmptyMatch() { | ||
479 | return NotEnoughAvailableHdd.Match.newEmptyMatch(); | ||
480 | } | ||
481 | |||
482 | @Override | ||
483 | public NotEnoughAvailableHdd.Match newMatch(final Object... parameters) { | ||
484 | return NotEnoughAvailableHdd.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[0]); | ||
485 | } | ||
486 | |||
487 | /** | ||
488 | * Inner class allowing the singleton instance of {@link NotEnoughAvailableHdd} to be created | ||
489 | * <b>not</b> at the class load time of the outer class, | ||
490 | * but rather at the first call to {@link NotEnoughAvailableHdd#instance()}. | ||
491 | * | ||
492 | * <p> This workaround is required e.g. to support recursion. | ||
493 | * | ||
494 | */ | ||
495 | private static class LazyHolder { | ||
496 | private static final NotEnoughAvailableHdd INSTANCE = new NotEnoughAvailableHdd(); | ||
497 | |||
498 | /** | ||
499 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
500 | * This initialization order is required to support indirect recursion. | ||
501 | * | ||
502 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
503 | * | ||
504 | */ | ||
505 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
506 | |||
507 | public static Object ensureInitialized() { | ||
508 | INSTANCE.ensureInitializedInternal(); | ||
509 | return null; | ||
510 | } | ||
511 | } | ||
512 | |||
513 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
514 | private static final NotEnoughAvailableHdd.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
515 | |||
516 | 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); | ||
517 | |||
518 | private final List<PParameter> parameters = Arrays.asList(parameter_Host); | ||
519 | |||
520 | private GeneratedPQuery() { | ||
521 | super(PVisibility.PUBLIC); | ||
522 | } | ||
523 | |||
524 | @Override | ||
525 | public String getFullyQualifiedName() { | ||
526 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableHdd"; | ||
527 | } | ||
528 | |||
529 | @Override | ||
530 | public List<String> getParameterNames() { | ||
531 | return Arrays.asList("Host"); | ||
532 | } | ||
533 | |||
534 | @Override | ||
535 | public List<PParameter> getParameters() { | ||
536 | return parameters; | ||
537 | } | ||
538 | |||
539 | @Override | ||
540 | public Set<PBody> doGetContainedBodies() { | ||
541 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
542 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
543 | { | ||
544 | PBody body = new PBody(this); | ||
545 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
546 | PVariable var_Hdd = body.getOrCreateVariableByName("Hdd"); | ||
547 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
548 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
549 | new ExportedParameter(body, var_Host, parameter_Host) | ||
550 | )); | ||
551 | // find availableHdd(Host, Hdd) | ||
552 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_Hdd), AvailableHdd.instance().getInternalQueryRepresentation()); | ||
553 | // check(Hdd < 0) | ||
554 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
555 | |||
556 | @Override | ||
557 | public String getShortDescription() { | ||
558 | return "Expression evaluation from pattern notEnoughAvailableHdd"; | ||
559 | } | ||
560 | |||
561 | @Override | ||
562 | public Iterable<String> getInputParameterNames() { | ||
563 | return Arrays.asList("Hdd");} | ||
564 | |||
565 | @Override | ||
566 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
567 | Integer Hdd = (Integer) provider.getValue("Hdd"); | ||
568 | return evaluateExpression_1_1(Hdd); | ||
569 | } | ||
570 | }, null); | ||
571 | bodies.add(body); | ||
572 | } | ||
573 | { | ||
574 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
575 | annotation.addAttribute("severity", "error"); | ||
576 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
577 | new ParameterReference("Host") | ||
578 | })); | ||
579 | annotation.addAttribute("message", "Insufficient HDD available on host."); | ||
580 | addAnnotation(annotation); | ||
581 | } | ||
582 | return bodies; | ||
583 | } | ||
584 | } | ||
585 | |||
586 | private static boolean evaluateExpression_1_1(final Integer Hdd) { | ||
587 | return ((Hdd).intValue() < 0); | ||
588 | } | ||
589 | } | ||
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..6e52bee8 --- /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,589 @@ | |||
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 | switch(parameterName) { | ||
89 | case "Host": return this.fHost; | ||
90 | default: return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | @Override | ||
95 | public Object get(final int index) { | ||
96 | switch(index) { | ||
97 | case 0: return this.fHost; | ||
98 | default: return null; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public HostInstance getHost() { | ||
103 | return this.fHost; | ||
104 | } | ||
105 | |||
106 | @Override | ||
107 | public boolean set(final String parameterName, final Object newValue) { | ||
108 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
109 | if ("Host".equals(parameterName) ) { | ||
110 | this.fHost = (HostInstance) newValue; | ||
111 | return true; | ||
112 | } | ||
113 | return false; | ||
114 | } | ||
115 | |||
116 | public void setHost(final HostInstance pHost) { | ||
117 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
118 | this.fHost = pHost; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public String patternName() { | ||
123 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableMemory"; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public List<String> parameterNames() { | ||
128 | return NotEnoughAvailableMemory.Match.parameterNames; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public Object[] toArray() { | ||
133 | return new Object[]{fHost}; | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public NotEnoughAvailableMemory.Match toImmutable() { | ||
138 | return isMutable() ? newMatch(fHost) : this; | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public String prettyPrint() { | ||
143 | StringBuilder result = new StringBuilder(); | ||
144 | result.append("\"Host\"=" + prettyPrintValue(fHost)); | ||
145 | return result.toString(); | ||
146 | } | ||
147 | |||
148 | @Override | ||
149 | public int hashCode() { | ||
150 | return Objects.hash(fHost); | ||
151 | } | ||
152 | |||
153 | @Override | ||
154 | public boolean equals(final Object obj) { | ||
155 | if (this == obj) | ||
156 | return true; | ||
157 | if (obj == null) { | ||
158 | return false; | ||
159 | } | ||
160 | if ((obj instanceof NotEnoughAvailableMemory.Match)) { | ||
161 | NotEnoughAvailableMemory.Match other = (NotEnoughAvailableMemory.Match) obj; | ||
162 | return Objects.equals(fHost, other.fHost); | ||
163 | } else { | ||
164 | // this should be infrequent | ||
165 | if (!(obj instanceof IPatternMatch)) { | ||
166 | return false; | ||
167 | } | ||
168 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
169 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | @Override | ||
174 | public NotEnoughAvailableMemory specification() { | ||
175 | return NotEnoughAvailableMemory.instance(); | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * Returns an empty, mutable match. | ||
180 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
181 | * | ||
182 | * @return the empty match. | ||
183 | * | ||
184 | */ | ||
185 | public static NotEnoughAvailableMemory.Match newEmptyMatch() { | ||
186 | return new Mutable(null); | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * Returns a mutable (partial) match. | ||
191 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
192 | * | ||
193 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
194 | * @return the new, mutable (partial) match object. | ||
195 | * | ||
196 | */ | ||
197 | public static NotEnoughAvailableMemory.Match newMutableMatch(final HostInstance pHost) { | ||
198 | return new Mutable(pHost); | ||
199 | } | ||
200 | |||
201 | /** | ||
202 | * Returns a new (partial) match. | ||
203 | * This can be used e.g. to call the matcher with a partial match. | ||
204 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
205 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
206 | * @return the (partial) match object. | ||
207 | * | ||
208 | */ | ||
209 | public static NotEnoughAvailableMemory.Match newMatch(final HostInstance pHost) { | ||
210 | return new Immutable(pHost); | ||
211 | } | ||
212 | |||
213 | private static final class Mutable extends NotEnoughAvailableMemory.Match { | ||
214 | Mutable(final HostInstance pHost) { | ||
215 | super(pHost); | ||
216 | } | ||
217 | |||
218 | @Override | ||
219 | public boolean isMutable() { | ||
220 | return true; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | private static final class Immutable extends NotEnoughAvailableMemory.Match { | ||
225 | Immutable(final HostInstance pHost) { | ||
226 | super(pHost); | ||
227 | } | ||
228 | |||
229 | @Override | ||
230 | public boolean isMutable() { | ||
231 | return false; | ||
232 | } | ||
233 | } | ||
234 | } | ||
235 | |||
236 | /** | ||
237 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableMemory pattern, | ||
238 | * providing pattern-specific query methods. | ||
239 | * | ||
240 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
241 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
242 | * | ||
243 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
244 | * | ||
245 | * <p>Original source: | ||
246 | * <code><pre> | ||
247 | * {@literal @}Constraint(severity = "error", key = {Host}, | ||
248 | * message = "Insufficient memory available on host.") | ||
249 | * pattern notEnoughAvailableMemory(Host : HostInstance) { | ||
250 | * find availableMemory(Host, Memory); | ||
251 | * check(Memory {@literal <} 0); | ||
252 | * } | ||
253 | * </pre></code> | ||
254 | * | ||
255 | * @see Match | ||
256 | * @see NotEnoughAvailableMemory | ||
257 | * | ||
258 | */ | ||
259 | public static class Matcher extends BaseMatcher<NotEnoughAvailableMemory.Match> { | ||
260 | /** | ||
261 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
262 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
263 | * | ||
264 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
265 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
266 | * | ||
267 | */ | ||
268 | public static NotEnoughAvailableMemory.Matcher on(final ViatraQueryEngine engine) { | ||
269 | // check if matcher already exists | ||
270 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
271 | if (matcher == null) { | ||
272 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
273 | } | ||
274 | return matcher; | ||
275 | } | ||
276 | |||
277 | /** | ||
278 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
279 | * @return an initialized matcher | ||
280 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
281 | * | ||
282 | */ | ||
283 | public static NotEnoughAvailableMemory.Matcher create() { | ||
284 | return new Matcher(); | ||
285 | } | ||
286 | |||
287 | private static final int POSITION_HOST = 0; | ||
288 | |||
289 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NotEnoughAvailableMemory.Matcher.class); | ||
290 | |||
291 | /** | ||
292 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
293 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
294 | * | ||
295 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
296 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
297 | * | ||
298 | */ | ||
299 | private Matcher() { | ||
300 | super(querySpecification()); | ||
301 | } | ||
302 | |||
303 | /** | ||
304 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
305 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
306 | * @return matches represented as a Match object. | ||
307 | * | ||
308 | */ | ||
309 | public Collection<NotEnoughAvailableMemory.Match> getAllMatches(final HostInstance pHost) { | ||
310 | return rawStreamAllMatches(new Object[]{pHost}).collect(Collectors.toSet()); | ||
311 | } | ||
312 | |||
313 | /** | ||
314 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
315 | * </p> | ||
316 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
317 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
318 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
319 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
320 | * @return a stream of matches represented as a Match object. | ||
321 | * | ||
322 | */ | ||
323 | public Stream<NotEnoughAvailableMemory.Match> streamAllMatches(final HostInstance pHost) { | ||
324 | return rawStreamAllMatches(new Object[]{pHost}); | ||
325 | } | ||
326 | |||
327 | /** | ||
328 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
329 | * Neither determinism nor randomness of selection is guaranteed. | ||
330 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
331 | * @return a match represented as a Match object, or null if no match is found. | ||
332 | * | ||
333 | */ | ||
334 | public Optional<NotEnoughAvailableMemory.Match> getOneArbitraryMatch(final HostInstance pHost) { | ||
335 | return rawGetOneArbitraryMatch(new Object[]{pHost}); | ||
336 | } | ||
337 | |||
338 | /** | ||
339 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
340 | * under any possible substitution of the unspecified parameters (if any). | ||
341 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
342 | * @return true if the input is a valid (partial) match of the pattern. | ||
343 | * | ||
344 | */ | ||
345 | public boolean hasMatch(final HostInstance pHost) { | ||
346 | return rawHasMatch(new Object[]{pHost}); | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
351 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
352 | * @return the number of pattern matches found. | ||
353 | * | ||
354 | */ | ||
355 | public int countMatches(final HostInstance pHost) { | ||
356 | return rawCountMatches(new Object[]{pHost}); | ||
357 | } | ||
358 | |||
359 | /** | ||
360 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
361 | * Neither determinism nor randomness of selection is guaranteed. | ||
362 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
363 | * @param processor the action that will process the selected match. | ||
364 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
365 | * | ||
366 | */ | ||
367 | public boolean forOneArbitraryMatch(final HostInstance pHost, final Consumer<? super NotEnoughAvailableMemory.Match> processor) { | ||
368 | return rawForOneArbitraryMatch(new Object[]{pHost}, processor); | ||
369 | } | ||
370 | |||
371 | /** | ||
372 | * Returns a new (partial) match. | ||
373 | * This can be used e.g. to call the matcher with a partial match. | ||
374 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
375 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
376 | * @return the (partial) match object. | ||
377 | * | ||
378 | */ | ||
379 | public NotEnoughAvailableMemory.Match newMatch(final HostInstance pHost) { | ||
380 | return NotEnoughAvailableMemory.Match.newMatch(pHost); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * Retrieve the set of values that occur in matches for Host. | ||
385 | * @return the Set of all values or empty set if there are no matches | ||
386 | * | ||
387 | */ | ||
388 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
389 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * Retrieve the set of values that occur in matches for Host. | ||
394 | * @return the Set of all values or empty set if there are no matches | ||
395 | * | ||
396 | */ | ||
397 | public Set<HostInstance> getAllValuesOfHost() { | ||
398 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
399 | } | ||
400 | |||
401 | /** | ||
402 | * Retrieve the set of values that occur in matches for Host. | ||
403 | * @return the Set of all values or empty set if there are no matches | ||
404 | * | ||
405 | */ | ||
406 | public Stream<HostInstance> streamAllValuesOfHost() { | ||
407 | return rawStreamAllValuesOfHost(emptyArray()); | ||
408 | } | ||
409 | |||
410 | @Override | ||
411 | protected NotEnoughAvailableMemory.Match tupleToMatch(final Tuple t) { | ||
412 | try { | ||
413 | return NotEnoughAvailableMemory.Match.newMatch((HostInstance) t.get(POSITION_HOST)); | ||
414 | } catch(ClassCastException e) { | ||
415 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
416 | return null; | ||
417 | } | ||
418 | } | ||
419 | |||
420 | @Override | ||
421 | protected NotEnoughAvailableMemory.Match arrayToMatch(final Object[] match) { | ||
422 | try { | ||
423 | return NotEnoughAvailableMemory.Match.newMatch((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 | @Override | ||
431 | protected NotEnoughAvailableMemory.Match arrayToMatchMutable(final Object[] match) { | ||
432 | try { | ||
433 | return NotEnoughAvailableMemory.Match.newMutableMatch((HostInstance) match[POSITION_HOST]); | ||
434 | } catch(ClassCastException e) { | ||
435 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
436 | return null; | ||
437 | } | ||
438 | } | ||
439 | |||
440 | /** | ||
441 | * @return the singleton instance of the query specification of this pattern | ||
442 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
443 | * | ||
444 | */ | ||
445 | public static IQuerySpecification<NotEnoughAvailableMemory.Matcher> querySpecification() { | ||
446 | return NotEnoughAvailableMemory.instance(); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | private NotEnoughAvailableMemory() { | ||
451 | super(GeneratedPQuery.INSTANCE); | ||
452 | } | ||
453 | |||
454 | /** | ||
455 | * @return the singleton instance of the query specification | ||
456 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
457 | * | ||
458 | */ | ||
459 | public static NotEnoughAvailableMemory instance() { | ||
460 | try{ | ||
461 | return LazyHolder.INSTANCE; | ||
462 | } catch (ExceptionInInitializerError err) { | ||
463 | throw processInitializerError(err); | ||
464 | } | ||
465 | } | ||
466 | |||
467 | @Override | ||
468 | protected NotEnoughAvailableMemory.Matcher instantiate(final ViatraQueryEngine engine) { | ||
469 | return NotEnoughAvailableMemory.Matcher.on(engine); | ||
470 | } | ||
471 | |||
472 | @Override | ||
473 | public NotEnoughAvailableMemory.Matcher instantiate() { | ||
474 | return NotEnoughAvailableMemory.Matcher.create(); | ||
475 | } | ||
476 | |||
477 | @Override | ||
478 | public NotEnoughAvailableMemory.Match newEmptyMatch() { | ||
479 | return NotEnoughAvailableMemory.Match.newEmptyMatch(); | ||
480 | } | ||
481 | |||
482 | @Override | ||
483 | public NotEnoughAvailableMemory.Match newMatch(final Object... parameters) { | ||
484 | return NotEnoughAvailableMemory.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[0]); | ||
485 | } | ||
486 | |||
487 | /** | ||
488 | * Inner class allowing the singleton instance of {@link NotEnoughAvailableMemory} to be created | ||
489 | * <b>not</b> at the class load time of the outer class, | ||
490 | * but rather at the first call to {@link NotEnoughAvailableMemory#instance()}. | ||
491 | * | ||
492 | * <p> This workaround is required e.g. to support recursion. | ||
493 | * | ||
494 | */ | ||
495 | private static class LazyHolder { | ||
496 | private static final NotEnoughAvailableMemory INSTANCE = new NotEnoughAvailableMemory(); | ||
497 | |||
498 | /** | ||
499 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
500 | * This initialization order is required to support indirect recursion. | ||
501 | * | ||
502 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
503 | * | ||
504 | */ | ||
505 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
506 | |||
507 | public static Object ensureInitialized() { | ||
508 | INSTANCE.ensureInitializedInternal(); | ||
509 | return null; | ||
510 | } | ||
511 | } | ||
512 | |||
513 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
514 | private static final NotEnoughAvailableMemory.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
515 | |||
516 | 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); | ||
517 | |||
518 | private final List<PParameter> parameters = Arrays.asList(parameter_Host); | ||
519 | |||
520 | private GeneratedPQuery() { | ||
521 | super(PVisibility.PUBLIC); | ||
522 | } | ||
523 | |||
524 | @Override | ||
525 | public String getFullyQualifiedName() { | ||
526 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.notEnoughAvailableMemory"; | ||
527 | } | ||
528 | |||
529 | @Override | ||
530 | public List<String> getParameterNames() { | ||
531 | return Arrays.asList("Host"); | ||
532 | } | ||
533 | |||
534 | @Override | ||
535 | public List<PParameter> getParameters() { | ||
536 | return parameters; | ||
537 | } | ||
538 | |||
539 | @Override | ||
540 | public Set<PBody> doGetContainedBodies() { | ||
541 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
542 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
543 | { | ||
544 | PBody body = new PBody(this); | ||
545 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
546 | PVariable var_Memory = body.getOrCreateVariableByName("Memory"); | ||
547 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
548 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
549 | new ExportedParameter(body, var_Host, parameter_Host) | ||
550 | )); | ||
551 | // find availableMemory(Host, Memory) | ||
552 | new PositivePatternCall(body, Tuples.flatTupleOf(var_Host, var_Memory), AvailableMemory.instance().getInternalQueryRepresentation()); | ||
553 | // check(Memory < 0) | ||
554 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
555 | |||
556 | @Override | ||
557 | public String getShortDescription() { | ||
558 | return "Expression evaluation from pattern notEnoughAvailableMemory"; | ||
559 | } | ||
560 | |||
561 | @Override | ||
562 | public Iterable<String> getInputParameterNames() { | ||
563 | return Arrays.asList("Memory");} | ||
564 | |||
565 | @Override | ||
566 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
567 | Integer Memory = (Integer) provider.getValue("Memory"); | ||
568 | return evaluateExpression_1_1(Memory); | ||
569 | } | ||
570 | }, null); | ||
571 | bodies.add(body); | ||
572 | } | ||
573 | { | ||
574 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
575 | annotation.addAttribute("severity", "error"); | ||
576 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
577 | new ParameterReference("Host") | ||
578 | })); | ||
579 | annotation.addAttribute("message", "Insufficient memory available on host."); | ||
580 | addAnnotation(annotation); | ||
581 | } | ||
582 | return bodies; | ||
583 | } | ||
584 | } | ||
585 | |||
586 | private static boolean evaluateExpression_1_1(final Integer Memory) { | ||
587 | return ((Memory).intValue() < 0); | ||
588 | } | ||
589 | } | ||
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..2a40ac57 --- /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,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 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 | switch(parameterName) { | ||
90 | case "Req": return this.fReq; | ||
91 | default: return null; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | @Override | ||
96 | public Object get(final int index) { | ||
97 | switch(index) { | ||
98 | case 0: return this.fReq; | ||
99 | default: return null; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | public Requirement getReq() { | ||
104 | return this.fReq; | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public boolean set(final String parameterName, final Object newValue) { | ||
109 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
110 | if ("Req".equals(parameterName) ) { | ||
111 | this.fReq = (Requirement) newValue; | ||
112 | return true; | ||
113 | } | ||
114 | return false; | ||
115 | } | ||
116 | |||
117 | public void setReq(final Requirement pReq) { | ||
118 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
119 | this.fReq = pReq; | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public String patternName() { | ||
124 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.redundantInstancesOnSameHost"; | ||
125 | } | ||
126 | |||
127 | @Override | ||
128 | public List<String> parameterNames() { | ||
129 | return RedundantInstancesOnSameHost.Match.parameterNames; | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | public Object[] toArray() { | ||
134 | return new Object[]{fReq}; | ||
135 | } | ||
136 | |||
137 | @Override | ||
138 | public RedundantInstancesOnSameHost.Match toImmutable() { | ||
139 | return isMutable() ? newMatch(fReq) : this; | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public String prettyPrint() { | ||
144 | StringBuilder result = new StringBuilder(); | ||
145 | result.append("\"Req\"=" + prettyPrintValue(fReq)); | ||
146 | return result.toString(); | ||
147 | } | ||
148 | |||
149 | @Override | ||
150 | public int hashCode() { | ||
151 | return Objects.hash(fReq); | ||
152 | } | ||
153 | |||
154 | @Override | ||
155 | public boolean equals(final Object obj) { | ||
156 | if (this == obj) | ||
157 | return true; | ||
158 | if (obj == null) { | ||
159 | return false; | ||
160 | } | ||
161 | if ((obj instanceof RedundantInstancesOnSameHost.Match)) { | ||
162 | RedundantInstancesOnSameHost.Match other = (RedundantInstancesOnSameHost.Match) obj; | ||
163 | return Objects.equals(fReq, other.fReq); | ||
164 | } else { | ||
165 | // this should be infrequent | ||
166 | if (!(obj instanceof IPatternMatch)) { | ||
167 | return false; | ||
168 | } | ||
169 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
170 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | @Override | ||
175 | public RedundantInstancesOnSameHost specification() { | ||
176 | return RedundantInstancesOnSameHost.instance(); | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * Returns an empty, mutable match. | ||
181 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
182 | * | ||
183 | * @return the empty match. | ||
184 | * | ||
185 | */ | ||
186 | public static RedundantInstancesOnSameHost.Match newEmptyMatch() { | ||
187 | return new Mutable(null); | ||
188 | } | ||
189 | |||
190 | /** | ||
191 | * Returns a mutable (partial) match. | ||
192 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
193 | * | ||
194 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
195 | * @return the new, mutable (partial) match object. | ||
196 | * | ||
197 | */ | ||
198 | public static RedundantInstancesOnSameHost.Match newMutableMatch(final Requirement pReq) { | ||
199 | return new Mutable(pReq); | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * Returns a new (partial) match. | ||
204 | * This can be used e.g. to call the matcher with a partial match. | ||
205 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
206 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
207 | * @return the (partial) match object. | ||
208 | * | ||
209 | */ | ||
210 | public static RedundantInstancesOnSameHost.Match newMatch(final Requirement pReq) { | ||
211 | return new Immutable(pReq); | ||
212 | } | ||
213 | |||
214 | private static final class Mutable extends RedundantInstancesOnSameHost.Match { | ||
215 | Mutable(final Requirement pReq) { | ||
216 | super(pReq); | ||
217 | } | ||
218 | |||
219 | @Override | ||
220 | public boolean isMutable() { | ||
221 | return true; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | private static final class Immutable extends RedundantInstancesOnSameHost.Match { | ||
226 | Immutable(final Requirement pReq) { | ||
227 | super(pReq); | ||
228 | } | ||
229 | |||
230 | @Override | ||
231 | public boolean isMutable() { | ||
232 | return false; | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | |||
237 | /** | ||
238 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.redundantInstancesOnSameHost pattern, | ||
239 | * providing pattern-specific query methods. | ||
240 | * | ||
241 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
242 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
243 | * | ||
244 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
245 | * | ||
246 | * <p>Original source: | ||
247 | * <code><pre> | ||
248 | * {@literal @}Constraint(severity = "error", key = {Req}, | ||
249 | * message = "Redundant instances must not be allocated to the same host.") | ||
250 | * pattern redundantInstancesOnSameHost(Req : Requirement) { | ||
251 | * Requirement.instances(Req, App1); | ||
252 | * Requirement.instances(Req, App2); | ||
253 | * App1 != App2; | ||
254 | * ApplicationInstance.allocatedTo(App1, Host); | ||
255 | * ApplicationInstance.allocatedTo(App2, Host); | ||
256 | * } | ||
257 | * </pre></code> | ||
258 | * | ||
259 | * @see Match | ||
260 | * @see RedundantInstancesOnSameHost | ||
261 | * | ||
262 | */ | ||
263 | public static class Matcher extends BaseMatcher<RedundantInstancesOnSameHost.Match> { | ||
264 | /** | ||
265 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
266 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
267 | * | ||
268 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
269 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
270 | * | ||
271 | */ | ||
272 | public static RedundantInstancesOnSameHost.Matcher on(final ViatraQueryEngine engine) { | ||
273 | // check if matcher already exists | ||
274 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
275 | if (matcher == null) { | ||
276 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
277 | } | ||
278 | return matcher; | ||
279 | } | ||
280 | |||
281 | /** | ||
282 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
283 | * @return an initialized matcher | ||
284 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
285 | * | ||
286 | */ | ||
287 | public static RedundantInstancesOnSameHost.Matcher create() { | ||
288 | return new Matcher(); | ||
289 | } | ||
290 | |||
291 | private static final int POSITION_REQ = 0; | ||
292 | |||
293 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(RedundantInstancesOnSameHost.Matcher.class); | ||
294 | |||
295 | /** | ||
296 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
297 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
298 | * | ||
299 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
300 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
301 | * | ||
302 | */ | ||
303 | private Matcher() { | ||
304 | super(querySpecification()); | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
309 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
310 | * @return matches represented as a Match object. | ||
311 | * | ||
312 | */ | ||
313 | public Collection<RedundantInstancesOnSameHost.Match> getAllMatches(final Requirement pReq) { | ||
314 | return rawStreamAllMatches(new Object[]{pReq}).collect(Collectors.toSet()); | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
319 | * </p> | ||
320 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
321 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
322 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
323 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
324 | * @return a stream of matches represented as a Match object. | ||
325 | * | ||
326 | */ | ||
327 | public Stream<RedundantInstancesOnSameHost.Match> streamAllMatches(final Requirement pReq) { | ||
328 | return rawStreamAllMatches(new Object[]{pReq}); | ||
329 | } | ||
330 | |||
331 | /** | ||
332 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
333 | * Neither determinism nor randomness of selection is guaranteed. | ||
334 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
335 | * @return a match represented as a Match object, or null if no match is found. | ||
336 | * | ||
337 | */ | ||
338 | public Optional<RedundantInstancesOnSameHost.Match> getOneArbitraryMatch(final Requirement pReq) { | ||
339 | return rawGetOneArbitraryMatch(new Object[]{pReq}); | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
344 | * under any possible substitution of the unspecified parameters (if any). | ||
345 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
346 | * @return true if the input is a valid (partial) match of the pattern. | ||
347 | * | ||
348 | */ | ||
349 | public boolean hasMatch(final Requirement pReq) { | ||
350 | return rawHasMatch(new Object[]{pReq}); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
355 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
356 | * @return the number of pattern matches found. | ||
357 | * | ||
358 | */ | ||
359 | public int countMatches(final Requirement pReq) { | ||
360 | return rawCountMatches(new Object[]{pReq}); | ||
361 | } | ||
362 | |||
363 | /** | ||
364 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
365 | * Neither determinism nor randomness of selection is guaranteed. | ||
366 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
367 | * @param processor the action that will process the selected match. | ||
368 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
369 | * | ||
370 | */ | ||
371 | public boolean forOneArbitraryMatch(final Requirement pReq, final Consumer<? super RedundantInstancesOnSameHost.Match> processor) { | ||
372 | return rawForOneArbitraryMatch(new Object[]{pReq}, processor); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * Returns a new (partial) match. | ||
377 | * This can be used e.g. to call the matcher with a partial match. | ||
378 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
379 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
380 | * @return the (partial) match object. | ||
381 | * | ||
382 | */ | ||
383 | public RedundantInstancesOnSameHost.Match newMatch(final Requirement pReq) { | ||
384 | return RedundantInstancesOnSameHost.Match.newMatch(pReq); | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * Retrieve the set of values that occur in matches for Req. | ||
389 | * @return the Set of all values or empty set if there are no matches | ||
390 | * | ||
391 | */ | ||
392 | protected Stream<Requirement> rawStreamAllValuesOfReq(final Object[] parameters) { | ||
393 | return rawStreamAllValues(POSITION_REQ, parameters).map(Requirement.class::cast); | ||
394 | } | ||
395 | |||
396 | /** | ||
397 | * Retrieve the set of values that occur in matches for Req. | ||
398 | * @return the Set of all values or empty set if there are no matches | ||
399 | * | ||
400 | */ | ||
401 | public Set<Requirement> getAllValuesOfReq() { | ||
402 | return rawStreamAllValuesOfReq(emptyArray()).collect(Collectors.toSet()); | ||
403 | } | ||
404 | |||
405 | /** | ||
406 | * Retrieve the set of values that occur in matches for Req. | ||
407 | * @return the Set of all values or empty set if there are no matches | ||
408 | * | ||
409 | */ | ||
410 | public Stream<Requirement> streamAllValuesOfReq() { | ||
411 | return rawStreamAllValuesOfReq(emptyArray()); | ||
412 | } | ||
413 | |||
414 | @Override | ||
415 | protected RedundantInstancesOnSameHost.Match tupleToMatch(final Tuple t) { | ||
416 | try { | ||
417 | return RedundantInstancesOnSameHost.Match.newMatch((Requirement) t.get(POSITION_REQ)); | ||
418 | } catch(ClassCastException e) { | ||
419 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
420 | return null; | ||
421 | } | ||
422 | } | ||
423 | |||
424 | @Override | ||
425 | protected RedundantInstancesOnSameHost.Match arrayToMatch(final Object[] match) { | ||
426 | try { | ||
427 | return RedundantInstancesOnSameHost.Match.newMatch((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 | @Override | ||
435 | protected RedundantInstancesOnSameHost.Match arrayToMatchMutable(final Object[] match) { | ||
436 | try { | ||
437 | return RedundantInstancesOnSameHost.Match.newMutableMatch((Requirement) match[POSITION_REQ]); | ||
438 | } catch(ClassCastException e) { | ||
439 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
440 | return null; | ||
441 | } | ||
442 | } | ||
443 | |||
444 | /** | ||
445 | * @return the singleton instance of the query specification of this pattern | ||
446 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
447 | * | ||
448 | */ | ||
449 | public static IQuerySpecification<RedundantInstancesOnSameHost.Matcher> querySpecification() { | ||
450 | return RedundantInstancesOnSameHost.instance(); | ||
451 | } | ||
452 | } | ||
453 | |||
454 | private RedundantInstancesOnSameHost() { | ||
455 | super(GeneratedPQuery.INSTANCE); | ||
456 | } | ||
457 | |||
458 | /** | ||
459 | * @return the singleton instance of the query specification | ||
460 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
461 | * | ||
462 | */ | ||
463 | public static RedundantInstancesOnSameHost instance() { | ||
464 | try{ | ||
465 | return LazyHolder.INSTANCE; | ||
466 | } catch (ExceptionInInitializerError err) { | ||
467 | throw processInitializerError(err); | ||
468 | } | ||
469 | } | ||
470 | |||
471 | @Override | ||
472 | protected RedundantInstancesOnSameHost.Matcher instantiate(final ViatraQueryEngine engine) { | ||
473 | return RedundantInstancesOnSameHost.Matcher.on(engine); | ||
474 | } | ||
475 | |||
476 | @Override | ||
477 | public RedundantInstancesOnSameHost.Matcher instantiate() { | ||
478 | return RedundantInstancesOnSameHost.Matcher.create(); | ||
479 | } | ||
480 | |||
481 | @Override | ||
482 | public RedundantInstancesOnSameHost.Match newEmptyMatch() { | ||
483 | return RedundantInstancesOnSameHost.Match.newEmptyMatch(); | ||
484 | } | ||
485 | |||
486 | @Override | ||
487 | public RedundantInstancesOnSameHost.Match newMatch(final Object... parameters) { | ||
488 | return RedundantInstancesOnSameHost.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.Requirement) parameters[0]); | ||
489 | } | ||
490 | |||
491 | /** | ||
492 | * Inner class allowing the singleton instance of {@link RedundantInstancesOnSameHost} to be created | ||
493 | * <b>not</b> at the class load time of the outer class, | ||
494 | * but rather at the first call to {@link RedundantInstancesOnSameHost#instance()}. | ||
495 | * | ||
496 | * <p> This workaround is required e.g. to support recursion. | ||
497 | * | ||
498 | */ | ||
499 | private static class LazyHolder { | ||
500 | private static final RedundantInstancesOnSameHost INSTANCE = new RedundantInstancesOnSameHost(); | ||
501 | |||
502 | /** | ||
503 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
504 | * This initialization order is required to support indirect recursion. | ||
505 | * | ||
506 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
507 | * | ||
508 | */ | ||
509 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
510 | |||
511 | public static Object ensureInitialized() { | ||
512 | INSTANCE.ensureInitializedInternal(); | ||
513 | return null; | ||
514 | } | ||
515 | } | ||
516 | |||
517 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
518 | private static final RedundantInstancesOnSameHost.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
519 | |||
520 | 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); | ||
521 | |||
522 | private final List<PParameter> parameters = Arrays.asList(parameter_Req); | ||
523 | |||
524 | private GeneratedPQuery() { | ||
525 | super(PVisibility.PUBLIC); | ||
526 | } | ||
527 | |||
528 | @Override | ||
529 | public String getFullyQualifiedName() { | ||
530 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.redundantInstancesOnSameHost"; | ||
531 | } | ||
532 | |||
533 | @Override | ||
534 | public List<String> getParameterNames() { | ||
535 | return Arrays.asList("Req"); | ||
536 | } | ||
537 | |||
538 | @Override | ||
539 | public List<PParameter> getParameters() { | ||
540 | return parameters; | ||
541 | } | ||
542 | |||
543 | @Override | ||
544 | public Set<PBody> doGetContainedBodies() { | ||
545 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
546 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
547 | { | ||
548 | PBody body = new PBody(this); | ||
549 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
550 | PVariable var_App1 = body.getOrCreateVariableByName("App1"); | ||
551 | PVariable var_App2 = body.getOrCreateVariableByName("App2"); | ||
552 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
553 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
554 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
555 | new ExportedParameter(body, var_Req, parameter_Req) | ||
556 | )); | ||
557 | // Requirement.instances(Req, App1) | ||
558 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
559 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
560 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "instances"))); | ||
561 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
562 | new Equality(body, var__virtual_0_, var_App1); | ||
563 | // Requirement.instances(Req, App2) | ||
564 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
565 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
566 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "instances"))); | ||
567 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
568 | new Equality(body, var__virtual_1_, var_App2); | ||
569 | // App1 != App2 | ||
570 | new Inequality(body, var_App1, var_App2); | ||
571 | // ApplicationInstance.allocatedTo(App1, Host) | ||
572 | new TypeConstraint(body, Tuples.flatTupleOf(var_App1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
573 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
574 | new TypeConstraint(body, Tuples.flatTupleOf(var_App1, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
575 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
576 | new Equality(body, var__virtual_2_, var_Host); | ||
577 | // ApplicationInstance.allocatedTo(App2, Host) | ||
578 | new TypeConstraint(body, Tuples.flatTupleOf(var_App2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
579 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
580 | new TypeConstraint(body, Tuples.flatTupleOf(var_App2, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
581 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
582 | new Equality(body, var__virtual_3_, var_Host); | ||
583 | bodies.add(body); | ||
584 | } | ||
585 | { | ||
586 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
587 | annotation.addAttribute("severity", "error"); | ||
588 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
589 | new ParameterReference("Req") | ||
590 | })); | ||
591 | annotation.addAttribute("message", "Redundant instances must not be allocated to the same host."); | ||
592 | addAnnotation(annotation); | ||
593 | } | ||
594 | return bodies; | ||
595 | } | ||
596 | } | ||
597 | } | ||
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..ed3c903c --- /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,589 @@ | |||
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 | switch(parameterName) { | ||
83 | case "HostInstance": return this.fHostInstance; | ||
84 | default: return null; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public Object get(final int index) { | ||
90 | switch(index) { | ||
91 | case 0: return this.fHostInstance; | ||
92 | default: return null; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public HostInstance getHostInstance() { | ||
97 | return this.fHostInstance; | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public boolean set(final String parameterName, final Object newValue) { | ||
102 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
103 | if ("HostInstance".equals(parameterName) ) { | ||
104 | this.fHostInstance = (HostInstance) newValue; | ||
105 | return true; | ||
106 | } | ||
107 | return false; | ||
108 | } | ||
109 | |||
110 | public void setHostInstance(final HostInstance pHostInstance) { | ||
111 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
112 | this.fHostInstance = pHostInstance; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public String patternName() { | ||
117 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.removeHostInstance"; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<String> parameterNames() { | ||
122 | return RemoveHostInstance.Match.parameterNames; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Object[] toArray() { | ||
127 | return new Object[]{fHostInstance}; | ||
128 | } | ||
129 | |||
130 | @Override | ||
131 | public RemoveHostInstance.Match toImmutable() { | ||
132 | return isMutable() ? newMatch(fHostInstance) : this; | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public String prettyPrint() { | ||
137 | StringBuilder result = new StringBuilder(); | ||
138 | result.append("\"HostInstance\"=" + prettyPrintValue(fHostInstance)); | ||
139 | return result.toString(); | ||
140 | } | ||
141 | |||
142 | @Override | ||
143 | public int hashCode() { | ||
144 | return Objects.hash(fHostInstance); | ||
145 | } | ||
146 | |||
147 | @Override | ||
148 | public boolean equals(final Object obj) { | ||
149 | if (this == obj) | ||
150 | return true; | ||
151 | if (obj == null) { | ||
152 | return false; | ||
153 | } | ||
154 | if ((obj instanceof RemoveHostInstance.Match)) { | ||
155 | RemoveHostInstance.Match other = (RemoveHostInstance.Match) obj; | ||
156 | return Objects.equals(fHostInstance, other.fHostInstance); | ||
157 | } else { | ||
158 | // this should be infrequent | ||
159 | if (!(obj instanceof IPatternMatch)) { | ||
160 | return false; | ||
161 | } | ||
162 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
163 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
164 | } | ||
165 | } | ||
166 | |||
167 | @Override | ||
168 | public RemoveHostInstance specification() { | ||
169 | return RemoveHostInstance.instance(); | ||
170 | } | ||
171 | |||
172 | /** | ||
173 | * Returns an empty, mutable match. | ||
174 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
175 | * | ||
176 | * @return the empty match. | ||
177 | * | ||
178 | */ | ||
179 | public static RemoveHostInstance.Match newEmptyMatch() { | ||
180 | return new Mutable(null); | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * Returns a mutable (partial) match. | ||
185 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
186 | * | ||
187 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
188 | * @return the new, mutable (partial) match object. | ||
189 | * | ||
190 | */ | ||
191 | public static RemoveHostInstance.Match newMutableMatch(final HostInstance pHostInstance) { | ||
192 | return new Mutable(pHostInstance); | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * Returns a new (partial) match. | ||
197 | * This can be used e.g. to call the matcher with a partial match. | ||
198 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
199 | * @param pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
200 | * @return the (partial) match object. | ||
201 | * | ||
202 | */ | ||
203 | public static RemoveHostInstance.Match newMatch(final HostInstance pHostInstance) { | ||
204 | return new Immutable(pHostInstance); | ||
205 | } | ||
206 | |||
207 | private static final class Mutable extends RemoveHostInstance.Match { | ||
208 | Mutable(final HostInstance pHostInstance) { | ||
209 | super(pHostInstance); | ||
210 | } | ||
211 | |||
212 | @Override | ||
213 | public boolean isMutable() { | ||
214 | return true; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | private static final class Immutable extends RemoveHostInstance.Match { | ||
219 | Immutable(final HostInstance pHostInstance) { | ||
220 | super(pHostInstance); | ||
221 | } | ||
222 | |||
223 | @Override | ||
224 | public boolean isMutable() { | ||
225 | return false; | ||
226 | } | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /** | ||
231 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.removeHostInstance pattern, | ||
232 | * providing pattern-specific query methods. | ||
233 | * | ||
234 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
235 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
236 | * | ||
237 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
238 | * | ||
239 | * <p>Original source: | ||
240 | * <code><pre> | ||
241 | * pattern removeHostInstance(HostInstance : HostInstance) { | ||
242 | * neg HostInstance.applications(HostInstance, _); | ||
243 | * } | ||
244 | * </pre></code> | ||
245 | * | ||
246 | * @see Match | ||
247 | * @see RemoveHostInstance | ||
248 | * | ||
249 | */ | ||
250 | public static class Matcher extends BaseMatcher<RemoveHostInstance.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 RemoveHostInstance.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 RemoveHostInstance.Matcher create() { | ||
275 | return new Matcher(); | ||
276 | } | ||
277 | |||
278 | private static final int POSITION_HOSTINSTANCE = 0; | ||
279 | |||
280 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(RemoveHostInstance.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 pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
297 | * @return matches represented as a Match object. | ||
298 | * | ||
299 | */ | ||
300 | public Collection<RemoveHostInstance.Match> getAllMatches(final HostInstance pHostInstance) { | ||
301 | return rawStreamAllMatches(new Object[]{pHostInstance}).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 pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
311 | * @return a stream of matches represented as a Match object. | ||
312 | * | ||
313 | */ | ||
314 | public Stream<RemoveHostInstance.Match> streamAllMatches(final HostInstance pHostInstance) { | ||
315 | return rawStreamAllMatches(new Object[]{pHostInstance}); | ||
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 pHostInstance the fixed value of pattern parameter HostInstance, 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<RemoveHostInstance.Match> getOneArbitraryMatch(final HostInstance pHostInstance) { | ||
326 | return rawGetOneArbitraryMatch(new Object[]{pHostInstance}); | ||
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 pHostInstance the fixed value of pattern parameter HostInstance, 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 HostInstance pHostInstance) { | ||
337 | return rawHasMatch(new Object[]{pHostInstance}); | ||
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 pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
343 | * @return the number of pattern matches found. | ||
344 | * | ||
345 | */ | ||
346 | public int countMatches(final HostInstance pHostInstance) { | ||
347 | return rawCountMatches(new Object[]{pHostInstance}); | ||
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 pHostInstance the fixed value of pattern parameter HostInstance, 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 HostInstance pHostInstance, final Consumer<? super RemoveHostInstance.Match> processor) { | ||
359 | return rawForOneArbitraryMatch(new Object[]{pHostInstance}, 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 pHostInstance the fixed value of pattern parameter HostInstance, or null if not bound. | ||
367 | * @return the (partial) match object. | ||
368 | * | ||
369 | */ | ||
370 | public RemoveHostInstance.Match newMatch(final HostInstance pHostInstance) { | ||
371 | return RemoveHostInstance.Match.newMatch(pHostInstance); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * Retrieve the set of values that occur in matches for HostInstance. | ||
376 | * @return the Set of all values or empty set if there are no matches | ||
377 | * | ||
378 | */ | ||
379 | protected Stream<HostInstance> rawStreamAllValuesOfHostInstance(final Object[] parameters) { | ||
380 | return rawStreamAllValues(POSITION_HOSTINSTANCE, parameters).map(HostInstance.class::cast); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * Retrieve the set of values that occur in matches for HostInstance. | ||
385 | * @return the Set of all values or empty set if there are no matches | ||
386 | * | ||
387 | */ | ||
388 | public Set<HostInstance> getAllValuesOfHostInstance() { | ||
389 | return rawStreamAllValuesOfHostInstance(emptyArray()).collect(Collectors.toSet()); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * Retrieve the set of values that occur in matches for HostInstance. | ||
394 | * @return the Set of all values or empty set if there are no matches | ||
395 | * | ||
396 | */ | ||
397 | public Stream<HostInstance> streamAllValuesOfHostInstance() { | ||
398 | return rawStreamAllValuesOfHostInstance(emptyArray()); | ||
399 | } | ||
400 | |||
401 | @Override | ||
402 | protected RemoveHostInstance.Match tupleToMatch(final Tuple t) { | ||
403 | try { | ||
404 | return RemoveHostInstance.Match.newMatch((HostInstance) t.get(POSITION_HOSTINSTANCE)); | ||
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 RemoveHostInstance.Match arrayToMatch(final Object[] match) { | ||
413 | try { | ||
414 | return RemoveHostInstance.Match.newMatch((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 | @Override | ||
422 | protected RemoveHostInstance.Match arrayToMatchMutable(final Object[] match) { | ||
423 | try { | ||
424 | return RemoveHostInstance.Match.newMutableMatch((HostInstance) match[POSITION_HOSTINSTANCE]); | ||
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<RemoveHostInstance.Matcher> querySpecification() { | ||
437 | return RemoveHostInstance.instance(); | ||
438 | } | ||
439 | } | ||
440 | |||
441 | private RemoveHostInstance() { | ||
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 RemoveHostInstance instance() { | ||
451 | try{ | ||
452 | return LazyHolder.INSTANCE; | ||
453 | } catch (ExceptionInInitializerError err) { | ||
454 | throw processInitializerError(err); | ||
455 | } | ||
456 | } | ||
457 | |||
458 | @Override | ||
459 | protected RemoveHostInstance.Matcher instantiate(final ViatraQueryEngine engine) { | ||
460 | return RemoveHostInstance.Matcher.on(engine); | ||
461 | } | ||
462 | |||
463 | @Override | ||
464 | public RemoveHostInstance.Matcher instantiate() { | ||
465 | return RemoveHostInstance.Matcher.create(); | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | public RemoveHostInstance.Match newEmptyMatch() { | ||
470 | return RemoveHostInstance.Match.newEmptyMatch(); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public RemoveHostInstance.Match newMatch(final Object... parameters) { | ||
475 | return RemoveHostInstance.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance) parameters[0]); | ||
476 | } | ||
477 | |||
478 | /** | ||
479 | * Inner class allowing the singleton instance of {@link RemoveHostInstance} 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 RemoveHostInstance#instance()}. | ||
482 | * | ||
483 | * <p> This workaround is required e.g. to support recursion. | ||
484 | * | ||
485 | */ | ||
486 | private static class LazyHolder { | ||
487 | private static final RemoveHostInstance INSTANCE = new RemoveHostInstance(); | ||
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 RemoveHostInstance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
506 | |||
507 | 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); | ||
508 | |||
509 | private final List<PParameter> parameters = Arrays.asList(parameter_HostInstance); | ||
510 | |||
511 | private class Embedded_1_HostInstance_applications extends BaseGeneratedEMFPQuery { | ||
512 | 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); | ||
513 | |||
514 | 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); | ||
515 | |||
516 | private final List<PParameter> embeddedParameters = Arrays.asList(parameter_p0, parameter_p1); | ||
517 | |||
518 | public Embedded_1_HostInstance_applications() { | ||
519 | super(PVisibility.EMBEDDED); | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public String getFullyQualifiedName() { | ||
524 | return GeneratedPQuery.this.getFullyQualifiedName() + "$Embedded_1_HostInstance_applications"; | ||
525 | } | ||
526 | |||
527 | @Override | ||
528 | public List<PParameter> getParameters() { | ||
529 | return embeddedParameters; | ||
530 | } | ||
531 | |||
532 | @Override | ||
533 | public Set<PBody> doGetContainedBodies() { | ||
534 | PBody body = new PBody(this); | ||
535 | PVariable var_p0 = body.getOrCreateVariableByName("p0"); | ||
536 | PVariable var_p1 = body.getOrCreateVariableByName("p1"); | ||
537 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
538 | new ExportedParameter(body, var_p0, parameter_p0), | ||
539 | new ExportedParameter(body, var_p1, parameter_p1) | ||
540 | )); | ||
541 | // HostInstance.applications(HostInstance, _) | ||
542 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
543 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
544 | new TypeConstraint(body, Tuples.flatTupleOf(var_p0, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostInstance", "applications"))); | ||
545 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
546 | new Equality(body, var__virtual_0_, var_p1); | ||
547 | return Collections.singleton(body); | ||
548 | } | ||
549 | } | ||
550 | |||
551 | private GeneratedPQuery() { | ||
552 | super(PVisibility.PUBLIC); | ||
553 | } | ||
554 | |||
555 | @Override | ||
556 | public String getFullyQualifiedName() { | ||
557 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.removeHostInstance"; | ||
558 | } | ||
559 | |||
560 | @Override | ||
561 | public List<String> getParameterNames() { | ||
562 | return Arrays.asList("HostInstance"); | ||
563 | } | ||
564 | |||
565 | @Override | ||
566 | public List<PParameter> getParameters() { | ||
567 | return parameters; | ||
568 | } | ||
569 | |||
570 | @Override | ||
571 | public Set<PBody> doGetContainedBodies() { | ||
572 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
573 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
574 | { | ||
575 | PBody body = new PBody(this); | ||
576 | PVariable var_HostInstance = body.getOrCreateVariableByName("HostInstance"); | ||
577 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
578 | new TypeConstraint(body, Tuples.flatTupleOf(var_HostInstance), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
579 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
580 | new ExportedParameter(body, var_HostInstance, parameter_HostInstance) | ||
581 | )); | ||
582 | // neg HostInstance.applications(HostInstance, _) | ||
583 | new NegativePatternCall(body, Tuples.flatTupleOf(var_HostInstance, var___0_), new RemoveHostInstance.GeneratedPQuery.Embedded_1_HostInstance_applications()); | ||
584 | bodies.add(body); | ||
585 | } | ||
586 | return bodies; | ||
587 | } | ||
588 | } | ||
589 | } | ||
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..eaceec5f --- /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,607 @@ | |||
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 | switch(parameterName) { | ||
94 | case "Req": return this.fReq; | ||
95 | default: return null; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | @Override | ||
100 | public Object get(final int index) { | ||
101 | switch(index) { | ||
102 | case 0: return this.fReq; | ||
103 | default: return null; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | public Requirement getReq() { | ||
108 | return this.fReq; | ||
109 | } | ||
110 | |||
111 | @Override | ||
112 | public boolean set(final String parameterName, final Object newValue) { | ||
113 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
114 | if ("Req".equals(parameterName) ) { | ||
115 | this.fReq = (Requirement) newValue; | ||
116 | return true; | ||
117 | } | ||
118 | return false; | ||
119 | } | ||
120 | |||
121 | public void setReq(final Requirement pReq) { | ||
122 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
123 | this.fReq = pReq; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public String patternName() { | ||
128 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.requirementNotSatisfied"; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public List<String> parameterNames() { | ||
133 | return RequirementNotSatisfied.Match.parameterNames; | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public Object[] toArray() { | ||
138 | return new Object[]{fReq}; | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public RequirementNotSatisfied.Match toImmutable() { | ||
143 | return isMutable() ? newMatch(fReq) : this; | ||
144 | } | ||
145 | |||
146 | @Override | ||
147 | public String prettyPrint() { | ||
148 | StringBuilder result = new StringBuilder(); | ||
149 | result.append("\"Req\"=" + prettyPrintValue(fReq)); | ||
150 | return result.toString(); | ||
151 | } | ||
152 | |||
153 | @Override | ||
154 | public int hashCode() { | ||
155 | return Objects.hash(fReq); | ||
156 | } | ||
157 | |||
158 | @Override | ||
159 | public boolean equals(final Object obj) { | ||
160 | if (this == obj) | ||
161 | return true; | ||
162 | if (obj == null) { | ||
163 | return false; | ||
164 | } | ||
165 | if ((obj instanceof RequirementNotSatisfied.Match)) { | ||
166 | RequirementNotSatisfied.Match other = (RequirementNotSatisfied.Match) obj; | ||
167 | return Objects.equals(fReq, other.fReq); | ||
168 | } else { | ||
169 | // this should be infrequent | ||
170 | if (!(obj instanceof IPatternMatch)) { | ||
171 | return false; | ||
172 | } | ||
173 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
174 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | @Override | ||
179 | public RequirementNotSatisfied specification() { | ||
180 | return RequirementNotSatisfied.instance(); | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * Returns an empty, mutable match. | ||
185 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
186 | * | ||
187 | * @return the empty match. | ||
188 | * | ||
189 | */ | ||
190 | public static RequirementNotSatisfied.Match newEmptyMatch() { | ||
191 | return new Mutable(null); | ||
192 | } | ||
193 | |||
194 | /** | ||
195 | * Returns a mutable (partial) match. | ||
196 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
197 | * | ||
198 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
199 | * @return the new, mutable (partial) match object. | ||
200 | * | ||
201 | */ | ||
202 | public static RequirementNotSatisfied.Match newMutableMatch(final Requirement pReq) { | ||
203 | return new Mutable(pReq); | ||
204 | } | ||
205 | |||
206 | /** | ||
207 | * Returns a new (partial) match. | ||
208 | * This can be used e.g. to call the matcher with a partial match. | ||
209 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
210 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
211 | * @return the (partial) match object. | ||
212 | * | ||
213 | */ | ||
214 | public static RequirementNotSatisfied.Match newMatch(final Requirement pReq) { | ||
215 | return new Immutable(pReq); | ||
216 | } | ||
217 | |||
218 | private static final class Mutable extends RequirementNotSatisfied.Match { | ||
219 | Mutable(final Requirement pReq) { | ||
220 | super(pReq); | ||
221 | } | ||
222 | |||
223 | @Override | ||
224 | public boolean isMutable() { | ||
225 | return true; | ||
226 | } | ||
227 | } | ||
228 | |||
229 | private static final class Immutable extends RequirementNotSatisfied.Match { | ||
230 | Immutable(final Requirement pReq) { | ||
231 | super(pReq); | ||
232 | } | ||
233 | |||
234 | @Override | ||
235 | public boolean isMutable() { | ||
236 | return false; | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.requirementNotSatisfied pattern, | ||
243 | * providing pattern-specific query methods. | ||
244 | * | ||
245 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
246 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
247 | * | ||
248 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
249 | * | ||
250 | * <p>Original source: | ||
251 | * <code><pre> | ||
252 | * {@literal @}Constraint(severity = "error", key = {Req}, | ||
253 | * message = "Requirement is not satisfied by enough application instances.") | ||
254 | * pattern requirementNotSatisfied(Req : Requirement) { | ||
255 | * Instances == count find satisfyingInstance(Req, _); | ||
256 | * Requirement.count(Req, RequiredCount); | ||
257 | * check(Instances {@literal <} RequiredCount); | ||
258 | * } | ||
259 | * </pre></code> | ||
260 | * | ||
261 | * @see Match | ||
262 | * @see RequirementNotSatisfied | ||
263 | * | ||
264 | */ | ||
265 | public static class Matcher extends BaseMatcher<RequirementNotSatisfied.Match> { | ||
266 | /** | ||
267 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
268 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
269 | * | ||
270 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
271 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
272 | * | ||
273 | */ | ||
274 | public static RequirementNotSatisfied.Matcher on(final ViatraQueryEngine engine) { | ||
275 | // check if matcher already exists | ||
276 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
277 | if (matcher == null) { | ||
278 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
279 | } | ||
280 | return matcher; | ||
281 | } | ||
282 | |||
283 | /** | ||
284 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
285 | * @return an initialized matcher | ||
286 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
287 | * | ||
288 | */ | ||
289 | public static RequirementNotSatisfied.Matcher create() { | ||
290 | return new Matcher(); | ||
291 | } | ||
292 | |||
293 | private static final int POSITION_REQ = 0; | ||
294 | |||
295 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(RequirementNotSatisfied.Matcher.class); | ||
296 | |||
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 | private Matcher() { | ||
306 | super(querySpecification()); | ||
307 | } | ||
308 | |||
309 | /** | ||
310 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
311 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
312 | * @return matches represented as a Match object. | ||
313 | * | ||
314 | */ | ||
315 | public Collection<RequirementNotSatisfied.Match> getAllMatches(final Requirement pReq) { | ||
316 | return rawStreamAllMatches(new Object[]{pReq}).collect(Collectors.toSet()); | ||
317 | } | ||
318 | |||
319 | /** | ||
320 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
321 | * </p> | ||
322 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
323 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
324 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
325 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
326 | * @return a stream of matches represented as a Match object. | ||
327 | * | ||
328 | */ | ||
329 | public Stream<RequirementNotSatisfied.Match> streamAllMatches(final Requirement pReq) { | ||
330 | return rawStreamAllMatches(new Object[]{pReq}); | ||
331 | } | ||
332 | |||
333 | /** | ||
334 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
335 | * Neither determinism nor randomness of selection is guaranteed. | ||
336 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
337 | * @return a match represented as a Match object, or null if no match is found. | ||
338 | * | ||
339 | */ | ||
340 | public Optional<RequirementNotSatisfied.Match> getOneArbitraryMatch(final Requirement pReq) { | ||
341 | return rawGetOneArbitraryMatch(new Object[]{pReq}); | ||
342 | } | ||
343 | |||
344 | /** | ||
345 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
346 | * under any possible substitution of the unspecified parameters (if any). | ||
347 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
348 | * @return true if the input is a valid (partial) match of the pattern. | ||
349 | * | ||
350 | */ | ||
351 | public boolean hasMatch(final Requirement pReq) { | ||
352 | return rawHasMatch(new Object[]{pReq}); | ||
353 | } | ||
354 | |||
355 | /** | ||
356 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
357 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
358 | * @return the number of pattern matches found. | ||
359 | * | ||
360 | */ | ||
361 | public int countMatches(final Requirement pReq) { | ||
362 | return rawCountMatches(new Object[]{pReq}); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
367 | * Neither determinism nor randomness of selection is guaranteed. | ||
368 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
369 | * @param processor the action that will process the selected match. | ||
370 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
371 | * | ||
372 | */ | ||
373 | public boolean forOneArbitraryMatch(final Requirement pReq, final Consumer<? super RequirementNotSatisfied.Match> processor) { | ||
374 | return rawForOneArbitraryMatch(new Object[]{pReq}, processor); | ||
375 | } | ||
376 | |||
377 | /** | ||
378 | * Returns a new (partial) match. | ||
379 | * This can be used e.g. to call the matcher with a partial match. | ||
380 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
381 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
382 | * @return the (partial) match object. | ||
383 | * | ||
384 | */ | ||
385 | public RequirementNotSatisfied.Match newMatch(final Requirement pReq) { | ||
386 | return RequirementNotSatisfied.Match.newMatch(pReq); | ||
387 | } | ||
388 | |||
389 | /** | ||
390 | * Retrieve the set of values that occur in matches for Req. | ||
391 | * @return the Set of all values or empty set if there are no matches | ||
392 | * | ||
393 | */ | ||
394 | protected Stream<Requirement> rawStreamAllValuesOfReq(final Object[] parameters) { | ||
395 | return rawStreamAllValues(POSITION_REQ, parameters).map(Requirement.class::cast); | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * Retrieve the set of values that occur in matches for Req. | ||
400 | * @return the Set of all values or empty set if there are no matches | ||
401 | * | ||
402 | */ | ||
403 | public Set<Requirement> getAllValuesOfReq() { | ||
404 | return rawStreamAllValuesOfReq(emptyArray()).collect(Collectors.toSet()); | ||
405 | } | ||
406 | |||
407 | /** | ||
408 | * Retrieve the set of values that occur in matches for Req. | ||
409 | * @return the Set of all values or empty set if there are no matches | ||
410 | * | ||
411 | */ | ||
412 | public Stream<Requirement> streamAllValuesOfReq() { | ||
413 | return rawStreamAllValuesOfReq(emptyArray()); | ||
414 | } | ||
415 | |||
416 | @Override | ||
417 | protected RequirementNotSatisfied.Match tupleToMatch(final Tuple t) { | ||
418 | try { | ||
419 | return RequirementNotSatisfied.Match.newMatch((Requirement) t.get(POSITION_REQ)); | ||
420 | } catch(ClassCastException e) { | ||
421 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
422 | return null; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | @Override | ||
427 | protected RequirementNotSatisfied.Match arrayToMatch(final Object[] match) { | ||
428 | try { | ||
429 | return RequirementNotSatisfied.Match.newMatch((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 | @Override | ||
437 | protected RequirementNotSatisfied.Match arrayToMatchMutable(final Object[] match) { | ||
438 | try { | ||
439 | return RequirementNotSatisfied.Match.newMutableMatch((Requirement) match[POSITION_REQ]); | ||
440 | } catch(ClassCastException e) { | ||
441 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
442 | return null; | ||
443 | } | ||
444 | } | ||
445 | |||
446 | /** | ||
447 | * @return the singleton instance of the query specification of this pattern | ||
448 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
449 | * | ||
450 | */ | ||
451 | public static IQuerySpecification<RequirementNotSatisfied.Matcher> querySpecification() { | ||
452 | return RequirementNotSatisfied.instance(); | ||
453 | } | ||
454 | } | ||
455 | |||
456 | private RequirementNotSatisfied() { | ||
457 | super(GeneratedPQuery.INSTANCE); | ||
458 | } | ||
459 | |||
460 | /** | ||
461 | * @return the singleton instance of the query specification | ||
462 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
463 | * | ||
464 | */ | ||
465 | public static RequirementNotSatisfied instance() { | ||
466 | try{ | ||
467 | return LazyHolder.INSTANCE; | ||
468 | } catch (ExceptionInInitializerError err) { | ||
469 | throw processInitializerError(err); | ||
470 | } | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | protected RequirementNotSatisfied.Matcher instantiate(final ViatraQueryEngine engine) { | ||
475 | return RequirementNotSatisfied.Matcher.on(engine); | ||
476 | } | ||
477 | |||
478 | @Override | ||
479 | public RequirementNotSatisfied.Matcher instantiate() { | ||
480 | return RequirementNotSatisfied.Matcher.create(); | ||
481 | } | ||
482 | |||
483 | @Override | ||
484 | public RequirementNotSatisfied.Match newEmptyMatch() { | ||
485 | return RequirementNotSatisfied.Match.newEmptyMatch(); | ||
486 | } | ||
487 | |||
488 | @Override | ||
489 | public RequirementNotSatisfied.Match newMatch(final Object... parameters) { | ||
490 | return RequirementNotSatisfied.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.Requirement) parameters[0]); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * Inner class allowing the singleton instance of {@link RequirementNotSatisfied} to be created | ||
495 | * <b>not</b> at the class load time of the outer class, | ||
496 | * but rather at the first call to {@link RequirementNotSatisfied#instance()}. | ||
497 | * | ||
498 | * <p> This workaround is required e.g. to support recursion. | ||
499 | * | ||
500 | */ | ||
501 | private static class LazyHolder { | ||
502 | private static final RequirementNotSatisfied INSTANCE = new RequirementNotSatisfied(); | ||
503 | |||
504 | /** | ||
505 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
506 | * This initialization order is required to support indirect recursion. | ||
507 | * | ||
508 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
509 | * | ||
510 | */ | ||
511 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
512 | |||
513 | public static Object ensureInitialized() { | ||
514 | INSTANCE.ensureInitializedInternal(); | ||
515 | return null; | ||
516 | } | ||
517 | } | ||
518 | |||
519 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
520 | private static final RequirementNotSatisfied.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
521 | |||
522 | 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); | ||
523 | |||
524 | private final List<PParameter> parameters = Arrays.asList(parameter_Req); | ||
525 | |||
526 | private GeneratedPQuery() { | ||
527 | super(PVisibility.PUBLIC); | ||
528 | } | ||
529 | |||
530 | @Override | ||
531 | public String getFullyQualifiedName() { | ||
532 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.requirementNotSatisfied"; | ||
533 | } | ||
534 | |||
535 | @Override | ||
536 | public List<String> getParameterNames() { | ||
537 | return Arrays.asList("Req"); | ||
538 | } | ||
539 | |||
540 | @Override | ||
541 | public List<PParameter> getParameters() { | ||
542 | return parameters; | ||
543 | } | ||
544 | |||
545 | @Override | ||
546 | public Set<PBody> doGetContainedBodies() { | ||
547 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
548 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
549 | { | ||
550 | PBody body = new PBody(this); | ||
551 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
552 | PVariable var_Instances = body.getOrCreateVariableByName("Instances"); | ||
553 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
554 | PVariable var_RequiredCount = body.getOrCreateVariableByName("RequiredCount"); | ||
555 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
556 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
557 | new ExportedParameter(body, var_Req, parameter_Req) | ||
558 | )); | ||
559 | // Instances == count find satisfyingInstance(Req, _) | ||
560 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
561 | new PatternMatchCounter(body, Tuples.flatTupleOf(var_Req, var___0_), SatisfyingInstance.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
562 | new Equality(body, var_Instances, var__virtual_0_); | ||
563 | // Requirement.count(Req, RequiredCount) | ||
564 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "Requirement"))); | ||
565 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
566 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "Requirement", "count"))); | ||
567 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); | ||
568 | new Equality(body, var__virtual_1_, var_RequiredCount); | ||
569 | // check(Instances < RequiredCount) | ||
570 | new ExpressionEvaluation(body, new IExpressionEvaluator() { | ||
571 | |||
572 | @Override | ||
573 | public String getShortDescription() { | ||
574 | return "Expression evaluation from pattern requirementNotSatisfied"; | ||
575 | } | ||
576 | |||
577 | @Override | ||
578 | public Iterable<String> getInputParameterNames() { | ||
579 | return Arrays.asList("Instances", "RequiredCount");} | ||
580 | |||
581 | @Override | ||
582 | public Object evaluateExpression(IValueProvider provider) throws Exception { | ||
583 | Integer Instances = (Integer) provider.getValue("Instances"); | ||
584 | Integer RequiredCount = (Integer) provider.getValue("RequiredCount"); | ||
585 | return evaluateExpression_1_1(Instances, RequiredCount); | ||
586 | } | ||
587 | }, null); | ||
588 | bodies.add(body); | ||
589 | } | ||
590 | { | ||
591 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
592 | annotation.addAttribute("severity", "error"); | ||
593 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
594 | new ParameterReference("Req") | ||
595 | })); | ||
596 | annotation.addAttribute("message", "Requirement is not satisfied by enough application instances."); | ||
597 | addAnnotation(annotation); | ||
598 | } | ||
599 | return bodies; | ||
600 | } | ||
601 | } | ||
602 | |||
603 | private static boolean evaluateExpression_1_1(final Integer Instances, final Integer RequiredCount) { | ||
604 | boolean _lessThan = (Instances.compareTo(RequiredCount) < 0); | ||
605 | return _lessThan; | ||
606 | } | ||
607 | } | ||
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..23b578ea --- /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,841 @@ | |||
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 | switch(parameterName) { | ||
91 | case "Host": return this.fHost; | ||
92 | case "App": return this.fApp; | ||
93 | case "Req": return this.fReq; | ||
94 | default: return null; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public Object get(final int index) { | ||
100 | switch(index) { | ||
101 | case 0: return this.fHost; | ||
102 | case 1: return this.fApp; | ||
103 | case 2: return this.fReq; | ||
104 | default: return null; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | public HostInstance getHost() { | ||
109 | return this.fHost; | ||
110 | } | ||
111 | |||
112 | public ApplicationInstance getApp() { | ||
113 | return this.fApp; | ||
114 | } | ||
115 | |||
116 | public hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement getReq() { | ||
117 | return this.fReq; | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public boolean set(final String parameterName, final Object newValue) { | ||
122 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
123 | if ("Host".equals(parameterName) ) { | ||
124 | this.fHost = (HostInstance) newValue; | ||
125 | return true; | ||
126 | } | ||
127 | if ("App".equals(parameterName) ) { | ||
128 | this.fApp = (ApplicationInstance) newValue; | ||
129 | return true; | ||
130 | } | ||
131 | if ("Req".equals(parameterName) ) { | ||
132 | this.fReq = (hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement) newValue; | ||
133 | return true; | ||
134 | } | ||
135 | return false; | ||
136 | } | ||
137 | |||
138 | public void setHost(final HostInstance pHost) { | ||
139 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
140 | this.fHost = pHost; | ||
141 | } | ||
142 | |||
143 | public void setApp(final ApplicationInstance pApp) { | ||
144 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
145 | this.fApp = pApp; | ||
146 | } | ||
147 | |||
148 | public void setReq(final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
149 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
150 | this.fReq = pReq; | ||
151 | } | ||
152 | |||
153 | @Override | ||
154 | public String patternName() { | ||
155 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.resourceRequirement"; | ||
156 | } | ||
157 | |||
158 | @Override | ||
159 | public List<String> parameterNames() { | ||
160 | return ResourceRequirement.Match.parameterNames; | ||
161 | } | ||
162 | |||
163 | @Override | ||
164 | public Object[] toArray() { | ||
165 | return new Object[]{fHost, fApp, fReq}; | ||
166 | } | ||
167 | |||
168 | @Override | ||
169 | public ResourceRequirement.Match toImmutable() { | ||
170 | return isMutable() ? newMatch(fHost, fApp, fReq) : this; | ||
171 | } | ||
172 | |||
173 | @Override | ||
174 | public String prettyPrint() { | ||
175 | StringBuilder result = new StringBuilder(); | ||
176 | result.append("\"Host\"=" + prettyPrintValue(fHost) + ", "); | ||
177 | result.append("\"App\"=" + prettyPrintValue(fApp) + ", "); | ||
178 | result.append("\"Req\"=" + prettyPrintValue(fReq)); | ||
179 | return result.toString(); | ||
180 | } | ||
181 | |||
182 | @Override | ||
183 | public int hashCode() { | ||
184 | return Objects.hash(fHost, fApp, fReq); | ||
185 | } | ||
186 | |||
187 | @Override | ||
188 | public boolean equals(final Object obj) { | ||
189 | if (this == obj) | ||
190 | return true; | ||
191 | if (obj == null) { | ||
192 | return false; | ||
193 | } | ||
194 | if ((obj instanceof ResourceRequirement.Match)) { | ||
195 | ResourceRequirement.Match other = (ResourceRequirement.Match) obj; | ||
196 | return Objects.equals(fHost, other.fHost) && Objects.equals(fApp, other.fApp) && Objects.equals(fReq, other.fReq); | ||
197 | } else { | ||
198 | // this should be infrequent | ||
199 | if (!(obj instanceof IPatternMatch)) { | ||
200 | return false; | ||
201 | } | ||
202 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
203 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | @Override | ||
208 | public ResourceRequirement specification() { | ||
209 | return ResourceRequirement.instance(); | ||
210 | } | ||
211 | |||
212 | /** | ||
213 | * Returns an empty, mutable match. | ||
214 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
215 | * | ||
216 | * @return the empty match. | ||
217 | * | ||
218 | */ | ||
219 | public static ResourceRequirement.Match newEmptyMatch() { | ||
220 | return new Mutable(null, null, null); | ||
221 | } | ||
222 | |||
223 | /** | ||
224 | * Returns a mutable (partial) match. | ||
225 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
226 | * | ||
227 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
228 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
229 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
230 | * @return the new, mutable (partial) match object. | ||
231 | * | ||
232 | */ | ||
233 | public static ResourceRequirement.Match newMutableMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
234 | return new Mutable(pHost, pApp, pReq); | ||
235 | } | ||
236 | |||
237 | /** | ||
238 | * Returns a new (partial) match. | ||
239 | * This can be used e.g. to call the matcher with a partial match. | ||
240 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
241 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
242 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
243 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
244 | * @return the (partial) match object. | ||
245 | * | ||
246 | */ | ||
247 | public static ResourceRequirement.Match newMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
248 | return new Immutable(pHost, pApp, pReq); | ||
249 | } | ||
250 | |||
251 | private static final class Mutable extends ResourceRequirement.Match { | ||
252 | Mutable(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
253 | super(pHost, pApp, pReq); | ||
254 | } | ||
255 | |||
256 | @Override | ||
257 | public boolean isMutable() { | ||
258 | return true; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | private static final class Immutable extends ResourceRequirement.Match { | ||
263 | Immutable(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
264 | super(pHost, pApp, pReq); | ||
265 | } | ||
266 | |||
267 | @Override | ||
268 | public boolean isMutable() { | ||
269 | return false; | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | |||
274 | /** | ||
275 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.resourceRequirement pattern, | ||
276 | * providing pattern-specific query methods. | ||
277 | * | ||
278 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
279 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
280 | * | ||
281 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
282 | * | ||
283 | * <p>Original source: | ||
284 | * <code><pre> | ||
285 | * pattern resourceRequirement(Host : HostInstance, App : ApplicationInstance, Req : ResourceRequirement) { | ||
286 | * ApplicationInstance.allocatedTo(App, Host); | ||
287 | * ApplicationInstance.type.requirements(App, Req); | ||
288 | * HostInstance.type(Host, HostType); | ||
289 | * ResourceRequirement.hostType(Req, HostType); | ||
290 | * } | ||
291 | * </pre></code> | ||
292 | * | ||
293 | * @see Match | ||
294 | * @see ResourceRequirement | ||
295 | * | ||
296 | */ | ||
297 | public static class Matcher extends BaseMatcher<ResourceRequirement.Match> { | ||
298 | /** | ||
299 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
300 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
301 | * | ||
302 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
303 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
304 | * | ||
305 | */ | ||
306 | public static ResourceRequirement.Matcher on(final ViatraQueryEngine engine) { | ||
307 | // check if matcher already exists | ||
308 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
309 | if (matcher == null) { | ||
310 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
311 | } | ||
312 | return matcher; | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
317 | * @return an initialized matcher | ||
318 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
319 | * | ||
320 | */ | ||
321 | public static ResourceRequirement.Matcher create() { | ||
322 | return new Matcher(); | ||
323 | } | ||
324 | |||
325 | private static final int POSITION_HOST = 0; | ||
326 | |||
327 | private static final int POSITION_APP = 1; | ||
328 | |||
329 | private static final int POSITION_REQ = 2; | ||
330 | |||
331 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ResourceRequirement.Matcher.class); | ||
332 | |||
333 | /** | ||
334 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
335 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
336 | * | ||
337 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
338 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
339 | * | ||
340 | */ | ||
341 | private Matcher() { | ||
342 | super(querySpecification()); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
347 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
348 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
349 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
350 | * @return matches represented as a Match object. | ||
351 | * | ||
352 | */ | ||
353 | public Collection<ResourceRequirement.Match> getAllMatches(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
354 | return rawStreamAllMatches(new Object[]{pHost, pApp, pReq}).collect(Collectors.toSet()); | ||
355 | } | ||
356 | |||
357 | /** | ||
358 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
359 | * </p> | ||
360 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
361 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
362 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
363 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
364 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
365 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
366 | * @return a stream of matches represented as a Match object. | ||
367 | * | ||
368 | */ | ||
369 | public Stream<ResourceRequirement.Match> streamAllMatches(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
370 | return rawStreamAllMatches(new Object[]{pHost, pApp, pReq}); | ||
371 | } | ||
372 | |||
373 | /** | ||
374 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
375 | * Neither determinism nor randomness of selection is guaranteed. | ||
376 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
377 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
378 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
379 | * @return a match represented as a Match object, or null if no match is found. | ||
380 | * | ||
381 | */ | ||
382 | public Optional<ResourceRequirement.Match> getOneArbitraryMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
383 | return rawGetOneArbitraryMatch(new Object[]{pHost, pApp, pReq}); | ||
384 | } | ||
385 | |||
386 | /** | ||
387 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
388 | * under any possible substitution of the unspecified parameters (if any). | ||
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 true if the input is a valid (partial) match of the pattern. | ||
393 | * | ||
394 | */ | ||
395 | public boolean hasMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
396 | return rawHasMatch(new Object[]{pHost, pApp, pReq}); | ||
397 | } | ||
398 | |||
399 | /** | ||
400 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
401 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
402 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
403 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
404 | * @return the number of pattern matches found. | ||
405 | * | ||
406 | */ | ||
407 | public int countMatches(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
408 | return rawCountMatches(new Object[]{pHost, pApp, pReq}); | ||
409 | } | ||
410 | |||
411 | /** | ||
412 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
413 | * Neither determinism nor randomness of selection is guaranteed. | ||
414 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
415 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
416 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
417 | * @param processor the action that will process the selected match. | ||
418 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
419 | * | ||
420 | */ | ||
421 | 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) { | ||
422 | return rawForOneArbitraryMatch(new Object[]{pHost, pApp, pReq}, processor); | ||
423 | } | ||
424 | |||
425 | /** | ||
426 | * Returns a new (partial) match. | ||
427 | * This can be used e.g. to call the matcher with a partial match. | ||
428 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
429 | * @param pHost the fixed value of pattern parameter Host, or null if not bound. | ||
430 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
431 | * @param pReq the fixed value of pattern parameter Req, or null if not bound. | ||
432 | * @return the (partial) match object. | ||
433 | * | ||
434 | */ | ||
435 | public ResourceRequirement.Match newMatch(final HostInstance pHost, final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
436 | return ResourceRequirement.Match.newMatch(pHost, pApp, pReq); | ||
437 | } | ||
438 | |||
439 | /** | ||
440 | * Retrieve the set of values that occur in matches for Host. | ||
441 | * @return the Set of all values or empty set if there are no matches | ||
442 | * | ||
443 | */ | ||
444 | protected Stream<HostInstance> rawStreamAllValuesOfHost(final Object[] parameters) { | ||
445 | return rawStreamAllValues(POSITION_HOST, parameters).map(HostInstance.class::cast); | ||
446 | } | ||
447 | |||
448 | /** | ||
449 | * Retrieve the set of values that occur in matches for Host. | ||
450 | * @return the Set of all values or empty set if there are no matches | ||
451 | * | ||
452 | */ | ||
453 | public Set<HostInstance> getAllValuesOfHost() { | ||
454 | return rawStreamAllValuesOfHost(emptyArray()).collect(Collectors.toSet()); | ||
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 Stream<HostInstance> streamAllValuesOfHost() { | ||
463 | return rawStreamAllValuesOfHost(emptyArray()); | ||
464 | } | ||
465 | |||
466 | /** | ||
467 | * Retrieve the set of values that occur in matches for Host. | ||
468 | * </p> | ||
469 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
470 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
471 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
472 | * | ||
473 | * @return the Stream of all values or empty set if there are no matches | ||
474 | * | ||
475 | */ | ||
476 | public Stream<HostInstance> streamAllValuesOfHost(final ResourceRequirement.Match partialMatch) { | ||
477 | return rawStreamAllValuesOfHost(partialMatch.toArray()); | ||
478 | } | ||
479 | |||
480 | /** | ||
481 | * Retrieve the set of values that occur in matches for Host. | ||
482 | * </p> | ||
483 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
484 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
485 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
486 | * | ||
487 | * @return the Stream of all values or empty set if there are no matches | ||
488 | * | ||
489 | */ | ||
490 | public Stream<HostInstance> streamAllValuesOfHost(final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
491 | return rawStreamAllValuesOfHost(new Object[]{null, pApp, pReq}); | ||
492 | } | ||
493 | |||
494 | /** | ||
495 | * Retrieve the set of values that occur in matches for Host. | ||
496 | * @return the Set of all values or empty set if there are no matches | ||
497 | * | ||
498 | */ | ||
499 | public Set<HostInstance> getAllValuesOfHost(final ResourceRequirement.Match partialMatch) { | ||
500 | return rawStreamAllValuesOfHost(partialMatch.toArray()).collect(Collectors.toSet()); | ||
501 | } | ||
502 | |||
503 | /** | ||
504 | * Retrieve the set of values that occur in matches for Host. | ||
505 | * @return the Set of all values or empty set if there are no matches | ||
506 | * | ||
507 | */ | ||
508 | public Set<HostInstance> getAllValuesOfHost(final ApplicationInstance pApp, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
509 | return rawStreamAllValuesOfHost(new Object[]{null, pApp, pReq}).collect(Collectors.toSet()); | ||
510 | } | ||
511 | |||
512 | /** | ||
513 | * Retrieve the set of values that occur in matches for App. | ||
514 | * @return the Set of all values or empty set if there are no matches | ||
515 | * | ||
516 | */ | ||
517 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
518 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
519 | } | ||
520 | |||
521 | /** | ||
522 | * Retrieve the set of values that occur in matches for App. | ||
523 | * @return the Set of all values or empty set if there are no matches | ||
524 | * | ||
525 | */ | ||
526 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
527 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
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 Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
536 | return rawStreamAllValuesOfApp(emptyArray()); | ||
537 | } | ||
538 | |||
539 | /** | ||
540 | * Retrieve the set of values that occur in matches for App. | ||
541 | * </p> | ||
542 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
543 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
544 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
545 | * | ||
546 | * @return the Stream of all values or empty set if there are no matches | ||
547 | * | ||
548 | */ | ||
549 | public Stream<ApplicationInstance> streamAllValuesOfApp(final ResourceRequirement.Match partialMatch) { | ||
550 | return rawStreamAllValuesOfApp(partialMatch.toArray()); | ||
551 | } | ||
552 | |||
553 | /** | ||
554 | * Retrieve the set of values that occur in matches for App. | ||
555 | * </p> | ||
556 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
557 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
558 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
559 | * | ||
560 | * @return the Stream of all values or empty set if there are no matches | ||
561 | * | ||
562 | */ | ||
563 | public Stream<ApplicationInstance> streamAllValuesOfApp(final HostInstance pHost, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
564 | return rawStreamAllValuesOfApp(new Object[]{pHost, null, pReq}); | ||
565 | } | ||
566 | |||
567 | /** | ||
568 | * Retrieve the set of values that occur in matches for App. | ||
569 | * @return the Set of all values or empty set if there are no matches | ||
570 | * | ||
571 | */ | ||
572 | public Set<ApplicationInstance> getAllValuesOfApp(final ResourceRequirement.Match partialMatch) { | ||
573 | return rawStreamAllValuesOfApp(partialMatch.toArray()).collect(Collectors.toSet()); | ||
574 | } | ||
575 | |||
576 | /** | ||
577 | * Retrieve the set of values that occur in matches for App. | ||
578 | * @return the Set of all values or empty set if there are no matches | ||
579 | * | ||
580 | */ | ||
581 | public Set<ApplicationInstance> getAllValuesOfApp(final HostInstance pHost, final hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement pReq) { | ||
582 | return rawStreamAllValuesOfApp(new Object[]{pHost, null, pReq}).collect(Collectors.toSet()); | ||
583 | } | ||
584 | |||
585 | /** | ||
586 | * Retrieve the set of values that occur in matches for Req. | ||
587 | * @return the Set of all values or empty set if there are no matches | ||
588 | * | ||
589 | */ | ||
590 | protected Stream<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> rawStreamAllValuesOfReq(final Object[] parameters) { | ||
591 | return rawStreamAllValues(POSITION_REQ, parameters).map(hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement.class::cast); | ||
592 | } | ||
593 | |||
594 | /** | ||
595 | * Retrieve the set of values that occur in matches for Req. | ||
596 | * @return the Set of all values or empty set if there are no matches | ||
597 | * | ||
598 | */ | ||
599 | public Set<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> getAllValuesOfReq() { | ||
600 | return rawStreamAllValuesOfReq(emptyArray()).collect(Collectors.toSet()); | ||
601 | } | ||
602 | |||
603 | /** | ||
604 | * Retrieve the set of values that occur in matches for Req. | ||
605 | * @return the Set of all values or empty set if there are no matches | ||
606 | * | ||
607 | */ | ||
608 | public Stream<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> streamAllValuesOfReq() { | ||
609 | return rawStreamAllValuesOfReq(emptyArray()); | ||
610 | } | ||
611 | |||
612 | /** | ||
613 | * Retrieve the set of values that occur in matches for Req. | ||
614 | * </p> | ||
615 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
616 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
617 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
618 | * | ||
619 | * @return the Stream of all values or empty set if there are no matches | ||
620 | * | ||
621 | */ | ||
622 | public Stream<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> streamAllValuesOfReq(final ResourceRequirement.Match partialMatch) { | ||
623 | return rawStreamAllValuesOfReq(partialMatch.toArray()); | ||
624 | } | ||
625 | |||
626 | /** | ||
627 | * Retrieve the set of values that occur in matches for Req. | ||
628 | * </p> | ||
629 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
630 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
631 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
632 | * | ||
633 | * @return the Stream of all values or empty set if there are no matches | ||
634 | * | ||
635 | */ | ||
636 | public Stream<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> streamAllValuesOfReq(final HostInstance pHost, final ApplicationInstance pApp) { | ||
637 | return rawStreamAllValuesOfReq(new Object[]{pHost, pApp, null}); | ||
638 | } | ||
639 | |||
640 | /** | ||
641 | * Retrieve the set of values that occur in matches for Req. | ||
642 | * @return the Set of all values or empty set if there are no matches | ||
643 | * | ||
644 | */ | ||
645 | public Set<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> getAllValuesOfReq(final ResourceRequirement.Match partialMatch) { | ||
646 | return rawStreamAllValuesOfReq(partialMatch.toArray()).collect(Collectors.toSet()); | ||
647 | } | ||
648 | |||
649 | /** | ||
650 | * Retrieve the set of values that occur in matches for Req. | ||
651 | * @return the Set of all values or empty set if there are no matches | ||
652 | * | ||
653 | */ | ||
654 | public Set<hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement> getAllValuesOfReq(final HostInstance pHost, final ApplicationInstance pApp) { | ||
655 | return rawStreamAllValuesOfReq(new Object[]{pHost, pApp, null}).collect(Collectors.toSet()); | ||
656 | } | ||
657 | |||
658 | @Override | ||
659 | protected ResourceRequirement.Match tupleToMatch(final Tuple t) { | ||
660 | try { | ||
661 | 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)); | ||
662 | } catch(ClassCastException e) { | ||
663 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
664 | return null; | ||
665 | } | ||
666 | } | ||
667 | |||
668 | @Override | ||
669 | protected ResourceRequirement.Match arrayToMatch(final Object[] match) { | ||
670 | try { | ||
671 | return ResourceRequirement.Match.newMatch((HostInstance) match[POSITION_HOST], (ApplicationInstance) match[POSITION_APP], (hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement) match[POSITION_REQ]); | ||
672 | } catch(ClassCastException e) { | ||
673 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
674 | return null; | ||
675 | } | ||
676 | } | ||
677 | |||
678 | @Override | ||
679 | protected ResourceRequirement.Match arrayToMatchMutable(final Object[] match) { | ||
680 | try { | ||
681 | return ResourceRequirement.Match.newMutableMatch((HostInstance) match[POSITION_HOST], (ApplicationInstance) match[POSITION_APP], (hu.bme.mit.inf.dslreasoner.domains.cps.ResourceRequirement) match[POSITION_REQ]); | ||
682 | } catch(ClassCastException e) { | ||
683 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
684 | return null; | ||
685 | } | ||
686 | } | ||
687 | |||
688 | /** | ||
689 | * @return the singleton instance of the query specification of this pattern | ||
690 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
691 | * | ||
692 | */ | ||
693 | public static IQuerySpecification<ResourceRequirement.Matcher> querySpecification() { | ||
694 | return ResourceRequirement.instance(); | ||
695 | } | ||
696 | } | ||
697 | |||
698 | private ResourceRequirement() { | ||
699 | super(GeneratedPQuery.INSTANCE); | ||
700 | } | ||
701 | |||
702 | /** | ||
703 | * @return the singleton instance of the query specification | ||
704 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
705 | * | ||
706 | */ | ||
707 | public static ResourceRequirement instance() { | ||
708 | try{ | ||
709 | return LazyHolder.INSTANCE; | ||
710 | } catch (ExceptionInInitializerError err) { | ||
711 | throw processInitializerError(err); | ||
712 | } | ||
713 | } | ||
714 | |||
715 | @Override | ||
716 | protected ResourceRequirement.Matcher instantiate(final ViatraQueryEngine engine) { | ||
717 | return ResourceRequirement.Matcher.on(engine); | ||
718 | } | ||
719 | |||
720 | @Override | ||
721 | public ResourceRequirement.Matcher instantiate() { | ||
722 | return ResourceRequirement.Matcher.create(); | ||
723 | } | ||
724 | |||
725 | @Override | ||
726 | public ResourceRequirement.Match newEmptyMatch() { | ||
727 | return ResourceRequirement.Match.newEmptyMatch(); | ||
728 | } | ||
729 | |||
730 | @Override | ||
731 | public ResourceRequirement.Match newMatch(final Object... parameters) { | ||
732 | 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]); | ||
733 | } | ||
734 | |||
735 | /** | ||
736 | * Inner class allowing the singleton instance of {@link ResourceRequirement} to be created | ||
737 | * <b>not</b> at the class load time of the outer class, | ||
738 | * but rather at the first call to {@link ResourceRequirement#instance()}. | ||
739 | * | ||
740 | * <p> This workaround is required e.g. to support recursion. | ||
741 | * | ||
742 | */ | ||
743 | private static class LazyHolder { | ||
744 | private static final ResourceRequirement INSTANCE = new ResourceRequirement(); | ||
745 | |||
746 | /** | ||
747 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
748 | * This initialization order is required to support indirect recursion. | ||
749 | * | ||
750 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
751 | * | ||
752 | */ | ||
753 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
754 | |||
755 | public static Object ensureInitialized() { | ||
756 | INSTANCE.ensureInitializedInternal(); | ||
757 | return null; | ||
758 | } | ||
759 | } | ||
760 | |||
761 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
762 | private static final ResourceRequirement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
763 | |||
764 | 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); | ||
765 | |||
766 | 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); | ||
767 | |||
768 | 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); | ||
769 | |||
770 | private final List<PParameter> parameters = Arrays.asList(parameter_Host, parameter_App, parameter_Req); | ||
771 | |||
772 | private GeneratedPQuery() { | ||
773 | super(PVisibility.PUBLIC); | ||
774 | } | ||
775 | |||
776 | @Override | ||
777 | public String getFullyQualifiedName() { | ||
778 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.resourceRequirement"; | ||
779 | } | ||
780 | |||
781 | @Override | ||
782 | public List<String> getParameterNames() { | ||
783 | return Arrays.asList("Host","App","Req"); | ||
784 | } | ||
785 | |||
786 | @Override | ||
787 | public List<PParameter> getParameters() { | ||
788 | return parameters; | ||
789 | } | ||
790 | |||
791 | @Override | ||
792 | public Set<PBody> doGetContainedBodies() { | ||
793 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
794 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
795 | { | ||
796 | PBody body = new PBody(this); | ||
797 | PVariable var_Host = body.getOrCreateVariableByName("Host"); | ||
798 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
799 | PVariable var_Req = body.getOrCreateVariableByName("Req"); | ||
800 | PVariable var_HostType = body.getOrCreateVariableByName("HostType"); | ||
801 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
802 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
803 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
804 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
805 | new ExportedParameter(body, var_Host, parameter_Host), | ||
806 | new ExportedParameter(body, var_App, parameter_App), | ||
807 | new ExportedParameter(body, var_Req, parameter_Req) | ||
808 | )); | ||
809 | // ApplicationInstance.allocatedTo(App, Host) | ||
810 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
811 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
812 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
813 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
814 | new Equality(body, var__virtual_0_, var_Host); | ||
815 | // ApplicationInstance.type.requirements(App, Req) | ||
816 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
817 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
818 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "type"))); | ||
819 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationType"))); | ||
820 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
821 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationType", "requirements"))); | ||
822 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
823 | new Equality(body, var__virtual_2_, var_Req); | ||
824 | // HostInstance.type(Host, HostType) | ||
825 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
826 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
827 | new TypeConstraint(body, Tuples.flatTupleOf(var_Host, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "HostInstance", "type"))); | ||
828 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
829 | new Equality(body, var__virtual_3_, var_HostType); | ||
830 | // ResourceRequirement.hostType(Req, HostType) | ||
831 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ResourceRequirement"))); | ||
832 | PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); | ||
833 | new TypeConstraint(body, Tuples.flatTupleOf(var_Req, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ResourceRequirement", "hostType"))); | ||
834 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostType"))); | ||
835 | new Equality(body, var__virtual_4_, var_HostType); | ||
836 | bodies.add(body); | ||
837 | } | ||
838 | return bodies; | ||
839 | } | ||
840 | } | ||
841 | } | ||
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..9f3d74b6 --- /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,551 @@ | |||
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 | switch(parameterName) { | ||
81 | case "App": return this.fApp; | ||
82 | default: return null; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | @Override | ||
87 | public Object get(final int index) { | ||
88 | switch(index) { | ||
89 | case 0: return this.fApp; | ||
90 | default: return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public ApplicationInstance getApp() { | ||
95 | return this.fApp; | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public boolean set(final String parameterName, final Object newValue) { | ||
100 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
101 | if ("App".equals(parameterName) ) { | ||
102 | this.fApp = (ApplicationInstance) newValue; | ||
103 | return true; | ||
104 | } | ||
105 | return false; | ||
106 | } | ||
107 | |||
108 | public void setApp(final ApplicationInstance pApp) { | ||
109 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
110 | this.fApp = pApp; | ||
111 | } | ||
112 | |||
113 | @Override | ||
114 | public String patternName() { | ||
115 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocateAppInstance"; | ||
116 | } | ||
117 | |||
118 | @Override | ||
119 | public List<String> parameterNames() { | ||
120 | return UnallocateAppInstance.Match.parameterNames; | ||
121 | } | ||
122 | |||
123 | @Override | ||
124 | public Object[] toArray() { | ||
125 | return new Object[]{fApp}; | ||
126 | } | ||
127 | |||
128 | @Override | ||
129 | public UnallocateAppInstance.Match toImmutable() { | ||
130 | return isMutable() ? newMatch(fApp) : this; | ||
131 | } | ||
132 | |||
133 | @Override | ||
134 | public String prettyPrint() { | ||
135 | StringBuilder result = new StringBuilder(); | ||
136 | result.append("\"App\"=" + prettyPrintValue(fApp)); | ||
137 | return result.toString(); | ||
138 | } | ||
139 | |||
140 | @Override | ||
141 | public int hashCode() { | ||
142 | return Objects.hash(fApp); | ||
143 | } | ||
144 | |||
145 | @Override | ||
146 | public boolean equals(final Object obj) { | ||
147 | if (this == obj) | ||
148 | return true; | ||
149 | if (obj == null) { | ||
150 | return false; | ||
151 | } | ||
152 | if ((obj instanceof UnallocateAppInstance.Match)) { | ||
153 | UnallocateAppInstance.Match other = (UnallocateAppInstance.Match) obj; | ||
154 | return Objects.equals(fApp, other.fApp); | ||
155 | } else { | ||
156 | // this should be infrequent | ||
157 | if (!(obj instanceof IPatternMatch)) { | ||
158 | return false; | ||
159 | } | ||
160 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
161 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | @Override | ||
166 | public UnallocateAppInstance specification() { | ||
167 | return UnallocateAppInstance.instance(); | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * Returns an empty, mutable match. | ||
172 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
173 | * | ||
174 | * @return the empty match. | ||
175 | * | ||
176 | */ | ||
177 | public static UnallocateAppInstance.Match newEmptyMatch() { | ||
178 | return new Mutable(null); | ||
179 | } | ||
180 | |||
181 | /** | ||
182 | * Returns a mutable (partial) match. | ||
183 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
184 | * | ||
185 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
186 | * @return the new, mutable (partial) match object. | ||
187 | * | ||
188 | */ | ||
189 | public static UnallocateAppInstance.Match newMutableMatch(final ApplicationInstance pApp) { | ||
190 | return new Mutable(pApp); | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * Returns a new (partial) match. | ||
195 | * This can be used e.g. to call the matcher with a partial match. | ||
196 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
197 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
198 | * @return the (partial) match object. | ||
199 | * | ||
200 | */ | ||
201 | public static UnallocateAppInstance.Match newMatch(final ApplicationInstance pApp) { | ||
202 | return new Immutable(pApp); | ||
203 | } | ||
204 | |||
205 | private static final class Mutable extends UnallocateAppInstance.Match { | ||
206 | Mutable(final ApplicationInstance pApp) { | ||
207 | super(pApp); | ||
208 | } | ||
209 | |||
210 | @Override | ||
211 | public boolean isMutable() { | ||
212 | return true; | ||
213 | } | ||
214 | } | ||
215 | |||
216 | private static final class Immutable extends UnallocateAppInstance.Match { | ||
217 | Immutable(final ApplicationInstance pApp) { | ||
218 | super(pApp); | ||
219 | } | ||
220 | |||
221 | @Override | ||
222 | public boolean isMutable() { | ||
223 | return false; | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | |||
228 | /** | ||
229 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocateAppInstance pattern, | ||
230 | * providing pattern-specific query methods. | ||
231 | * | ||
232 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
233 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
234 | * | ||
235 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
236 | * | ||
237 | * <p>Original source: | ||
238 | * <code><pre> | ||
239 | * pattern unallocateAppInstance(App : ApplicationInstance) { | ||
240 | * ApplicationInstance.allocatedTo(App, _); | ||
241 | * } | ||
242 | * </pre></code> | ||
243 | * | ||
244 | * @see Match | ||
245 | * @see UnallocateAppInstance | ||
246 | * | ||
247 | */ | ||
248 | public static class Matcher extends BaseMatcher<UnallocateAppInstance.Match> { | ||
249 | /** | ||
250 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
251 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
252 | * | ||
253 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
254 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
255 | * | ||
256 | */ | ||
257 | public static UnallocateAppInstance.Matcher on(final ViatraQueryEngine engine) { | ||
258 | // check if matcher already exists | ||
259 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
260 | if (matcher == null) { | ||
261 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
262 | } | ||
263 | return matcher; | ||
264 | } | ||
265 | |||
266 | /** | ||
267 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
268 | * @return an initialized matcher | ||
269 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
270 | * | ||
271 | */ | ||
272 | public static UnallocateAppInstance.Matcher create() { | ||
273 | return new Matcher(); | ||
274 | } | ||
275 | |||
276 | private static final int POSITION_APP = 0; | ||
277 | |||
278 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(UnallocateAppInstance.Matcher.class); | ||
279 | |||
280 | /** | ||
281 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
282 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
283 | * | ||
284 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
285 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
286 | * | ||
287 | */ | ||
288 | private Matcher() { | ||
289 | super(querySpecification()); | ||
290 | } | ||
291 | |||
292 | /** | ||
293 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
294 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
295 | * @return matches represented as a Match object. | ||
296 | * | ||
297 | */ | ||
298 | public Collection<UnallocateAppInstance.Match> getAllMatches(final ApplicationInstance pApp) { | ||
299 | return rawStreamAllMatches(new Object[]{pApp}).collect(Collectors.toSet()); | ||
300 | } | ||
301 | |||
302 | /** | ||
303 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
304 | * </p> | ||
305 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
306 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
307 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
308 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
309 | * @return a stream of matches represented as a Match object. | ||
310 | * | ||
311 | */ | ||
312 | public Stream<UnallocateAppInstance.Match> streamAllMatches(final ApplicationInstance pApp) { | ||
313 | return rawStreamAllMatches(new Object[]{pApp}); | ||
314 | } | ||
315 | |||
316 | /** | ||
317 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
318 | * Neither determinism nor randomness of selection is guaranteed. | ||
319 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
320 | * @return a match represented as a Match object, or null if no match is found. | ||
321 | * | ||
322 | */ | ||
323 | public Optional<UnallocateAppInstance.Match> getOneArbitraryMatch(final ApplicationInstance pApp) { | ||
324 | return rawGetOneArbitraryMatch(new Object[]{pApp}); | ||
325 | } | ||
326 | |||
327 | /** | ||
328 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
329 | * under any possible substitution of the unspecified parameters (if any). | ||
330 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
331 | * @return true if the input is a valid (partial) match of the pattern. | ||
332 | * | ||
333 | */ | ||
334 | public boolean hasMatch(final ApplicationInstance pApp) { | ||
335 | return rawHasMatch(new Object[]{pApp}); | ||
336 | } | ||
337 | |||
338 | /** | ||
339 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
340 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
341 | * @return the number of pattern matches found. | ||
342 | * | ||
343 | */ | ||
344 | public int countMatches(final ApplicationInstance pApp) { | ||
345 | return rawCountMatches(new Object[]{pApp}); | ||
346 | } | ||
347 | |||
348 | /** | ||
349 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
350 | * Neither determinism nor randomness of selection is guaranteed. | ||
351 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
352 | * @param processor the action that will process the selected match. | ||
353 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
354 | * | ||
355 | */ | ||
356 | public boolean forOneArbitraryMatch(final ApplicationInstance pApp, final Consumer<? super UnallocateAppInstance.Match> processor) { | ||
357 | return rawForOneArbitraryMatch(new Object[]{pApp}, processor); | ||
358 | } | ||
359 | |||
360 | /** | ||
361 | * Returns a new (partial) match. | ||
362 | * This can be used e.g. to call the matcher with a partial match. | ||
363 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
364 | * @param pApp the fixed value of pattern parameter App, or null if not bound. | ||
365 | * @return the (partial) match object. | ||
366 | * | ||
367 | */ | ||
368 | public UnallocateAppInstance.Match newMatch(final ApplicationInstance pApp) { | ||
369 | return UnallocateAppInstance.Match.newMatch(pApp); | ||
370 | } | ||
371 | |||
372 | /** | ||
373 | * Retrieve the set of values that occur in matches for App. | ||
374 | * @return the Set of all values or empty set if there are no matches | ||
375 | * | ||
376 | */ | ||
377 | protected Stream<ApplicationInstance> rawStreamAllValuesOfApp(final Object[] parameters) { | ||
378 | return rawStreamAllValues(POSITION_APP, parameters).map(ApplicationInstance.class::cast); | ||
379 | } | ||
380 | |||
381 | /** | ||
382 | * Retrieve the set of values that occur in matches for App. | ||
383 | * @return the Set of all values or empty set if there are no matches | ||
384 | * | ||
385 | */ | ||
386 | public Set<ApplicationInstance> getAllValuesOfApp() { | ||
387 | return rawStreamAllValuesOfApp(emptyArray()).collect(Collectors.toSet()); | ||
388 | } | ||
389 | |||
390 | /** | ||
391 | * Retrieve the set of values that occur in matches for App. | ||
392 | * @return the Set of all values or empty set if there are no matches | ||
393 | * | ||
394 | */ | ||
395 | public Stream<ApplicationInstance> streamAllValuesOfApp() { | ||
396 | return rawStreamAllValuesOfApp(emptyArray()); | ||
397 | } | ||
398 | |||
399 | @Override | ||
400 | protected UnallocateAppInstance.Match tupleToMatch(final Tuple t) { | ||
401 | try { | ||
402 | return UnallocateAppInstance.Match.newMatch((ApplicationInstance) t.get(POSITION_APP)); | ||
403 | } catch(ClassCastException e) { | ||
404 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
405 | return null; | ||
406 | } | ||
407 | } | ||
408 | |||
409 | @Override | ||
410 | protected UnallocateAppInstance.Match arrayToMatch(final Object[] match) { | ||
411 | try { | ||
412 | return UnallocateAppInstance.Match.newMatch((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 | @Override | ||
420 | protected UnallocateAppInstance.Match arrayToMatchMutable(final Object[] match) { | ||
421 | try { | ||
422 | return UnallocateAppInstance.Match.newMutableMatch((ApplicationInstance) match[POSITION_APP]); | ||
423 | } catch(ClassCastException e) { | ||
424 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
425 | return null; | ||
426 | } | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * @return the singleton instance of the query specification of this pattern | ||
431 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
432 | * | ||
433 | */ | ||
434 | public static IQuerySpecification<UnallocateAppInstance.Matcher> querySpecification() { | ||
435 | return UnallocateAppInstance.instance(); | ||
436 | } | ||
437 | } | ||
438 | |||
439 | private UnallocateAppInstance() { | ||
440 | super(GeneratedPQuery.INSTANCE); | ||
441 | } | ||
442 | |||
443 | /** | ||
444 | * @return the singleton instance of the query specification | ||
445 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
446 | * | ||
447 | */ | ||
448 | public static UnallocateAppInstance instance() { | ||
449 | try{ | ||
450 | return LazyHolder.INSTANCE; | ||
451 | } catch (ExceptionInInitializerError err) { | ||
452 | throw processInitializerError(err); | ||
453 | } | ||
454 | } | ||
455 | |||
456 | @Override | ||
457 | protected UnallocateAppInstance.Matcher instantiate(final ViatraQueryEngine engine) { | ||
458 | return UnallocateAppInstance.Matcher.on(engine); | ||
459 | } | ||
460 | |||
461 | @Override | ||
462 | public UnallocateAppInstance.Matcher instantiate() { | ||
463 | return UnallocateAppInstance.Matcher.create(); | ||
464 | } | ||
465 | |||
466 | @Override | ||
467 | public UnallocateAppInstance.Match newEmptyMatch() { | ||
468 | return UnallocateAppInstance.Match.newEmptyMatch(); | ||
469 | } | ||
470 | |||
471 | @Override | ||
472 | public UnallocateAppInstance.Match newMatch(final Object... parameters) { | ||
473 | return UnallocateAppInstance.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance) parameters[0]); | ||
474 | } | ||
475 | |||
476 | /** | ||
477 | * Inner class allowing the singleton instance of {@link UnallocateAppInstance} to be created | ||
478 | * <b>not</b> at the class load time of the outer class, | ||
479 | * but rather at the first call to {@link UnallocateAppInstance#instance()}. | ||
480 | * | ||
481 | * <p> This workaround is required e.g. to support recursion. | ||
482 | * | ||
483 | */ | ||
484 | private static class LazyHolder { | ||
485 | private static final UnallocateAppInstance INSTANCE = new UnallocateAppInstance(); | ||
486 | |||
487 | /** | ||
488 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
489 | * This initialization order is required to support indirect recursion. | ||
490 | * | ||
491 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
492 | * | ||
493 | */ | ||
494 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
495 | |||
496 | public static Object ensureInitialized() { | ||
497 | INSTANCE.ensureInitializedInternal(); | ||
498 | return null; | ||
499 | } | ||
500 | } | ||
501 | |||
502 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
503 | private static final UnallocateAppInstance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
504 | |||
505 | 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); | ||
506 | |||
507 | private final List<PParameter> parameters = Arrays.asList(parameter_App); | ||
508 | |||
509 | private GeneratedPQuery() { | ||
510 | super(PVisibility.PUBLIC); | ||
511 | } | ||
512 | |||
513 | @Override | ||
514 | public String getFullyQualifiedName() { | ||
515 | return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocateAppInstance"; | ||
516 | } | ||
517 | |||
518 | @Override | ||
519 | public List<String> getParameterNames() { | ||
520 | return Arrays.asList("App"); | ||
521 | } | ||
522 | |||
523 | @Override | ||
524 | public List<PParameter> getParameters() { | ||
525 | return parameters; | ||
526 | } | ||
527 | |||
528 | @Override | ||
529 | public Set<PBody> doGetContainedBodies() { | ||
530 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
531 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
532 | { | ||
533 | PBody body = new PBody(this); | ||
534 | PVariable var_App = body.getOrCreateVariableByName("App"); | ||
535 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
536 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
537 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
538 | new ExportedParameter(body, var_App, parameter_App) | ||
539 | )); | ||
540 | // ApplicationInstance.allocatedTo(App, _) | ||
541 | new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); | ||
542 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
543 | new TypeConstraint(body, Tuples.flatTupleOf(var_App, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); | ||
544 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); | ||
545 | new Equality(body, var__virtual_0_, var___0_); | ||
546 | bodies.add(body); | ||
547 | } | ||
548 | return bodies; | ||
549 | } | ||
550 | } | ||
551 | } | ||
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..8a150288 --- /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 AvailableHdd} 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 AvailableHdd#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..c89872e6 --- /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 AvailableMemory} 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 AvailableMemory#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..fe115086 --- /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 CpsApplications} 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 CpsApplications#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..cea8c097 --- /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 CpsHosts} 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 CpsHosts#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..ed5c9cda --- /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 FreeHddPercentage} 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 FreeHddPercentage#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..b5923ba9 --- /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 FreeMemoryPercentage} 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 FreeMemoryPercentage#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..4e6a2d10 --- /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 HddRequirement} 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 HddRequirement#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..429817ce --- /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 HostInstanceCost} 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 HostInstanceCost#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..98924467 --- /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 MemoryRequirement} 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 MemoryRequirement#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..155ed09b --- /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 NoHostToAllocateTo} 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 NoHostToAllocateTo#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..ffce9148 --- /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 RequiredAppInstances} 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 RequiredAppInstances#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..dea68f94 --- /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 SatisfyingInstance} 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 SatisfyingInstance#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..efa13033 --- /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 TotalHdd} 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 TotalHdd#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..2fe3e741 --- /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 TotalMemory} 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 TotalMemory#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..66b315f4 --- /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 UnallocatedAppInstance} 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 UnallocatedAppInstance#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/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 | } | ||