aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kris7topher@gmail.com>2019-08-15 15:36:05 +0200
committerLibravatar Kristóf Marussy <kris7topher@gmail.com>2019-08-15 15:36:05 +0200
commit110268c8e8937df8d67075caebd6d31460d0f81a (patch)
treef52bd65d0cc8516e5fb1f68c5cdf1e89d6390ebd
parentMeasurements WIP (diff)
downloadVIATRA-Generator-110268c8e8937df8d67075caebd6d31460d0f81a.tar.gz
VIATRA-Generator-110268c8e8937df8d67075caebd6d31460d0f81a.tar.zst
VIATRA-Generator-110268c8e8937df8d67075caebd6d31460d0f81a.zip
Measurements WIP
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/META-INF/MANIFEST.MF5
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore2
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.genmodel8
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql12
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml2
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/.gitignore2
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Dir.java533
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Live.java4
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/PatternContent.java69
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/RootIsNotDir.java560
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/FileSystem.java6
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java1
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java2
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java18
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java5
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java36
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java3
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json7
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend32
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend6
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend15
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend37
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend2
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend2
24 files changed, 1254 insertions, 115 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/META-INF/MANIFEST.MF b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/META-INF/MANIFEST.MF
index 1adef165..d5f7db65 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/META-INF/MANIFEST.MF
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/META-INF/MANIFEST.MF
@@ -19,6 +19,7 @@ Require-Bundle: org.eclipse.viatra.addon.querybasedfeatures.runtime,
19 org.eclipse.xtext.xbase.lib, 19 org.eclipse.xtext.xbase.lib,
20 org.eclipse.xtend.lib, 20 org.eclipse.xtend.lib,
21 org.eclipse.xtend.lib.macro 21 org.eclipse.xtend.lib.macro
22Bundle-RequiredExecutionEnvironment: JavaSE-1.8
23Bundle-ActivationPolicy: lazy
24Import-Package: org.apache.log4j 22Import-Package: org.apache.log4j
23Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.domains.alloyexamples
24Bundle-ActivationPolicy: lazy
25Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore
index 87ba7135..32874953 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore
@@ -5,7 +5,7 @@
5 <details key="settingDelegates" value="org.eclipse.viatra.query.querybasedfeature"/> 5 <details key="settingDelegates" value="org.eclipse.viatra.query.querybasedfeature"/>
6 </eAnnotations> 6 </eAnnotations>
7 <eClassifiers xsi:type="ecore:EClass" name="FileSystem"> 7 <eClassifiers xsi:type="ecore:EClass" name="FileSystem">
8 <eStructuralFeatures xsi:type="ecore:EReference" name="root" lowerBound="1" eType="#//Dir" 8 <eStructuralFeatures xsi:type="ecore:EReference" name="root" lowerBound="1" eType="#//FSObject"
9 containment="true"/> 9 containment="true"/>
10 <eStructuralFeatures xsi:type="ecore:EReference" name="live" upperBound="-1" eType="#//FSObject" 10 <eStructuralFeatures xsi:type="ecore:EReference" name="live" upperBound="-1" eType="#//FSObject"
11 changeable="false" volatile="true" transient="true" derived="true"> 11 changeable="false" volatile="true" transient="true" derived="true">
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.genmodel b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.genmodel
index 355ac109..daa44727 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.genmodel
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.genmodel
@@ -11,13 +11,13 @@
11 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileSytem.ecore#//FileSystem/root"/> 11 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileSytem.ecore#//FileSystem/root"/>
12 <genFeatures property="Readonly" notify="false" createChild="false" ecoreFeature="ecore:EReference FileSytem.ecore#//FileSystem/live"/> 12 <genFeatures property="Readonly" notify="false" createChild="false" ecoreFeature="ecore:EReference FileSytem.ecore#//FileSystem/live"/>
13 </genClasses> 13 </genClasses>
14 <genClasses image="false" ecoreClass="FileSytem.ecore#//FSObject"/> 14 <genClasses image="false" ecoreClass="FileSytem.ecore#//FSObject">
15 <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference FileSytem.ecore#//FSObject/parent"/>
16 </genClasses>
15 <genClasses ecoreClass="FileSytem.ecore#//Dir"> 17 <genClasses ecoreClass="FileSytem.ecore#//Dir">
16 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileSytem.ecore#//Dir/contents"/> 18 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileSytem.ecore#//Dir/contents"/>
17 </genClasses> 19 </genClasses>
18 <genClasses ecoreClass="FileSytem.ecore#//File"> 20 <genClasses ecoreClass="FileSytem.ecore#//File"/>
19 <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference FileSytem.ecore#//File/parent"/>
20 </genClasses>
21 <genClasses ecoreClass="FileSytem.ecore#//Model"> 21 <genClasses ecoreClass="FileSytem.ecore#//Model">
22 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileSytem.ecore#//Model/filesystems"/> 22 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileSytem.ecore#//Model/filesystems"/>
23 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileSytem.ecore#//Model/otherFSObjects"/> 23 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileSytem.ecore#//Model/otherFSObjects"/>
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql
index 719a9d96..c785c2fc 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql
@@ -2,7 +2,7 @@ package hu.bme.mit.inf.dslreasoner.domains.alloyexamples
2 2
3import epackage "FS" 3import epackage "FS"
4 4
5pattern patternContent(o1: FSObject, o2: FSObject) { 5pattern patternContent(o1: Dir, o2: FSObject) {
6 Dir.contents(o1,o2); 6 Dir.contents(o1,o2);
7} 7}
8 8
@@ -22,3 +22,13 @@ pattern contentInNotLive(parent : Dir, child: FSObject) {
22 Dir.contents(parent,child); 22 Dir.contents(parent,child);
23 neg find live(_,child); 23 neg find live(_,child);
24} 24}
25
26pattern dir(d: Dir) {
27 Dir(d);
28}
29
30@Constraint(key={fs}, severity="error", message="error")
31pattern rootIsNotDir(fs: FileSystem) {
32 FileSystem.root(fs, root);
33 neg find dir(root);
34}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml
index d7fd112a..6eae8535 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml
@@ -21,6 +21,8 @@
21 <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.patternContent"/> 21 <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.patternContent"/>
22 <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.live"/> 22 <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.live"/>
23 <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.contentInNotLive"/> 23 <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.contentInNotLive"/>
24 <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir"/>
25 <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.rootIsNotDir"/>
24 </group> 26 </group>
25 </extension> 27 </extension>
26</plugin> 28</plugin>
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/.gitignore
index 1e7d444f..fa9b1325 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/.gitignore
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/.gitignore
@@ -50,3 +50,5 @@
50/Opposite.java 50/Opposite.java
51/OppositeDifferentClass.java 51/OppositeDifferentClass.java
52/PatternContent.java 52/PatternContent.java
53/.Dir.java._trace
54/.RootIsNotDir.java._trace
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Dir.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Dir.java
new file mode 100644
index 00000000..ad04c098
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Dir.java
@@ -0,0 +1,533 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.alloyexamples;
5
6import java.util.Arrays;
7import java.util.Collection;
8import java.util.LinkedHashSet;
9import java.util.List;
10import java.util.Objects;
11import java.util.Optional;
12import java.util.Set;
13import java.util.function.Consumer;
14import java.util.stream.Collectors;
15import java.util.stream.Stream;
16import org.apache.log4j.Logger;
17import org.eclipse.emf.ecore.EClass;
18import org.eclipse.viatra.query.runtime.api.IPatternMatch;
19import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
20import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
21import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
24import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
25import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
26import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
27import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
28import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
29import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
30import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
31import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
32import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
33import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
34import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
35import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
36import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
37
38/**
39 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
40 *
41 * <p>Original source:
42 * <code><pre>
43 * pattern dir(d: Dir) {
44 * Dir(d);
45 * }
46 * </pre></code>
47 *
48 * @see Matcher
49 * @see Match
50 *
51 */
52@SuppressWarnings("all")
53public final class Dir extends BaseGeneratedEMFQuerySpecification<Dir.Matcher> {
54 /**
55 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir pattern,
56 * to be used in conjunction with {@link Matcher}.
57 *
58 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
59 * Each instance is a (possibly partial) substitution of pattern parameters,
60 * usable to represent a match of the pattern in the result of a query,
61 * or to specify the bound (fixed) input parameters when issuing a query.
62 *
63 * @see Matcher
64 *
65 */
66 public static abstract class Match extends BasePatternMatch {
67 private hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir fD;
68
69 private static List<String> parameterNames = makeImmutableList("d");
70
71 private Match(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
72 this.fD = pD;
73 }
74
75 @Override
76 public Object get(final String parameterName) {
77 if ("d".equals(parameterName)) return this.fD;
78 return null;
79 }
80
81 public hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir getD() {
82 return this.fD;
83 }
84
85 @Override
86 public boolean set(final String parameterName, final Object newValue) {
87 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
88 if ("d".equals(parameterName) ) {
89 this.fD = (hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) newValue;
90 return true;
91 }
92 return false;
93 }
94
95 public void setD(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
96 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
97 this.fD = pD;
98 }
99
100 @Override
101 public String patternName() {
102 return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir";
103 }
104
105 @Override
106 public List<String> parameterNames() {
107 return Dir.Match.parameterNames;
108 }
109
110 @Override
111 public Object[] toArray() {
112 return new Object[]{fD};
113 }
114
115 @Override
116 public Dir.Match toImmutable() {
117 return isMutable() ? newMatch(fD) : this;
118 }
119
120 @Override
121 public String prettyPrint() {
122 StringBuilder result = new StringBuilder();
123 result.append("\"d\"=" + prettyPrintValue(fD));
124 return result.toString();
125 }
126
127 @Override
128 public int hashCode() {
129 return Objects.hash(fD);
130 }
131
132 @Override
133 public boolean equals(final Object obj) {
134 if (this == obj)
135 return true;
136 if (obj == null) {
137 return false;
138 }
139 if ((obj instanceof Dir.Match)) {
140 Dir.Match other = (Dir.Match) obj;
141 return Objects.equals(fD, other.fD);
142 } else {
143 // this should be infrequent
144 if (!(obj instanceof IPatternMatch)) {
145 return false;
146 }
147 IPatternMatch otherSig = (IPatternMatch) obj;
148 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
149 }
150 }
151
152 @Override
153 public Dir specification() {
154 return Dir.instance();
155 }
156
157 /**
158 * Returns an empty, mutable match.
159 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
160 *
161 * @return the empty match.
162 *
163 */
164 public static Dir.Match newEmptyMatch() {
165 return new Mutable(null);
166 }
167
168 /**
169 * Returns a mutable (partial) match.
170 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
171 *
172 * @param pD the fixed value of pattern parameter d, or null if not bound.
173 * @return the new, mutable (partial) match object.
174 *
175 */
176 public static Dir.Match newMutableMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
177 return new Mutable(pD);
178 }
179
180 /**
181 * Returns a new (partial) match.
182 * This can be used e.g. to call the matcher with a partial match.
183 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
184 * @param pD the fixed value of pattern parameter d, or null if not bound.
185 * @return the (partial) match object.
186 *
187 */
188 public static Dir.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
189 return new Immutable(pD);
190 }
191
192 private static final class Mutable extends Dir.Match {
193 Mutable(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
194 super(pD);
195 }
196
197 @Override
198 public boolean isMutable() {
199 return true;
200 }
201 }
202
203 private static final class Immutable extends Dir.Match {
204 Immutable(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
205 super(pD);
206 }
207
208 @Override
209 public boolean isMutable() {
210 return false;
211 }
212 }
213 }
214
215 /**
216 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir pattern,
217 * providing pattern-specific query methods.
218 *
219 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
220 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
221 *
222 * <p>Matches of the pattern will be represented as {@link Match}.
223 *
224 * <p>Original source:
225 * <code><pre>
226 * pattern dir(d: Dir) {
227 * Dir(d);
228 * }
229 * </pre></code>
230 *
231 * @see Match
232 * @see Dir
233 *
234 */
235 public static class Matcher extends BaseMatcher<Dir.Match> {
236 /**
237 * Initializes the pattern matcher within an existing VIATRA Query engine.
238 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
239 *
240 * @param engine the existing VIATRA Query engine in which this matcher will be created.
241 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
242 *
243 */
244 public static Dir.Matcher on(final ViatraQueryEngine engine) {
245 // check if matcher already exists
246 Matcher matcher = engine.getExistingMatcher(querySpecification());
247 if (matcher == null) {
248 matcher = (Matcher)engine.getMatcher(querySpecification());
249 }
250 return matcher;
251 }
252
253 /**
254 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
255 * @return an initialized matcher
256 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
257 *
258 */
259 public static Dir.Matcher create() {
260 return new Matcher();
261 }
262
263 private static final int POSITION_D = 0;
264
265 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Dir.Matcher.class);
266
267 /**
268 * Initializes the pattern matcher within an existing VIATRA Query engine.
269 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
270 *
271 * @param engine the existing VIATRA Query engine in which this matcher will be created.
272 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
273 *
274 */
275 private Matcher() {
276 super(querySpecification());
277 }
278
279 /**
280 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
281 * @param pD the fixed value of pattern parameter d, or null if not bound.
282 * @return matches represented as a Match object.
283 *
284 */
285 public Collection<Dir.Match> getAllMatches(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
286 return rawStreamAllMatches(new Object[]{pD}).collect(Collectors.toSet());
287 }
288
289 /**
290 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
291 * </p>
292 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
293 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
294 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
295 * @param pD the fixed value of pattern parameter d, or null if not bound.
296 * @return a stream of matches represented as a Match object.
297 *
298 */
299 public Stream<Dir.Match> streamAllMatches(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
300 return rawStreamAllMatches(new Object[]{pD});
301 }
302
303 /**
304 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
305 * Neither determinism nor randomness of selection is guaranteed.
306 * @param pD the fixed value of pattern parameter d, or null if not bound.
307 * @return a match represented as a Match object, or null if no match is found.
308 *
309 */
310 public Optional<Dir.Match> getOneArbitraryMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
311 return rawGetOneArbitraryMatch(new Object[]{pD});
312 }
313
314 /**
315 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
316 * under any possible substitution of the unspecified parameters (if any).
317 * @param pD the fixed value of pattern parameter d, or null if not bound.
318 * @return true if the input is a valid (partial) match of the pattern.
319 *
320 */
321 public boolean hasMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
322 return rawHasMatch(new Object[]{pD});
323 }
324
325 /**
326 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
327 * @param pD the fixed value of pattern parameter d, or null if not bound.
328 * @return the number of pattern matches found.
329 *
330 */
331 public int countMatches(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
332 return rawCountMatches(new Object[]{pD});
333 }
334
335 /**
336 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
337 * Neither determinism nor randomness of selection is guaranteed.
338 * @param pD the fixed value of pattern parameter d, or null if not bound.
339 * @param processor the action that will process the selected match.
340 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
341 *
342 */
343 public boolean forOneArbitraryMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD, final Consumer<? super Dir.Match> processor) {
344 return rawForOneArbitraryMatch(new Object[]{pD}, processor);
345 }
346
347 /**
348 * Returns a new (partial) match.
349 * This can be used e.g. to call the matcher with a partial match.
350 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
351 * @param pD the fixed value of pattern parameter d, or null if not bound.
352 * @return the (partial) match object.
353 *
354 */
355 public Dir.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
356 return Dir.Match.newMatch(pD);
357 }
358
359 /**
360 * Retrieve the set of values that occur in matches for d.
361 * @return the Set of all values or empty set if there are no matches
362 *
363 */
364 protected Stream<hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir> rawStreamAllValuesOfd(final Object[] parameters) {
365 return rawStreamAllValues(POSITION_D, parameters).map(hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir.class::cast);
366 }
367
368 /**
369 * Retrieve the set of values that occur in matches for d.
370 * @return the Set of all values or empty set if there are no matches
371 *
372 */
373 public Set<hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir> getAllValuesOfd() {
374 return rawStreamAllValuesOfd(emptyArray()).collect(Collectors.toSet());
375 }
376
377 /**
378 * Retrieve the set of values that occur in matches for d.
379 * @return the Set of all values or empty set if there are no matches
380 *
381 */
382 public Stream<hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir> streamAllValuesOfd() {
383 return rawStreamAllValuesOfd(emptyArray());
384 }
385
386 @Override
387 protected Dir.Match tupleToMatch(final Tuple t) {
388 try {
389 return Dir.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) t.get(POSITION_D));
390 } catch(ClassCastException e) {
391 LOGGER.error("Element(s) in tuple not properly typed!",e);
392 return null;
393 }
394 }
395
396 @Override
397 protected Dir.Match arrayToMatch(final Object[] match) {
398 try {
399 return Dir.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) match[POSITION_D]);
400 } catch(ClassCastException e) {
401 LOGGER.error("Element(s) in array not properly typed!",e);
402 return null;
403 }
404 }
405
406 @Override
407 protected Dir.Match arrayToMatchMutable(final Object[] match) {
408 try {
409 return Dir.Match.newMutableMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) match[POSITION_D]);
410 } catch(ClassCastException e) {
411 LOGGER.error("Element(s) in array not properly typed!",e);
412 return null;
413 }
414 }
415
416 /**
417 * @return the singleton instance of the query specification of this pattern
418 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
419 *
420 */
421 public static IQuerySpecification<Dir.Matcher> querySpecification() {
422 return Dir.instance();
423 }
424 }
425
426 private Dir() {
427 super(GeneratedPQuery.INSTANCE);
428 }
429
430 /**
431 * @return the singleton instance of the query specification
432 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
433 *
434 */
435 public static Dir instance() {
436 try{
437 return LazyHolder.INSTANCE;
438 } catch (ExceptionInInitializerError err) {
439 throw processInitializerError(err);
440 }
441 }
442
443 @Override
444 protected Dir.Matcher instantiate(final ViatraQueryEngine engine) {
445 return Dir.Matcher.on(engine);
446 }
447
448 @Override
449 public Dir.Matcher instantiate() {
450 return Dir.Matcher.create();
451 }
452
453 @Override
454 public Dir.Match newEmptyMatch() {
455 return Dir.Match.newEmptyMatch();
456 }
457
458 @Override
459 public Dir.Match newMatch(final Object... parameters) {
460 return Dir.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) parameters[0]);
461 }
462
463 /**
464 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir (visibility: PUBLIC, simpleName: Dir, identifier: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.alloyexamples) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
465 * <b>not</b> at the class load time of the outer class,
466 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir (visibility: PUBLIC, simpleName: Dir, identifier: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.alloyexamples) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
467 *
468 * <p> This workaround is required e.g. to support recursion.
469 *
470 */
471 private static class LazyHolder {
472 private static final Dir INSTANCE = new Dir();
473
474 /**
475 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
476 * This initialization order is required to support indirect recursion.
477 *
478 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
479 *
480 */
481 private static final Object STATIC_INITIALIZER = ensureInitialized();
482
483 public static Object ensureInitialized() {
484 INSTANCE.ensureInitializedInternal();
485 return null;
486 }
487 }
488
489 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
490 private static final Dir.GeneratedPQuery INSTANCE = new GeneratedPQuery();
491
492 private final PParameter parameter_d = new PParameter("d", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("FS", "Dir")), PParameterDirection.INOUT);
493
494 private final List<PParameter> parameters = Arrays.asList(parameter_d);
495
496 private GeneratedPQuery() {
497 super(PVisibility.PUBLIC);
498 }
499
500 @Override
501 public String getFullyQualifiedName() {
502 return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir";
503 }
504
505 @Override
506 public List<String> getParameterNames() {
507 return Arrays.asList("d");
508 }
509
510 @Override
511 public List<PParameter> getParameters() {
512 return parameters;
513 }
514
515 @Override
516 public Set<PBody> doGetContainedBodies() {
517 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
518 Set<PBody> bodies = new LinkedHashSet<>();
519 {
520 PBody body = new PBody(this);
521 PVariable var_d = body.getOrCreateVariableByName("d");
522 new TypeConstraint(body, Tuples.flatTupleOf(var_d), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "Dir")));
523 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
524 new ExportedParameter(body, var_d, parameter_d)
525 ));
526 // Dir(d)
527 new TypeConstraint(body, Tuples.flatTupleOf(var_d), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "Dir")));
528 bodies.add(body);
529 }
530 return bodies;
531 }
532 }
533}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Live.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Live.java
index ae0f0c58..14a4c5c0 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Live.java
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Live.java
@@ -695,7 +695,7 @@ public final class Live extends BaseGeneratedEMFQuerySpecification<Live.Matcher>
695 new TypeConstraint(body, Tuples.flatTupleOf(var_this), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem"))); 695 new TypeConstraint(body, Tuples.flatTupleOf(var_this), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem")));
696 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); 696 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
697 new TypeConstraint(body, Tuples.flatTupleOf(var_this, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("FS", "FileSystem", "root"))); 697 new TypeConstraint(body, Tuples.flatTupleOf(var_this, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("FS", "FileSystem", "root")));
698 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "Dir"))); 698 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FSObject")));
699 new Equality(body, var__virtual_0_, var_l); 699 new Equality(body, var__virtual_0_, var_l);
700 bodies.add(body); 700 bodies.add(body);
701 } 701 }
@@ -714,7 +714,7 @@ public final class Live extends BaseGeneratedEMFQuerySpecification<Live.Matcher>
714 new TypeConstraint(body, Tuples.flatTupleOf(var_this), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem"))); 714 new TypeConstraint(body, Tuples.flatTupleOf(var_this), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem")));
715 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); 715 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
716 new TypeConstraint(body, Tuples.flatTupleOf(var_this, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("FS", "FileSystem", "root"))); 716 new TypeConstraint(body, Tuples.flatTupleOf(var_this, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("FS", "FileSystem", "root")));
717 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "Dir"))); 717 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FSObject")));
718 new Equality(body, var__virtual_0_, var_root); 718 new Equality(body, var__virtual_0_, var_root);
719 // find patternContent+(root,l) 719 // find patternContent+(root,l)
720 new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_root, var_l), PatternContent.instance().getInternalQueryRepresentation()); 720 new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_root, var_l), PatternContent.instance().getInternalQueryRepresentation());
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/PatternContent.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/PatternContent.java
index 690d3e27..5410b693 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/PatternContent.java
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/PatternContent.java
@@ -3,6 +3,7 @@
3 */ 3 */
4package hu.bme.mit.inf.dslreasoner.domains.alloyexamples; 4package hu.bme.mit.inf.dslreasoner.domains.alloyexamples;
5 5
6import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir;
6import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject; 7import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject;
7import java.util.Arrays; 8import java.util.Arrays;
8import java.util.Collection; 9import java.util.Collection;
@@ -43,7 +44,7 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
43 * 44 *
44 * <p>Original source: 45 * <p>Original source:
45 * <code><pre> 46 * <code><pre>
46 * pattern patternContent(o1: FSObject, o2: FSObject) { 47 * pattern patternContent(o1: Dir, o2: FSObject) {
47 * Dir.contents(o1,o2); 48 * Dir.contents(o1,o2);
48 * } 49 * }
49 * </pre></code> 50 * </pre></code>
@@ -67,13 +68,13 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
67 * 68 *
68 */ 69 */
69 public static abstract class Match extends BasePatternMatch { 70 public static abstract class Match extends BasePatternMatch {
70 private FSObject fO1; 71 private Dir fO1;
71 72
72 private FSObject fO2; 73 private FSObject fO2;
73 74
74 private static List<String> parameterNames = makeImmutableList("o1", "o2"); 75 private static List<String> parameterNames = makeImmutableList("o1", "o2");
75 76
76 private Match(final FSObject pO1, final FSObject pO2) { 77 private Match(final Dir pO1, final FSObject pO2) {
77 this.fO1 = pO1; 78 this.fO1 = pO1;
78 this.fO2 = pO2; 79 this.fO2 = pO2;
79 } 80 }
@@ -85,7 +86,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
85 return null; 86 return null;
86 } 87 }
87 88
88 public FSObject getO1() { 89 public Dir getO1() {
89 return this.fO1; 90 return this.fO1;
90 } 91 }
91 92
@@ -97,7 +98,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
97 public boolean set(final String parameterName, final Object newValue) { 98 public boolean set(final String parameterName, final Object newValue) {
98 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 99 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
99 if ("o1".equals(parameterName) ) { 100 if ("o1".equals(parameterName) ) {
100 this.fO1 = (FSObject) newValue; 101 this.fO1 = (Dir) newValue;
101 return true; 102 return true;
102 } 103 }
103 if ("o2".equals(parameterName) ) { 104 if ("o2".equals(parameterName) ) {
@@ -107,7 +108,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
107 return false; 108 return false;
108 } 109 }
109 110
110 public void setO1(final FSObject pO1) { 111 public void setO1(final Dir pO1) {
111 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 112 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
112 this.fO1 = pO1; 113 this.fO1 = pO1;
113 } 114 }
@@ -195,7 +196,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
195 * @return the new, mutable (partial) match object. 196 * @return the new, mutable (partial) match object.
196 * 197 *
197 */ 198 */
198 public static PatternContent.Match newMutableMatch(final FSObject pO1, final FSObject pO2) { 199 public static PatternContent.Match newMutableMatch(final Dir pO1, final FSObject pO2) {
199 return new Mutable(pO1, pO2); 200 return new Mutable(pO1, pO2);
200 } 201 }
201 202
@@ -208,12 +209,12 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
208 * @return the (partial) match object. 209 * @return the (partial) match object.
209 * 210 *
210 */ 211 */
211 public static PatternContent.Match newMatch(final FSObject pO1, final FSObject pO2) { 212 public static PatternContent.Match newMatch(final Dir pO1, final FSObject pO2) {
212 return new Immutable(pO1, pO2); 213 return new Immutable(pO1, pO2);
213 } 214 }
214 215
215 private static final class Mutable extends PatternContent.Match { 216 private static final class Mutable extends PatternContent.Match {
216 Mutable(final FSObject pO1, final FSObject pO2) { 217 Mutable(final Dir pO1, final FSObject pO2) {
217 super(pO1, pO2); 218 super(pO1, pO2);
218 } 219 }
219 220
@@ -224,7 +225,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
224 } 225 }
225 226
226 private static final class Immutable extends PatternContent.Match { 227 private static final class Immutable extends PatternContent.Match {
227 Immutable(final FSObject pO1, final FSObject pO2) { 228 Immutable(final Dir pO1, final FSObject pO2) {
228 super(pO1, pO2); 229 super(pO1, pO2);
229 } 230 }
230 231
@@ -246,7 +247,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
246 * 247 *
247 * <p>Original source: 248 * <p>Original source:
248 * <code><pre> 249 * <code><pre>
249 * pattern patternContent(o1: FSObject, o2: FSObject) { 250 * pattern patternContent(o1: Dir, o2: FSObject) {
250 * Dir.contents(o1,o2); 251 * Dir.contents(o1,o2);
251 * } 252 * }
252 * </pre></code> 253 * </pre></code>
@@ -308,7 +309,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
308 * @return matches represented as a Match object. 309 * @return matches represented as a Match object.
309 * 310 *
310 */ 311 */
311 public Collection<PatternContent.Match> getAllMatches(final FSObject pO1, final FSObject pO2) { 312 public Collection<PatternContent.Match> getAllMatches(final Dir pO1, final FSObject pO2) {
312 return rawStreamAllMatches(new Object[]{pO1, pO2}).collect(Collectors.toSet()); 313 return rawStreamAllMatches(new Object[]{pO1, pO2}).collect(Collectors.toSet());
313 } 314 }
314 315
@@ -323,7 +324,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
323 * @return a stream of matches represented as a Match object. 324 * @return a stream of matches represented as a Match object.
324 * 325 *
325 */ 326 */
326 public Stream<PatternContent.Match> streamAllMatches(final FSObject pO1, final FSObject pO2) { 327 public Stream<PatternContent.Match> streamAllMatches(final Dir pO1, final FSObject pO2) {
327 return rawStreamAllMatches(new Object[]{pO1, pO2}); 328 return rawStreamAllMatches(new Object[]{pO1, pO2});
328 } 329 }
329 330
@@ -335,7 +336,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
335 * @return a match represented as a Match object, or null if no match is found. 336 * @return a match represented as a Match object, or null if no match is found.
336 * 337 *
337 */ 338 */
338 public Optional<PatternContent.Match> getOneArbitraryMatch(final FSObject pO1, final FSObject pO2) { 339 public Optional<PatternContent.Match> getOneArbitraryMatch(final Dir pO1, final FSObject pO2) {
339 return rawGetOneArbitraryMatch(new Object[]{pO1, pO2}); 340 return rawGetOneArbitraryMatch(new Object[]{pO1, pO2});
340 } 341 }
341 342
@@ -347,7 +348,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
347 * @return true if the input is a valid (partial) match of the pattern. 348 * @return true if the input is a valid (partial) match of the pattern.
348 * 349 *
349 */ 350 */
350 public boolean hasMatch(final FSObject pO1, final FSObject pO2) { 351 public boolean hasMatch(final Dir pO1, final FSObject pO2) {
351 return rawHasMatch(new Object[]{pO1, pO2}); 352 return rawHasMatch(new Object[]{pO1, pO2});
352 } 353 }
353 354
@@ -358,7 +359,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
358 * @return the number of pattern matches found. 359 * @return the number of pattern matches found.
359 * 360 *
360 */ 361 */
361 public int countMatches(final FSObject pO1, final FSObject pO2) { 362 public int countMatches(final Dir pO1, final FSObject pO2) {
362 return rawCountMatches(new Object[]{pO1, pO2}); 363 return rawCountMatches(new Object[]{pO1, pO2});
363 } 364 }
364 365
@@ -371,7 +372,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
371 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked 372 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
372 * 373 *
373 */ 374 */
374 public boolean forOneArbitraryMatch(final FSObject pO1, final FSObject pO2, final Consumer<? super PatternContent.Match> processor) { 375 public boolean forOneArbitraryMatch(final Dir pO1, final FSObject pO2, final Consumer<? super PatternContent.Match> processor) {
375 return rawForOneArbitraryMatch(new Object[]{pO1, pO2}, processor); 376 return rawForOneArbitraryMatch(new Object[]{pO1, pO2}, processor);
376 } 377 }
377 378
@@ -384,7 +385,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
384 * @return the (partial) match object. 385 * @return the (partial) match object.
385 * 386 *
386 */ 387 */
387 public PatternContent.Match newMatch(final FSObject pO1, final FSObject pO2) { 388 public PatternContent.Match newMatch(final Dir pO1, final FSObject pO2) {
388 return PatternContent.Match.newMatch(pO1, pO2); 389 return PatternContent.Match.newMatch(pO1, pO2);
389 } 390 }
390 391
@@ -393,8 +394,8 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
393 * @return the Set of all values or empty set if there are no matches 394 * @return the Set of all values or empty set if there are no matches
394 * 395 *
395 */ 396 */
396 protected Stream<FSObject> rawStreamAllValuesOfo1(final Object[] parameters) { 397 protected Stream<Dir> rawStreamAllValuesOfo1(final Object[] parameters) {
397 return rawStreamAllValues(POSITION_O1, parameters).map(FSObject.class::cast); 398 return rawStreamAllValues(POSITION_O1, parameters).map(Dir.class::cast);
398 } 399 }
399 400
400 /** 401 /**
@@ -402,7 +403,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
402 * @return the Set of all values or empty set if there are no matches 403 * @return the Set of all values or empty set if there are no matches
403 * 404 *
404 */ 405 */
405 public Set<FSObject> getAllValuesOfo1() { 406 public Set<Dir> getAllValuesOfo1() {
406 return rawStreamAllValuesOfo1(emptyArray()).collect(Collectors.toSet()); 407 return rawStreamAllValuesOfo1(emptyArray()).collect(Collectors.toSet());
407 } 408 }
408 409
@@ -411,7 +412,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
411 * @return the Set of all values or empty set if there are no matches 412 * @return the Set of all values or empty set if there are no matches
412 * 413 *
413 */ 414 */
414 public Stream<FSObject> streamAllValuesOfo1() { 415 public Stream<Dir> streamAllValuesOfo1() {
415 return rawStreamAllValuesOfo1(emptyArray()); 416 return rawStreamAllValuesOfo1(emptyArray());
416 } 417 }
417 418
@@ -425,7 +426,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
425 * @return the Stream of all values or empty set if there are no matches 426 * @return the Stream of all values or empty set if there are no matches
426 * 427 *
427 */ 428 */
428 public Stream<FSObject> streamAllValuesOfo1(final PatternContent.Match partialMatch) { 429 public Stream<Dir> streamAllValuesOfo1(final PatternContent.Match partialMatch) {
429 return rawStreamAllValuesOfo1(partialMatch.toArray()); 430 return rawStreamAllValuesOfo1(partialMatch.toArray());
430 } 431 }
431 432
@@ -439,7 +440,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
439 * @return the Stream of all values or empty set if there are no matches 440 * @return the Stream of all values or empty set if there are no matches
440 * 441 *
441 */ 442 */
442 public Stream<FSObject> streamAllValuesOfo1(final FSObject pO2) { 443 public Stream<Dir> streamAllValuesOfo1(final FSObject pO2) {
443 return rawStreamAllValuesOfo1(new Object[]{null, pO2}); 444 return rawStreamAllValuesOfo1(new Object[]{null, pO2});
444 } 445 }
445 446
@@ -448,7 +449,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
448 * @return the Set of all values or empty set if there are no matches 449 * @return the Set of all values or empty set if there are no matches
449 * 450 *
450 */ 451 */
451 public Set<FSObject> getAllValuesOfo1(final PatternContent.Match partialMatch) { 452 public Set<Dir> getAllValuesOfo1(final PatternContent.Match partialMatch) {
452 return rawStreamAllValuesOfo1(partialMatch.toArray()).collect(Collectors.toSet()); 453 return rawStreamAllValuesOfo1(partialMatch.toArray()).collect(Collectors.toSet());
453 } 454 }
454 455
@@ -457,7 +458,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
457 * @return the Set of all values or empty set if there are no matches 458 * @return the Set of all values or empty set if there are no matches
458 * 459 *
459 */ 460 */
460 public Set<FSObject> getAllValuesOfo1(final FSObject pO2) { 461 public Set<Dir> getAllValuesOfo1(final FSObject pO2) {
461 return rawStreamAllValuesOfo1(new Object[]{null, pO2}).collect(Collectors.toSet()); 462 return rawStreamAllValuesOfo1(new Object[]{null, pO2}).collect(Collectors.toSet());
462 } 463 }
463 464
@@ -512,7 +513,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
512 * @return the Stream of all values or empty set if there are no matches 513 * @return the Stream of all values or empty set if there are no matches
513 * 514 *
514 */ 515 */
515 public Stream<FSObject> streamAllValuesOfo2(final FSObject pO1) { 516 public Stream<FSObject> streamAllValuesOfo2(final Dir pO1) {
516 return rawStreamAllValuesOfo2(new Object[]{pO1, null}); 517 return rawStreamAllValuesOfo2(new Object[]{pO1, null});
517 } 518 }
518 519
@@ -530,14 +531,14 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
530 * @return the Set of all values or empty set if there are no matches 531 * @return the Set of all values or empty set if there are no matches
531 * 532 *
532 */ 533 */
533 public Set<FSObject> getAllValuesOfo2(final FSObject pO1) { 534 public Set<FSObject> getAllValuesOfo2(final Dir pO1) {
534 return rawStreamAllValuesOfo2(new Object[]{pO1, null}).collect(Collectors.toSet()); 535 return rawStreamAllValuesOfo2(new Object[]{pO1, null}).collect(Collectors.toSet());
535 } 536 }
536 537
537 @Override 538 @Override
538 protected PatternContent.Match tupleToMatch(final Tuple t) { 539 protected PatternContent.Match tupleToMatch(final Tuple t) {
539 try { 540 try {
540 return PatternContent.Match.newMatch((FSObject) t.get(POSITION_O1), (FSObject) t.get(POSITION_O2)); 541 return PatternContent.Match.newMatch((Dir) t.get(POSITION_O1), (FSObject) t.get(POSITION_O2));
541 } catch(ClassCastException e) { 542 } catch(ClassCastException e) {
542 LOGGER.error("Element(s) in tuple not properly typed!",e); 543 LOGGER.error("Element(s) in tuple not properly typed!",e);
543 return null; 544 return null;
@@ -547,7 +548,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
547 @Override 548 @Override
548 protected PatternContent.Match arrayToMatch(final Object[] match) { 549 protected PatternContent.Match arrayToMatch(final Object[] match) {
549 try { 550 try {
550 return PatternContent.Match.newMatch((FSObject) match[POSITION_O1], (FSObject) match[POSITION_O2]); 551 return PatternContent.Match.newMatch((Dir) match[POSITION_O1], (FSObject) match[POSITION_O2]);
551 } catch(ClassCastException e) { 552 } catch(ClassCastException e) {
552 LOGGER.error("Element(s) in array not properly typed!",e); 553 LOGGER.error("Element(s) in array not properly typed!",e);
553 return null; 554 return null;
@@ -557,7 +558,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
557 @Override 558 @Override
558 protected PatternContent.Match arrayToMatchMutable(final Object[] match) { 559 protected PatternContent.Match arrayToMatchMutable(final Object[] match) {
559 try { 560 try {
560 return PatternContent.Match.newMutableMatch((FSObject) match[POSITION_O1], (FSObject) match[POSITION_O2]); 561 return PatternContent.Match.newMutableMatch((Dir) match[POSITION_O1], (FSObject) match[POSITION_O2]);
561 } catch(ClassCastException e) { 562 } catch(ClassCastException e) {
562 LOGGER.error("Element(s) in array not properly typed!",e); 563 LOGGER.error("Element(s) in array not properly typed!",e);
563 return null; 564 return null;
@@ -608,7 +609,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
608 609
609 @Override 610 @Override
610 public PatternContent.Match newMatch(final Object... parameters) { 611 public PatternContent.Match newMatch(final Object... parameters) {
611 return PatternContent.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject) parameters[1]); 612 return PatternContent.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) parameters[0], (hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject) parameters[1]);
612 } 613 }
613 614
614 /** 615 /**
@@ -640,7 +641,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
640 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { 641 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
641 private static final PatternContent.GeneratedPQuery INSTANCE = new GeneratedPQuery(); 642 private static final PatternContent.GeneratedPQuery INSTANCE = new GeneratedPQuery();
642 643
643 private final PParameter parameter_o1 = new PParameter("o1", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("FS", "FSObject")), PParameterDirection.INOUT); 644 private final PParameter parameter_o1 = new PParameter("o1", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("FS", "Dir")), PParameterDirection.INOUT);
644 645
645 private final PParameter parameter_o2 = new PParameter("o2", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("FS", "FSObject")), PParameterDirection.INOUT); 646 private final PParameter parameter_o2 = new PParameter("o2", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("FS", "FSObject")), PParameterDirection.INOUT);
646 647
@@ -673,7 +674,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification<Pat
673 PBody body = new PBody(this); 674 PBody body = new PBody(this);
674 PVariable var_o1 = body.getOrCreateVariableByName("o1"); 675 PVariable var_o1 = body.getOrCreateVariableByName("o1");
675 PVariable var_o2 = body.getOrCreateVariableByName("o2"); 676 PVariable var_o2 = body.getOrCreateVariableByName("o2");
676 new TypeConstraint(body, Tuples.flatTupleOf(var_o1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FSObject"))); 677 new TypeConstraint(body, Tuples.flatTupleOf(var_o1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "Dir")));
677 new TypeConstraint(body, Tuples.flatTupleOf(var_o2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FSObject"))); 678 new TypeConstraint(body, Tuples.flatTupleOf(var_o2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FSObject")));
678 body.setSymbolicParameters(Arrays.<ExportedParameter>asList( 679 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
679 new ExportedParameter(body, var_o1, parameter_o1), 680 new ExportedParameter(body, var_o1, parameter_o1),
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/RootIsNotDir.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/RootIsNotDir.java
new file mode 100644
index 00000000..22c31158
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/RootIsNotDir.java
@@ -0,0 +1,560 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.alloyexamples;
5
6import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir;
7import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
29import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
41import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
42import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
43import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
44
45/**
46 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
47 *
48 * <p>Original source:
49 * <code><pre>
50 * {@literal @}Constraint(key={fs}, severity="error", message="error")
51 * pattern rootIsNotDir(fs: FileSystem) {
52 * FileSystem.root(fs, root);
53 * neg find dir(root);
54 * }
55 * </pre></code>
56 *
57 * @see Matcher
58 * @see Match
59 *
60 */
61@SuppressWarnings("all")
62public final class RootIsNotDir extends BaseGeneratedEMFQuerySpecification<RootIsNotDir.Matcher> {
63 /**
64 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.rootIsNotDir 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 FileSystem fFs;
77
78 private static List<String> parameterNames = makeImmutableList("fs");
79
80 private Match(final FileSystem pFs) {
81 this.fFs = pFs;
82 }
83
84 @Override
85 public Object get(final String parameterName) {
86 if ("fs".equals(parameterName)) return this.fFs;
87 return null;
88 }
89
90 public FileSystem getFs() {
91 return this.fFs;
92 }
93
94 @Override
95 public boolean set(final String parameterName, final Object newValue) {
96 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
97 if ("fs".equals(parameterName) ) {
98 this.fFs = (FileSystem) newValue;
99 return true;
100 }
101 return false;
102 }
103
104 public void setFs(final FileSystem pFs) {
105 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
106 this.fFs = pFs;
107 }
108
109 @Override
110 public String patternName() {
111 return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.rootIsNotDir";
112 }
113
114 @Override
115 public List<String> parameterNames() {
116 return RootIsNotDir.Match.parameterNames;
117 }
118
119 @Override
120 public Object[] toArray() {
121 return new Object[]{fFs};
122 }
123
124 @Override
125 public RootIsNotDir.Match toImmutable() {
126 return isMutable() ? newMatch(fFs) : this;
127 }
128
129 @Override
130 public String prettyPrint() {
131 StringBuilder result = new StringBuilder();
132 result.append("\"fs\"=" + prettyPrintValue(fFs));
133 return result.toString();
134 }
135
136 @Override
137 public int hashCode() {
138 return Objects.hash(fFs);
139 }
140
141 @Override
142 public boolean equals(final Object obj) {
143 if (this == obj)
144 return true;
145 if (obj == null) {
146 return false;
147 }
148 if ((obj instanceof RootIsNotDir.Match)) {
149 RootIsNotDir.Match other = (RootIsNotDir.Match) obj;
150 return Objects.equals(fFs, other.fFs);
151 } else {
152 // this should be infrequent
153 if (!(obj instanceof IPatternMatch)) {
154 return false;
155 }
156 IPatternMatch otherSig = (IPatternMatch) obj;
157 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
158 }
159 }
160
161 @Override
162 public RootIsNotDir specification() {
163 return RootIsNotDir.instance();
164 }
165
166 /**
167 * Returns an empty, mutable match.
168 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
169 *
170 * @return the empty match.
171 *
172 */
173 public static RootIsNotDir.Match newEmptyMatch() {
174 return new Mutable(null);
175 }
176
177 /**
178 * Returns a mutable (partial) match.
179 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
180 *
181 * @param pFs the fixed value of pattern parameter fs, or null if not bound.
182 * @return the new, mutable (partial) match object.
183 *
184 */
185 public static RootIsNotDir.Match newMutableMatch(final FileSystem pFs) {
186 return new Mutable(pFs);
187 }
188
189 /**
190 * Returns a new (partial) match.
191 * This can be used e.g. to call the matcher with a partial match.
192 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
193 * @param pFs the fixed value of pattern parameter fs, or null if not bound.
194 * @return the (partial) match object.
195 *
196 */
197 public static RootIsNotDir.Match newMatch(final FileSystem pFs) {
198 return new Immutable(pFs);
199 }
200
201 private static final class Mutable extends RootIsNotDir.Match {
202 Mutable(final FileSystem pFs) {
203 super(pFs);
204 }
205
206 @Override
207 public boolean isMutable() {
208 return true;
209 }
210 }
211
212 private static final class Immutable extends RootIsNotDir.Match {
213 Immutable(final FileSystem pFs) {
214 super(pFs);
215 }
216
217 @Override
218 public boolean isMutable() {
219 return false;
220 }
221 }
222 }
223
224 /**
225 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.rootIsNotDir pattern,
226 * providing pattern-specific query methods.
227 *
228 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
229 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
230 *
231 * <p>Matches of the pattern will be represented as {@link Match}.
232 *
233 * <p>Original source:
234 * <code><pre>
235 * {@literal @}Constraint(key={fs}, severity="error", message="error")
236 * pattern rootIsNotDir(fs: FileSystem) {
237 * FileSystem.root(fs, root);
238 * neg find dir(root);
239 * }
240 * </pre></code>
241 *
242 * @see Match
243 * @see RootIsNotDir
244 *
245 */
246 public static class Matcher extends BaseMatcher<RootIsNotDir.Match> {
247 /**
248 * Initializes the pattern matcher within an existing VIATRA Query engine.
249 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
250 *
251 * @param engine the existing VIATRA Query engine in which this matcher will be created.
252 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
253 *
254 */
255 public static RootIsNotDir.Matcher on(final ViatraQueryEngine engine) {
256 // check if matcher already exists
257 Matcher matcher = engine.getExistingMatcher(querySpecification());
258 if (matcher == null) {
259 matcher = (Matcher)engine.getMatcher(querySpecification());
260 }
261 return matcher;
262 }
263
264 /**
265 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
266 * @return an initialized matcher
267 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
268 *
269 */
270 public static RootIsNotDir.Matcher create() {
271 return new Matcher();
272 }
273
274 private static final int POSITION_FS = 0;
275
276 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(RootIsNotDir.Matcher.class);
277
278 /**
279 * Initializes the pattern matcher within an existing VIATRA Query engine.
280 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
281 *
282 * @param engine the existing VIATRA Query engine in which this matcher will be created.
283 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
284 *
285 */
286 private Matcher() {
287 super(querySpecification());
288 }
289
290 /**
291 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
292 * @param pFs the fixed value of pattern parameter fs, or null if not bound.
293 * @return matches represented as a Match object.
294 *
295 */
296 public Collection<RootIsNotDir.Match> getAllMatches(final FileSystem pFs) {
297 return rawStreamAllMatches(new Object[]{pFs}).collect(Collectors.toSet());
298 }
299
300 /**
301 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
302 * </p>
303 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
304 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
305 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
306 * @param pFs the fixed value of pattern parameter fs, or null if not bound.
307 * @return a stream of matches represented as a Match object.
308 *
309 */
310 public Stream<RootIsNotDir.Match> streamAllMatches(final FileSystem pFs) {
311 return rawStreamAllMatches(new Object[]{pFs});
312 }
313
314 /**
315 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
316 * Neither determinism nor randomness of selection is guaranteed.
317 * @param pFs the fixed value of pattern parameter fs, or null if not bound.
318 * @return a match represented as a Match object, or null if no match is found.
319 *
320 */
321 public Optional<RootIsNotDir.Match> getOneArbitraryMatch(final FileSystem pFs) {
322 return rawGetOneArbitraryMatch(new Object[]{pFs});
323 }
324
325 /**
326 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
327 * under any possible substitution of the unspecified parameters (if any).
328 * @param pFs the fixed value of pattern parameter fs, or null if not bound.
329 * @return true if the input is a valid (partial) match of the pattern.
330 *
331 */
332 public boolean hasMatch(final FileSystem pFs) {
333 return rawHasMatch(new Object[]{pFs});
334 }
335
336 /**
337 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
338 * @param pFs the fixed value of pattern parameter fs, or null if not bound.
339 * @return the number of pattern matches found.
340 *
341 */
342 public int countMatches(final FileSystem pFs) {
343 return rawCountMatches(new Object[]{pFs});
344 }
345
346 /**
347 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
348 * Neither determinism nor randomness of selection is guaranteed.
349 * @param pFs the fixed value of pattern parameter fs, or null if not bound.
350 * @param processor the action that will process the selected match.
351 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
352 *
353 */
354 public boolean forOneArbitraryMatch(final FileSystem pFs, final Consumer<? super RootIsNotDir.Match> processor) {
355 return rawForOneArbitraryMatch(new Object[]{pFs}, processor);
356 }
357
358 /**
359 * Returns a new (partial) match.
360 * This can be used e.g. to call the matcher with a partial match.
361 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
362 * @param pFs the fixed value of pattern parameter fs, or null if not bound.
363 * @return the (partial) match object.
364 *
365 */
366 public RootIsNotDir.Match newMatch(final FileSystem pFs) {
367 return RootIsNotDir.Match.newMatch(pFs);
368 }
369
370 /**
371 * Retrieve the set of values that occur in matches for fs.
372 * @return the Set of all values or empty set if there are no matches
373 *
374 */
375 protected Stream<FileSystem> rawStreamAllValuesOffs(final Object[] parameters) {
376 return rawStreamAllValues(POSITION_FS, parameters).map(FileSystem.class::cast);
377 }
378
379 /**
380 * Retrieve the set of values that occur in matches for fs.
381 * @return the Set of all values or empty set if there are no matches
382 *
383 */
384 public Set<FileSystem> getAllValuesOffs() {
385 return rawStreamAllValuesOffs(emptyArray()).collect(Collectors.toSet());
386 }
387
388 /**
389 * Retrieve the set of values that occur in matches for fs.
390 * @return the Set of all values or empty set if there are no matches
391 *
392 */
393 public Stream<FileSystem> streamAllValuesOffs() {
394 return rawStreamAllValuesOffs(emptyArray());
395 }
396
397 @Override
398 protected RootIsNotDir.Match tupleToMatch(final Tuple t) {
399 try {
400 return RootIsNotDir.Match.newMatch((FileSystem) t.get(POSITION_FS));
401 } catch(ClassCastException e) {
402 LOGGER.error("Element(s) in tuple not properly typed!",e);
403 return null;
404 }
405 }
406
407 @Override
408 protected RootIsNotDir.Match arrayToMatch(final Object[] match) {
409 try {
410 return RootIsNotDir.Match.newMatch((FileSystem) match[POSITION_FS]);
411 } catch(ClassCastException e) {
412 LOGGER.error("Element(s) in array not properly typed!",e);
413 return null;
414 }
415 }
416
417 @Override
418 protected RootIsNotDir.Match arrayToMatchMutable(final Object[] match) {
419 try {
420 return RootIsNotDir.Match.newMutableMatch((FileSystem) match[POSITION_FS]);
421 } catch(ClassCastException e) {
422 LOGGER.error("Element(s) in array not properly typed!",e);
423 return null;
424 }
425 }
426
427 /**
428 * @return the singleton instance of the query specification of this pattern
429 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
430 *
431 */
432 public static IQuerySpecification<RootIsNotDir.Matcher> querySpecification() {
433 return RootIsNotDir.instance();
434 }
435 }
436
437 private RootIsNotDir() {
438 super(GeneratedPQuery.INSTANCE);
439 }
440
441 /**
442 * @return the singleton instance of the query specification
443 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
444 *
445 */
446 public static RootIsNotDir instance() {
447 try{
448 return LazyHolder.INSTANCE;
449 } catch (ExceptionInInitializerError err) {
450 throw processInitializerError(err);
451 }
452 }
453
454 @Override
455 protected RootIsNotDir.Matcher instantiate(final ViatraQueryEngine engine) {
456 return RootIsNotDir.Matcher.on(engine);
457 }
458
459 @Override
460 public RootIsNotDir.Matcher instantiate() {
461 return RootIsNotDir.Matcher.create();
462 }
463
464 @Override
465 public RootIsNotDir.Match newEmptyMatch() {
466 return RootIsNotDir.Match.newEmptyMatch();
467 }
468
469 @Override
470 public RootIsNotDir.Match newMatch(final Object... parameters) {
471 return RootIsNotDir.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem) parameters[0]);
472 }
473
474 /**
475 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.RootIsNotDir (visibility: PUBLIC, simpleName: RootIsNotDir, identifier: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.RootIsNotDir, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.alloyexamples) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
476 * <b>not</b> at the class load time of the outer class,
477 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.RootIsNotDir (visibility: PUBLIC, simpleName: RootIsNotDir, identifier: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.RootIsNotDir, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.alloyexamples) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
478 *
479 * <p> This workaround is required e.g. to support recursion.
480 *
481 */
482 private static class LazyHolder {
483 private static final RootIsNotDir INSTANCE = new RootIsNotDir();
484
485 /**
486 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
487 * This initialization order is required to support indirect recursion.
488 *
489 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
490 *
491 */
492 private static final Object STATIC_INITIALIZER = ensureInitialized();
493
494 public static Object ensureInitialized() {
495 INSTANCE.ensureInitializedInternal();
496 return null;
497 }
498 }
499
500 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
501 private static final RootIsNotDir.GeneratedPQuery INSTANCE = new GeneratedPQuery();
502
503 private final PParameter parameter_fs = new PParameter("fs", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("FS", "FileSystem")), PParameterDirection.INOUT);
504
505 private final List<PParameter> parameters = Arrays.asList(parameter_fs);
506
507 private GeneratedPQuery() {
508 super(PVisibility.PUBLIC);
509 }
510
511 @Override
512 public String getFullyQualifiedName() {
513 return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.rootIsNotDir";
514 }
515
516 @Override
517 public List<String> getParameterNames() {
518 return Arrays.asList("fs");
519 }
520
521 @Override
522 public List<PParameter> getParameters() {
523 return parameters;
524 }
525
526 @Override
527 public Set<PBody> doGetContainedBodies() {
528 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
529 Set<PBody> bodies = new LinkedHashSet<>();
530 {
531 PBody body = new PBody(this);
532 PVariable var_fs = body.getOrCreateVariableByName("fs");
533 PVariable var_root = body.getOrCreateVariableByName("root");
534 new TypeConstraint(body, Tuples.flatTupleOf(var_fs), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem")));
535 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
536 new ExportedParameter(body, var_fs, parameter_fs)
537 ));
538 // FileSystem.root(fs, root)
539 new TypeConstraint(body, Tuples.flatTupleOf(var_fs), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem")));
540 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
541 new TypeConstraint(body, Tuples.flatTupleOf(var_fs, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("FS", "FileSystem", "root")));
542 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FSObject")));
543 new Equality(body, var__virtual_0_, var_root);
544 // neg find dir(root)
545 new NegativePatternCall(body, Tuples.flatTupleOf(var_root), Dir.instance().getInternalQueryRepresentation());
546 bodies.add(body);
547 }
548 {
549 PAnnotation annotation = new PAnnotation("Constraint");
550 annotation.addAttribute("key", Arrays.asList(new Object[] {
551 new ParameterReference("fs")
552 }));
553 annotation.addAttribute("severity", "error");
554 annotation.addAttribute("message", "error");
555 addAnnotation(annotation);
556 }
557 return bodies;
558 }
559 }
560}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/FileSystem.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/FileSystem.java
index 1896e31e..f0066955 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/FileSystem.java
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/FileSystem.java
@@ -33,12 +33,12 @@ public interface FileSystem extends EObject {
33 * </p> 33 * </p>
34 * <!-- end-user-doc --> 34 * <!-- end-user-doc -->
35 * @return the value of the '<em>Root</em>' containment reference. 35 * @return the value of the '<em>Root</em>' containment reference.
36 * @see #setRoot(Dir) 36 * @see #setRoot(FSObject)
37 * @see hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage#getFileSystem_Root() 37 * @see hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage#getFileSystem_Root()
38 * @model containment="true" required="true" 38 * @model containment="true" required="true"
39 * @generated 39 * @generated
40 */ 40 */
41 Dir getRoot(); 41 FSObject getRoot();
42 42
43 /** 43 /**
44 * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem#getRoot <em>Root</em>}' containment reference. 44 * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem#getRoot <em>Root</em>}' containment reference.
@@ -48,7 +48,7 @@ public interface FileSystem extends EObject {
48 * @see #getRoot() 48 * @see #getRoot()
49 * @generated 49 * @generated
50 */ 50 */
51 void setRoot(Dir value); 51 void setRoot(FSObject value);
52 52
53 /** 53 /**
54 * Returns the value of the '<em><b>Live</b></em>' reference list. 54 * Returns the value of the '<em><b>Live</b></em>' reference list.
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java
index 62df04af..c2d417d2 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java
@@ -66,6 +66,7 @@ public class DirImpl extends FSObjectImpl implements Dir {
66 * <!-- end-user-doc --> 66 * <!-- end-user-doc -->
67 * @generated 67 * @generated
68 */ 68 */
69 @Override
69 public EList<FSObject> getContents() { 70 public EList<FSObject> getContents() {
70 if (contents == null) { 71 if (contents == null) {
71 contents = new EObjectContainmentWithInverseEList<FSObject>(FSObject.class, this, FilesystemPackage.DIR__CONTENTS, FilesystemPackage.FS_OBJECT__PARENT); 72 contents = new EObjectContainmentWithInverseEList<FSObject>(FSObject.class, this, FilesystemPackage.DIR__CONTENTS, FilesystemPackage.FS_OBJECT__PARENT);
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java
index c8e73b4e..d87935d6 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java
@@ -53,6 +53,7 @@ public abstract class FSObjectImpl extends MinimalEObjectImpl.Container implemen
53 * <!-- end-user-doc --> 53 * <!-- end-user-doc -->
54 * @generated 54 * @generated
55 */ 55 */
56 @Override
56 public Dir getParent() { 57 public Dir getParent() {
57 if (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT) return null; 58 if (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT) return null;
58 return (Dir)eInternalContainer(); 59 return (Dir)eInternalContainer();
@@ -73,6 +74,7 @@ public abstract class FSObjectImpl extends MinimalEObjectImpl.Container implemen
73 * <!-- end-user-doc --> 74 * <!-- end-user-doc -->
74 * @generated 75 * @generated
75 */ 76 */
77 @Override
76 public void setParent(Dir newParent) { 78 public void setParent(Dir newParent) {
77 if (newParent != eInternalContainer() || (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT && newParent != null)) { 79 if (newParent != eInternalContainer() || (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT && newParent != null)) {
78 if (EcoreUtil.isAncestor(this, newParent)) 80 if (EcoreUtil.isAncestor(this, newParent))
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java
index adf30f3a..e6859cab 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java
@@ -2,7 +2,6 @@
2 */ 2 */
3package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl; 3package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl;
4 4
5import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir;
6import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject; 5import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject;
7import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem; 6import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem;
8import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage; 7import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage;
@@ -42,7 +41,7 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File
42 * @generated 41 * @generated
43 * @ordered 42 * @ordered
44 */ 43 */
45 protected Dir root; 44 protected FSObject root;
46 45
47 /** 46 /**
48 * The cached setting delegate for the '{@link #getLive() <em>Live</em>}' reference list. 47 * The cached setting delegate for the '{@link #getLive() <em>Live</em>}' reference list.
@@ -78,7 +77,8 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File
78 * <!-- end-user-doc --> 77 * <!-- end-user-doc -->
79 * @generated 78 * @generated
80 */ 79 */
81 public Dir getRoot() { 80 @Override
81 public FSObject getRoot() {
82 return root; 82 return root;
83 } 83 }
84 84
@@ -87,8 +87,8 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File
87 * <!-- end-user-doc --> 87 * <!-- end-user-doc -->
88 * @generated 88 * @generated
89 */ 89 */
90 public NotificationChain basicSetRoot(Dir newRoot, NotificationChain msgs) { 90 public NotificationChain basicSetRoot(FSObject newRoot, NotificationChain msgs) {
91 Dir oldRoot = root; 91 FSObject oldRoot = root;
92 root = newRoot; 92 root = newRoot;
93 if (eNotificationRequired()) { 93 if (eNotificationRequired()) {
94 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilesystemPackage.FILE_SYSTEM__ROOT, oldRoot, newRoot); 94 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilesystemPackage.FILE_SYSTEM__ROOT, oldRoot, newRoot);
@@ -102,7 +102,8 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File
102 * <!-- end-user-doc --> 102 * <!-- end-user-doc -->
103 * @generated 103 * @generated
104 */ 104 */
105 public void setRoot(Dir newRoot) { 105 @Override
106 public void setRoot(FSObject newRoot) {
106 if (newRoot != root) { 107 if (newRoot != root) {
107 NotificationChain msgs = null; 108 NotificationChain msgs = null;
108 if (root != null) 109 if (root != null)
@@ -122,6 +123,7 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File
122 * @generated 123 * @generated
123 */ 124 */
124 @SuppressWarnings("unchecked") 125 @SuppressWarnings("unchecked")
126 @Override
125 public EList<FSObject> getLive() { 127 public EList<FSObject> getLive() {
126 return (EList<FSObject>)LIVE__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false); 128 return (EList<FSObject>)LIVE__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false);
127 } 129 }
@@ -165,7 +167,7 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File
165 public void eSet(int featureID, Object newValue) { 167 public void eSet(int featureID, Object newValue) {
166 switch (featureID) { 168 switch (featureID) {
167 case FilesystemPackage.FILE_SYSTEM__ROOT: 169 case FilesystemPackage.FILE_SYSTEM__ROOT:
168 setRoot((Dir)newValue); 170 setRoot((FSObject)newValue);
169 return; 171 return;
170 } 172 }
171 super.eSet(featureID, newValue); 173 super.eSet(featureID, newValue);
@@ -180,7 +182,7 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File
180 public void eUnset(int featureID) { 182 public void eUnset(int featureID) {
181 switch (featureID) { 183 switch (featureID) {
182 case FilesystemPackage.FILE_SYSTEM__ROOT: 184 case FilesystemPackage.FILE_SYSTEM__ROOT:
183 setRoot((Dir)null); 185 setRoot((FSObject)null);
184 return; 186 return;
185 } 187 }
186 super.eUnset(featureID); 188 super.eUnset(featureID);
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java
index e40b0bd1..b4b09e15 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java
@@ -70,6 +70,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac
70 * <!-- end-user-doc --> 70 * <!-- end-user-doc -->
71 * @generated 71 * @generated
72 */ 72 */
73 @Override
73 public FileSystem createFileSystem() { 74 public FileSystem createFileSystem() {
74 FileSystemImpl fileSystem = new FileSystemImpl(); 75 FileSystemImpl fileSystem = new FileSystemImpl();
75 return fileSystem; 76 return fileSystem;
@@ -80,6 +81,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac
80 * <!-- end-user-doc --> 81 * <!-- end-user-doc -->
81 * @generated 82 * @generated
82 */ 83 */
84 @Override
83 public Dir createDir() { 85 public Dir createDir() {
84 DirImpl dir = new DirImpl(); 86 DirImpl dir = new DirImpl();
85 return dir; 87 return dir;
@@ -90,6 +92,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac
90 * <!-- end-user-doc --> 92 * <!-- end-user-doc -->
91 * @generated 93 * @generated
92 */ 94 */
95 @Override
93 public File createFile() { 96 public File createFile() {
94 FileImpl file = new FileImpl(); 97 FileImpl file = new FileImpl();
95 return file; 98 return file;
@@ -100,6 +103,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac
100 * <!-- end-user-doc --> 103 * <!-- end-user-doc -->
101 * @generated 104 * @generated
102 */ 105 */
106 @Override
103 public Model createModel() { 107 public Model createModel() {
104 ModelImpl model = new ModelImpl(); 108 ModelImpl model = new ModelImpl();
105 return model; 109 return model;
@@ -110,6 +114,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac
110 * <!-- end-user-doc --> 114 * <!-- end-user-doc -->
111 * @generated 115 * @generated
112 */ 116 */
117 @Override
113 public FilesystemPackage getFilesystemPackage() { 118 public FilesystemPackage getFilesystemPackage() {
114 return (FilesystemPackage)getEPackage(); 119 return (FilesystemPackage)getEPackage();
115 } 120 }
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java
index 87390fee..4c0ca4c5 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java
@@ -86,7 +86,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
86 86
87 /** 87 /**
88 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. 88 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
89 * 89 *
90 * <p>This method is used to initialize {@link FilesystemPackage#eINSTANCE} when that field is accessed. 90 * <p>This method is used to initialize {@link FilesystemPackage#eINSTANCE} when that field is accessed.
91 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. 91 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
92 * <!-- begin-user-doc --> 92 * <!-- begin-user-doc -->
@@ -100,7 +100,8 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
100 if (isInited) return (FilesystemPackage)EPackage.Registry.INSTANCE.getEPackage(FilesystemPackage.eNS_URI); 100 if (isInited) return (FilesystemPackage)EPackage.Registry.INSTANCE.getEPackage(FilesystemPackage.eNS_URI);
101 101
102 // Obtain or create and register package 102 // Obtain or create and register package
103 FilesystemPackageImpl theFilesystemPackage = (FilesystemPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FilesystemPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FilesystemPackageImpl()); 103 Object registeredFilesystemPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
104 FilesystemPackageImpl theFilesystemPackage = registeredFilesystemPackage instanceof FilesystemPackageImpl ? (FilesystemPackageImpl)registeredFilesystemPackage : new FilesystemPackageImpl();
104 105
105 isInited = true; 106 isInited = true;
106 107
@@ -113,7 +114,6 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
113 // Mark meta-data to indicate it can't be changed 114 // Mark meta-data to indicate it can't be changed
114 theFilesystemPackage.freeze(); 115 theFilesystemPackage.freeze();
115 116
116
117 // Update the registry and return the package 117 // Update the registry and return the package
118 EPackage.Registry.INSTANCE.put(FilesystemPackage.eNS_URI, theFilesystemPackage); 118 EPackage.Registry.INSTANCE.put(FilesystemPackage.eNS_URI, theFilesystemPackage);
119 return theFilesystemPackage; 119 return theFilesystemPackage;
@@ -124,6 +124,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
124 * <!-- end-user-doc --> 124 * <!-- end-user-doc -->
125 * @generated 125 * @generated
126 */ 126 */
127 @Override
127 public EClass getFileSystem() { 128 public EClass getFileSystem() {
128 return fileSystemEClass; 129 return fileSystemEClass;
129 } 130 }
@@ -133,6 +134,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
133 * <!-- end-user-doc --> 134 * <!-- end-user-doc -->
134 * @generated 135 * @generated
135 */ 136 */
137 @Override
136 public EReference getFileSystem_Root() { 138 public EReference getFileSystem_Root() {
137 return (EReference)fileSystemEClass.getEStructuralFeatures().get(0); 139 return (EReference)fileSystemEClass.getEStructuralFeatures().get(0);
138 } 140 }
@@ -142,6 +144,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
142 * <!-- end-user-doc --> 144 * <!-- end-user-doc -->
143 * @generated 145 * @generated
144 */ 146 */
147 @Override
145 public EReference getFileSystem_Live() { 148 public EReference getFileSystem_Live() {
146 return (EReference)fileSystemEClass.getEStructuralFeatures().get(1); 149 return (EReference)fileSystemEClass.getEStructuralFeatures().get(1);
147 } 150 }
@@ -151,6 +154,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
151 * <!-- end-user-doc --> 154 * <!-- end-user-doc -->
152 * @generated 155 * @generated
153 */ 156 */
157 @Override
154 public EClass getFSObject() { 158 public EClass getFSObject() {
155 return fsObjectEClass; 159 return fsObjectEClass;
156 } 160 }
@@ -160,6 +164,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
160 * <!-- end-user-doc --> 164 * <!-- end-user-doc -->
161 * @generated 165 * @generated
162 */ 166 */
167 @Override
163 public EReference getFSObject_Parent() { 168 public EReference getFSObject_Parent() {
164 return (EReference)fsObjectEClass.getEStructuralFeatures().get(0); 169 return (EReference)fsObjectEClass.getEStructuralFeatures().get(0);
165 } 170 }
@@ -169,6 +174,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
169 * <!-- end-user-doc --> 174 * <!-- end-user-doc -->
170 * @generated 175 * @generated
171 */ 176 */
177 @Override
172 public EClass getDir() { 178 public EClass getDir() {
173 return dirEClass; 179 return dirEClass;
174 } 180 }
@@ -178,6 +184,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
178 * <!-- end-user-doc --> 184 * <!-- end-user-doc -->
179 * @generated 185 * @generated
180 */ 186 */
187 @Override
181 public EReference getDir_Contents() { 188 public EReference getDir_Contents() {
182 return (EReference)dirEClass.getEStructuralFeatures().get(0); 189 return (EReference)dirEClass.getEStructuralFeatures().get(0);
183 } 190 }
@@ -187,6 +194,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
187 * <!-- end-user-doc --> 194 * <!-- end-user-doc -->
188 * @generated 195 * @generated
189 */ 196 */
197 @Override
190 public EClass getFile() { 198 public EClass getFile() {
191 return fileEClass; 199 return fileEClass;
192 } 200 }
@@ -196,6 +204,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
196 * <!-- end-user-doc --> 204 * <!-- end-user-doc -->
197 * @generated 205 * @generated
198 */ 206 */
207 @Override
199 public EClass getModel() { 208 public EClass getModel() {
200 return modelEClass; 209 return modelEClass;
201 } 210 }
@@ -205,6 +214,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
205 * <!-- end-user-doc --> 214 * <!-- end-user-doc -->
206 * @generated 215 * @generated
207 */ 216 */
217 @Override
208 public EReference getModel_Filesystems() { 218 public EReference getModel_Filesystems() {
209 return (EReference)modelEClass.getEStructuralFeatures().get(0); 219 return (EReference)modelEClass.getEStructuralFeatures().get(0);
210 } 220 }
@@ -214,6 +224,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
214 * <!-- end-user-doc --> 224 * <!-- end-user-doc -->
215 * @generated 225 * @generated
216 */ 226 */
227 @Override
217 public EReference getModel_OtherFSObjects() { 228 public EReference getModel_OtherFSObjects() {
218 return (EReference)modelEClass.getEStructuralFeatures().get(1); 229 return (EReference)modelEClass.getEStructuralFeatures().get(1);
219 } 230 }
@@ -223,6 +234,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
223 * <!-- end-user-doc --> 234 * <!-- end-user-doc -->
224 * @generated 235 * @generated
225 */ 236 */
237 @Override
226 public FilesystemFactory getFilesystemFactory() { 238 public FilesystemFactory getFilesystemFactory() {
227 return (FilesystemFactory)getEFactoryInstance(); 239 return (FilesystemFactory)getEFactoryInstance();
228 } 240 }
@@ -296,7 +308,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
296 308
297 // Initialize classes, features, and operations; add parameters 309 // Initialize classes, features, and operations; add parameters
298 initEClass(fileSystemEClass, FileSystem.class, "FileSystem", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); 310 initEClass(fileSystemEClass, FileSystem.class, "FileSystem", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
299 initEReference(getFileSystem_Root(), this.getDir(), null, "root", null, 1, 1, FileSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); 311 initEReference(getFileSystem_Root(), this.getFSObject(), null, "root", null, 1, 1, FileSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
300 initEReference(getFileSystem_Live(), this.getFSObject(), null, "live", null, 0, -1, FileSystem.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); 312 initEReference(getFileSystem_Live(), this.getFSObject(), null, "live", null, 0, -1, FileSystem.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
301 313
302 initEClass(fsObjectEClass, FSObject.class, "FSObject", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); 314 initEClass(fsObjectEClass, FSObject.class, "FSObject", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -328,12 +340,12 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
328 * @generated 340 * @generated
329 */ 341 */
330 protected void createEcoreAnnotations() { 342 protected void createEcoreAnnotations() {
331 String source = "http://www.eclipse.org/emf/2002/Ecore"; 343 String source = "http://www.eclipse.org/emf/2002/Ecore";
332 addAnnotation 344 addAnnotation
333 (this, 345 (this,
334 source, 346 source,
335 new String[] { 347 new String[] {
336 "settingDelegates", "org.eclipse.viatra.query.querybasedfeature" 348 "settingDelegates", "org.eclipse.viatra.query.querybasedfeature"
337 }); 349 });
338 } 350 }
339 351
@@ -344,12 +356,12 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac
344 * @generated 356 * @generated
345 */ 357 */
346 protected void createOrgAnnotations() { 358 protected void createOrgAnnotations() {
347 String source = "org.eclipse.viatra.query.querybasedfeature"; 359 String source = "org.eclipse.viatra.query.querybasedfeature";
348 addAnnotation 360 addAnnotation
349 (getFileSystem_Live(), 361 (getFileSystem_Live(),
350 source, 362 source,
351 new String[] { 363 new String[] {
352 "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.live" 364 "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.live"
353 }); 365 });
354 } 366 }
355 367
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java
index 4c236e8e..093b9972 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java
@@ -82,6 +82,7 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model {
82 * <!-- end-user-doc --> 82 * <!-- end-user-doc -->
83 * @generated 83 * @generated
84 */ 84 */
85 @Override
85 public FileSystem getFilesystems() { 86 public FileSystem getFilesystems() {
86 return filesystems; 87 return filesystems;
87 } 88 }
@@ -106,6 +107,7 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model {
106 * <!-- end-user-doc --> 107 * <!-- end-user-doc -->
107 * @generated 108 * @generated
108 */ 109 */
110 @Override
109 public void setFilesystems(FileSystem newFilesystems) { 111 public void setFilesystems(FileSystem newFilesystems) {
110 if (newFilesystems != filesystems) { 112 if (newFilesystems != filesystems) {
111 NotificationChain msgs = null; 113 NotificationChain msgs = null;
@@ -125,6 +127,7 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model {
125 * <!-- end-user-doc --> 127 * <!-- end-user-doc -->
126 * @generated 128 * @generated
127 */ 129 */
130 @Override
128 public EList<FSObject> getOtherFSObjects() { 131 public EList<FSObject> getOtherFSObjects() {
129 if (otherFSObjects == null) { 132 if (otherFSObjects == null) {
130 otherFSObjects = new EObjectContainmentEList<FSObject>(FSObject.class, this, FilesystemPackage.MODEL__OTHER_FS_OBJECTS); 133 otherFSObjects = new EObjectContainmentEList<FSObject>(FSObject.class, this, FilesystemPackage.MODEL__OTHER_FS_OBJECTS);
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json
index d7955ddd..a7e29a22 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json
@@ -6,10 +6,11 @@
6 "warmupIterations": 1, 6 "warmupIterations": 1,
7 "iterations": 1, 7 "iterations": 1,
8 "domain": "fs", 8 "domain": "fs",
9 "scope": "useful", 9 "scope": "none",
10 "sizes": [50, 100, 150, 200, 250, 300, 350, 400, 450, 500], 10 "sizes": [50, 100, 150, 200, 250, 300, 350, 400, 450, 500],
11 "solver": "ViatraSolver", 11 "solver": "ViatraSolver",
12 "scopePropagator": "polyhedral", 12 "scopePropagator": "polyhedral",
13 "propagatedConstraints": "relations", 13 "propagatedConstraints": "hints",
14 "polyhedronSolver": "Clp" 14 "polyhedronSolver": "Clp",
15 "scopeHeuristic": "polyhedral"
15} 16}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend
new file mode 100644
index 00000000..8d6523b1
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend
@@ -0,0 +1,32 @@
1package hu.bme.mit.inf.dslreasoner.run
2
3import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
4import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace
5import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeExpressionBuilderFactory
6import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator
7
8class FileSystemHint extends Ecore2LogicTraceBasedHint {
9 static val REMAINING_CONTENTS_ROOT = "hint_root"
10
11 new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) {
12 super(ecore2Logic, trace)
13 }
14
15 override getAdditionalPatterns(PatternGenerator it) '''
16 pattern «REMAINING_CONTENTS_ROOT»(problem:LogicProblem, interpretation:PartialInterpretation, remainingContents:java Integer) {
17 find interpretation(problem, interpretation);
18 remainingContents == sum find remainingContents_root_reference_Dir_helper(problem, interpretation, _, #_)
19 }
20 '''
21
22 override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) {
23 val dirCount = createBuilder.add(1, "Dir".type).build
24
25 val remainingContentsRootMatcher = createMatcher(REMAINING_CONTENTS_ROOT)
26
27 return [ p |
28 dirCount.tightenLowerBound(remainingContentsRootMatcher.getCount(p))
29 ]
30 }
31
32}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend
index e79a6261..f4f36951 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend
@@ -35,11 +35,11 @@ class FileSystemInconsistencyDetector extends ModelGenerationMethodBasedGlobalCo
35 35
36 override checkGlobalConstraint(ThreadContext context) { 36 override checkGlobalConstraint(ThreadContext context) {
37 var requiredNewObjects = 37 var requiredNewObjects =
38 filesystem.countMatches*2 + 38 root.countMatches*2 +
39 root.countMatches 39 filesystem.countMatches
40 val availableNewObjects = partialInterpretation.maxNewElements 40 val availableNewObjects = partialInterpretation.maxNewElements
41 val res = availableNewObjects >= requiredNewObjects 41 val res = availableNewObjects >= requiredNewObjects
42 //println('''[«availableNewObjects» >= «requiredNewObjects»] = «res»''') 42 println('''[«availableNewObjects» >= «requiredNewObjects»] = «res»''')
43 return res 43 return res
44 } 44 }
45 45
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend
index 54724226..4b0791d4 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend
@@ -195,8 +195,9 @@ class YakinduLoader extends MetamodelLoader {
195 this.workspace.readModel(EObject, "Yakindu.xmi").eResource.allContents.toList 195 this.workspace.readModel(EObject, "Yakindu.xmi").eResource.allContents.toList
196 } 196 }
197 197
198 override additionalConstraints() { // #[] 198 override additionalConstraints() {
199 #[[method|new SGraphInconsistencyDetector(method)]] 199 //#[[method|new SGraphInconsistencyDetector(method)]]
200 emptyList
200 } 201 }
201 202
202 override getTypeQuantiles() { 203 override getTypeQuantiles() {
@@ -260,9 +261,17 @@ class FileSystemLoader extends MetamodelLoader {
260 } 261 }
261 262
262 override additionalConstraints() { 263 override additionalConstraints() {
263 #[[method|new FileSystemInconsistencyDetector(method)]] 264 //#[[method|new FileSystemInconsistencyDetector(method)]]
265 emptyList
264 } 266 }
265 267
268 override getTypeQuantiles() {
269 #{
270 "Filesystem" -> new TypeQuantiles(0, 0.05),
271 "Dir" -> new TypeQuantiles(0.15, 0.3),
272 "File" -> new TypeQuantiles(0.25, 0.85)
273 }
274 }
266} 275}
267 276
268class EcoreLoader extends MetamodelLoader { 277class EcoreLoader extends MetamodelLoader {
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend
index e95c0c64..ef5b779e 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend
@@ -9,8 +9,6 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGene
9class SatelliteHint extends Ecore2LogicTraceBasedHint { 9class SatelliteHint extends Ecore2LogicTraceBasedHint {
10 static val INTERFEROMETY_PAYLOAD = "hint_interferometryPayload" 10 static val INTERFEROMETY_PAYLOAD = "hint_interferometryPayload"
11 static val REMAINING_CONTENTS_KA_COMM_SUBSYSTEM = "hint_kaCommSubsystem" 11 static val REMAINING_CONTENTS_KA_COMM_SUBSYSTEM = "hint_kaCommSubsystem"
12 static val HINT_SPACECRAFT_UHF_POSSIBLE_LINK = "hint_spacecraftWithUhfPossibleLink"
13 static val HINT_SPACECRAFT_UHF_ONLY_NO_LINK = "hint_spacecraftUhfOnlyNoLink"
14 12
15 new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { 13 new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) {
16 super(ecore2Logic, trace) 14 super(ecore2Logic, trace)
@@ -32,54 +30,19 @@ class SatelliteHint extends Ecore2LogicTraceBasedHint {
32 find interpretation(problem, interpretation); 30 find interpretation(problem, interpretation);
33 remainingContents == sum find «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»_helper(problem, interpretation, _, #_); 31 remainingContents == sum find «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»_helper(problem, interpretation, _, #_);
34 } 32 }
35
36 private pattern hint_spacecraftNotUhfOnly(problem:LogicProblem, interpretation:PartialInterpretation, spacecraft:DefinedElement) {
37 find interpretation(problem, interpretation);
38 find mustExist(problem, interpretation, spacecraft);
39 «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")»
40 «relationDeclarationIndexer.referRelation("CommunicatingElement".relation("commSubsystem"), "spacecraft", "comm", Modality.MAY)»
41 neg «typeIndexer.referInstanceOf("UHFCommSubsystem".type, Modality.MUST, "comm")»
42 }
43
44 private pattern hint_spacecraftWithUhf(problem:LogicProblem, interpretation:PartialInterpretation, spacecraft:DefinedElement) {
45 find interpretation(problem, interpretation);
46 find mustExist(problem, interpretation, spacecraft);
47 «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")»
48 «relationDeclarationIndexer.referRelation("CommunicatingElement".relation("commSubsystem"), "spacecraft", "comm", Modality.MUST)»
49 «typeIndexer.referInstanceOf("UHFCommSubsystem".type, Modality.MUST, "comm")»
50 }
51
52 pattern «HINT_SPACECRAFT_UHF_POSSIBLE_LINK»(problem:LogicProblem, interpretation:PartialInterpretation) {
53 find hint_spacecraftWithUhf(problem, interpretation, spacecraft);
54 find hint_spacecraftNotUhfOnly(problem, interpretation, spacecraft);
55 }
56
57 pattern «HINT_SPACECRAFT_UHF_ONLY_NO_LINK»(problem:LogicProblem, interpretation:PartialInterpretation) {
58 find interpretation(problem, interpretation);
59 find mustExist(problem, interpretation, spacecraft);
60 «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")»
61 neg find hint_spacecraftNotUhfOnly(problem, interpretation, spacecraft);
62 find currentInRelation_pattern_hu_bme_mit_inf_dslreasoner_domains_satellite_queries_noLinkToGroundStation(problem, interpretation, spacecraft);
63 }
64 ''' 33 '''
65 34
66 override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) { 35 override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) {
67 val interferometryPayloadCount = createBuilder.add(1, "InterferometryPayload".type).build 36 val interferometryPayloadCount = createBuilder.add(1, "InterferometryPayload".type).build
68 val kaCommSubsystemWithoutSmallSatCount = createBuilder.add(1, "KaCommSubsystem".type).add(-2, "SmallSat".type). 37 val kaCommSubsystemWithoutSmallSatCount = createBuilder.add(1, "KaCommSubsystem".type).add(-2, "SmallSat".type).
69 build 38 build
70 val uhfCommSubsystemCount = createBuilder.add(1, "UHFCommSubsystem".type).build
71 39
72 val interferometryPayloadMatcher = createMatcher(INTERFEROMETY_PAYLOAD) 40 val interferometryPayloadMatcher = createMatcher(INTERFEROMETY_PAYLOAD)
73 val kaCommSubsystemRemainingContentsMatcher = createMatcher(REMAINING_CONTENTS_KA_COMM_SUBSYSTEM) 41 val kaCommSubsystemRemainingContentsMatcher = createMatcher(REMAINING_CONTENTS_KA_COMM_SUBSYSTEM)
74 val uhfPossibleLinkMatcher = createMatcher(HINT_SPACECRAFT_UHF_POSSIBLE_LINK)
75 val uhfNoLinkMatcher = createMatcher(HINT_SPACECRAFT_UHF_ONLY_NO_LINK)
76 42
77 return [ p | 43 return [ p |
78 interferometryPayloadCount.tightenLowerBound(2 - interferometryPayloadMatcher.countMatches(p)) 44 interferometryPayloadCount.tightenLowerBound(2 - interferometryPayloadMatcher.countMatches(p))
79 kaCommSubsystemWithoutSmallSatCount.tightenUpperBound(kaCommSubsystemRemainingContentsMatcher.getCount(p)) 45 kaCommSubsystemWithoutSmallSatCount.tightenUpperBound(kaCommSubsystemRemainingContentsMatcher.getCount(p))
80 if (uhfPossibleLinkMatcher.countMatches(p) == 0 && uhfNoLinkMatcher.countMatches(p) >= 1) {
81 uhfCommSubsystemCount.tightenLowerBound(1)
82 }
83 ] 46 ]
84 } 47 }
85 48
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend
index 5abff962..56a65091 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend
@@ -22,7 +22,7 @@ class MeasurementScript {
22 ScopeHeuristic scopeHeuristic 22 ScopeHeuristic scopeHeuristic
23 23
24 def toCsvHeader() { 24 def toCsvHeader() {
25 '''«domain»,«scope»,«solver»,«scopePropagator ?: "NULL"»,«propagatedConstraints ?: "NULL"»,«polyhedronSolver ?: "NULL"»''' 25 '''«domain»,«scope»,«solver»,«scopePropagator ?: "NULL"»,«propagatedConstraints ?: "NULL"»,«polyhedronSolver ?: "NULL"»,«scopeHeuristic ?: "NULL"»'''
26 } 26 }
27} 27}
28 28
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend
index 48e750cb..bfbbf329 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend
@@ -68,7 +68,7 @@ class MeasurementScriptRunner {
68 this.script = script 68 this.script = script
69 inputWorkspace = new FileSystemWorkspace(script.inputPath + "/", "") 69 inputWorkspace = new FileSystemWorkspace(script.inputPath + "/", "")
70 outputWorkspace = new FileSystemWorkspace(script.outputPath + 70 outputWorkspace = new FileSystemWorkspace(script.outputPath +
71 "/", '''«script.domain»_«script.solver»_«script.scope»_«script.scopePropagator ?: "na"»_«script.propagatedConstraints ?: "na"»_«script.polyhedronSolver ?: "na"»_''') 71 "/", '''«script.domain»_«script.solver»_«script.scope»_«script.scopePropagator ?: "na"»_«script.propagatedConstraints ?: "na"»_«script.polyhedronSolver ?: "na"»_«script.scopeHeuristic ?: "na"»_''')
72 metamodelLoader = switch (script.domain) { 72 metamodelLoader = switch (script.domain) {
73 case fs: new FileSystemLoader(inputWorkspace) 73 case fs: new FileSystemLoader(inputWorkspace)
74 case ecore: new EcoreLoader(inputWorkspace) 74 case ecore: new EcoreLoader(inputWorkspace)