aboutsummaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <marussy@mit.bme.hu>2020-06-25 19:55:10 +0200
committerLibravatar Kristóf Marussy <marussy@mit.bme.hu>2020-06-25 19:55:10 +0200
commitc3a6d4b9cf3657070d180aa65ddbf0459e880329 (patch)
tree780c4fc61578dcb309af53fb0c164c7627e51676 /Tests
parentNew configuration language parser WIP (diff)
parentScope unsat benchmarks (diff)
downloadVIATRA-Generator-c3a6d4b9cf3657070d180aa65ddbf0459e880329.tar.gz
VIATRA-Generator-c3a6d4b9cf3657070d180aa65ddbf0459e880329.tar.zst
VIATRA-Generator-c3a6d4b9cf3657070d180aa65ddbf0459e880329.zip
Merge branch 'kris'
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Ecore-Plugin/.classpath17
-rw-r--r--Tests/Ecore-Plugin/.gitignore1
-rw-r--r--Tests/Ecore-Plugin/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--Tests/Ecore-Plugin/build.properties2
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath20
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.project6
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/META-INF/MANIFEST.MF42
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties11
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/generation.vsconfig9
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamMetamodel.genmodel48
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamPatterns.vql8
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.properties4
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FAMTerminator.java52
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/Function.java72
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionType.java244
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalArchitectureModel.java42
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalData.java81
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalElement.java109
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalInput.java42
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalInterface.java73
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalOutput.java42
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalarchitectureFactory.java96
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalarchitecturePackage.java1031
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/InformationLink.java81
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FAMTerminatorImpl.java198
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionImpl.java240
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalArchitectureModelImpl.java153
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalDataImpl.java270
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalElementImpl.java318
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalInputImpl.java166
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalInterfaceImpl.java245
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalOutputImpl.java166
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalarchitectureFactoryImpl.java228
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalarchitecturePackageImpl.java575
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/InformationLinkImpl.java289
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/util/FunctionalarchitectureAdapterFactory.java272
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/util/FunctionalarchitectureSwitch.java289
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/.classpath21
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF13
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu.json13
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json17
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json17
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/FAM.xmi2
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/satellite.xmi14
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/CountMatches.xtend176
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend13
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/Ecore2LogicTraceBasedHint.xtend56
-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.xtend391
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend17
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend18
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend46
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend49
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend95
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/TypeDistributionCalculator.xtend35
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend12
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend77
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend400
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.classpath16
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.gitignore4
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.project34
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/META-INF/MANIFEST.MF15
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/build.properties5
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/CbcPolyhedronSolverTest.xtend42
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend385
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/Z3PolyhedronSolverTest.xtend17
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/AdditionTest.xtend49
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/DivisionTest.xtend202
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MinAggregatorTest.xtend67
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MultiplicationTest.xtend205
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/NegationTest.xtend34
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/PowerTest.xtend43
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/RelationTest.xtend126
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SubtractionTest.xtend49
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SumAggregatorTest.xtend140
77 files changed, 8094 insertions, 416 deletions
diff --git a/Tests/Ecore-Plugin/.classpath b/Tests/Ecore-Plugin/.classpath
index b862a296..19ec8693 100644
--- a/Tests/Ecore-Plugin/.classpath
+++ b/Tests/Ecore-Plugin/.classpath
@@ -1,7 +1,10 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<classpath> 2<classpath>
3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> 3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
4 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> 4 <attributes>
5 <classpathentry kind="src" path="src"/> 5 <attribute name="module" value="true"/>
6 <classpathentry kind="output" path="bin"/> 6 </attributes>
7</classpath> 7 </classpathentry>
8 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
9 <classpathentry kind="output" path="bin"/>
10</classpath>
diff --git a/Tests/Ecore-Plugin/.gitignore b/Tests/Ecore-Plugin/.gitignore
new file mode 100644
index 00000000..ae3c1726
--- /dev/null
+++ b/Tests/Ecore-Plugin/.gitignore
@@ -0,0 +1 @@
/bin/
diff --git a/Tests/Ecore-Plugin/.settings/org.eclipse.jdt.core.prefs b/Tests/Ecore-Plugin/.settings/org.eclipse.jdt.core.prefs
index 295926d9..c59d0c6a 100644
--- a/Tests/Ecore-Plugin/.settings/org.eclipse.jdt.core.prefs
+++ b/Tests/Ecore-Plugin/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,15 @@
1eclipse.preferences.version=1 1eclipse.preferences.version=1
2org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 2org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
3org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
5org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
4org.eclipse.jdt.core.compiler.compliance=1.8 6org.eclipse.jdt.core.compiler.compliance=1.8
7org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8org.eclipse.jdt.core.compiler.debug.localVariable=generate
9org.eclipse.jdt.core.compiler.debug.sourceFile=generate
5org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
6org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
13org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
14org.eclipse.jdt.core.compiler.release=disabled
7org.eclipse.jdt.core.compiler.source=1.8 15org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Tests/Ecore-Plugin/build.properties b/Tests/Ecore-Plugin/build.properties
index 41eb6ade..577870e2 100644
--- a/Tests/Ecore-Plugin/build.properties
+++ b/Tests/Ecore-Plugin/build.properties
@@ -1,4 +1,2 @@
1source.. = src/
2output.. = bin/
3bin.includes = META-INF/,\ 1bin.includes = META-INF/,\
4 . 2 .
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath
index 1c96fe2f..e7847821 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath
@@ -1,8 +1,12 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<classpath> 2<classpath>
3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> 3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
4 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> 4 <attributes>
5 <classpathentry kind="src" path="src"/> 5 <attribute name="module" value="true"/>
6 <classpathentry kind="src" path="xtend-gen"/> 6 </attributes>
7 <classpathentry kind="output" path="bin"/> 7 </classpathentry>
8</classpath> 8 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
9 <classpathentry kind="src" path="src"/>
10 <classpathentry kind="src" path="xtend-gen"/>
11 <classpathentry kind="output" path="bin"/>
12</classpath>
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.project b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.project
index 86c19a90..2917d28f 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.project
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.project
@@ -11,6 +11,11 @@
11 </arguments> 11 </arguments>
12 </buildCommand> 12 </buildCommand>
13 <buildCommand> 13 <buildCommand>
14 <name>org.eclipse.viatra.query.tooling.ui.projectbuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
14 <name>org.eclipse.jdt.core.javabuilder</name> 19 <name>org.eclipse.jdt.core.javabuilder</name>
15 <arguments> 20 <arguments>
16 </arguments> 21 </arguments>
@@ -29,6 +34,7 @@
29 <natures> 34 <natures>
30 <nature>org.eclipse.pde.PluginNature</nature> 35 <nature>org.eclipse.pde.PluginNature</nature>
31 <nature>org.eclipse.jdt.core.javanature</nature> 36 <nature>org.eclipse.jdt.core.javanature</nature>
37 <nature>org.eclipse.viatra.query.projectnature</nature>
32 <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> 38 <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
33 </natures> 39 </natures>
34</projectDescription> 40</projectDescription>
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/META-INF/MANIFEST.MF b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/META-INF/MANIFEST.MF
index 4e3222f9..8c6ae636 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/META-INF/MANIFEST.MF
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/META-INF/MANIFEST.MF
@@ -1,15 +1,27 @@
1Manifest-Version: 1.0 1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2 2Bundle-ManifestVersion: 2
3Bundle-Name: FAMTest 3Bundle-Name: %pluginName
4Bundle-SymbolicName: hu.bme.mit.inf.dslreasoner.application.FAMTest;singleton:=true 4Bundle-SymbolicName: hu.bme.mit.inf.dslreasoner.application.FAMTest;singleton:=true
5Bundle-Version: 1.0.0.qualifier 5Bundle-Version: 1.0.0.qualifier
6Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.application.FAMTest 6Bundle-ClassPath: .
7Bundle-RequiredExecutionEnvironment: JavaSE-1.8 7Bundle-Vendor: %providerName
8Require-Bundle: com.google.guava, 8Bundle-Localization: plugin
9 org.eclipse.xtext.xbase.lib, 9Export-Package: hu.bme.mit.inf.dslreasoner.application.FAMTest,
10 org.eclipse.xtend.lib, 10 functionalarchitecture,
11 org.eclipse.xtend.lib.macro, 11 functionalarchitecture.impl,
12 hu.bme.mit.inf.dslreasoner.application;bundle-version="1.0.0", 12 functionalarchitecture.util
13 org.junit;bundle-version="4.12.0", 13Require-Bundle: org.eclipse.core.runtime,
14 org.eclipse.collections;bundle-version="7.1.1" 14 org.eclipse.emf.ecore;visibility:=reexport,
15 15 org.eclipse.viatra.query.runtime,
16 org.eclipse.viatra.query.runtime.rete,
17 org.eclipse.viatra.query.runtime.localsearch,
18 com.google.guava,
19 org.eclipse.xtext.xbase.lib,
20 org.eclipse.xtend.lib,
21 org.eclipse.xtend.lib.macro,
22 hu.bme.mit.inf.dslreasoner.application;bundle-version="1.0.0";visibility:=reexport
23Bundle-ActivationPolicy: lazy
24Bundle-RequiredExecutionEnvironment: JavaSE-1.8
25Import-Package: org.apache.log4j;version="1.2.15",
26 org.junit;version="4.12.0"
27Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.application.FAMTest
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties
index 41eb6ade..e1651110 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties
@@ -1,4 +1,7 @@
1source.. = src/ 1bin.includes = META-INF/,\
2output.. = bin/ 2 .
3bin.includes = META-INF/,\ 3additional.bundles = org.apache.log4j,\
4 . 4 org.junit
5source.. = src/,\
6 xtend-gen/
7output.. = bin/
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/generation.vsconfig b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/generation.vsconfig
index a95fa38c..72def8c5 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/generation.vsconfig
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/generation.vsconfig
@@ -1,15 +1,18 @@
1import epackage "inputs/FamMetamodel.ecore" 1import epackage "inputs/FamMetamodel.ecore"
2import viatra "inputs/FamPatterns.vql" 2import viatra "inputs/FamPatterns.vql"
3 3
4
5
6generate { 4generate {
7 metamodel = { package functionalarchitecture } 5 metamodel = { package functionalarchitecture }
8 constraints = { package hu.bme.mit.inf.dslreasoner.domains.fam } 6 constraints = { package hu.bme.mit.inf.dslreasoner.domains.fam }
9 partial-model = { "inputs/FamInstance.xmi"} 7 partial-model = { "inputs/FamInstance.xmi"}
10 solver = ViatraSolver 8 solver = ViatraSolver
11 scope = { 9 scope = {
12 #node = 5 10 #node = 10
11 }
12 objectives = {
13 minimize cost {
14 hu.bme.mit.inf.dslreasoner.domains.fam::functionalOutput = 1
15 }
13 } 16 }
14 17
15 config = { 18 config = {
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamMetamodel.genmodel b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamMetamodel.genmodel
new file mode 100644
index 00000000..b325a20c
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamMetamodel.genmodel
@@ -0,0 +1,48 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
3 xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/hu.bme.mit.inf.dslreasoner.application.FAMTest/src"
4 modelPluginID="hu.bme.mit.inf.dslreasoner.application.FAMTest" modelName="FamMetamodel"
5 rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" importerID="org.eclipse.emf.importer.ecore"
6 complianceLevel="8.0" copyrightFields="false" operationReflection="true" importOrganizing="true">
7 <foreignModel>FamMetamodel.ecore</foreignModel>
8 <genPackages prefix="Functionalarchitecture" disposableProviderFactory="true" ecorePackage="FamMetamodel.ecore#/">
9 <genEnums typeSafeEnumCompatible="false" ecoreEnum="FamMetamodel.ecore#//FunctionType">
10 <genEnumLiterals ecoreEnumLiteral="FamMetamodel.ecore#//FunctionType/Root"/>
11 <genEnumLiterals ecoreEnumLiteral="FamMetamodel.ecore#//FunctionType/Intermediate"/>
12 <genEnumLiterals ecoreEnumLiteral="FamMetamodel.ecore#//FunctionType/Leaf"/>
13 </genEnums>
14 <genClasses image="false" ecoreClass="FamMetamodel.ecore#//FunctionalElement">
15 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalElement/interface"/>
16 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalElement/model"/>
17 <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalElement/parent"/>
18 </genClasses>
19 <genClasses ecoreClass="FamMetamodel.ecore#//FunctionalArchitectureModel">
20 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalArchitectureModel/rootElements"/>
21 </genClasses>
22 <genClasses ecoreClass="FamMetamodel.ecore#//Function">
23 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FamMetamodel.ecore#//Function/subElements"/>
24 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute FamMetamodel.ecore#//Function/type"/>
25 </genClasses>
26 <genClasses ecoreClass="FamMetamodel.ecore#//FAMTerminator">
27 <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FAMTerminator/data"/>
28 </genClasses>
29 <genClasses ecoreClass="FamMetamodel.ecore#//InformationLink">
30 <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference FamMetamodel.ecore#//InformationLink/from"/>
31 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference FamMetamodel.ecore#//InformationLink/to"/>
32 </genClasses>
33 <genClasses ecoreClass="FamMetamodel.ecore#//FunctionalInterface">
34 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalInterface/data"/>
35 <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalInterface/element"/>
36 </genClasses>
37 <genClasses ecoreClass="FamMetamodel.ecore#//FunctionalInput">
38 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalInput/IncomingLinks"/>
39 </genClasses>
40 <genClasses ecoreClass="FamMetamodel.ecore#//FunctionalOutput">
41 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalOutput/outgoingLinks"/>
42 </genClasses>
43 <genClasses image="false" ecoreClass="FamMetamodel.ecore#//FunctionalData">
44 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalData/terminator"/>
45 <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference FamMetamodel.ecore#//FunctionalData/interface"/>
46 </genClasses>
47 </genPackages>
48</genmodel:GenModel>
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamPatterns.vql b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamPatterns.vql
index 013d0419..96bb5f3a 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamPatterns.vql
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamPatterns.vql
@@ -5,8 +5,12 @@ import epackage "http://www.inf.mit.bme.hu/viatrasolver/example/fam"
5@Constraint(message="terminatorAndInformation", severity="error", key={T}) 5@Constraint(message="terminatorAndInformation", severity="error", key={T})
6pattern terminatorAndInformation(T : FAMTerminator, I : InformationLink) = { 6pattern terminatorAndInformation(T : FAMTerminator, I : InformationLink) = {
7 FunctionalOutput.outgoingLinks(Out,I); 7 FunctionalOutput.outgoingLinks(Out,I);
8 FunctionalOutput.terminator(Out,T); 8 FunctionalOutput.terminator(Out,T);
9} or { 9} or {
10 InformationLink.to(I,In); 10 InformationLink.to(I,In);
11 FunctionalInput.terminator(In,T); 11 FunctionalInput.terminator(In,T);
12} \ No newline at end of file 12}
13
14pattern functionalOutput(O : FunctionalOutput) {
15 FunctionalOutput(O);
16}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.properties b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.properties
new file mode 100644
index 00000000..59843fcd
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.properties
@@ -0,0 +1,4 @@
1#
2
3pluginName = FAMTest
4providerName = www.example.org
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FAMTerminator.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FAMTerminator.java
new file mode 100644
index 00000000..5d4bd9ba
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FAMTerminator.java
@@ -0,0 +1,52 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.ecore.EObject;
6
7/**
8 * <!-- begin-user-doc -->
9 * A representation of the model object '<em><b>FAM Terminator</b></em>'.
10 * <!-- end-user-doc -->
11 *
12 * <p>
13 * The following features are supported:
14 * </p>
15 * <ul>
16 * <li>{@link functionalarchitecture.FAMTerminator#getData <em>Data</em>}</li>
17 * </ul>
18 *
19 * @see functionalarchitecture.FunctionalarchitecturePackage#getFAMTerminator()
20 * @model
21 * @generated
22 */
23public interface FAMTerminator extends EObject {
24 /**
25 * Returns the value of the '<em><b>Data</b></em>' container reference.
26 * It is bidirectional and its opposite is '{@link functionalarchitecture.FunctionalData#getTerminator <em>Terminator</em>}'.
27 * <!-- begin-user-doc -->
28 * <p>
29 * If the meaning of the '<em>Data</em>' container reference isn't clear,
30 * there really should be more of a description here...
31 * </p>
32 * <!-- end-user-doc -->
33 * @return the value of the '<em>Data</em>' container reference.
34 * @see #setData(FunctionalData)
35 * @see functionalarchitecture.FunctionalarchitecturePackage#getFAMTerminator_Data()
36 * @see functionalarchitecture.FunctionalData#getTerminator
37 * @model opposite="terminator" transient="false"
38 * @generated
39 */
40 FunctionalData getData();
41
42 /**
43 * Sets the value of the '{@link functionalarchitecture.FAMTerminator#getData <em>Data</em>}' container reference.
44 * <!-- begin-user-doc -->
45 * <!-- end-user-doc -->
46 * @param value the new value of the '<em>Data</em>' container reference.
47 * @see #getData()
48 * @generated
49 */
50 void setData(FunctionalData value);
51
52} // FAMTerminator
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/Function.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/Function.java
new file mode 100644
index 00000000..afc2ac39
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/Function.java
@@ -0,0 +1,72 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.common.util.EList;
6
7/**
8 * <!-- begin-user-doc -->
9 * A representation of the model object '<em><b>Function</b></em>'.
10 * <!-- end-user-doc -->
11 *
12 * <p>
13 * The following features are supported:
14 * </p>
15 * <ul>
16 * <li>{@link functionalarchitecture.Function#getSubElements <em>Sub Elements</em>}</li>
17 * <li>{@link functionalarchitecture.Function#getType <em>Type</em>}</li>
18 * </ul>
19 *
20 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunction()
21 * @model
22 * @generated
23 */
24public interface Function extends FunctionalElement {
25 /**
26 * Returns the value of the '<em><b>Sub Elements</b></em>' containment reference list.
27 * The list contents are of type {@link functionalarchitecture.FunctionalElement}.
28 * It is bidirectional and its opposite is '{@link functionalarchitecture.FunctionalElement#getParent <em>Parent</em>}'.
29 * <!-- begin-user-doc -->
30 * <p>
31 * If the meaning of the '<em>Sub Elements</em>' containment reference list isn't clear,
32 * there really should be more of a description here...
33 * </p>
34 * <!-- end-user-doc -->
35 * @return the value of the '<em>Sub Elements</em>' containment reference list.
36 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunction_SubElements()
37 * @see functionalarchitecture.FunctionalElement#getParent
38 * @model opposite="parent" containment="true"
39 * @generated
40 */
41 EList<FunctionalElement> getSubElements();
42
43 /**
44 * Returns the value of the '<em><b>Type</b></em>' attribute.
45 * The literals are from the enumeration {@link functionalarchitecture.FunctionType}.
46 * <!-- begin-user-doc -->
47 * <p>
48 * If the meaning of the '<em>Type</em>' attribute isn't clear,
49 * there really should be more of a description here...
50 * </p>
51 * <!-- end-user-doc -->
52 * @return the value of the '<em>Type</em>' attribute.
53 * @see functionalarchitecture.FunctionType
54 * @see #setType(FunctionType)
55 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunction_Type()
56 * @model required="true"
57 * @generated
58 */
59 FunctionType getType();
60
61 /**
62 * Sets the value of the '{@link functionalarchitecture.Function#getType <em>Type</em>}' attribute.
63 * <!-- begin-user-doc -->
64 * <!-- end-user-doc -->
65 * @param value the new value of the '<em>Type</em>' attribute.
66 * @see functionalarchitecture.FunctionType
67 * @see #getType()
68 * @generated
69 */
70 void setType(FunctionType value);
71
72} // Function
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionType.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionType.java
new file mode 100644
index 00000000..f98f3888
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionType.java
@@ -0,0 +1,244 @@
1/**
2 */
3package functionalarchitecture;
4
5import java.util.Arrays;
6import java.util.Collections;
7import java.util.List;
8
9import org.eclipse.emf.common.util.Enumerator;
10
11/**
12 * <!-- begin-user-doc -->
13 * A representation of the literals of the enumeration '<em><b>Function Type</b></em>',
14 * and utility methods for working with them.
15 * <!-- end-user-doc -->
16 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionType()
17 * @model
18 * @generated
19 */
20public enum FunctionType implements Enumerator {
21 /**
22 * The '<em><b>Root</b></em>' literal object.
23 * <!-- begin-user-doc -->
24 * <!-- end-user-doc -->
25 * @see #ROOT_VALUE
26 * @generated
27 * @ordered
28 */
29 ROOT(0, "Root", "Root"),
30
31 /**
32 * The '<em><b>Intermediate</b></em>' literal object.
33 * <!-- begin-user-doc -->
34 * <!-- end-user-doc -->
35 * @see #INTERMEDIATE_VALUE
36 * @generated
37 * @ordered
38 */
39 INTERMEDIATE(1, "Intermediate", "Intermediate"),
40
41 /**
42 * The '<em><b>Leaf</b></em>' literal object.
43 * <!-- begin-user-doc -->
44 * <!-- end-user-doc -->
45 * @see #LEAF_VALUE
46 * @generated
47 * @ordered
48 */
49 LEAF(2, "Leaf", "Leaf");
50
51 /**
52 * The '<em><b>Root</b></em>' literal value.
53 * <!-- begin-user-doc -->
54 * <p>
55 * If the meaning of '<em><b>Root</b></em>' literal object isn't clear,
56 * there really should be more of a description here...
57 * </p>
58 * <!-- end-user-doc -->
59 * @see #ROOT
60 * @model name="Root"
61 * @generated
62 * @ordered
63 */
64 public static final int ROOT_VALUE = 0;
65
66 /**
67 * The '<em><b>Intermediate</b></em>' literal value.
68 * <!-- begin-user-doc -->
69 * <p>
70 * If the meaning of '<em><b>Intermediate</b></em>' literal object isn't clear,
71 * there really should be more of a description here...
72 * </p>
73 * <!-- end-user-doc -->
74 * @see #INTERMEDIATE
75 * @model name="Intermediate"
76 * @generated
77 * @ordered
78 */
79 public static final int INTERMEDIATE_VALUE = 1;
80
81 /**
82 * The '<em><b>Leaf</b></em>' literal value.
83 * <!-- begin-user-doc -->
84 * <p>
85 * If the meaning of '<em><b>Leaf</b></em>' literal object isn't clear,
86 * there really should be more of a description here...
87 * </p>
88 * <!-- end-user-doc -->
89 * @see #LEAF
90 * @model name="Leaf"
91 * @generated
92 * @ordered
93 */
94 public static final int LEAF_VALUE = 2;
95
96 /**
97 * An array of all the '<em><b>Function Type</b></em>' enumerators.
98 * <!-- begin-user-doc -->
99 * <!-- end-user-doc -->
100 * @generated
101 */
102 private static final FunctionType[] VALUES_ARRAY =
103 new FunctionType[] {
104 ROOT,
105 INTERMEDIATE,
106 LEAF,
107 };
108
109 /**
110 * A public read-only list of all the '<em><b>Function Type</b></em>' enumerators.
111 * <!-- begin-user-doc -->
112 * <!-- end-user-doc -->
113 * @generated
114 */
115 public static final List<FunctionType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
116
117 /**
118 * Returns the '<em><b>Function Type</b></em>' literal with the specified literal value.
119 * <!-- begin-user-doc -->
120 * <!-- end-user-doc -->
121 * @param literal the literal.
122 * @return the matching enumerator or <code>null</code>.
123 * @generated
124 */
125 public static FunctionType get(String literal) {
126 for (int i = 0; i < VALUES_ARRAY.length; ++i) {
127 FunctionType result = VALUES_ARRAY[i];
128 if (result.toString().equals(literal)) {
129 return result;
130 }
131 }
132 return null;
133 }
134
135 /**
136 * Returns the '<em><b>Function Type</b></em>' literal with the specified name.
137 * <!-- begin-user-doc -->
138 * <!-- end-user-doc -->
139 * @param name the name.
140 * @return the matching enumerator or <code>null</code>.
141 * @generated
142 */
143 public static FunctionType getByName(String name) {
144 for (int i = 0; i < VALUES_ARRAY.length; ++i) {
145 FunctionType result = VALUES_ARRAY[i];
146 if (result.getName().equals(name)) {
147 return result;
148 }
149 }
150 return null;
151 }
152
153 /**
154 * Returns the '<em><b>Function Type</b></em>' literal with the specified integer value.
155 * <!-- begin-user-doc -->
156 * <!-- end-user-doc -->
157 * @param value the integer value.
158 * @return the matching enumerator or <code>null</code>.
159 * @generated
160 */
161 public static FunctionType get(int value) {
162 switch (value) {
163 case ROOT_VALUE: return ROOT;
164 case INTERMEDIATE_VALUE: return INTERMEDIATE;
165 case LEAF_VALUE: return LEAF;
166 }
167 return null;
168 }
169
170 /**
171 * <!-- begin-user-doc -->
172 * <!-- end-user-doc -->
173 * @generated
174 */
175 private final int value;
176
177 /**
178 * <!-- begin-user-doc -->
179 * <!-- end-user-doc -->
180 * @generated
181 */
182 private final String name;
183
184 /**
185 * <!-- begin-user-doc -->
186 * <!-- end-user-doc -->
187 * @generated
188 */
189 private final String literal;
190
191 /**
192 * Only this class can construct instances.
193 * <!-- begin-user-doc -->
194 * <!-- end-user-doc -->
195 * @generated
196 */
197 private FunctionType(int value, String name, String literal) {
198 this.value = value;
199 this.name = name;
200 this.literal = literal;
201 }
202
203 /**
204 * <!-- begin-user-doc -->
205 * <!-- end-user-doc -->
206 * @generated
207 */
208 @Override
209 public int getValue() {
210 return value;
211 }
212
213 /**
214 * <!-- begin-user-doc -->
215 * <!-- end-user-doc -->
216 * @generated
217 */
218 @Override
219 public String getName() {
220 return name;
221 }
222
223 /**
224 * <!-- begin-user-doc -->
225 * <!-- end-user-doc -->
226 * @generated
227 */
228 @Override
229 public String getLiteral() {
230 return literal;
231 }
232
233 /**
234 * Returns the literal value of the enumerator, which is its string representation.
235 * <!-- begin-user-doc -->
236 * <!-- end-user-doc -->
237 * @generated
238 */
239 @Override
240 public String toString() {
241 return literal;
242 }
243
244} //FunctionType
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalArchitectureModel.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalArchitectureModel.java
new file mode 100644
index 00000000..bef8431d
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalArchitectureModel.java
@@ -0,0 +1,42 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.common.util.EList;
6
7import org.eclipse.emf.ecore.EObject;
8
9/**
10 * <!-- begin-user-doc -->
11 * A representation of the model object '<em><b>Functional Architecture Model</b></em>'.
12 * <!-- end-user-doc -->
13 *
14 * <p>
15 * The following features are supported:
16 * </p>
17 * <ul>
18 * <li>{@link functionalarchitecture.FunctionalArchitectureModel#getRootElements <em>Root Elements</em>}</li>
19 * </ul>
20 *
21 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalArchitectureModel()
22 * @model
23 * @generated
24 */
25public interface FunctionalArchitectureModel extends EObject {
26 /**
27 * Returns the value of the '<em><b>Root Elements</b></em>' containment reference list.
28 * The list contents are of type {@link functionalarchitecture.FunctionalElement}.
29 * <!-- begin-user-doc -->
30 * <p>
31 * If the meaning of the '<em>Root Elements</em>' containment reference list isn't clear,
32 * there really should be more of a description here...
33 * </p>
34 * <!-- end-user-doc -->
35 * @return the value of the '<em>Root Elements</em>' containment reference list.
36 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalArchitectureModel_RootElements()
37 * @model containment="true"
38 * @generated
39 */
40 EList<FunctionalElement> getRootElements();
41
42} // FunctionalArchitectureModel
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalData.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalData.java
new file mode 100644
index 00000000..2b985e23
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalData.java
@@ -0,0 +1,81 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.ecore.EObject;
6
7/**
8 * <!-- begin-user-doc -->
9 * A representation of the model object '<em><b>Functional Data</b></em>'.
10 * <!-- end-user-doc -->
11 *
12 * <p>
13 * The following features are supported:
14 * </p>
15 * <ul>
16 * <li>{@link functionalarchitecture.FunctionalData#getTerminator <em>Terminator</em>}</li>
17 * <li>{@link functionalarchitecture.FunctionalData#getInterface <em>Interface</em>}</li>
18 * </ul>
19 *
20 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalData()
21 * @model abstract="true"
22 * @generated
23 */
24public interface FunctionalData extends EObject {
25 /**
26 * Returns the value of the '<em><b>Terminator</b></em>' containment reference.
27 * It is bidirectional and its opposite is '{@link functionalarchitecture.FAMTerminator#getData <em>Data</em>}'.
28 * <!-- begin-user-doc -->
29 * <p>
30 * If the meaning of the '<em>Terminator</em>' containment reference isn't clear,
31 * there really should be more of a description here...
32 * </p>
33 * <!-- end-user-doc -->
34 * @return the value of the '<em>Terminator</em>' containment reference.
35 * @see #setTerminator(FAMTerminator)
36 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalData_Terminator()
37 * @see functionalarchitecture.FAMTerminator#getData
38 * @model opposite="data" containment="true"
39 * @generated
40 */
41 FAMTerminator getTerminator();
42
43 /**
44 * Sets the value of the '{@link functionalarchitecture.FunctionalData#getTerminator <em>Terminator</em>}' containment reference.
45 * <!-- begin-user-doc -->
46 * <!-- end-user-doc -->
47 * @param value the new value of the '<em>Terminator</em>' containment reference.
48 * @see #getTerminator()
49 * @generated
50 */
51 void setTerminator(FAMTerminator value);
52
53 /**
54 * Returns the value of the '<em><b>Interface</b></em>' container reference.
55 * It is bidirectional and its opposite is '{@link functionalarchitecture.FunctionalInterface#getData <em>Data</em>}'.
56 * <!-- begin-user-doc -->
57 * <p>
58 * If the meaning of the '<em>Interface</em>' container reference isn't clear,
59 * there really should be more of a description here...
60 * </p>
61 * <!-- end-user-doc -->
62 * @return the value of the '<em>Interface</em>' container reference.
63 * @see #setInterface(functionalarchitecture.FunctionalInterface)
64 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalData_Interface()
65 * @see functionalarchitecture.FunctionalInterface#getData
66 * @model opposite="data" transient="false"
67 * @generated
68 */
69 functionalarchitecture.FunctionalInterface getInterface();
70
71 /**
72 * Sets the value of the '{@link functionalarchitecture.FunctionalData#getInterface <em>Interface</em>}' container reference.
73 * <!-- begin-user-doc -->
74 * <!-- end-user-doc -->
75 * @param value the new value of the '<em>Interface</em>' container reference.
76 * @see #getInterface()
77 * @generated
78 */
79 void setInterface(functionalarchitecture.FunctionalInterface value);
80
81} // FunctionalData
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalElement.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalElement.java
new file mode 100644
index 00000000..5971f370
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalElement.java
@@ -0,0 +1,109 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.ecore.EObject;
6
7/**
8 * <!-- begin-user-doc -->
9 * A representation of the model object '<em><b>Functional Element</b></em>'.
10 * <!-- end-user-doc -->
11 *
12 * <p>
13 * The following features are supported:
14 * </p>
15 * <ul>
16 * <li>{@link functionalarchitecture.FunctionalElement#getInterface <em>Interface</em>}</li>
17 * <li>{@link functionalarchitecture.FunctionalElement#getModel <em>Model</em>}</li>
18 * <li>{@link functionalarchitecture.FunctionalElement#getParent <em>Parent</em>}</li>
19 * </ul>
20 *
21 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalElement()
22 * @model abstract="true"
23 * @generated
24 */
25public interface FunctionalElement extends EObject {
26 /**
27 * Returns the value of the '<em><b>Interface</b></em>' containment reference.
28 * It is bidirectional and its opposite is '{@link functionalarchitecture.FunctionalInterface#getElement <em>Element</em>}'.
29 * <!-- begin-user-doc -->
30 * <p>
31 * If the meaning of the '<em>Interface</em>' containment reference isn't clear,
32 * there really should be more of a description here...
33 * </p>
34 * <!-- end-user-doc -->
35 * @return the value of the '<em>Interface</em>' containment reference.
36 * @see #setInterface(functionalarchitecture.FunctionalInterface)
37 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalElement_Interface()
38 * @see functionalarchitecture.FunctionalInterface#getElement
39 * @model opposite="element" containment="true"
40 * @generated
41 */
42 functionalarchitecture.FunctionalInterface getInterface();
43
44 /**
45 * Sets the value of the '{@link functionalarchitecture.FunctionalElement#getInterface <em>Interface</em>}' containment reference.
46 * <!-- begin-user-doc -->
47 * <!-- end-user-doc -->
48 * @param value the new value of the '<em>Interface</em>' containment reference.
49 * @see #getInterface()
50 * @generated
51 */
52 void setInterface(functionalarchitecture.FunctionalInterface value);
53
54 /**
55 * Returns the value of the '<em><b>Model</b></em>' reference.
56 * <!-- begin-user-doc -->
57 * <p>
58 * If the meaning of the '<em>Model</em>' reference isn't clear,
59 * there really should be more of a description here...
60 * </p>
61 * <!-- end-user-doc -->
62 * @return the value of the '<em>Model</em>' reference.
63 * @see #setModel(FunctionalArchitectureModel)
64 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalElement_Model()
65 * @model required="true" transient="true" volatile="true" derived="true"
66 * annotation="org.eclipse.viatra.query.querybasedfeature patternFQN='hu.bme.mit.inf.dslreasoner.domains.fam.model'"
67 * @generated
68 */
69 FunctionalArchitectureModel getModel();
70
71 /**
72 * Sets the value of the '{@link functionalarchitecture.FunctionalElement#getModel <em>Model</em>}' reference.
73 * <!-- begin-user-doc -->
74 * <!-- end-user-doc -->
75 * @param value the new value of the '<em>Model</em>' reference.
76 * @see #getModel()
77 * @generated
78 */
79 void setModel(FunctionalArchitectureModel value);
80
81 /**
82 * Returns the value of the '<em><b>Parent</b></em>' container reference.
83 * It is bidirectional and its opposite is '{@link functionalarchitecture.Function#getSubElements <em>Sub Elements</em>}'.
84 * <!-- begin-user-doc -->
85 * <p>
86 * If the meaning of the '<em>Parent</em>' container reference isn't clear,
87 * there really should be more of a description here...
88 * </p>
89 * <!-- end-user-doc -->
90 * @return the value of the '<em>Parent</em>' container reference.
91 * @see #setParent(Function)
92 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalElement_Parent()
93 * @see functionalarchitecture.Function#getSubElements
94 * @model opposite="subElements" transient="false"
95 * @generated
96 */
97 Function getParent();
98
99 /**
100 * Sets the value of the '{@link functionalarchitecture.FunctionalElement#getParent <em>Parent</em>}' container reference.
101 * <!-- begin-user-doc -->
102 * <!-- end-user-doc -->
103 * @param value the new value of the '<em>Parent</em>' container reference.
104 * @see #getParent()
105 * @generated
106 */
107 void setParent(Function value);
108
109} // FunctionalElement
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalInput.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalInput.java
new file mode 100644
index 00000000..2f511349
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalInput.java
@@ -0,0 +1,42 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.common.util.EList;
6
7/**
8 * <!-- begin-user-doc -->
9 * A representation of the model object '<em><b>Functional Input</b></em>'.
10 * <!-- end-user-doc -->
11 *
12 * <p>
13 * The following features are supported:
14 * </p>
15 * <ul>
16 * <li>{@link functionalarchitecture.FunctionalInput#getIncomingLinks <em>Incoming Links</em>}</li>
17 * </ul>
18 *
19 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalInput()
20 * @model
21 * @generated
22 */
23public interface FunctionalInput extends FunctionalData {
24 /**
25 * Returns the value of the '<em><b>Incoming Links</b></em>' reference list.
26 * The list contents are of type {@link functionalarchitecture.InformationLink}.
27 * It is bidirectional and its opposite is '{@link functionalarchitecture.InformationLink#getTo <em>To</em>}'.
28 * <!-- begin-user-doc -->
29 * <p>
30 * If the meaning of the '<em>Incoming Links</em>' reference list isn't clear,
31 * there really should be more of a description here...
32 * </p>
33 * <!-- end-user-doc -->
34 * @return the value of the '<em>Incoming Links</em>' reference list.
35 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalInput_IncomingLinks()
36 * @see functionalarchitecture.InformationLink#getTo
37 * @model opposite="to"
38 * @generated
39 */
40 EList<InformationLink> getIncomingLinks();
41
42} // FunctionalInput
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalInterface.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalInterface.java
new file mode 100644
index 00000000..e35b82c0
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalInterface.java
@@ -0,0 +1,73 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.common.util.EList;
6
7import org.eclipse.emf.ecore.EObject;
8
9/**
10 * <!-- begin-user-doc -->
11 * A representation of the model object '<em><b>Functional Interface</b></em>'.
12 * <!-- end-user-doc -->
13 *
14 * <p>
15 * The following features are supported:
16 * </p>
17 * <ul>
18 * <li>{@link functionalarchitecture.FunctionalInterface#getData <em>Data</em>}</li>
19 * <li>{@link functionalarchitecture.FunctionalInterface#getElement <em>Element</em>}</li>
20 * </ul>
21 *
22 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalInterface()
23 * @model
24 * @generated
25 */
26public interface FunctionalInterface extends EObject {
27 /**
28 * Returns the value of the '<em><b>Data</b></em>' containment reference list.
29 * The list contents are of type {@link functionalarchitecture.FunctionalData}.
30 * It is bidirectional and its opposite is '{@link functionalarchitecture.FunctionalData#getInterface <em>Interface</em>}'.
31 * <!-- begin-user-doc -->
32 * <p>
33 * If the meaning of the '<em>Data</em>' containment reference list isn't clear,
34 * there really should be more of a description here...
35 * </p>
36 * <!-- end-user-doc -->
37 * @return the value of the '<em>Data</em>' containment reference list.
38 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalInterface_Data()
39 * @see functionalarchitecture.FunctionalData#getInterface
40 * @model opposite="interface" containment="true"
41 * @generated
42 */
43 EList<FunctionalData> getData();
44
45 /**
46 * Returns the value of the '<em><b>Element</b></em>' container reference.
47 * It is bidirectional and its opposite is '{@link functionalarchitecture.FunctionalElement#getInterface <em>Interface</em>}'.
48 * <!-- begin-user-doc -->
49 * <p>
50 * If the meaning of the '<em>Element</em>' container reference isn't clear,
51 * there really should be more of a description here...
52 * </p>
53 * <!-- end-user-doc -->
54 * @return the value of the '<em>Element</em>' container reference.
55 * @see #setElement(FunctionalElement)
56 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalInterface_Element()
57 * @see functionalarchitecture.FunctionalElement#getInterface
58 * @model opposite="interface" transient="false"
59 * @generated
60 */
61 FunctionalElement getElement();
62
63 /**
64 * Sets the value of the '{@link functionalarchitecture.FunctionalInterface#getElement <em>Element</em>}' container reference.
65 * <!-- begin-user-doc -->
66 * <!-- end-user-doc -->
67 * @param value the new value of the '<em>Element</em>' container reference.
68 * @see #getElement()
69 * @generated
70 */
71 void setElement(FunctionalElement value);
72
73} // FunctionalInterface
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalOutput.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalOutput.java
new file mode 100644
index 00000000..bed905d9
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalOutput.java
@@ -0,0 +1,42 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.common.util.EList;
6
7/**
8 * <!-- begin-user-doc -->
9 * A representation of the model object '<em><b>Functional Output</b></em>'.
10 * <!-- end-user-doc -->
11 *
12 * <p>
13 * The following features are supported:
14 * </p>
15 * <ul>
16 * <li>{@link functionalarchitecture.FunctionalOutput#getOutgoingLinks <em>Outgoing Links</em>}</li>
17 * </ul>
18 *
19 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalOutput()
20 * @model
21 * @generated
22 */
23public interface FunctionalOutput extends FunctionalData {
24 /**
25 * Returns the value of the '<em><b>Outgoing Links</b></em>' containment reference list.
26 * The list contents are of type {@link functionalarchitecture.InformationLink}.
27 * It is bidirectional and its opposite is '{@link functionalarchitecture.InformationLink#getFrom <em>From</em>}'.
28 * <!-- begin-user-doc -->
29 * <p>
30 * If the meaning of the '<em>Outgoing Links</em>' containment reference list isn't clear,
31 * there really should be more of a description here...
32 * </p>
33 * <!-- end-user-doc -->
34 * @return the value of the '<em>Outgoing Links</em>' containment reference list.
35 * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalOutput_OutgoingLinks()
36 * @see functionalarchitecture.InformationLink#getFrom
37 * @model opposite="from" containment="true"
38 * @generated
39 */
40 EList<InformationLink> getOutgoingLinks();
41
42} // FunctionalOutput
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalarchitectureFactory.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalarchitectureFactory.java
new file mode 100644
index 00000000..942173de
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalarchitectureFactory.java
@@ -0,0 +1,96 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.ecore.EFactory;
6
7/**
8 * <!-- begin-user-doc -->
9 * The <b>Factory</b> for the model.
10 * It provides a create method for each non-abstract class of the model.
11 * <!-- end-user-doc -->
12 * @see functionalarchitecture.FunctionalarchitecturePackage
13 * @generated
14 */
15public interface FunctionalarchitectureFactory extends EFactory {
16 /**
17 * The singleton instance of the factory.
18 * <!-- begin-user-doc -->
19 * <!-- end-user-doc -->
20 * @generated
21 */
22 FunctionalarchitectureFactory eINSTANCE = functionalarchitecture.impl.FunctionalarchitectureFactoryImpl.init();
23
24 /**
25 * Returns a new object of class '<em>Functional Architecture Model</em>'.
26 * <!-- begin-user-doc -->
27 * <!-- end-user-doc -->
28 * @return a new object of class '<em>Functional Architecture Model</em>'.
29 * @generated
30 */
31 FunctionalArchitectureModel createFunctionalArchitectureModel();
32
33 /**
34 * Returns a new object of class '<em>Function</em>'.
35 * <!-- begin-user-doc -->
36 * <!-- end-user-doc -->
37 * @return a new object of class '<em>Function</em>'.
38 * @generated
39 */
40 Function createFunction();
41
42 /**
43 * Returns a new object of class '<em>FAM Terminator</em>'.
44 * <!-- begin-user-doc -->
45 * <!-- end-user-doc -->
46 * @return a new object of class '<em>FAM Terminator</em>'.
47 * @generated
48 */
49 FAMTerminator createFAMTerminator();
50
51 /**
52 * Returns a new object of class '<em>Information Link</em>'.
53 * <!-- begin-user-doc -->
54 * <!-- end-user-doc -->
55 * @return a new object of class '<em>Information Link</em>'.
56 * @generated
57 */
58 InformationLink createInformationLink();
59
60 /**
61 * Returns a new object of class '<em>Functional Interface</em>'.
62 * <!-- begin-user-doc -->
63 * <!-- end-user-doc -->
64 * @return a new object of class '<em>Functional Interface</em>'.
65 * @generated
66 */
67 FunctionalInterface createFunctionalInterface();
68
69 /**
70 * Returns a new object of class '<em>Functional Input</em>'.
71 * <!-- begin-user-doc -->
72 * <!-- end-user-doc -->
73 * @return a new object of class '<em>Functional Input</em>'.
74 * @generated
75 */
76 FunctionalInput createFunctionalInput();
77
78 /**
79 * Returns a new object of class '<em>Functional Output</em>'.
80 * <!-- begin-user-doc -->
81 * <!-- end-user-doc -->
82 * @return a new object of class '<em>Functional Output</em>'.
83 * @generated
84 */
85 FunctionalOutput createFunctionalOutput();
86
87 /**
88 * Returns the package supported by this factory.
89 * <!-- begin-user-doc -->
90 * <!-- end-user-doc -->
91 * @return the package supported by this factory.
92 * @generated
93 */
94 FunctionalarchitecturePackage getFunctionalarchitecturePackage();
95
96} //FunctionalarchitectureFactory
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalarchitecturePackage.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalarchitecturePackage.java
new file mode 100644
index 00000000..98fdb72e
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/FunctionalarchitecturePackage.java
@@ -0,0 +1,1031 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.ecore.EAttribute;
6import org.eclipse.emf.ecore.EClass;
7import org.eclipse.emf.ecore.EEnum;
8import org.eclipse.emf.ecore.EPackage;
9import org.eclipse.emf.ecore.EReference;
10
11/**
12 * <!-- begin-user-doc -->
13 * The <b>Package</b> for the model.
14 * It contains accessors for the meta objects to represent
15 * <ul>
16 * <li>each class,</li>
17 * <li>each feature of each class,</li>
18 * <li>each operation of each class,</li>
19 * <li>each enum,</li>
20 * <li>and each data type</li>
21 * </ul>
22 * <!-- end-user-doc -->
23 * @see functionalarchitecture.FunctionalarchitectureFactory
24 * @model kind="package"
25 * @generated
26 */
27public interface FunctionalarchitecturePackage extends EPackage {
28 /**
29 * The package name.
30 * <!-- begin-user-doc -->
31 * <!-- end-user-doc -->
32 * @generated
33 */
34 String eNAME = "functionalarchitecture";
35
36 /**
37 * The package namespace URI.
38 * <!-- begin-user-doc -->
39 * <!-- end-user-doc -->
40 * @generated
41 */
42 String eNS_URI = "http://www.inf.mit.bme.hu/viatrasolver/example/fam";
43
44 /**
45 * The package namespace name.
46 * <!-- begin-user-doc -->
47 * <!-- end-user-doc -->
48 * @generated
49 */
50 String eNS_PREFIX = "functionalarchitecture";
51
52 /**
53 * The singleton instance of the package.
54 * <!-- begin-user-doc -->
55 * <!-- end-user-doc -->
56 * @generated
57 */
58 FunctionalarchitecturePackage eINSTANCE = functionalarchitecture.impl.FunctionalarchitecturePackageImpl.init();
59
60 /**
61 * The meta object id for the '{@link functionalarchitecture.impl.FunctionalElementImpl <em>Functional Element</em>}' class.
62 * <!-- begin-user-doc -->
63 * <!-- end-user-doc -->
64 * @see functionalarchitecture.impl.FunctionalElementImpl
65 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalElement()
66 * @generated
67 */
68 int FUNCTIONAL_ELEMENT = 0;
69
70 /**
71 * The feature id for the '<em><b>Interface</b></em>' containment reference.
72 * <!-- begin-user-doc -->
73 * <!-- end-user-doc -->
74 * @generated
75 * @ordered
76 */
77 int FUNCTIONAL_ELEMENT__INTERFACE = 0;
78
79 /**
80 * The feature id for the '<em><b>Model</b></em>' reference.
81 * <!-- begin-user-doc -->
82 * <!-- end-user-doc -->
83 * @generated
84 * @ordered
85 */
86 int FUNCTIONAL_ELEMENT__MODEL = 1;
87
88 /**
89 * The feature id for the '<em><b>Parent</b></em>' container reference.
90 * <!-- begin-user-doc -->
91 * <!-- end-user-doc -->
92 * @generated
93 * @ordered
94 */
95 int FUNCTIONAL_ELEMENT__PARENT = 2;
96
97 /**
98 * The number of structural features of the '<em>Functional Element</em>' class.
99 * <!-- begin-user-doc -->
100 * <!-- end-user-doc -->
101 * @generated
102 * @ordered
103 */
104 int FUNCTIONAL_ELEMENT_FEATURE_COUNT = 3;
105
106 /**
107 * The number of operations of the '<em>Functional Element</em>' class.
108 * <!-- begin-user-doc -->
109 * <!-- end-user-doc -->
110 * @generated
111 * @ordered
112 */
113 int FUNCTIONAL_ELEMENT_OPERATION_COUNT = 0;
114
115 /**
116 * The meta object id for the '{@link functionalarchitecture.impl.FunctionalArchitectureModelImpl <em>Functional Architecture Model</em>}' class.
117 * <!-- begin-user-doc -->
118 * <!-- end-user-doc -->
119 * @see functionalarchitecture.impl.FunctionalArchitectureModelImpl
120 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalArchitectureModel()
121 * @generated
122 */
123 int FUNCTIONAL_ARCHITECTURE_MODEL = 1;
124
125 /**
126 * The feature id for the '<em><b>Root Elements</b></em>' containment reference list.
127 * <!-- begin-user-doc -->
128 * <!-- end-user-doc -->
129 * @generated
130 * @ordered
131 */
132 int FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS = 0;
133
134 /**
135 * The number of structural features of the '<em>Functional Architecture Model</em>' class.
136 * <!-- begin-user-doc -->
137 * <!-- end-user-doc -->
138 * @generated
139 * @ordered
140 */
141 int FUNCTIONAL_ARCHITECTURE_MODEL_FEATURE_COUNT = 1;
142
143 /**
144 * The number of operations of the '<em>Functional Architecture Model</em>' class.
145 * <!-- begin-user-doc -->
146 * <!-- end-user-doc -->
147 * @generated
148 * @ordered
149 */
150 int FUNCTIONAL_ARCHITECTURE_MODEL_OPERATION_COUNT = 0;
151
152 /**
153 * The meta object id for the '{@link functionalarchitecture.impl.FunctionImpl <em>Function</em>}' class.
154 * <!-- begin-user-doc -->
155 * <!-- end-user-doc -->
156 * @see functionalarchitecture.impl.FunctionImpl
157 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunction()
158 * @generated
159 */
160 int FUNCTION = 2;
161
162 /**
163 * The feature id for the '<em><b>Interface</b></em>' containment reference.
164 * <!-- begin-user-doc -->
165 * <!-- end-user-doc -->
166 * @generated
167 * @ordered
168 */
169 int FUNCTION__INTERFACE = FUNCTIONAL_ELEMENT__INTERFACE;
170
171 /**
172 * The feature id for the '<em><b>Model</b></em>' reference.
173 * <!-- begin-user-doc -->
174 * <!-- end-user-doc -->
175 * @generated
176 * @ordered
177 */
178 int FUNCTION__MODEL = FUNCTIONAL_ELEMENT__MODEL;
179
180 /**
181 * The feature id for the '<em><b>Parent</b></em>' container reference.
182 * <!-- begin-user-doc -->
183 * <!-- end-user-doc -->
184 * @generated
185 * @ordered
186 */
187 int FUNCTION__PARENT = FUNCTIONAL_ELEMENT__PARENT;
188
189 /**
190 * The feature id for the '<em><b>Sub Elements</b></em>' containment reference list.
191 * <!-- begin-user-doc -->
192 * <!-- end-user-doc -->
193 * @generated
194 * @ordered
195 */
196 int FUNCTION__SUB_ELEMENTS = FUNCTIONAL_ELEMENT_FEATURE_COUNT + 0;
197
198 /**
199 * The feature id for the '<em><b>Type</b></em>' attribute.
200 * <!-- begin-user-doc -->
201 * <!-- end-user-doc -->
202 * @generated
203 * @ordered
204 */
205 int FUNCTION__TYPE = FUNCTIONAL_ELEMENT_FEATURE_COUNT + 1;
206
207 /**
208 * The number of structural features of the '<em>Function</em>' class.
209 * <!-- begin-user-doc -->
210 * <!-- end-user-doc -->
211 * @generated
212 * @ordered
213 */
214 int FUNCTION_FEATURE_COUNT = FUNCTIONAL_ELEMENT_FEATURE_COUNT + 2;
215
216 /**
217 * The number of operations of the '<em>Function</em>' class.
218 * <!-- begin-user-doc -->
219 * <!-- end-user-doc -->
220 * @generated
221 * @ordered
222 */
223 int FUNCTION_OPERATION_COUNT = FUNCTIONAL_ELEMENT_OPERATION_COUNT + 0;
224
225 /**
226 * The meta object id for the '{@link functionalarchitecture.impl.FAMTerminatorImpl <em>FAM Terminator</em>}' class.
227 * <!-- begin-user-doc -->
228 * <!-- end-user-doc -->
229 * @see functionalarchitecture.impl.FAMTerminatorImpl
230 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFAMTerminator()
231 * @generated
232 */
233 int FAM_TERMINATOR = 3;
234
235 /**
236 * The feature id for the '<em><b>Data</b></em>' container reference.
237 * <!-- begin-user-doc -->
238 * <!-- end-user-doc -->
239 * @generated
240 * @ordered
241 */
242 int FAM_TERMINATOR__DATA = 0;
243
244 /**
245 * The number of structural features of the '<em>FAM Terminator</em>' class.
246 * <!-- begin-user-doc -->
247 * <!-- end-user-doc -->
248 * @generated
249 * @ordered
250 */
251 int FAM_TERMINATOR_FEATURE_COUNT = 1;
252
253 /**
254 * The number of operations of the '<em>FAM Terminator</em>' class.
255 * <!-- begin-user-doc -->
256 * <!-- end-user-doc -->
257 * @generated
258 * @ordered
259 */
260 int FAM_TERMINATOR_OPERATION_COUNT = 0;
261
262 /**
263 * The meta object id for the '{@link functionalarchitecture.impl.InformationLinkImpl <em>Information Link</em>}' class.
264 * <!-- begin-user-doc -->
265 * <!-- end-user-doc -->
266 * @see functionalarchitecture.impl.InformationLinkImpl
267 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getInformationLink()
268 * @generated
269 */
270 int INFORMATION_LINK = 4;
271
272 /**
273 * The feature id for the '<em><b>From</b></em>' container reference.
274 * <!-- begin-user-doc -->
275 * <!-- end-user-doc -->
276 * @generated
277 * @ordered
278 */
279 int INFORMATION_LINK__FROM = 0;
280
281 /**
282 * The feature id for the '<em><b>To</b></em>' reference.
283 * <!-- begin-user-doc -->
284 * <!-- end-user-doc -->
285 * @generated
286 * @ordered
287 */
288 int INFORMATION_LINK__TO = 1;
289
290 /**
291 * The number of structural features of the '<em>Information Link</em>' class.
292 * <!-- begin-user-doc -->
293 * <!-- end-user-doc -->
294 * @generated
295 * @ordered
296 */
297 int INFORMATION_LINK_FEATURE_COUNT = 2;
298
299 /**
300 * The number of operations of the '<em>Information Link</em>' class.
301 * <!-- begin-user-doc -->
302 * <!-- end-user-doc -->
303 * @generated
304 * @ordered
305 */
306 int INFORMATION_LINK_OPERATION_COUNT = 0;
307
308 /**
309 * The meta object id for the '{@link functionalarchitecture.impl.FunctionalInterfaceImpl <em>Functional Interface</em>}' class.
310 * <!-- begin-user-doc -->
311 * <!-- end-user-doc -->
312 * @see functionalarchitecture.impl.FunctionalInterfaceImpl
313 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalInterface()
314 * @generated
315 */
316 int FUNCTIONAL_INTERFACE = 5;
317
318 /**
319 * The feature id for the '<em><b>Data</b></em>' containment reference list.
320 * <!-- begin-user-doc -->
321 * <!-- end-user-doc -->
322 * @generated
323 * @ordered
324 */
325 int FUNCTIONAL_INTERFACE__DATA = 0;
326
327 /**
328 * The feature id for the '<em><b>Element</b></em>' container reference.
329 * <!-- begin-user-doc -->
330 * <!-- end-user-doc -->
331 * @generated
332 * @ordered
333 */
334 int FUNCTIONAL_INTERFACE__ELEMENT = 1;
335
336 /**
337 * The number of structural features of the '<em>Functional Interface</em>' class.
338 * <!-- begin-user-doc -->
339 * <!-- end-user-doc -->
340 * @generated
341 * @ordered
342 */
343 int FUNCTIONAL_INTERFACE_FEATURE_COUNT = 2;
344
345 /**
346 * The number of operations of the '<em>Functional Interface</em>' class.
347 * <!-- begin-user-doc -->
348 * <!-- end-user-doc -->
349 * @generated
350 * @ordered
351 */
352 int FUNCTIONAL_INTERFACE_OPERATION_COUNT = 0;
353
354 /**
355 * The meta object id for the '{@link functionalarchitecture.impl.FunctionalDataImpl <em>Functional Data</em>}' class.
356 * <!-- begin-user-doc -->
357 * <!-- end-user-doc -->
358 * @see functionalarchitecture.impl.FunctionalDataImpl
359 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalData()
360 * @generated
361 */
362 int FUNCTIONAL_DATA = 8;
363
364 /**
365 * The feature id for the '<em><b>Terminator</b></em>' containment reference.
366 * <!-- begin-user-doc -->
367 * <!-- end-user-doc -->
368 * @generated
369 * @ordered
370 */
371 int FUNCTIONAL_DATA__TERMINATOR = 0;
372
373 /**
374 * The feature id for the '<em><b>Interface</b></em>' container reference.
375 * <!-- begin-user-doc -->
376 * <!-- end-user-doc -->
377 * @generated
378 * @ordered
379 */
380 int FUNCTIONAL_DATA__INTERFACE = 1;
381
382 /**
383 * The number of structural features of the '<em>Functional Data</em>' class.
384 * <!-- begin-user-doc -->
385 * <!-- end-user-doc -->
386 * @generated
387 * @ordered
388 */
389 int FUNCTIONAL_DATA_FEATURE_COUNT = 2;
390
391 /**
392 * The number of operations of the '<em>Functional Data</em>' class.
393 * <!-- begin-user-doc -->
394 * <!-- end-user-doc -->
395 * @generated
396 * @ordered
397 */
398 int FUNCTIONAL_DATA_OPERATION_COUNT = 0;
399
400 /**
401 * The meta object id for the '{@link functionalarchitecture.impl.FunctionalInputImpl <em>Functional Input</em>}' class.
402 * <!-- begin-user-doc -->
403 * <!-- end-user-doc -->
404 * @see functionalarchitecture.impl.FunctionalInputImpl
405 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalInput()
406 * @generated
407 */
408 int FUNCTIONAL_INPUT = 6;
409
410 /**
411 * The feature id for the '<em><b>Terminator</b></em>' containment reference.
412 * <!-- begin-user-doc -->
413 * <!-- end-user-doc -->
414 * @generated
415 * @ordered
416 */
417 int FUNCTIONAL_INPUT__TERMINATOR = FUNCTIONAL_DATA__TERMINATOR;
418
419 /**
420 * The feature id for the '<em><b>Interface</b></em>' container reference.
421 * <!-- begin-user-doc -->
422 * <!-- end-user-doc -->
423 * @generated
424 * @ordered
425 */
426 int FUNCTIONAL_INPUT__INTERFACE = FUNCTIONAL_DATA__INTERFACE;
427
428 /**
429 * The feature id for the '<em><b>Incoming Links</b></em>' reference list.
430 * <!-- begin-user-doc -->
431 * <!-- end-user-doc -->
432 * @generated
433 * @ordered
434 */
435 int FUNCTIONAL_INPUT__INCOMING_LINKS = FUNCTIONAL_DATA_FEATURE_COUNT + 0;
436
437 /**
438 * The number of structural features of the '<em>Functional Input</em>' class.
439 * <!-- begin-user-doc -->
440 * <!-- end-user-doc -->
441 * @generated
442 * @ordered
443 */
444 int FUNCTIONAL_INPUT_FEATURE_COUNT = FUNCTIONAL_DATA_FEATURE_COUNT + 1;
445
446 /**
447 * The number of operations of the '<em>Functional Input</em>' class.
448 * <!-- begin-user-doc -->
449 * <!-- end-user-doc -->
450 * @generated
451 * @ordered
452 */
453 int FUNCTIONAL_INPUT_OPERATION_COUNT = FUNCTIONAL_DATA_OPERATION_COUNT + 0;
454
455 /**
456 * The meta object id for the '{@link functionalarchitecture.impl.FunctionalOutputImpl <em>Functional Output</em>}' class.
457 * <!-- begin-user-doc -->
458 * <!-- end-user-doc -->
459 * @see functionalarchitecture.impl.FunctionalOutputImpl
460 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalOutput()
461 * @generated
462 */
463 int FUNCTIONAL_OUTPUT = 7;
464
465 /**
466 * The feature id for the '<em><b>Terminator</b></em>' containment reference.
467 * <!-- begin-user-doc -->
468 * <!-- end-user-doc -->
469 * @generated
470 * @ordered
471 */
472 int FUNCTIONAL_OUTPUT__TERMINATOR = FUNCTIONAL_DATA__TERMINATOR;
473
474 /**
475 * The feature id for the '<em><b>Interface</b></em>' container reference.
476 * <!-- begin-user-doc -->
477 * <!-- end-user-doc -->
478 * @generated
479 * @ordered
480 */
481 int FUNCTIONAL_OUTPUT__INTERFACE = FUNCTIONAL_DATA__INTERFACE;
482
483 /**
484 * The feature id for the '<em><b>Outgoing Links</b></em>' containment reference list.
485 * <!-- begin-user-doc -->
486 * <!-- end-user-doc -->
487 * @generated
488 * @ordered
489 */
490 int FUNCTIONAL_OUTPUT__OUTGOING_LINKS = FUNCTIONAL_DATA_FEATURE_COUNT + 0;
491
492 /**
493 * The number of structural features of the '<em>Functional Output</em>' class.
494 * <!-- begin-user-doc -->
495 * <!-- end-user-doc -->
496 * @generated
497 * @ordered
498 */
499 int FUNCTIONAL_OUTPUT_FEATURE_COUNT = FUNCTIONAL_DATA_FEATURE_COUNT + 1;
500
501 /**
502 * The number of operations of the '<em>Functional Output</em>' class.
503 * <!-- begin-user-doc -->
504 * <!-- end-user-doc -->
505 * @generated
506 * @ordered
507 */
508 int FUNCTIONAL_OUTPUT_OPERATION_COUNT = FUNCTIONAL_DATA_OPERATION_COUNT + 0;
509
510 /**
511 * The meta object id for the '{@link functionalarchitecture.FunctionType <em>Function Type</em>}' enum.
512 * <!-- begin-user-doc -->
513 * <!-- end-user-doc -->
514 * @see functionalarchitecture.FunctionType
515 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionType()
516 * @generated
517 */
518 int FUNCTION_TYPE = 9;
519
520
521 /**
522 * Returns the meta object for class '{@link functionalarchitecture.FunctionalElement <em>Functional Element</em>}'.
523 * <!-- begin-user-doc -->
524 * <!-- end-user-doc -->
525 * @return the meta object for class '<em>Functional Element</em>'.
526 * @see functionalarchitecture.FunctionalElement
527 * @generated
528 */
529 EClass getFunctionalElement();
530
531 /**
532 * Returns the meta object for the containment reference '{@link functionalarchitecture.FunctionalElement#getInterface <em>Interface</em>}'.
533 * <!-- begin-user-doc -->
534 * <!-- end-user-doc -->
535 * @return the meta object for the containment reference '<em>Interface</em>'.
536 * @see functionalarchitecture.FunctionalElement#getInterface()
537 * @see #getFunctionalElement()
538 * @generated
539 */
540 EReference getFunctionalElement_Interface();
541
542 /**
543 * Returns the meta object for the reference '{@link functionalarchitecture.FunctionalElement#getModel <em>Model</em>}'.
544 * <!-- begin-user-doc -->
545 * <!-- end-user-doc -->
546 * @return the meta object for the reference '<em>Model</em>'.
547 * @see functionalarchitecture.FunctionalElement#getModel()
548 * @see #getFunctionalElement()
549 * @generated
550 */
551 EReference getFunctionalElement_Model();
552
553 /**
554 * Returns the meta object for the container reference '{@link functionalarchitecture.FunctionalElement#getParent <em>Parent</em>}'.
555 * <!-- begin-user-doc -->
556 * <!-- end-user-doc -->
557 * @return the meta object for the container reference '<em>Parent</em>'.
558 * @see functionalarchitecture.FunctionalElement#getParent()
559 * @see #getFunctionalElement()
560 * @generated
561 */
562 EReference getFunctionalElement_Parent();
563
564 /**
565 * Returns the meta object for class '{@link functionalarchitecture.FunctionalArchitectureModel <em>Functional Architecture Model</em>}'.
566 * <!-- begin-user-doc -->
567 * <!-- end-user-doc -->
568 * @return the meta object for class '<em>Functional Architecture Model</em>'.
569 * @see functionalarchitecture.FunctionalArchitectureModel
570 * @generated
571 */
572 EClass getFunctionalArchitectureModel();
573
574 /**
575 * Returns the meta object for the containment reference list '{@link functionalarchitecture.FunctionalArchitectureModel#getRootElements <em>Root Elements</em>}'.
576 * <!-- begin-user-doc -->
577 * <!-- end-user-doc -->
578 * @return the meta object for the containment reference list '<em>Root Elements</em>'.
579 * @see functionalarchitecture.FunctionalArchitectureModel#getRootElements()
580 * @see #getFunctionalArchitectureModel()
581 * @generated
582 */
583 EReference getFunctionalArchitectureModel_RootElements();
584
585 /**
586 * Returns the meta object for class '{@link functionalarchitecture.Function <em>Function</em>}'.
587 * <!-- begin-user-doc -->
588 * <!-- end-user-doc -->
589 * @return the meta object for class '<em>Function</em>'.
590 * @see functionalarchitecture.Function
591 * @generated
592 */
593 EClass getFunction();
594
595 /**
596 * Returns the meta object for the containment reference list '{@link functionalarchitecture.Function#getSubElements <em>Sub Elements</em>}'.
597 * <!-- begin-user-doc -->
598 * <!-- end-user-doc -->
599 * @return the meta object for the containment reference list '<em>Sub Elements</em>'.
600 * @see functionalarchitecture.Function#getSubElements()
601 * @see #getFunction()
602 * @generated
603 */
604 EReference getFunction_SubElements();
605
606 /**
607 * Returns the meta object for the attribute '{@link functionalarchitecture.Function#getType <em>Type</em>}'.
608 * <!-- begin-user-doc -->
609 * <!-- end-user-doc -->
610 * @return the meta object for the attribute '<em>Type</em>'.
611 * @see functionalarchitecture.Function#getType()
612 * @see #getFunction()
613 * @generated
614 */
615 EAttribute getFunction_Type();
616
617 /**
618 * Returns the meta object for class '{@link functionalarchitecture.FAMTerminator <em>FAM Terminator</em>}'.
619 * <!-- begin-user-doc -->
620 * <!-- end-user-doc -->
621 * @return the meta object for class '<em>FAM Terminator</em>'.
622 * @see functionalarchitecture.FAMTerminator
623 * @generated
624 */
625 EClass getFAMTerminator();
626
627 /**
628 * Returns the meta object for the container reference '{@link functionalarchitecture.FAMTerminator#getData <em>Data</em>}'.
629 * <!-- begin-user-doc -->
630 * <!-- end-user-doc -->
631 * @return the meta object for the container reference '<em>Data</em>'.
632 * @see functionalarchitecture.FAMTerminator#getData()
633 * @see #getFAMTerminator()
634 * @generated
635 */
636 EReference getFAMTerminator_Data();
637
638 /**
639 * Returns the meta object for class '{@link functionalarchitecture.InformationLink <em>Information Link</em>}'.
640 * <!-- begin-user-doc -->
641 * <!-- end-user-doc -->
642 * @return the meta object for class '<em>Information Link</em>'.
643 * @see functionalarchitecture.InformationLink
644 * @generated
645 */
646 EClass getInformationLink();
647
648 /**
649 * Returns the meta object for the container reference '{@link functionalarchitecture.InformationLink#getFrom <em>From</em>}'.
650 * <!-- begin-user-doc -->
651 * <!-- end-user-doc -->
652 * @return the meta object for the container reference '<em>From</em>'.
653 * @see functionalarchitecture.InformationLink#getFrom()
654 * @see #getInformationLink()
655 * @generated
656 */
657 EReference getInformationLink_From();
658
659 /**
660 * Returns the meta object for the reference '{@link functionalarchitecture.InformationLink#getTo <em>To</em>}'.
661 * <!-- begin-user-doc -->
662 * <!-- end-user-doc -->
663 * @return the meta object for the reference '<em>To</em>'.
664 * @see functionalarchitecture.InformationLink#getTo()
665 * @see #getInformationLink()
666 * @generated
667 */
668 EReference getInformationLink_To();
669
670 /**
671 * Returns the meta object for class '{@link functionalarchitecture.FunctionalInterface <em>Functional Interface</em>}'.
672 * <!-- begin-user-doc -->
673 * <!-- end-user-doc -->
674 * @return the meta object for class '<em>Functional Interface</em>'.
675 * @see functionalarchitecture.FunctionalInterface
676 * @generated
677 */
678 EClass getFunctionalInterface();
679
680 /**
681 * Returns the meta object for the containment reference list '{@link functionalarchitecture.FunctionalInterface#getData <em>Data</em>}'.
682 * <!-- begin-user-doc -->
683 * <!-- end-user-doc -->
684 * @return the meta object for the containment reference list '<em>Data</em>'.
685 * @see functionalarchitecture.FunctionalInterface#getData()
686 * @see #getFunctionalInterface()
687 * @generated
688 */
689 EReference getFunctionalInterface_Data();
690
691 /**
692 * Returns the meta object for the container reference '{@link functionalarchitecture.FunctionalInterface#getElement <em>Element</em>}'.
693 * <!-- begin-user-doc -->
694 * <!-- end-user-doc -->
695 * @return the meta object for the container reference '<em>Element</em>'.
696 * @see functionalarchitecture.FunctionalInterface#getElement()
697 * @see #getFunctionalInterface()
698 * @generated
699 */
700 EReference getFunctionalInterface_Element();
701
702 /**
703 * Returns the meta object for class '{@link functionalarchitecture.FunctionalInput <em>Functional Input</em>}'.
704 * <!-- begin-user-doc -->
705 * <!-- end-user-doc -->
706 * @return the meta object for class '<em>Functional Input</em>'.
707 * @see functionalarchitecture.FunctionalInput
708 * @generated
709 */
710 EClass getFunctionalInput();
711
712 /**
713 * Returns the meta object for the reference list '{@link functionalarchitecture.FunctionalInput#getIncomingLinks <em>Incoming Links</em>}'.
714 * <!-- begin-user-doc -->
715 * <!-- end-user-doc -->
716 * @return the meta object for the reference list '<em>Incoming Links</em>'.
717 * @see functionalarchitecture.FunctionalInput#getIncomingLinks()
718 * @see #getFunctionalInput()
719 * @generated
720 */
721 EReference getFunctionalInput_IncomingLinks();
722
723 /**
724 * Returns the meta object for class '{@link functionalarchitecture.FunctionalOutput <em>Functional Output</em>}'.
725 * <!-- begin-user-doc -->
726 * <!-- end-user-doc -->
727 * @return the meta object for class '<em>Functional Output</em>'.
728 * @see functionalarchitecture.FunctionalOutput
729 * @generated
730 */
731 EClass getFunctionalOutput();
732
733 /**
734 * Returns the meta object for the containment reference list '{@link functionalarchitecture.FunctionalOutput#getOutgoingLinks <em>Outgoing Links</em>}'.
735 * <!-- begin-user-doc -->
736 * <!-- end-user-doc -->
737 * @return the meta object for the containment reference list '<em>Outgoing Links</em>'.
738 * @see functionalarchitecture.FunctionalOutput#getOutgoingLinks()
739 * @see #getFunctionalOutput()
740 * @generated
741 */
742 EReference getFunctionalOutput_OutgoingLinks();
743
744 /**
745 * Returns the meta object for class '{@link functionalarchitecture.FunctionalData <em>Functional Data</em>}'.
746 * <!-- begin-user-doc -->
747 * <!-- end-user-doc -->
748 * @return the meta object for class '<em>Functional Data</em>'.
749 * @see functionalarchitecture.FunctionalData
750 * @generated
751 */
752 EClass getFunctionalData();
753
754 /**
755 * Returns the meta object for the containment reference '{@link functionalarchitecture.FunctionalData#getTerminator <em>Terminator</em>}'.
756 * <!-- begin-user-doc -->
757 * <!-- end-user-doc -->
758 * @return the meta object for the containment reference '<em>Terminator</em>'.
759 * @see functionalarchitecture.FunctionalData#getTerminator()
760 * @see #getFunctionalData()
761 * @generated
762 */
763 EReference getFunctionalData_Terminator();
764
765 /**
766 * Returns the meta object for the container reference '{@link functionalarchitecture.FunctionalData#getInterface <em>Interface</em>}'.
767 * <!-- begin-user-doc -->
768 * <!-- end-user-doc -->
769 * @return the meta object for the container reference '<em>Interface</em>'.
770 * @see functionalarchitecture.FunctionalData#getInterface()
771 * @see #getFunctionalData()
772 * @generated
773 */
774 EReference getFunctionalData_Interface();
775
776 /**
777 * Returns the meta object for enum '{@link functionalarchitecture.FunctionType <em>Function Type</em>}'.
778 * <!-- begin-user-doc -->
779 * <!-- end-user-doc -->
780 * @return the meta object for enum '<em>Function Type</em>'.
781 * @see functionalarchitecture.FunctionType
782 * @generated
783 */
784 EEnum getFunctionType();
785
786 /**
787 * Returns the factory that creates the instances of the model.
788 * <!-- begin-user-doc -->
789 * <!-- end-user-doc -->
790 * @return the factory that creates the instances of the model.
791 * @generated
792 */
793 FunctionalarchitectureFactory getFunctionalarchitectureFactory();
794
795 /**
796 * <!-- begin-user-doc -->
797 * Defines literals for the meta objects that represent
798 * <ul>
799 * <li>each class,</li>
800 * <li>each feature of each class,</li>
801 * <li>each operation of each class,</li>
802 * <li>each enum,</li>
803 * <li>and each data type</li>
804 * </ul>
805 * <!-- end-user-doc -->
806 * @generated
807 */
808 interface Literals {
809 /**
810 * The meta object literal for the '{@link functionalarchitecture.impl.FunctionalElementImpl <em>Functional Element</em>}' class.
811 * <!-- begin-user-doc -->
812 * <!-- end-user-doc -->
813 * @see functionalarchitecture.impl.FunctionalElementImpl
814 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalElement()
815 * @generated
816 */
817 EClass FUNCTIONAL_ELEMENT = eINSTANCE.getFunctionalElement();
818
819 /**
820 * The meta object literal for the '<em><b>Interface</b></em>' containment reference feature.
821 * <!-- begin-user-doc -->
822 * <!-- end-user-doc -->
823 * @generated
824 */
825 EReference FUNCTIONAL_ELEMENT__INTERFACE = eINSTANCE.getFunctionalElement_Interface();
826
827 /**
828 * The meta object literal for the '<em><b>Model</b></em>' reference feature.
829 * <!-- begin-user-doc -->
830 * <!-- end-user-doc -->
831 * @generated
832 */
833 EReference FUNCTIONAL_ELEMENT__MODEL = eINSTANCE.getFunctionalElement_Model();
834
835 /**
836 * The meta object literal for the '<em><b>Parent</b></em>' container reference feature.
837 * <!-- begin-user-doc -->
838 * <!-- end-user-doc -->
839 * @generated
840 */
841 EReference FUNCTIONAL_ELEMENT__PARENT = eINSTANCE.getFunctionalElement_Parent();
842
843 /**
844 * The meta object literal for the '{@link functionalarchitecture.impl.FunctionalArchitectureModelImpl <em>Functional Architecture Model</em>}' class.
845 * <!-- begin-user-doc -->
846 * <!-- end-user-doc -->
847 * @see functionalarchitecture.impl.FunctionalArchitectureModelImpl
848 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalArchitectureModel()
849 * @generated
850 */
851 EClass FUNCTIONAL_ARCHITECTURE_MODEL = eINSTANCE.getFunctionalArchitectureModel();
852
853 /**
854 * The meta object literal for the '<em><b>Root Elements</b></em>' containment reference list feature.
855 * <!-- begin-user-doc -->
856 * <!-- end-user-doc -->
857 * @generated
858 */
859 EReference FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS = eINSTANCE.getFunctionalArchitectureModel_RootElements();
860
861 /**
862 * The meta object literal for the '{@link functionalarchitecture.impl.FunctionImpl <em>Function</em>}' class.
863 * <!-- begin-user-doc -->
864 * <!-- end-user-doc -->
865 * @see functionalarchitecture.impl.FunctionImpl
866 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunction()
867 * @generated
868 */
869 EClass FUNCTION = eINSTANCE.getFunction();
870
871 /**
872 * The meta object literal for the '<em><b>Sub Elements</b></em>' containment reference list feature.
873 * <!-- begin-user-doc -->
874 * <!-- end-user-doc -->
875 * @generated
876 */
877 EReference FUNCTION__SUB_ELEMENTS = eINSTANCE.getFunction_SubElements();
878
879 /**
880 * The meta object literal for the '<em><b>Type</b></em>' attribute feature.
881 * <!-- begin-user-doc -->
882 * <!-- end-user-doc -->
883 * @generated
884 */
885 EAttribute FUNCTION__TYPE = eINSTANCE.getFunction_Type();
886
887 /**
888 * The meta object literal for the '{@link functionalarchitecture.impl.FAMTerminatorImpl <em>FAM Terminator</em>}' class.
889 * <!-- begin-user-doc -->
890 * <!-- end-user-doc -->
891 * @see functionalarchitecture.impl.FAMTerminatorImpl
892 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFAMTerminator()
893 * @generated
894 */
895 EClass FAM_TERMINATOR = eINSTANCE.getFAMTerminator();
896
897 /**
898 * The meta object literal for the '<em><b>Data</b></em>' container reference feature.
899 * <!-- begin-user-doc -->
900 * <!-- end-user-doc -->
901 * @generated
902 */
903 EReference FAM_TERMINATOR__DATA = eINSTANCE.getFAMTerminator_Data();
904
905 /**
906 * The meta object literal for the '{@link functionalarchitecture.impl.InformationLinkImpl <em>Information Link</em>}' class.
907 * <!-- begin-user-doc -->
908 * <!-- end-user-doc -->
909 * @see functionalarchitecture.impl.InformationLinkImpl
910 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getInformationLink()
911 * @generated
912 */
913 EClass INFORMATION_LINK = eINSTANCE.getInformationLink();
914
915 /**
916 * The meta object literal for the '<em><b>From</b></em>' container reference feature.
917 * <!-- begin-user-doc -->
918 * <!-- end-user-doc -->
919 * @generated
920 */
921 EReference INFORMATION_LINK__FROM = eINSTANCE.getInformationLink_From();
922
923 /**
924 * The meta object literal for the '<em><b>To</b></em>' reference feature.
925 * <!-- begin-user-doc -->
926 * <!-- end-user-doc -->
927 * @generated
928 */
929 EReference INFORMATION_LINK__TO = eINSTANCE.getInformationLink_To();
930
931 /**
932 * The meta object literal for the '{@link functionalarchitecture.impl.FunctionalInterfaceImpl <em>Functional Interface</em>}' class.
933 * <!-- begin-user-doc -->
934 * <!-- end-user-doc -->
935 * @see functionalarchitecture.impl.FunctionalInterfaceImpl
936 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalInterface()
937 * @generated
938 */
939 EClass FUNCTIONAL_INTERFACE = eINSTANCE.getFunctionalInterface();
940
941 /**
942 * The meta object literal for the '<em><b>Data</b></em>' containment reference list feature.
943 * <!-- begin-user-doc -->
944 * <!-- end-user-doc -->
945 * @generated
946 */
947 EReference FUNCTIONAL_INTERFACE__DATA = eINSTANCE.getFunctionalInterface_Data();
948
949 /**
950 * The meta object literal for the '<em><b>Element</b></em>' container reference feature.
951 * <!-- begin-user-doc -->
952 * <!-- end-user-doc -->
953 * @generated
954 */
955 EReference FUNCTIONAL_INTERFACE__ELEMENT = eINSTANCE.getFunctionalInterface_Element();
956
957 /**
958 * The meta object literal for the '{@link functionalarchitecture.impl.FunctionalInputImpl <em>Functional Input</em>}' class.
959 * <!-- begin-user-doc -->
960 * <!-- end-user-doc -->
961 * @see functionalarchitecture.impl.FunctionalInputImpl
962 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalInput()
963 * @generated
964 */
965 EClass FUNCTIONAL_INPUT = eINSTANCE.getFunctionalInput();
966
967 /**
968 * The meta object literal for the '<em><b>Incoming Links</b></em>' reference list feature.
969 * <!-- begin-user-doc -->
970 * <!-- end-user-doc -->
971 * @generated
972 */
973 EReference FUNCTIONAL_INPUT__INCOMING_LINKS = eINSTANCE.getFunctionalInput_IncomingLinks();
974
975 /**
976 * The meta object literal for the '{@link functionalarchitecture.impl.FunctionalOutputImpl <em>Functional Output</em>}' class.
977 * <!-- begin-user-doc -->
978 * <!-- end-user-doc -->
979 * @see functionalarchitecture.impl.FunctionalOutputImpl
980 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalOutput()
981 * @generated
982 */
983 EClass FUNCTIONAL_OUTPUT = eINSTANCE.getFunctionalOutput();
984
985 /**
986 * The meta object literal for the '<em><b>Outgoing Links</b></em>' containment reference list feature.
987 * <!-- begin-user-doc -->
988 * <!-- end-user-doc -->
989 * @generated
990 */
991 EReference FUNCTIONAL_OUTPUT__OUTGOING_LINKS = eINSTANCE.getFunctionalOutput_OutgoingLinks();
992
993 /**
994 * The meta object literal for the '{@link functionalarchitecture.impl.FunctionalDataImpl <em>Functional Data</em>}' class.
995 * <!-- begin-user-doc -->
996 * <!-- end-user-doc -->
997 * @see functionalarchitecture.impl.FunctionalDataImpl
998 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionalData()
999 * @generated
1000 */
1001 EClass FUNCTIONAL_DATA = eINSTANCE.getFunctionalData();
1002
1003 /**
1004 * The meta object literal for the '<em><b>Terminator</b></em>' containment reference feature.
1005 * <!-- begin-user-doc -->
1006 * <!-- end-user-doc -->
1007 * @generated
1008 */
1009 EReference FUNCTIONAL_DATA__TERMINATOR = eINSTANCE.getFunctionalData_Terminator();
1010
1011 /**
1012 * The meta object literal for the '<em><b>Interface</b></em>' container reference feature.
1013 * <!-- begin-user-doc -->
1014 * <!-- end-user-doc -->
1015 * @generated
1016 */
1017 EReference FUNCTIONAL_DATA__INTERFACE = eINSTANCE.getFunctionalData_Interface();
1018
1019 /**
1020 * The meta object literal for the '{@link functionalarchitecture.FunctionType <em>Function Type</em>}' enum.
1021 * <!-- begin-user-doc -->
1022 * <!-- end-user-doc -->
1023 * @see functionalarchitecture.FunctionType
1024 * @see functionalarchitecture.impl.FunctionalarchitecturePackageImpl#getFunctionType()
1025 * @generated
1026 */
1027 EEnum FUNCTION_TYPE = eINSTANCE.getFunctionType();
1028
1029 }
1030
1031} //FunctionalarchitecturePackage
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/InformationLink.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/InformationLink.java
new file mode 100644
index 00000000..aa74488a
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/InformationLink.java
@@ -0,0 +1,81 @@
1/**
2 */
3package functionalarchitecture;
4
5import org.eclipse.emf.ecore.EObject;
6
7/**
8 * <!-- begin-user-doc -->
9 * A representation of the model object '<em><b>Information Link</b></em>'.
10 * <!-- end-user-doc -->
11 *
12 * <p>
13 * The following features are supported:
14 * </p>
15 * <ul>
16 * <li>{@link functionalarchitecture.InformationLink#getFrom <em>From</em>}</li>
17 * <li>{@link functionalarchitecture.InformationLink#getTo <em>To</em>}</li>
18 * </ul>
19 *
20 * @see functionalarchitecture.FunctionalarchitecturePackage#getInformationLink()
21 * @model
22 * @generated
23 */
24public interface InformationLink extends EObject {
25 /**
26 * Returns the value of the '<em><b>From</b></em>' container reference.
27 * It is bidirectional and its opposite is '{@link functionalarchitecture.FunctionalOutput#getOutgoingLinks <em>Outgoing Links</em>}'.
28 * <!-- begin-user-doc -->
29 * <p>
30 * If the meaning of the '<em>From</em>' container reference isn't clear,
31 * there really should be more of a description here...
32 * </p>
33 * <!-- end-user-doc -->
34 * @return the value of the '<em>From</em>' container reference.
35 * @see #setFrom(FunctionalOutput)
36 * @see functionalarchitecture.FunctionalarchitecturePackage#getInformationLink_From()
37 * @see functionalarchitecture.FunctionalOutput#getOutgoingLinks
38 * @model opposite="outgoingLinks" transient="false"
39 * @generated
40 */
41 FunctionalOutput getFrom();
42
43 /**
44 * Sets the value of the '{@link functionalarchitecture.InformationLink#getFrom <em>From</em>}' container reference.
45 * <!-- begin-user-doc -->
46 * <!-- end-user-doc -->
47 * @param value the new value of the '<em>From</em>' container reference.
48 * @see #getFrom()
49 * @generated
50 */
51 void setFrom(FunctionalOutput value);
52
53 /**
54 * Returns the value of the '<em><b>To</b></em>' reference.
55 * It is bidirectional and its opposite is '{@link functionalarchitecture.FunctionalInput#getIncomingLinks <em>Incoming Links</em>}'.
56 * <!-- begin-user-doc -->
57 * <p>
58 * If the meaning of the '<em>To</em>' reference isn't clear,
59 * there really should be more of a description here...
60 * </p>
61 * <!-- end-user-doc -->
62 * @return the value of the '<em>To</em>' reference.
63 * @see #setTo(FunctionalInput)
64 * @see functionalarchitecture.FunctionalarchitecturePackage#getInformationLink_To()
65 * @see functionalarchitecture.FunctionalInput#getIncomingLinks
66 * @model opposite="IncomingLinks" required="true"
67 * @generated
68 */
69 FunctionalInput getTo();
70
71 /**
72 * Sets the value of the '{@link functionalarchitecture.InformationLink#getTo <em>To</em>}' reference.
73 * <!-- begin-user-doc -->
74 * <!-- end-user-doc -->
75 * @param value the new value of the '<em>To</em>' reference.
76 * @see #getTo()
77 * @generated
78 */
79 void setTo(FunctionalInput value);
80
81} // InformationLink
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FAMTerminatorImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FAMTerminatorImpl.java
new file mode 100644
index 00000000..1b5eb362
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FAMTerminatorImpl.java
@@ -0,0 +1,198 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.FAMTerminator;
6import functionalarchitecture.FunctionalData;
7import functionalarchitecture.FunctionalarchitecturePackage;
8
9import org.eclipse.emf.common.notify.Notification;
10import org.eclipse.emf.common.notify.NotificationChain;
11
12import org.eclipse.emf.ecore.EClass;
13import org.eclipse.emf.ecore.InternalEObject;
14
15import org.eclipse.emf.ecore.impl.ENotificationImpl;
16import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
17
18import org.eclipse.emf.ecore.util.EcoreUtil;
19
20/**
21 * <!-- begin-user-doc -->
22 * An implementation of the model object '<em><b>FAM Terminator</b></em>'.
23 * <!-- end-user-doc -->
24 * <p>
25 * The following features are implemented:
26 * </p>
27 * <ul>
28 * <li>{@link functionalarchitecture.impl.FAMTerminatorImpl#getData <em>Data</em>}</li>
29 * </ul>
30 *
31 * @generated
32 */
33public class FAMTerminatorImpl extends MinimalEObjectImpl.Container implements FAMTerminator {
34 /**
35 * <!-- begin-user-doc -->
36 * <!-- end-user-doc -->
37 * @generated
38 */
39 protected FAMTerminatorImpl() {
40 super();
41 }
42
43 /**
44 * <!-- begin-user-doc -->
45 * <!-- end-user-doc -->
46 * @generated
47 */
48 @Override
49 protected EClass eStaticClass() {
50 return FunctionalarchitecturePackage.Literals.FAM_TERMINATOR;
51 }
52
53 /**
54 * <!-- begin-user-doc -->
55 * <!-- end-user-doc -->
56 * @generated
57 */
58 @Override
59 public FunctionalData getData() {
60 if (eContainerFeatureID() != FunctionalarchitecturePackage.FAM_TERMINATOR__DATA) return null;
61 return (FunctionalData)eInternalContainer();
62 }
63
64 /**
65 * <!-- begin-user-doc -->
66 * <!-- end-user-doc -->
67 * @generated
68 */
69 public NotificationChain basicSetData(FunctionalData newData, NotificationChain msgs) {
70 msgs = eBasicSetContainer((InternalEObject)newData, FunctionalarchitecturePackage.FAM_TERMINATOR__DATA, msgs);
71 return msgs;
72 }
73
74 /**
75 * <!-- begin-user-doc -->
76 * <!-- end-user-doc -->
77 * @generated
78 */
79 @Override
80 public void setData(FunctionalData newData) {
81 if (newData != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.FAM_TERMINATOR__DATA && newData != null)) {
82 if (EcoreUtil.isAncestor(this, newData))
83 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
84 NotificationChain msgs = null;
85 if (eInternalContainer() != null)
86 msgs = eBasicRemoveFromContainer(msgs);
87 if (newData != null)
88 msgs = ((InternalEObject)newData).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR, FunctionalData.class, msgs);
89 msgs = basicSetData(newData, msgs);
90 if (msgs != null) msgs.dispatch();
91 }
92 else if (eNotificationRequired())
93 eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FAM_TERMINATOR__DATA, newData, newData));
94 }
95
96 /**
97 * <!-- begin-user-doc -->
98 * <!-- end-user-doc -->
99 * @generated
100 */
101 @Override
102 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
103 switch (featureID) {
104 case FunctionalarchitecturePackage.FAM_TERMINATOR__DATA:
105 if (eInternalContainer() != null)
106 msgs = eBasicRemoveFromContainer(msgs);
107 return basicSetData((FunctionalData)otherEnd, msgs);
108 }
109 return super.eInverseAdd(otherEnd, featureID, msgs);
110 }
111
112 /**
113 * <!-- begin-user-doc -->
114 * <!-- end-user-doc -->
115 * @generated
116 */
117 @Override
118 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
119 switch (featureID) {
120 case FunctionalarchitecturePackage.FAM_TERMINATOR__DATA:
121 return basicSetData(null, msgs);
122 }
123 return super.eInverseRemove(otherEnd, featureID, msgs);
124 }
125
126 /**
127 * <!-- begin-user-doc -->
128 * <!-- end-user-doc -->
129 * @generated
130 */
131 @Override
132 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
133 switch (eContainerFeatureID()) {
134 case FunctionalarchitecturePackage.FAM_TERMINATOR__DATA:
135 return eInternalContainer().eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR, FunctionalData.class, msgs);
136 }
137 return super.eBasicRemoveFromContainerFeature(msgs);
138 }
139
140 /**
141 * <!-- begin-user-doc -->
142 * <!-- end-user-doc -->
143 * @generated
144 */
145 @Override
146 public Object eGet(int featureID, boolean resolve, boolean coreType) {
147 switch (featureID) {
148 case FunctionalarchitecturePackage.FAM_TERMINATOR__DATA:
149 return getData();
150 }
151 return super.eGet(featureID, resolve, coreType);
152 }
153
154 /**
155 * <!-- begin-user-doc -->
156 * <!-- end-user-doc -->
157 * @generated
158 */
159 @Override
160 public void eSet(int featureID, Object newValue) {
161 switch (featureID) {
162 case FunctionalarchitecturePackage.FAM_TERMINATOR__DATA:
163 setData((FunctionalData)newValue);
164 return;
165 }
166 super.eSet(featureID, newValue);
167 }
168
169 /**
170 * <!-- begin-user-doc -->
171 * <!-- end-user-doc -->
172 * @generated
173 */
174 @Override
175 public void eUnset(int featureID) {
176 switch (featureID) {
177 case FunctionalarchitecturePackage.FAM_TERMINATOR__DATA:
178 setData((FunctionalData)null);
179 return;
180 }
181 super.eUnset(featureID);
182 }
183
184 /**
185 * <!-- begin-user-doc -->
186 * <!-- end-user-doc -->
187 * @generated
188 */
189 @Override
190 public boolean eIsSet(int featureID) {
191 switch (featureID) {
192 case FunctionalarchitecturePackage.FAM_TERMINATOR__DATA:
193 return getData() != null;
194 }
195 return super.eIsSet(featureID);
196 }
197
198} //FAMTerminatorImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionImpl.java
new file mode 100644
index 00000000..cc41bd6f
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionImpl.java
@@ -0,0 +1,240 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.Function;
6import functionalarchitecture.FunctionType;
7import functionalarchitecture.FunctionalElement;
8import functionalarchitecture.FunctionalarchitecturePackage;
9
10import java.util.Collection;
11
12import org.eclipse.emf.common.notify.Notification;
13import org.eclipse.emf.common.notify.NotificationChain;
14
15import org.eclipse.emf.common.util.EList;
16
17import org.eclipse.emf.ecore.EClass;
18import org.eclipse.emf.ecore.InternalEObject;
19
20import org.eclipse.emf.ecore.impl.ENotificationImpl;
21
22import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
23import org.eclipse.emf.ecore.util.InternalEList;
24
25/**
26 * <!-- begin-user-doc -->
27 * An implementation of the model object '<em><b>Function</b></em>'.
28 * <!-- end-user-doc -->
29 * <p>
30 * The following features are implemented:
31 * </p>
32 * <ul>
33 * <li>{@link functionalarchitecture.impl.FunctionImpl#getSubElements <em>Sub Elements</em>}</li>
34 * <li>{@link functionalarchitecture.impl.FunctionImpl#getType <em>Type</em>}</li>
35 * </ul>
36 *
37 * @generated
38 */
39public class FunctionImpl extends FunctionalElementImpl implements Function {
40 /**
41 * The cached value of the '{@link #getSubElements() <em>Sub Elements</em>}' containment reference list.
42 * <!-- begin-user-doc -->
43 * <!-- end-user-doc -->
44 * @see #getSubElements()
45 * @generated
46 * @ordered
47 */
48 protected EList<FunctionalElement> subElements;
49
50 /**
51 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
52 * <!-- begin-user-doc -->
53 * <!-- end-user-doc -->
54 * @see #getType()
55 * @generated
56 * @ordered
57 */
58 protected static final FunctionType TYPE_EDEFAULT = FunctionType.ROOT;
59
60 /**
61 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
62 * <!-- begin-user-doc -->
63 * <!-- end-user-doc -->
64 * @see #getType()
65 * @generated
66 * @ordered
67 */
68 protected FunctionType type = TYPE_EDEFAULT;
69
70 /**
71 * <!-- begin-user-doc -->
72 * <!-- end-user-doc -->
73 * @generated
74 */
75 protected FunctionImpl() {
76 super();
77 }
78
79 /**
80 * <!-- begin-user-doc -->
81 * <!-- end-user-doc -->
82 * @generated
83 */
84 @Override
85 protected EClass eStaticClass() {
86 return FunctionalarchitecturePackage.Literals.FUNCTION;
87 }
88
89 /**
90 * <!-- begin-user-doc -->
91 * <!-- end-user-doc -->
92 * @generated
93 */
94 @Override
95 public EList<FunctionalElement> getSubElements() {
96 if (subElements == null) {
97 subElements = new EObjectContainmentWithInverseEList<FunctionalElement>(FunctionalElement.class, this, FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT);
98 }
99 return subElements;
100 }
101
102 /**
103 * <!-- begin-user-doc -->
104 * <!-- end-user-doc -->
105 * @generated
106 */
107 @Override
108 public FunctionType getType() {
109 return type;
110 }
111
112 /**
113 * <!-- begin-user-doc -->
114 * <!-- end-user-doc -->
115 * @generated
116 */
117 @Override
118 public void setType(FunctionType newType) {
119 FunctionType oldType = type;
120 type = newType == null ? TYPE_EDEFAULT : newType;
121 if (eNotificationRequired())
122 eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTION__TYPE, oldType, type));
123 }
124
125 /**
126 * <!-- begin-user-doc -->
127 * <!-- end-user-doc -->
128 * @generated
129 */
130 @SuppressWarnings("unchecked")
131 @Override
132 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
133 switch (featureID) {
134 case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
135 return ((InternalEList<InternalEObject>)(InternalEList<?>)getSubElements()).basicAdd(otherEnd, msgs);
136 }
137 return super.eInverseAdd(otherEnd, featureID, msgs);
138 }
139
140 /**
141 * <!-- begin-user-doc -->
142 * <!-- end-user-doc -->
143 * @generated
144 */
145 @Override
146 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
147 switch (featureID) {
148 case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
149 return ((InternalEList<?>)getSubElements()).basicRemove(otherEnd, msgs);
150 }
151 return super.eInverseRemove(otherEnd, featureID, msgs);
152 }
153
154 /**
155 * <!-- begin-user-doc -->
156 * <!-- end-user-doc -->
157 * @generated
158 */
159 @Override
160 public Object eGet(int featureID, boolean resolve, boolean coreType) {
161 switch (featureID) {
162 case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
163 return getSubElements();
164 case FunctionalarchitecturePackage.FUNCTION__TYPE:
165 return getType();
166 }
167 return super.eGet(featureID, resolve, coreType);
168 }
169
170 /**
171 * <!-- begin-user-doc -->
172 * <!-- end-user-doc -->
173 * @generated
174 */
175 @SuppressWarnings("unchecked")
176 @Override
177 public void eSet(int featureID, Object newValue) {
178 switch (featureID) {
179 case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
180 getSubElements().clear();
181 getSubElements().addAll((Collection<? extends FunctionalElement>)newValue);
182 return;
183 case FunctionalarchitecturePackage.FUNCTION__TYPE:
184 setType((FunctionType)newValue);
185 return;
186 }
187 super.eSet(featureID, newValue);
188 }
189
190 /**
191 * <!-- begin-user-doc -->
192 * <!-- end-user-doc -->
193 * @generated
194 */
195 @Override
196 public void eUnset(int featureID) {
197 switch (featureID) {
198 case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
199 getSubElements().clear();
200 return;
201 case FunctionalarchitecturePackage.FUNCTION__TYPE:
202 setType(TYPE_EDEFAULT);
203 return;
204 }
205 super.eUnset(featureID);
206 }
207
208 /**
209 * <!-- begin-user-doc -->
210 * <!-- end-user-doc -->
211 * @generated
212 */
213 @Override
214 public boolean eIsSet(int featureID) {
215 switch (featureID) {
216 case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
217 return subElements != null && !subElements.isEmpty();
218 case FunctionalarchitecturePackage.FUNCTION__TYPE:
219 return type != TYPE_EDEFAULT;
220 }
221 return super.eIsSet(featureID);
222 }
223
224 /**
225 * <!-- begin-user-doc -->
226 * <!-- end-user-doc -->
227 * @generated
228 */
229 @Override
230 public String toString() {
231 if (eIsProxy()) return super.toString();
232
233 StringBuilder result = new StringBuilder(super.toString());
234 result.append(" (type: ");
235 result.append(type);
236 result.append(')');
237 return result.toString();
238 }
239
240} //FunctionImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalArchitectureModelImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalArchitectureModelImpl.java
new file mode 100644
index 00000000..314b7db5
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalArchitectureModelImpl.java
@@ -0,0 +1,153 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.FunctionalArchitectureModel;
6import functionalarchitecture.FunctionalElement;
7import functionalarchitecture.FunctionalarchitecturePackage;
8
9import java.util.Collection;
10
11import org.eclipse.emf.common.notify.NotificationChain;
12
13import org.eclipse.emf.common.util.EList;
14
15import org.eclipse.emf.ecore.EClass;
16import org.eclipse.emf.ecore.InternalEObject;
17
18import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
19
20import org.eclipse.emf.ecore.util.EObjectContainmentEList;
21import org.eclipse.emf.ecore.util.InternalEList;
22
23/**
24 * <!-- begin-user-doc -->
25 * An implementation of the model object '<em><b>Functional Architecture Model</b></em>'.
26 * <!-- end-user-doc -->
27 * <p>
28 * The following features are implemented:
29 * </p>
30 * <ul>
31 * <li>{@link functionalarchitecture.impl.FunctionalArchitectureModelImpl#getRootElements <em>Root Elements</em>}</li>
32 * </ul>
33 *
34 * @generated
35 */
36public class FunctionalArchitectureModelImpl extends MinimalEObjectImpl.Container implements FunctionalArchitectureModel {
37 /**
38 * The cached value of the '{@link #getRootElements() <em>Root Elements</em>}' containment reference list.
39 * <!-- begin-user-doc -->
40 * <!-- end-user-doc -->
41 * @see #getRootElements()
42 * @generated
43 * @ordered
44 */
45 protected EList<FunctionalElement> rootElements;
46
47 /**
48 * <!-- begin-user-doc -->
49 * <!-- end-user-doc -->
50 * @generated
51 */
52 protected FunctionalArchitectureModelImpl() {
53 super();
54 }
55
56 /**
57 * <!-- begin-user-doc -->
58 * <!-- end-user-doc -->
59 * @generated
60 */
61 @Override
62 protected EClass eStaticClass() {
63 return FunctionalarchitecturePackage.Literals.FUNCTIONAL_ARCHITECTURE_MODEL;
64 }
65
66 /**
67 * <!-- begin-user-doc -->
68 * <!-- end-user-doc -->
69 * @generated
70 */
71 @Override
72 public EList<FunctionalElement> getRootElements() {
73 if (rootElements == null) {
74 rootElements = new EObjectContainmentEList<FunctionalElement>(FunctionalElement.class, this, FunctionalarchitecturePackage.FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS);
75 }
76 return rootElements;
77 }
78
79 /**
80 * <!-- begin-user-doc -->
81 * <!-- end-user-doc -->
82 * @generated
83 */
84 @Override
85 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
86 switch (featureID) {
87 case FunctionalarchitecturePackage.FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS:
88 return ((InternalEList<?>)getRootElements()).basicRemove(otherEnd, msgs);
89 }
90 return super.eInverseRemove(otherEnd, featureID, msgs);
91 }
92
93 /**
94 * <!-- begin-user-doc -->
95 * <!-- end-user-doc -->
96 * @generated
97 */
98 @Override
99 public Object eGet(int featureID, boolean resolve, boolean coreType) {
100 switch (featureID) {
101 case FunctionalarchitecturePackage.FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS:
102 return getRootElements();
103 }
104 return super.eGet(featureID, resolve, coreType);
105 }
106
107 /**
108 * <!-- begin-user-doc -->
109 * <!-- end-user-doc -->
110 * @generated
111 */
112 @SuppressWarnings("unchecked")
113 @Override
114 public void eSet(int featureID, Object newValue) {
115 switch (featureID) {
116 case FunctionalarchitecturePackage.FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS:
117 getRootElements().clear();
118 getRootElements().addAll((Collection<? extends FunctionalElement>)newValue);
119 return;
120 }
121 super.eSet(featureID, newValue);
122 }
123
124 /**
125 * <!-- begin-user-doc -->
126 * <!-- end-user-doc -->
127 * @generated
128 */
129 @Override
130 public void eUnset(int featureID) {
131 switch (featureID) {
132 case FunctionalarchitecturePackage.FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS:
133 getRootElements().clear();
134 return;
135 }
136 super.eUnset(featureID);
137 }
138
139 /**
140 * <!-- begin-user-doc -->
141 * <!-- end-user-doc -->
142 * @generated
143 */
144 @Override
145 public boolean eIsSet(int featureID) {
146 switch (featureID) {
147 case FunctionalarchitecturePackage.FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS:
148 return rootElements != null && !rootElements.isEmpty();
149 }
150 return super.eIsSet(featureID);
151 }
152
153} //FunctionalArchitectureModelImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalDataImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalDataImpl.java
new file mode 100644
index 00000000..50028019
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalDataImpl.java
@@ -0,0 +1,270 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.FAMTerminator;
6import functionalarchitecture.FunctionalData;
7import functionalarchitecture.FunctionalarchitecturePackage;
8
9import org.eclipse.emf.common.notify.Notification;
10import org.eclipse.emf.common.notify.NotificationChain;
11
12import org.eclipse.emf.ecore.EClass;
13import org.eclipse.emf.ecore.InternalEObject;
14
15import org.eclipse.emf.ecore.impl.ENotificationImpl;
16import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
17
18import org.eclipse.emf.ecore.util.EcoreUtil;
19
20/**
21 * <!-- begin-user-doc -->
22 * An implementation of the model object '<em><b>Functional Data</b></em>'.
23 * <!-- end-user-doc -->
24 * <p>
25 * The following features are implemented:
26 * </p>
27 * <ul>
28 * <li>{@link functionalarchitecture.impl.FunctionalDataImpl#getTerminator <em>Terminator</em>}</li>
29 * <li>{@link functionalarchitecture.impl.FunctionalDataImpl#getInterface <em>Interface</em>}</li>
30 * </ul>
31 *
32 * @generated
33 */
34public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container implements FunctionalData {
35 /**
36 * The cached value of the '{@link #getTerminator() <em>Terminator</em>}' containment reference.
37 * <!-- begin-user-doc -->
38 * <!-- end-user-doc -->
39 * @see #getTerminator()
40 * @generated
41 * @ordered
42 */
43 protected FAMTerminator terminator;
44
45 /**
46 * <!-- begin-user-doc -->
47 * <!-- end-user-doc -->
48 * @generated
49 */
50 protected FunctionalDataImpl() {
51 super();
52 }
53
54 /**
55 * <!-- begin-user-doc -->
56 * <!-- end-user-doc -->
57 * @generated
58 */
59 @Override
60 protected EClass eStaticClass() {
61 return FunctionalarchitecturePackage.Literals.FUNCTIONAL_DATA;
62 }
63
64 /**
65 * <!-- begin-user-doc -->
66 * <!-- end-user-doc -->
67 * @generated
68 */
69 @Override
70 public FAMTerminator getTerminator() {
71 return terminator;
72 }
73
74 /**
75 * <!-- begin-user-doc -->
76 * <!-- end-user-doc -->
77 * @generated
78 */
79 public NotificationChain basicSetTerminator(FAMTerminator newTerminator, NotificationChain msgs) {
80 FAMTerminator oldTerminator = terminator;
81 terminator = newTerminator;
82 if (eNotificationRequired()) {
83 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR, oldTerminator, newTerminator);
84 if (msgs == null) msgs = notification; else msgs.add(notification);
85 }
86 return msgs;
87 }
88
89 /**
90 * <!-- begin-user-doc -->
91 * <!-- end-user-doc -->
92 * @generated
93 */
94 @Override
95 public void setTerminator(FAMTerminator newTerminator) {
96 if (newTerminator != terminator) {
97 NotificationChain msgs = null;
98 if (terminator != null)
99 msgs = ((InternalEObject)terminator).eInverseRemove(this, FunctionalarchitecturePackage.FAM_TERMINATOR__DATA, FAMTerminator.class, msgs);
100 if (newTerminator != null)
101 msgs = ((InternalEObject)newTerminator).eInverseAdd(this, FunctionalarchitecturePackage.FAM_TERMINATOR__DATA, FAMTerminator.class, msgs);
102 msgs = basicSetTerminator(newTerminator, msgs);
103 if (msgs != null) msgs.dispatch();
104 }
105 else if (eNotificationRequired())
106 eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR, newTerminator, newTerminator));
107 }
108
109 /**
110 * <!-- begin-user-doc -->
111 * <!-- end-user-doc -->
112 * @generated
113 */
114 @Override
115 public functionalarchitecture.FunctionalInterface getInterface() {
116 if (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE) return null;
117 return (functionalarchitecture.FunctionalInterface)eInternalContainer();
118 }
119
120 /**
121 * <!-- begin-user-doc -->
122 * <!-- end-user-doc -->
123 * @generated
124 */
125 public NotificationChain basicSetInterface(functionalarchitecture.FunctionalInterface newInterface, NotificationChain msgs) {
126 msgs = eBasicSetContainer((InternalEObject)newInterface, FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE, msgs);
127 return msgs;
128 }
129
130 /**
131 * <!-- begin-user-doc -->
132 * <!-- end-user-doc -->
133 * @generated
134 */
135 @Override
136 public void setInterface(functionalarchitecture.FunctionalInterface newInterface) {
137 if (newInterface != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE && newInterface != null)) {
138 if (EcoreUtil.isAncestor(this, newInterface))
139 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
140 NotificationChain msgs = null;
141 if (eInternalContainer() != null)
142 msgs = eBasicRemoveFromContainer(msgs);
143 if (newInterface != null)
144 msgs = ((InternalEObject)newInterface).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA, functionalarchitecture.FunctionalInterface.class, msgs);
145 msgs = basicSetInterface(newInterface, msgs);
146 if (msgs != null) msgs.dispatch();
147 }
148 else if (eNotificationRequired())
149 eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE, newInterface, newInterface));
150 }
151
152 /**
153 * <!-- begin-user-doc -->
154 * <!-- end-user-doc -->
155 * @generated
156 */
157 @Override
158 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
159 switch (featureID) {
160 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR:
161 if (terminator != null)
162 msgs = ((InternalEObject)terminator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR, null, msgs);
163 return basicSetTerminator((FAMTerminator)otherEnd, msgs);
164 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE:
165 if (eInternalContainer() != null)
166 msgs = eBasicRemoveFromContainer(msgs);
167 return basicSetInterface((functionalarchitecture.FunctionalInterface)otherEnd, msgs);
168 }
169 return super.eInverseAdd(otherEnd, featureID, msgs);
170 }
171
172 /**
173 * <!-- begin-user-doc -->
174 * <!-- end-user-doc -->
175 * @generated
176 */
177 @Override
178 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
179 switch (featureID) {
180 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR:
181 return basicSetTerminator(null, msgs);
182 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE:
183 return basicSetInterface(null, msgs);
184 }
185 return super.eInverseRemove(otherEnd, featureID, msgs);
186 }
187
188 /**
189 * <!-- begin-user-doc -->
190 * <!-- end-user-doc -->
191 * @generated
192 */
193 @Override
194 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
195 switch (eContainerFeatureID()) {
196 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE:
197 return eInternalContainer().eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA, functionalarchitecture.FunctionalInterface.class, msgs);
198 }
199 return super.eBasicRemoveFromContainerFeature(msgs);
200 }
201
202 /**
203 * <!-- begin-user-doc -->
204 * <!-- end-user-doc -->
205 * @generated
206 */
207 @Override
208 public Object eGet(int featureID, boolean resolve, boolean coreType) {
209 switch (featureID) {
210 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR:
211 return getTerminator();
212 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE:
213 return getInterface();
214 }
215 return super.eGet(featureID, resolve, coreType);
216 }
217
218 /**
219 * <!-- begin-user-doc -->
220 * <!-- end-user-doc -->
221 * @generated
222 */
223 @Override
224 public void eSet(int featureID, Object newValue) {
225 switch (featureID) {
226 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR:
227 setTerminator((FAMTerminator)newValue);
228 return;
229 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE:
230 setInterface((functionalarchitecture.FunctionalInterface)newValue);
231 return;
232 }
233 super.eSet(featureID, newValue);
234 }
235
236 /**
237 * <!-- begin-user-doc -->
238 * <!-- end-user-doc -->
239 * @generated
240 */
241 @Override
242 public void eUnset(int featureID) {
243 switch (featureID) {
244 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR:
245 setTerminator((FAMTerminator)null);
246 return;
247 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE:
248 setInterface((functionalarchitecture.FunctionalInterface)null);
249 return;
250 }
251 super.eUnset(featureID);
252 }
253
254 /**
255 * <!-- begin-user-doc -->
256 * <!-- end-user-doc -->
257 * @generated
258 */
259 @Override
260 public boolean eIsSet(int featureID) {
261 switch (featureID) {
262 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__TERMINATOR:
263 return terminator != null;
264 case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE:
265 return getInterface() != null;
266 }
267 return super.eIsSet(featureID);
268 }
269
270} //FunctionalDataImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalElementImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalElementImpl.java
new file mode 100644
index 00000000..2690bcbd
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalElementImpl.java
@@ -0,0 +1,318 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.Function;
6import functionalarchitecture.FunctionalArchitectureModel;
7import functionalarchitecture.FunctionalElement;
8import functionalarchitecture.FunctionalarchitecturePackage;
9
10import org.eclipse.emf.common.notify.Notification;
11import org.eclipse.emf.common.notify.NotificationChain;
12
13import org.eclipse.emf.ecore.EClass;
14import org.eclipse.emf.ecore.InternalEObject;
15
16import org.eclipse.emf.ecore.impl.ENotificationImpl;
17import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
18
19import org.eclipse.emf.ecore.util.EcoreUtil;
20
21/**
22 * <!-- begin-user-doc -->
23 * An implementation of the model object '<em><b>Functional Element</b></em>'.
24 * <!-- end-user-doc -->
25 * <p>
26 * The following features are implemented:
27 * </p>
28 * <ul>
29 * <li>{@link functionalarchitecture.impl.FunctionalElementImpl#getInterface <em>Interface</em>}</li>
30 * <li>{@link functionalarchitecture.impl.FunctionalElementImpl#getModel <em>Model</em>}</li>
31 * <li>{@link functionalarchitecture.impl.FunctionalElementImpl#getParent <em>Parent</em>}</li>
32 * </ul>
33 *
34 * @generated
35 */
36public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container implements FunctionalElement {
37 /**
38 * The cached value of the '{@link #getInterface() <em>Interface</em>}' containment reference.
39 * <!-- begin-user-doc -->
40 * <!-- end-user-doc -->
41 * @see #getInterface()
42 * @generated
43 * @ordered
44 */
45 protected functionalarchitecture.FunctionalInterface interface_;
46
47 /**
48 * <!-- begin-user-doc -->
49 * <!-- end-user-doc -->
50 * @generated
51 */
52 protected FunctionalElementImpl() {
53 super();
54 }
55
56 /**
57 * <!-- begin-user-doc -->
58 * <!-- end-user-doc -->
59 * @generated
60 */
61 @Override
62 protected EClass eStaticClass() {
63 return FunctionalarchitecturePackage.Literals.FUNCTIONAL_ELEMENT;
64 }
65
66 /**
67 * <!-- begin-user-doc -->
68 * <!-- end-user-doc -->
69 * @generated
70 */
71 @Override
72 public functionalarchitecture.FunctionalInterface getInterface() {
73 return interface_;
74 }
75
76 /**
77 * <!-- begin-user-doc -->
78 * <!-- end-user-doc -->
79 * @generated
80 */
81 public NotificationChain basicSetInterface(functionalarchitecture.FunctionalInterface newInterface, NotificationChain msgs) {
82 functionalarchitecture.FunctionalInterface oldInterface = interface_;
83 interface_ = newInterface;
84 if (eNotificationRequired()) {
85 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE, oldInterface, newInterface);
86 if (msgs == null) msgs = notification; else msgs.add(notification);
87 }
88 return msgs;
89 }
90
91 /**
92 * <!-- begin-user-doc -->
93 * <!-- end-user-doc -->
94 * @generated
95 */
96 @Override
97 public void setInterface(functionalarchitecture.FunctionalInterface newInterface) {
98 if (newInterface != interface_) {
99 NotificationChain msgs = null;
100 if (interface_ != null)
101 msgs = ((InternalEObject)interface_).eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT, functionalarchitecture.FunctionalInterface.class, msgs);
102 if (newInterface != null)
103 msgs = ((InternalEObject)newInterface).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT, functionalarchitecture.FunctionalInterface.class, msgs);
104 msgs = basicSetInterface(newInterface, msgs);
105 if (msgs != null) msgs.dispatch();
106 }
107 else if (eNotificationRequired())
108 eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE, newInterface, newInterface));
109 }
110
111 /**
112 * <!-- begin-user-doc -->
113 * <!-- end-user-doc -->
114 * @generated
115 */
116 @Override
117 public FunctionalArchitectureModel getModel() {
118 FunctionalArchitectureModel model = basicGetModel();
119 return model != null && model.eIsProxy() ? (FunctionalArchitectureModel)eResolveProxy((InternalEObject)model) : model;
120 }
121
122 /**
123 * <!-- begin-user-doc -->
124 * <!-- end-user-doc -->
125 * @generated
126 */
127 public FunctionalArchitectureModel basicGetModel() {
128 // TODO: implement this method to return the 'Model' reference
129 // -> do not perform proxy resolution
130 // Ensure that you remove @generated or mark it @generated NOT
131 throw new UnsupportedOperationException();
132 }
133
134 /**
135 * <!-- begin-user-doc -->
136 * <!-- end-user-doc -->
137 * @generated
138 */
139 @Override
140 public void setModel(FunctionalArchitectureModel newModel) {
141 // TODO: implement this method to set the 'Model' reference
142 // Ensure that you remove @generated or mark it @generated NOT
143 throw new UnsupportedOperationException();
144 }
145
146 /**
147 * <!-- begin-user-doc -->
148 * <!-- end-user-doc -->
149 * @generated
150 */
151 @Override
152 public Function getParent() {
153 if (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT) return null;
154 return (Function)eInternalContainer();
155 }
156
157 /**
158 * <!-- begin-user-doc -->
159 * <!-- end-user-doc -->
160 * @generated
161 */
162 public NotificationChain basicSetParent(Function newParent, NotificationChain msgs) {
163 msgs = eBasicSetContainer((InternalEObject)newParent, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT, msgs);
164 return msgs;
165 }
166
167 /**
168 * <!-- begin-user-doc -->
169 * <!-- end-user-doc -->
170 * @generated
171 */
172 @Override
173 public void setParent(Function newParent) {
174 if (newParent != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT && newParent != null)) {
175 if (EcoreUtil.isAncestor(this, newParent))
176 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
177 NotificationChain msgs = null;
178 if (eInternalContainer() != null)
179 msgs = eBasicRemoveFromContainer(msgs);
180 if (newParent != null)
181 msgs = ((InternalEObject)newParent).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS, Function.class, msgs);
182 msgs = basicSetParent(newParent, msgs);
183 if (msgs != null) msgs.dispatch();
184 }
185 else if (eNotificationRequired())
186 eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT, newParent, newParent));
187 }
188
189 /**
190 * <!-- begin-user-doc -->
191 * <!-- end-user-doc -->
192 * @generated
193 */
194 @Override
195 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
196 switch (featureID) {
197 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE:
198 if (interface_ != null)
199 msgs = ((InternalEObject)interface_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE, null, msgs);
200 return basicSetInterface((functionalarchitecture.FunctionalInterface)otherEnd, msgs);
201 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT:
202 if (eInternalContainer() != null)
203 msgs = eBasicRemoveFromContainer(msgs);
204 return basicSetParent((Function)otherEnd, msgs);
205 }
206 return super.eInverseAdd(otherEnd, featureID, msgs);
207 }
208
209 /**
210 * <!-- begin-user-doc -->
211 * <!-- end-user-doc -->
212 * @generated
213 */
214 @Override
215 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
216 switch (featureID) {
217 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE:
218 return basicSetInterface(null, msgs);
219 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT:
220 return basicSetParent(null, msgs);
221 }
222 return super.eInverseRemove(otherEnd, featureID, msgs);
223 }
224
225 /**
226 * <!-- begin-user-doc -->
227 * <!-- end-user-doc -->
228 * @generated
229 */
230 @Override
231 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
232 switch (eContainerFeatureID()) {
233 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT:
234 return eInternalContainer().eInverseRemove(this, FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS, Function.class, msgs);
235 }
236 return super.eBasicRemoveFromContainerFeature(msgs);
237 }
238
239 /**
240 * <!-- begin-user-doc -->
241 * <!-- end-user-doc -->
242 * @generated
243 */
244 @Override
245 public Object eGet(int featureID, boolean resolve, boolean coreType) {
246 switch (featureID) {
247 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE:
248 return getInterface();
249 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__MODEL:
250 if (resolve) return getModel();
251 return basicGetModel();
252 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT:
253 return getParent();
254 }
255 return super.eGet(featureID, resolve, coreType);
256 }
257
258 /**
259 * <!-- begin-user-doc -->
260 * <!-- end-user-doc -->
261 * @generated
262 */
263 @Override
264 public void eSet(int featureID, Object newValue) {
265 switch (featureID) {
266 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE:
267 setInterface((functionalarchitecture.FunctionalInterface)newValue);
268 return;
269 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__MODEL:
270 setModel((FunctionalArchitectureModel)newValue);
271 return;
272 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT:
273 setParent((Function)newValue);
274 return;
275 }
276 super.eSet(featureID, newValue);
277 }
278
279 /**
280 * <!-- begin-user-doc -->
281 * <!-- end-user-doc -->
282 * @generated
283 */
284 @Override
285 public void eUnset(int featureID) {
286 switch (featureID) {
287 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE:
288 setInterface((functionalarchitecture.FunctionalInterface)null);
289 return;
290 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__MODEL:
291 setModel((FunctionalArchitectureModel)null);
292 return;
293 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT:
294 setParent((Function)null);
295 return;
296 }
297 super.eUnset(featureID);
298 }
299
300 /**
301 * <!-- begin-user-doc -->
302 * <!-- end-user-doc -->
303 * @generated
304 */
305 @Override
306 public boolean eIsSet(int featureID) {
307 switch (featureID) {
308 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE:
309 return interface_ != null;
310 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__MODEL:
311 return basicGetModel() != null;
312 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT:
313 return getParent() != null;
314 }
315 return super.eIsSet(featureID);
316 }
317
318} //FunctionalElementImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalInputImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalInputImpl.java
new file mode 100644
index 00000000..01aac03a
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalInputImpl.java
@@ -0,0 +1,166 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.FunctionalInput;
6import functionalarchitecture.FunctionalarchitecturePackage;
7import functionalarchitecture.InformationLink;
8
9import java.util.Collection;
10
11import org.eclipse.emf.common.notify.NotificationChain;
12
13import org.eclipse.emf.common.util.EList;
14
15import org.eclipse.emf.ecore.EClass;
16import org.eclipse.emf.ecore.InternalEObject;
17
18import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
19import org.eclipse.emf.ecore.util.InternalEList;
20
21/**
22 * <!-- begin-user-doc -->
23 * An implementation of the model object '<em><b>Functional Input</b></em>'.
24 * <!-- end-user-doc -->
25 * <p>
26 * The following features are implemented:
27 * </p>
28 * <ul>
29 * <li>{@link functionalarchitecture.impl.FunctionalInputImpl#getIncomingLinks <em>Incoming Links</em>}</li>
30 * </ul>
31 *
32 * @generated
33 */
34public class FunctionalInputImpl extends FunctionalDataImpl implements FunctionalInput {
35 /**
36 * The cached value of the '{@link #getIncomingLinks() <em>Incoming Links</em>}' reference list.
37 * <!-- begin-user-doc -->
38 * <!-- end-user-doc -->
39 * @see #getIncomingLinks()
40 * @generated
41 * @ordered
42 */
43 protected EList<InformationLink> incomingLinks;
44
45 /**
46 * <!-- begin-user-doc -->
47 * <!-- end-user-doc -->
48 * @generated
49 */
50 protected FunctionalInputImpl() {
51 super();
52 }
53
54 /**
55 * <!-- begin-user-doc -->
56 * <!-- end-user-doc -->
57 * @generated
58 */
59 @Override
60 protected EClass eStaticClass() {
61 return FunctionalarchitecturePackage.Literals.FUNCTIONAL_INPUT;
62 }
63
64 /**
65 * <!-- begin-user-doc -->
66 * <!-- end-user-doc -->
67 * @generated
68 */
69 @Override
70 public EList<InformationLink> getIncomingLinks() {
71 if (incomingLinks == null) {
72 incomingLinks = new EObjectWithInverseResolvingEList<InformationLink>(InformationLink.class, this, FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS, FunctionalarchitecturePackage.INFORMATION_LINK__TO);
73 }
74 return incomingLinks;
75 }
76
77 /**
78 * <!-- begin-user-doc -->
79 * <!-- end-user-doc -->
80 * @generated
81 */
82 @SuppressWarnings("unchecked")
83 @Override
84 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
85 switch (featureID) {
86 case FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS:
87 return ((InternalEList<InternalEObject>)(InternalEList<?>)getIncomingLinks()).basicAdd(otherEnd, msgs);
88 }
89 return super.eInverseAdd(otherEnd, featureID, msgs);
90 }
91
92 /**
93 * <!-- begin-user-doc -->
94 * <!-- end-user-doc -->
95 * @generated
96 */
97 @Override
98 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
99 switch (featureID) {
100 case FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS:
101 return ((InternalEList<?>)getIncomingLinks()).basicRemove(otherEnd, msgs);
102 }
103 return super.eInverseRemove(otherEnd, featureID, msgs);
104 }
105
106 /**
107 * <!-- begin-user-doc -->
108 * <!-- end-user-doc -->
109 * @generated
110 */
111 @Override
112 public Object eGet(int featureID, boolean resolve, boolean coreType) {
113 switch (featureID) {
114 case FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS:
115 return getIncomingLinks();
116 }
117 return super.eGet(featureID, resolve, coreType);
118 }
119
120 /**
121 * <!-- begin-user-doc -->
122 * <!-- end-user-doc -->
123 * @generated
124 */
125 @SuppressWarnings("unchecked")
126 @Override
127 public void eSet(int featureID, Object newValue) {
128 switch (featureID) {
129 case FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS:
130 getIncomingLinks().clear();
131 getIncomingLinks().addAll((Collection<? extends InformationLink>)newValue);
132 return;
133 }
134 super.eSet(featureID, newValue);
135 }
136
137 /**
138 * <!-- begin-user-doc -->
139 * <!-- end-user-doc -->
140 * @generated
141 */
142 @Override
143 public void eUnset(int featureID) {
144 switch (featureID) {
145 case FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS:
146 getIncomingLinks().clear();
147 return;
148 }
149 super.eUnset(featureID);
150 }
151
152 /**
153 * <!-- begin-user-doc -->
154 * <!-- end-user-doc -->
155 * @generated
156 */
157 @Override
158 public boolean eIsSet(int featureID) {
159 switch (featureID) {
160 case FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS:
161 return incomingLinks != null && !incomingLinks.isEmpty();
162 }
163 return super.eIsSet(featureID);
164 }
165
166} //FunctionalInputImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalInterfaceImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalInterfaceImpl.java
new file mode 100644
index 00000000..fe7f4e75
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalInterfaceImpl.java
@@ -0,0 +1,245 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.FunctionalData;
6import functionalarchitecture.FunctionalElement;
7import functionalarchitecture.FunctionalarchitecturePackage;
8
9import java.util.Collection;
10
11import org.eclipse.emf.common.notify.Notification;
12import org.eclipse.emf.common.notify.NotificationChain;
13
14import org.eclipse.emf.common.util.EList;
15
16import org.eclipse.emf.ecore.EClass;
17import org.eclipse.emf.ecore.InternalEObject;
18
19import org.eclipse.emf.ecore.impl.ENotificationImpl;
20import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
21
22import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
23import org.eclipse.emf.ecore.util.EcoreUtil;
24import org.eclipse.emf.ecore.util.InternalEList;
25
26/**
27 * <!-- begin-user-doc -->
28 * An implementation of the model object '<em><b>Functional Interface</b></em>'.
29 * <!-- end-user-doc -->
30 * <p>
31 * The following features are implemented:
32 * </p>
33 * <ul>
34 * <li>{@link functionalarchitecture.impl.FunctionalInterfaceImpl#getData <em>Data</em>}</li>
35 * <li>{@link functionalarchitecture.impl.FunctionalInterfaceImpl#getElement <em>Element</em>}</li>
36 * </ul>
37 *
38 * @generated
39 */
40public class FunctionalInterfaceImpl extends MinimalEObjectImpl.Container implements functionalarchitecture.FunctionalInterface {
41 /**
42 * The cached value of the '{@link #getData() <em>Data</em>}' containment reference list.
43 * <!-- begin-user-doc -->
44 * <!-- end-user-doc -->
45 * @see #getData()
46 * @generated
47 * @ordered
48 */
49 protected EList<FunctionalData> data;
50
51 /**
52 * <!-- begin-user-doc -->
53 * <!-- end-user-doc -->
54 * @generated
55 */
56 protected FunctionalInterfaceImpl() {
57 super();
58 }
59
60 /**
61 * <!-- begin-user-doc -->
62 * <!-- end-user-doc -->
63 * @generated
64 */
65 @Override
66 protected EClass eStaticClass() {
67 return FunctionalarchitecturePackage.Literals.FUNCTIONAL_INTERFACE;
68 }
69
70 /**
71 * <!-- begin-user-doc -->
72 * <!-- end-user-doc -->
73 * @generated
74 */
75 @Override
76 public EList<FunctionalData> getData() {
77 if (data == null) {
78 data = new EObjectContainmentWithInverseEList<FunctionalData>(FunctionalData.class, this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA, FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE);
79 }
80 return data;
81 }
82
83 /**
84 * <!-- begin-user-doc -->
85 * <!-- end-user-doc -->
86 * @generated
87 */
88 @Override
89 public FunctionalElement getElement() {
90 if (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT) return null;
91 return (FunctionalElement)eInternalContainer();
92 }
93
94 /**
95 * <!-- begin-user-doc -->
96 * <!-- end-user-doc -->
97 * @generated
98 */
99 public NotificationChain basicSetElement(FunctionalElement newElement, NotificationChain msgs) {
100 msgs = eBasicSetContainer((InternalEObject)newElement, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT, msgs);
101 return msgs;
102 }
103
104 /**
105 * <!-- begin-user-doc -->
106 * <!-- end-user-doc -->
107 * @generated
108 */
109 @Override
110 public void setElement(FunctionalElement newElement) {
111 if (newElement != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT && newElement != null)) {
112 if (EcoreUtil.isAncestor(this, newElement))
113 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
114 NotificationChain msgs = null;
115 if (eInternalContainer() != null)
116 msgs = eBasicRemoveFromContainer(msgs);
117 if (newElement != null)
118 msgs = ((InternalEObject)newElement).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE, FunctionalElement.class, msgs);
119 msgs = basicSetElement(newElement, msgs);
120 if (msgs != null) msgs.dispatch();
121 }
122 else if (eNotificationRequired())
123 eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT, newElement, newElement));
124 }
125
126 /**
127 * <!-- begin-user-doc -->
128 * <!-- end-user-doc -->
129 * @generated
130 */
131 @SuppressWarnings("unchecked")
132 @Override
133 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
134 switch (featureID) {
135 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA:
136 return ((InternalEList<InternalEObject>)(InternalEList<?>)getData()).basicAdd(otherEnd, msgs);
137 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT:
138 if (eInternalContainer() != null)
139 msgs = eBasicRemoveFromContainer(msgs);
140 return basicSetElement((FunctionalElement)otherEnd, msgs);
141 }
142 return super.eInverseAdd(otherEnd, featureID, msgs);
143 }
144
145 /**
146 * <!-- begin-user-doc -->
147 * <!-- end-user-doc -->
148 * @generated
149 */
150 @Override
151 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
152 switch (featureID) {
153 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA:
154 return ((InternalEList<?>)getData()).basicRemove(otherEnd, msgs);
155 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT:
156 return basicSetElement(null, msgs);
157 }
158 return super.eInverseRemove(otherEnd, featureID, msgs);
159 }
160
161 /**
162 * <!-- begin-user-doc -->
163 * <!-- end-user-doc -->
164 * @generated
165 */
166 @Override
167 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
168 switch (eContainerFeatureID()) {
169 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT:
170 return eInternalContainer().eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE, FunctionalElement.class, msgs);
171 }
172 return super.eBasicRemoveFromContainerFeature(msgs);
173 }
174
175 /**
176 * <!-- begin-user-doc -->
177 * <!-- end-user-doc -->
178 * @generated
179 */
180 @Override
181 public Object eGet(int featureID, boolean resolve, boolean coreType) {
182 switch (featureID) {
183 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA:
184 return getData();
185 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT:
186 return getElement();
187 }
188 return super.eGet(featureID, resolve, coreType);
189 }
190
191 /**
192 * <!-- begin-user-doc -->
193 * <!-- end-user-doc -->
194 * @generated
195 */
196 @SuppressWarnings("unchecked")
197 @Override
198 public void eSet(int featureID, Object newValue) {
199 switch (featureID) {
200 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA:
201 getData().clear();
202 getData().addAll((Collection<? extends FunctionalData>)newValue);
203 return;
204 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT:
205 setElement((FunctionalElement)newValue);
206 return;
207 }
208 super.eSet(featureID, newValue);
209 }
210
211 /**
212 * <!-- begin-user-doc -->
213 * <!-- end-user-doc -->
214 * @generated
215 */
216 @Override
217 public void eUnset(int featureID) {
218 switch (featureID) {
219 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA:
220 getData().clear();
221 return;
222 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT:
223 setElement((FunctionalElement)null);
224 return;
225 }
226 super.eUnset(featureID);
227 }
228
229 /**
230 * <!-- begin-user-doc -->
231 * <!-- end-user-doc -->
232 * @generated
233 */
234 @Override
235 public boolean eIsSet(int featureID) {
236 switch (featureID) {
237 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA:
238 return data != null && !data.isEmpty();
239 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT:
240 return getElement() != null;
241 }
242 return super.eIsSet(featureID);
243 }
244
245} //FunctionalInterfaceImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalOutputImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalOutputImpl.java
new file mode 100644
index 00000000..064dd99c
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalOutputImpl.java
@@ -0,0 +1,166 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.FunctionalOutput;
6import functionalarchitecture.FunctionalarchitecturePackage;
7import functionalarchitecture.InformationLink;
8
9import java.util.Collection;
10
11import org.eclipse.emf.common.notify.NotificationChain;
12
13import org.eclipse.emf.common.util.EList;
14
15import org.eclipse.emf.ecore.EClass;
16import org.eclipse.emf.ecore.InternalEObject;
17
18import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
19import org.eclipse.emf.ecore.util.InternalEList;
20
21/**
22 * <!-- begin-user-doc -->
23 * An implementation of the model object '<em><b>Functional Output</b></em>'.
24 * <!-- end-user-doc -->
25 * <p>
26 * The following features are implemented:
27 * </p>
28 * <ul>
29 * <li>{@link functionalarchitecture.impl.FunctionalOutputImpl#getOutgoingLinks <em>Outgoing Links</em>}</li>
30 * </ul>
31 *
32 * @generated
33 */
34public class FunctionalOutputImpl extends FunctionalDataImpl implements FunctionalOutput {
35 /**
36 * The cached value of the '{@link #getOutgoingLinks() <em>Outgoing Links</em>}' containment reference list.
37 * <!-- begin-user-doc -->
38 * <!-- end-user-doc -->
39 * @see #getOutgoingLinks()
40 * @generated
41 * @ordered
42 */
43 protected EList<InformationLink> outgoingLinks;
44
45 /**
46 * <!-- begin-user-doc -->
47 * <!-- end-user-doc -->
48 * @generated
49 */
50 protected FunctionalOutputImpl() {
51 super();
52 }
53
54 /**
55 * <!-- begin-user-doc -->
56 * <!-- end-user-doc -->
57 * @generated
58 */
59 @Override
60 protected EClass eStaticClass() {
61 return FunctionalarchitecturePackage.Literals.FUNCTIONAL_OUTPUT;
62 }
63
64 /**
65 * <!-- begin-user-doc -->
66 * <!-- end-user-doc -->
67 * @generated
68 */
69 @Override
70 public EList<InformationLink> getOutgoingLinks() {
71 if (outgoingLinks == null) {
72 outgoingLinks = new EObjectContainmentWithInverseEList<InformationLink>(InformationLink.class, this, FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS, FunctionalarchitecturePackage.INFORMATION_LINK__FROM);
73 }
74 return outgoingLinks;
75 }
76
77 /**
78 * <!-- begin-user-doc -->
79 * <!-- end-user-doc -->
80 * @generated
81 */
82 @SuppressWarnings("unchecked")
83 @Override
84 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
85 switch (featureID) {
86 case FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS:
87 return ((InternalEList<InternalEObject>)(InternalEList<?>)getOutgoingLinks()).basicAdd(otherEnd, msgs);
88 }
89 return super.eInverseAdd(otherEnd, featureID, msgs);
90 }
91
92 /**
93 * <!-- begin-user-doc -->
94 * <!-- end-user-doc -->
95 * @generated
96 */
97 @Override
98 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
99 switch (featureID) {
100 case FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS:
101 return ((InternalEList<?>)getOutgoingLinks()).basicRemove(otherEnd, msgs);
102 }
103 return super.eInverseRemove(otherEnd, featureID, msgs);
104 }
105
106 /**
107 * <!-- begin-user-doc -->
108 * <!-- end-user-doc -->
109 * @generated
110 */
111 @Override
112 public Object eGet(int featureID, boolean resolve, boolean coreType) {
113 switch (featureID) {
114 case FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS:
115 return getOutgoingLinks();
116 }
117 return super.eGet(featureID, resolve, coreType);
118 }
119
120 /**
121 * <!-- begin-user-doc -->
122 * <!-- end-user-doc -->
123 * @generated
124 */
125 @SuppressWarnings("unchecked")
126 @Override
127 public void eSet(int featureID, Object newValue) {
128 switch (featureID) {
129 case FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS:
130 getOutgoingLinks().clear();
131 getOutgoingLinks().addAll((Collection<? extends InformationLink>)newValue);
132 return;
133 }
134 super.eSet(featureID, newValue);
135 }
136
137 /**
138 * <!-- begin-user-doc -->
139 * <!-- end-user-doc -->
140 * @generated
141 */
142 @Override
143 public void eUnset(int featureID) {
144 switch (featureID) {
145 case FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS:
146 getOutgoingLinks().clear();
147 return;
148 }
149 super.eUnset(featureID);
150 }
151
152 /**
153 * <!-- begin-user-doc -->
154 * <!-- end-user-doc -->
155 * @generated
156 */
157 @Override
158 public boolean eIsSet(int featureID) {
159 switch (featureID) {
160 case FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS:
161 return outgoingLinks != null && !outgoingLinks.isEmpty();
162 }
163 return super.eIsSet(featureID);
164 }
165
166} //FunctionalOutputImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalarchitectureFactoryImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalarchitectureFactoryImpl.java
new file mode 100644
index 00000000..814aa62e
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalarchitectureFactoryImpl.java
@@ -0,0 +1,228 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.FAMTerminator;
6import functionalarchitecture.Function;
7import functionalarchitecture.FunctionType;
8import functionalarchitecture.FunctionalArchitectureModel;
9import functionalarchitecture.FunctionalInput;
10import functionalarchitecture.FunctionalOutput;
11import functionalarchitecture.FunctionalarchitectureFactory;
12import functionalarchitecture.FunctionalarchitecturePackage;
13import functionalarchitecture.InformationLink;
14
15import org.eclipse.emf.ecore.EClass;
16import org.eclipse.emf.ecore.EDataType;
17import org.eclipse.emf.ecore.EObject;
18import org.eclipse.emf.ecore.EPackage;
19
20import org.eclipse.emf.ecore.impl.EFactoryImpl;
21
22import org.eclipse.emf.ecore.plugin.EcorePlugin;
23
24/**
25 * <!-- begin-user-doc -->
26 * An implementation of the model <b>Factory</b>.
27 * <!-- end-user-doc -->
28 * @generated
29 */
30public class FunctionalarchitectureFactoryImpl extends EFactoryImpl implements FunctionalarchitectureFactory {
31 /**
32 * Creates the default factory implementation.
33 * <!-- begin-user-doc -->
34 * <!-- end-user-doc -->
35 * @generated
36 */
37 public static FunctionalarchitectureFactory init() {
38 try {
39 FunctionalarchitectureFactory theFunctionalarchitectureFactory = (FunctionalarchitectureFactory)EPackage.Registry.INSTANCE.getEFactory(FunctionalarchitecturePackage.eNS_URI);
40 if (theFunctionalarchitectureFactory != null) {
41 return theFunctionalarchitectureFactory;
42 }
43 }
44 catch (Exception exception) {
45 EcorePlugin.INSTANCE.log(exception);
46 }
47 return new FunctionalarchitectureFactoryImpl();
48 }
49
50 /**
51 * Creates an instance of the factory.
52 * <!-- begin-user-doc -->
53 * <!-- end-user-doc -->
54 * @generated
55 */
56 public FunctionalarchitectureFactoryImpl() {
57 super();
58 }
59
60 /**
61 * <!-- begin-user-doc -->
62 * <!-- end-user-doc -->
63 * @generated
64 */
65 @Override
66 public EObject create(EClass eClass) {
67 switch (eClass.getClassifierID()) {
68 case FunctionalarchitecturePackage.FUNCTIONAL_ARCHITECTURE_MODEL: return createFunctionalArchitectureModel();
69 case FunctionalarchitecturePackage.FUNCTION: return createFunction();
70 case FunctionalarchitecturePackage.FAM_TERMINATOR: return createFAMTerminator();
71 case FunctionalarchitecturePackage.INFORMATION_LINK: return createInformationLink();
72 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE: return createFunctionalInterface();
73 case FunctionalarchitecturePackage.FUNCTIONAL_INPUT: return createFunctionalInput();
74 case FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT: return createFunctionalOutput();
75 default:
76 throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
77 }
78 }
79
80 /**
81 * <!-- begin-user-doc -->
82 * <!-- end-user-doc -->
83 * @generated
84 */
85 @Override
86 public Object createFromString(EDataType eDataType, String initialValue) {
87 switch (eDataType.getClassifierID()) {
88 case FunctionalarchitecturePackage.FUNCTION_TYPE:
89 return createFunctionTypeFromString(eDataType, initialValue);
90 default:
91 throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
92 }
93 }
94
95 /**
96 * <!-- begin-user-doc -->
97 * <!-- end-user-doc -->
98 * @generated
99 */
100 @Override
101 public String convertToString(EDataType eDataType, Object instanceValue) {
102 switch (eDataType.getClassifierID()) {
103 case FunctionalarchitecturePackage.FUNCTION_TYPE:
104 return convertFunctionTypeToString(eDataType, instanceValue);
105 default:
106 throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
107 }
108 }
109
110 /**
111 * <!-- begin-user-doc -->
112 * <!-- end-user-doc -->
113 * @generated
114 */
115 @Override
116 public FunctionalArchitectureModel createFunctionalArchitectureModel() {
117 FunctionalArchitectureModelImpl functionalArchitectureModel = new FunctionalArchitectureModelImpl();
118 return functionalArchitectureModel;
119 }
120
121 /**
122 * <!-- begin-user-doc -->
123 * <!-- end-user-doc -->
124 * @generated
125 */
126 @Override
127 public Function createFunction() {
128 FunctionImpl function = new FunctionImpl();
129 return function;
130 }
131
132 /**
133 * <!-- begin-user-doc -->
134 * <!-- end-user-doc -->
135 * @generated
136 */
137 @Override
138 public FAMTerminator createFAMTerminator() {
139 FAMTerminatorImpl famTerminator = new FAMTerminatorImpl();
140 return famTerminator;
141 }
142
143 /**
144 * <!-- begin-user-doc -->
145 * <!-- end-user-doc -->
146 * @generated
147 */
148 @Override
149 public InformationLink createInformationLink() {
150 InformationLinkImpl informationLink = new InformationLinkImpl();
151 return informationLink;
152 }
153
154 /**
155 * <!-- begin-user-doc -->
156 * <!-- end-user-doc -->
157 * @generated
158 */
159 @Override
160 public functionalarchitecture.FunctionalInterface createFunctionalInterface() {
161 FunctionalInterfaceImpl functionalInterface = new FunctionalInterfaceImpl();
162 return functionalInterface;
163 }
164
165 /**
166 * <!-- begin-user-doc -->
167 * <!-- end-user-doc -->
168 * @generated
169 */
170 @Override
171 public FunctionalInput createFunctionalInput() {
172 FunctionalInputImpl functionalInput = new FunctionalInputImpl();
173 return functionalInput;
174 }
175
176 /**
177 * <!-- begin-user-doc -->
178 * <!-- end-user-doc -->
179 * @generated
180 */
181 @Override
182 public FunctionalOutput createFunctionalOutput() {
183 FunctionalOutputImpl functionalOutput = new FunctionalOutputImpl();
184 return functionalOutput;
185 }
186
187 /**
188 * <!-- begin-user-doc -->
189 * <!-- end-user-doc -->
190 * @generated
191 */
192 public FunctionType createFunctionTypeFromString(EDataType eDataType, String initialValue) {
193 FunctionType result = FunctionType.get(initialValue);
194 if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
195 return result;
196 }
197
198 /**
199 * <!-- begin-user-doc -->
200 * <!-- end-user-doc -->
201 * @generated
202 */
203 public String convertFunctionTypeToString(EDataType eDataType, Object instanceValue) {
204 return instanceValue == null ? null : instanceValue.toString();
205 }
206
207 /**
208 * <!-- begin-user-doc -->
209 * <!-- end-user-doc -->
210 * @generated
211 */
212 @Override
213 public FunctionalarchitecturePackage getFunctionalarchitecturePackage() {
214 return (FunctionalarchitecturePackage)getEPackage();
215 }
216
217 /**
218 * <!-- begin-user-doc -->
219 * <!-- end-user-doc -->
220 * @deprecated
221 * @generated
222 */
223 @Deprecated
224 public static FunctionalarchitecturePackage getPackage() {
225 return FunctionalarchitecturePackage.eINSTANCE;
226 }
227
228} //FunctionalarchitectureFactoryImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalarchitecturePackageImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalarchitecturePackageImpl.java
new file mode 100644
index 00000000..ccb5fade
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/FunctionalarchitecturePackageImpl.java
@@ -0,0 +1,575 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.FAMTerminator;
6import functionalarchitecture.Function;
7import functionalarchitecture.FunctionType;
8import functionalarchitecture.FunctionalArchitectureModel;
9import functionalarchitecture.FunctionalData;
10import functionalarchitecture.FunctionalElement;
11import functionalarchitecture.FunctionalInput;
12import functionalarchitecture.FunctionalOutput;
13import functionalarchitecture.FunctionalarchitectureFactory;
14import functionalarchitecture.FunctionalarchitecturePackage;
15import functionalarchitecture.InformationLink;
16
17import org.eclipse.emf.ecore.EAttribute;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.emf.ecore.EEnum;
20import org.eclipse.emf.ecore.EPackage;
21import org.eclipse.emf.ecore.EReference;
22
23import org.eclipse.emf.ecore.impl.EPackageImpl;
24
25/**
26 * <!-- begin-user-doc -->
27 * An implementation of the model <b>Package</b>.
28 * <!-- end-user-doc -->
29 * @generated
30 */
31public class FunctionalarchitecturePackageImpl extends EPackageImpl implements FunctionalarchitecturePackage {
32 /**
33 * <!-- begin-user-doc -->
34 * <!-- end-user-doc -->
35 * @generated
36 */
37 private EClass functionalElementEClass = null;
38
39 /**
40 * <!-- begin-user-doc -->
41 * <!-- end-user-doc -->
42 * @generated
43 */
44 private EClass functionalArchitectureModelEClass = null;
45
46 /**
47 * <!-- begin-user-doc -->
48 * <!-- end-user-doc -->
49 * @generated
50 */
51 private EClass functionEClass = null;
52
53 /**
54 * <!-- begin-user-doc -->
55 * <!-- end-user-doc -->
56 * @generated
57 */
58 private EClass famTerminatorEClass = null;
59
60 /**
61 * <!-- begin-user-doc -->
62 * <!-- end-user-doc -->
63 * @generated
64 */
65 private EClass informationLinkEClass = null;
66
67 /**
68 * <!-- begin-user-doc -->
69 * <!-- end-user-doc -->
70 * @generated
71 */
72 private EClass functionalInterfaceEClass = null;
73
74 /**
75 * <!-- begin-user-doc -->
76 * <!-- end-user-doc -->
77 * @generated
78 */
79 private EClass functionalInputEClass = null;
80
81 /**
82 * <!-- begin-user-doc -->
83 * <!-- end-user-doc -->
84 * @generated
85 */
86 private EClass functionalOutputEClass = null;
87
88 /**
89 * <!-- begin-user-doc -->
90 * <!-- end-user-doc -->
91 * @generated
92 */
93 private EClass functionalDataEClass = null;
94
95 /**
96 * <!-- begin-user-doc -->
97 * <!-- end-user-doc -->
98 * @generated
99 */
100 private EEnum functionTypeEEnum = null;
101
102 /**
103 * Creates an instance of the model <b>Package</b>, registered with
104 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
105 * package URI value.
106 * <p>Note: the correct way to create the package is via the static
107 * factory method {@link #init init()}, which also performs
108 * initialization of the package, or returns the registered package,
109 * if one already exists.
110 * <!-- begin-user-doc -->
111 * <!-- end-user-doc -->
112 * @see org.eclipse.emf.ecore.EPackage.Registry
113 * @see functionalarchitecture.FunctionalarchitecturePackage#eNS_URI
114 * @see #init()
115 * @generated
116 */
117 private FunctionalarchitecturePackageImpl() {
118 super(eNS_URI, FunctionalarchitectureFactory.eINSTANCE);
119 }
120
121 /**
122 * <!-- begin-user-doc -->
123 * <!-- end-user-doc -->
124 * @generated
125 */
126 private static boolean isInited = false;
127
128 /**
129 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
130 *
131 * <p>This method is used to initialize {@link FunctionalarchitecturePackage#eINSTANCE} when that field is accessed.
132 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
133 * <!-- begin-user-doc -->
134 * <!-- end-user-doc -->
135 * @see #eNS_URI
136 * @see #createPackageContents()
137 * @see #initializePackageContents()
138 * @generated
139 */
140 public static FunctionalarchitecturePackage init() {
141 if (isInited) return (FunctionalarchitecturePackage)EPackage.Registry.INSTANCE.getEPackage(FunctionalarchitecturePackage.eNS_URI);
142
143 // Obtain or create and register package
144 Object registeredFunctionalarchitecturePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
145 FunctionalarchitecturePackageImpl theFunctionalarchitecturePackage = registeredFunctionalarchitecturePackage instanceof FunctionalarchitecturePackageImpl ? (FunctionalarchitecturePackageImpl)registeredFunctionalarchitecturePackage : new FunctionalarchitecturePackageImpl();
146
147 isInited = true;
148
149 // Create package meta-data objects
150 theFunctionalarchitecturePackage.createPackageContents();
151
152 // Initialize created meta-data
153 theFunctionalarchitecturePackage.initializePackageContents();
154
155 // Mark meta-data to indicate it can't be changed
156 theFunctionalarchitecturePackage.freeze();
157
158 // Update the registry and return the package
159 EPackage.Registry.INSTANCE.put(FunctionalarchitecturePackage.eNS_URI, theFunctionalarchitecturePackage);
160 return theFunctionalarchitecturePackage;
161 }
162
163 /**
164 * <!-- begin-user-doc -->
165 * <!-- end-user-doc -->
166 * @generated
167 */
168 @Override
169 public EClass getFunctionalElement() {
170 return functionalElementEClass;
171 }
172
173 /**
174 * <!-- begin-user-doc -->
175 * <!-- end-user-doc -->
176 * @generated
177 */
178 @Override
179 public EReference getFunctionalElement_Interface() {
180 return (EReference)functionalElementEClass.getEStructuralFeatures().get(0);
181 }
182
183 /**
184 * <!-- begin-user-doc -->
185 * <!-- end-user-doc -->
186 * @generated
187 */
188 @Override
189 public EReference getFunctionalElement_Model() {
190 return (EReference)functionalElementEClass.getEStructuralFeatures().get(1);
191 }
192
193 /**
194 * <!-- begin-user-doc -->
195 * <!-- end-user-doc -->
196 * @generated
197 */
198 @Override
199 public EReference getFunctionalElement_Parent() {
200 return (EReference)functionalElementEClass.getEStructuralFeatures().get(2);
201 }
202
203 /**
204 * <!-- begin-user-doc -->
205 * <!-- end-user-doc -->
206 * @generated
207 */
208 @Override
209 public EClass getFunctionalArchitectureModel() {
210 return functionalArchitectureModelEClass;
211 }
212
213 /**
214 * <!-- begin-user-doc -->
215 * <!-- end-user-doc -->
216 * @generated
217 */
218 @Override
219 public EReference getFunctionalArchitectureModel_RootElements() {
220 return (EReference)functionalArchitectureModelEClass.getEStructuralFeatures().get(0);
221 }
222
223 /**
224 * <!-- begin-user-doc -->
225 * <!-- end-user-doc -->
226 * @generated
227 */
228 @Override
229 public EClass getFunction() {
230 return functionEClass;
231 }
232
233 /**
234 * <!-- begin-user-doc -->
235 * <!-- end-user-doc -->
236 * @generated
237 */
238 @Override
239 public EReference getFunction_SubElements() {
240 return (EReference)functionEClass.getEStructuralFeatures().get(0);
241 }
242
243 /**
244 * <!-- begin-user-doc -->
245 * <!-- end-user-doc -->
246 * @generated
247 */
248 @Override
249 public EAttribute getFunction_Type() {
250 return (EAttribute)functionEClass.getEStructuralFeatures().get(1);
251 }
252
253 /**
254 * <!-- begin-user-doc -->
255 * <!-- end-user-doc -->
256 * @generated
257 */
258 @Override
259 public EClass getFAMTerminator() {
260 return famTerminatorEClass;
261 }
262
263 /**
264 * <!-- begin-user-doc -->
265 * <!-- end-user-doc -->
266 * @generated
267 */
268 @Override
269 public EReference getFAMTerminator_Data() {
270 return (EReference)famTerminatorEClass.getEStructuralFeatures().get(0);
271 }
272
273 /**
274 * <!-- begin-user-doc -->
275 * <!-- end-user-doc -->
276 * @generated
277 */
278 @Override
279 public EClass getInformationLink() {
280 return informationLinkEClass;
281 }
282
283 /**
284 * <!-- begin-user-doc -->
285 * <!-- end-user-doc -->
286 * @generated
287 */
288 @Override
289 public EReference getInformationLink_From() {
290 return (EReference)informationLinkEClass.getEStructuralFeatures().get(0);
291 }
292
293 /**
294 * <!-- begin-user-doc -->
295 * <!-- end-user-doc -->
296 * @generated
297 */
298 @Override
299 public EReference getInformationLink_To() {
300 return (EReference)informationLinkEClass.getEStructuralFeatures().get(1);
301 }
302
303 /**
304 * <!-- begin-user-doc -->
305 * <!-- end-user-doc -->
306 * @generated
307 */
308 @Override
309 public EClass getFunctionalInterface() {
310 return functionalInterfaceEClass;
311 }
312
313 /**
314 * <!-- begin-user-doc -->
315 * <!-- end-user-doc -->
316 * @generated
317 */
318 @Override
319 public EReference getFunctionalInterface_Data() {
320 return (EReference)functionalInterfaceEClass.getEStructuralFeatures().get(0);
321 }
322
323 /**
324 * <!-- begin-user-doc -->
325 * <!-- end-user-doc -->
326 * @generated
327 */
328 @Override
329 public EReference getFunctionalInterface_Element() {
330 return (EReference)functionalInterfaceEClass.getEStructuralFeatures().get(1);
331 }
332
333 /**
334 * <!-- begin-user-doc -->
335 * <!-- end-user-doc -->
336 * @generated
337 */
338 @Override
339 public EClass getFunctionalInput() {
340 return functionalInputEClass;
341 }
342
343 /**
344 * <!-- begin-user-doc -->
345 * <!-- end-user-doc -->
346 * @generated
347 */
348 @Override
349 public EReference getFunctionalInput_IncomingLinks() {
350 return (EReference)functionalInputEClass.getEStructuralFeatures().get(0);
351 }
352
353 /**
354 * <!-- begin-user-doc -->
355 * <!-- end-user-doc -->
356 * @generated
357 */
358 @Override
359 public EClass getFunctionalOutput() {
360 return functionalOutputEClass;
361 }
362
363 /**
364 * <!-- begin-user-doc -->
365 * <!-- end-user-doc -->
366 * @generated
367 */
368 @Override
369 public EReference getFunctionalOutput_OutgoingLinks() {
370 return (EReference)functionalOutputEClass.getEStructuralFeatures().get(0);
371 }
372
373 /**
374 * <!-- begin-user-doc -->
375 * <!-- end-user-doc -->
376 * @generated
377 */
378 @Override
379 public EClass getFunctionalData() {
380 return functionalDataEClass;
381 }
382
383 /**
384 * <!-- begin-user-doc -->
385 * <!-- end-user-doc -->
386 * @generated
387 */
388 @Override
389 public EReference getFunctionalData_Terminator() {
390 return (EReference)functionalDataEClass.getEStructuralFeatures().get(0);
391 }
392
393 /**
394 * <!-- begin-user-doc -->
395 * <!-- end-user-doc -->
396 * @generated
397 */
398 @Override
399 public EReference getFunctionalData_Interface() {
400 return (EReference)functionalDataEClass.getEStructuralFeatures().get(1);
401 }
402
403 /**
404 * <!-- begin-user-doc -->
405 * <!-- end-user-doc -->
406 * @generated
407 */
408 @Override
409 public EEnum getFunctionType() {
410 return functionTypeEEnum;
411 }
412
413 /**
414 * <!-- begin-user-doc -->
415 * <!-- end-user-doc -->
416 * @generated
417 */
418 @Override
419 public FunctionalarchitectureFactory getFunctionalarchitectureFactory() {
420 return (FunctionalarchitectureFactory)getEFactoryInstance();
421 }
422
423 /**
424 * <!-- begin-user-doc -->
425 * <!-- end-user-doc -->
426 * @generated
427 */
428 private boolean isCreated = false;
429
430 /**
431 * Creates the meta-model objects for the package. This method is
432 * guarded to have no affect on any invocation but its first.
433 * <!-- begin-user-doc -->
434 * <!-- end-user-doc -->
435 * @generated
436 */
437 public void createPackageContents() {
438 if (isCreated) return;
439 isCreated = true;
440
441 // Create classes and their features
442 functionalElementEClass = createEClass(FUNCTIONAL_ELEMENT);
443 createEReference(functionalElementEClass, FUNCTIONAL_ELEMENT__INTERFACE);
444 createEReference(functionalElementEClass, FUNCTIONAL_ELEMENT__MODEL);
445 createEReference(functionalElementEClass, FUNCTIONAL_ELEMENT__PARENT);
446
447 functionalArchitectureModelEClass = createEClass(FUNCTIONAL_ARCHITECTURE_MODEL);
448 createEReference(functionalArchitectureModelEClass, FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS);
449
450 functionEClass = createEClass(FUNCTION);
451 createEReference(functionEClass, FUNCTION__SUB_ELEMENTS);
452 createEAttribute(functionEClass, FUNCTION__TYPE);
453
454 famTerminatorEClass = createEClass(FAM_TERMINATOR);
455 createEReference(famTerminatorEClass, FAM_TERMINATOR__DATA);
456
457 informationLinkEClass = createEClass(INFORMATION_LINK);
458 createEReference(informationLinkEClass, INFORMATION_LINK__FROM);
459 createEReference(informationLinkEClass, INFORMATION_LINK__TO);
460
461 functionalInterfaceEClass = createEClass(FUNCTIONAL_INTERFACE);
462 createEReference(functionalInterfaceEClass, FUNCTIONAL_INTERFACE__DATA);
463 createEReference(functionalInterfaceEClass, FUNCTIONAL_INTERFACE__ELEMENT);
464
465 functionalInputEClass = createEClass(FUNCTIONAL_INPUT);
466 createEReference(functionalInputEClass, FUNCTIONAL_INPUT__INCOMING_LINKS);
467
468 functionalOutputEClass = createEClass(FUNCTIONAL_OUTPUT);
469 createEReference(functionalOutputEClass, FUNCTIONAL_OUTPUT__OUTGOING_LINKS);
470
471 functionalDataEClass = createEClass(FUNCTIONAL_DATA);
472 createEReference(functionalDataEClass, FUNCTIONAL_DATA__TERMINATOR);
473 createEReference(functionalDataEClass, FUNCTIONAL_DATA__INTERFACE);
474
475 // Create enums
476 functionTypeEEnum = createEEnum(FUNCTION_TYPE);
477 }
478
479 /**
480 * <!-- begin-user-doc -->
481 * <!-- end-user-doc -->
482 * @generated
483 */
484 private boolean isInitialized = false;
485
486 /**
487 * Complete the initialization of the package and its meta-model. This
488 * method is guarded to have no affect on any invocation but its first.
489 * <!-- begin-user-doc -->
490 * <!-- end-user-doc -->
491 * @generated
492 */
493 public void initializePackageContents() {
494 if (isInitialized) return;
495 isInitialized = true;
496
497 // Initialize package
498 setName(eNAME);
499 setNsPrefix(eNS_PREFIX);
500 setNsURI(eNS_URI);
501
502 // Create type parameters
503
504 // Set bounds for type parameters
505
506 // Add supertypes to classes
507 functionEClass.getESuperTypes().add(this.getFunctionalElement());
508 functionalInputEClass.getESuperTypes().add(this.getFunctionalData());
509 functionalOutputEClass.getESuperTypes().add(this.getFunctionalData());
510
511 // Initialize classes, features, and operations; add parameters
512 initEClass(functionalElementEClass, FunctionalElement.class, "FunctionalElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
513 initEReference(getFunctionalElement_Interface(), this.getFunctionalInterface(), this.getFunctionalInterface_Element(), "interface", null, 0, 1, FunctionalElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
514 initEReference(getFunctionalElement_Model(), this.getFunctionalArchitectureModel(), null, "model", null, 1, 1, FunctionalElement.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
515 initEReference(getFunctionalElement_Parent(), this.getFunction(), this.getFunction_SubElements(), "parent", null, 0, 1, FunctionalElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
516
517 initEClass(functionalArchitectureModelEClass, FunctionalArchitectureModel.class, "FunctionalArchitectureModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
518 initEReference(getFunctionalArchitectureModel_RootElements(), this.getFunctionalElement(), null, "rootElements", null, 0, -1, FunctionalArchitectureModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
519
520 initEClass(functionEClass, Function.class, "Function", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
521 initEReference(getFunction_SubElements(), this.getFunctionalElement(), this.getFunctionalElement_Parent(), "subElements", null, 0, -1, Function.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
522 initEAttribute(getFunction_Type(), this.getFunctionType(), "type", null, 1, 1, Function.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
523
524 initEClass(famTerminatorEClass, FAMTerminator.class, "FAMTerminator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
525 initEReference(getFAMTerminator_Data(), this.getFunctionalData(), this.getFunctionalData_Terminator(), "data", null, 0, 1, FAMTerminator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
526
527 initEClass(informationLinkEClass, InformationLink.class, "InformationLink", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
528 initEReference(getInformationLink_From(), this.getFunctionalOutput(), this.getFunctionalOutput_OutgoingLinks(), "from", null, 0, 1, InformationLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
529 initEReference(getInformationLink_To(), this.getFunctionalInput(), this.getFunctionalInput_IncomingLinks(), "to", null, 1, 1, InformationLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
530
531 initEClass(functionalInterfaceEClass, functionalarchitecture.FunctionalInterface.class, "FunctionalInterface", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
532 initEReference(getFunctionalInterface_Data(), this.getFunctionalData(), this.getFunctionalData_Interface(), "data", null, 0, -1, functionalarchitecture.FunctionalInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
533 initEReference(getFunctionalInterface_Element(), this.getFunctionalElement(), this.getFunctionalElement_Interface(), "element", null, 0, 1, functionalarchitecture.FunctionalInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
534
535 initEClass(functionalInputEClass, FunctionalInput.class, "FunctionalInput", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
536 initEReference(getFunctionalInput_IncomingLinks(), this.getInformationLink(), this.getInformationLink_To(), "IncomingLinks", null, 0, -1, FunctionalInput.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
537
538 initEClass(functionalOutputEClass, FunctionalOutput.class, "FunctionalOutput", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
539 initEReference(getFunctionalOutput_OutgoingLinks(), this.getInformationLink(), this.getInformationLink_From(), "outgoingLinks", null, 0, -1, FunctionalOutput.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
540
541 initEClass(functionalDataEClass, FunctionalData.class, "FunctionalData", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
542 initEReference(getFunctionalData_Terminator(), this.getFAMTerminator(), this.getFAMTerminator_Data(), "terminator", null, 0, 1, FunctionalData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
543 initEReference(getFunctionalData_Interface(), this.getFunctionalInterface(), this.getFunctionalInterface_Data(), "interface", null, 0, 1, FunctionalData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
544
545 // Initialize enums and add enum literals
546 initEEnum(functionTypeEEnum, FunctionType.class, "FunctionType");
547 addEEnumLiteral(functionTypeEEnum, FunctionType.ROOT);
548 addEEnumLiteral(functionTypeEEnum, FunctionType.INTERMEDIATE);
549 addEEnumLiteral(functionTypeEEnum, FunctionType.LEAF);
550
551 // Create resource
552 createResource(eNS_URI);
553
554 // Create annotations
555 // org.eclipse.viatra.query.querybasedfeature
556 createOrgAnnotations();
557 }
558
559 /**
560 * Initializes the annotations for <b>org.eclipse.viatra.query.querybasedfeature</b>.
561 * <!-- begin-user-doc -->
562 * <!-- end-user-doc -->
563 * @generated
564 */
565 protected void createOrgAnnotations() {
566 String source = "org.eclipse.viatra.query.querybasedfeature";
567 addAnnotation
568 (getFunctionalElement_Model(),
569 source,
570 new String[] {
571 "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.fam.model"
572 });
573 }
574
575} //FunctionalarchitecturePackageImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/InformationLinkImpl.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/InformationLinkImpl.java
new file mode 100644
index 00000000..bf5d5db8
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/impl/InformationLinkImpl.java
@@ -0,0 +1,289 @@
1/**
2 */
3package functionalarchitecture.impl;
4
5import functionalarchitecture.FunctionalInput;
6import functionalarchitecture.FunctionalOutput;
7import functionalarchitecture.FunctionalarchitecturePackage;
8import functionalarchitecture.InformationLink;
9
10import org.eclipse.emf.common.notify.Notification;
11import org.eclipse.emf.common.notify.NotificationChain;
12
13import org.eclipse.emf.ecore.EClass;
14import org.eclipse.emf.ecore.InternalEObject;
15
16import org.eclipse.emf.ecore.impl.ENotificationImpl;
17import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
18
19import org.eclipse.emf.ecore.util.EcoreUtil;
20
21/**
22 * <!-- begin-user-doc -->
23 * An implementation of the model object '<em><b>Information Link</b></em>'.
24 * <!-- end-user-doc -->
25 * <p>
26 * The following features are implemented:
27 * </p>
28 * <ul>
29 * <li>{@link functionalarchitecture.impl.InformationLinkImpl#getFrom <em>From</em>}</li>
30 * <li>{@link functionalarchitecture.impl.InformationLinkImpl#getTo <em>To</em>}</li>
31 * </ul>
32 *
33 * @generated
34 */
35public class InformationLinkImpl extends MinimalEObjectImpl.Container implements InformationLink {
36 /**
37 * The cached value of the '{@link #getTo() <em>To</em>}' reference.
38 * <!-- begin-user-doc -->
39 * <!-- end-user-doc -->
40 * @see #getTo()
41 * @generated
42 * @ordered
43 */
44 protected FunctionalInput to;
45
46 /**
47 * <!-- begin-user-doc -->
48 * <!-- end-user-doc -->
49 * @generated
50 */
51 protected InformationLinkImpl() {
52 super();
53 }
54
55 /**
56 * <!-- begin-user-doc -->
57 * <!-- end-user-doc -->
58 * @generated
59 */
60 @Override
61 protected EClass eStaticClass() {
62 return FunctionalarchitecturePackage.Literals.INFORMATION_LINK;
63 }
64
65 /**
66 * <!-- begin-user-doc -->
67 * <!-- end-user-doc -->
68 * @generated
69 */
70 @Override
71 public FunctionalOutput getFrom() {
72 if (eContainerFeatureID() != FunctionalarchitecturePackage.INFORMATION_LINK__FROM) return null;
73 return (FunctionalOutput)eInternalContainer();
74 }
75
76 /**
77 * <!-- begin-user-doc -->
78 * <!-- end-user-doc -->
79 * @generated
80 */
81 public NotificationChain basicSetFrom(FunctionalOutput newFrom, NotificationChain msgs) {
82 msgs = eBasicSetContainer((InternalEObject)newFrom, FunctionalarchitecturePackage.INFORMATION_LINK__FROM, msgs);
83 return msgs;
84 }
85
86 /**
87 * <!-- begin-user-doc -->
88 * <!-- end-user-doc -->
89 * @generated
90 */
91 @Override
92 public void setFrom(FunctionalOutput newFrom) {
93 if (newFrom != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.INFORMATION_LINK__FROM && newFrom != null)) {
94 if (EcoreUtil.isAncestor(this, newFrom))
95 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
96 NotificationChain msgs = null;
97 if (eInternalContainer() != null)
98 msgs = eBasicRemoveFromContainer(msgs);
99 if (newFrom != null)
100 msgs = ((InternalEObject)newFrom).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS, FunctionalOutput.class, msgs);
101 msgs = basicSetFrom(newFrom, msgs);
102 if (msgs != null) msgs.dispatch();
103 }
104 else if (eNotificationRequired())
105 eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.INFORMATION_LINK__FROM, newFrom, newFrom));
106 }
107
108 /**
109 * <!-- begin-user-doc -->
110 * <!-- end-user-doc -->
111 * @generated
112 */
113 @Override
114 public FunctionalInput getTo() {
115 if (to != null && to.eIsProxy()) {
116 InternalEObject oldTo = (InternalEObject)to;
117 to = (FunctionalInput)eResolveProxy(oldTo);
118 if (to != oldTo) {
119 if (eNotificationRequired())
120 eNotify(new ENotificationImpl(this, Notification.RESOLVE, FunctionalarchitecturePackage.INFORMATION_LINK__TO, oldTo, to));
121 }
122 }
123 return to;
124 }
125
126 /**
127 * <!-- begin-user-doc -->
128 * <!-- end-user-doc -->
129 * @generated
130 */
131 public FunctionalInput basicGetTo() {
132 return to;
133 }
134
135 /**
136 * <!-- begin-user-doc -->
137 * <!-- end-user-doc -->
138 * @generated
139 */
140 public NotificationChain basicSetTo(FunctionalInput newTo, NotificationChain msgs) {
141 FunctionalInput oldTo = to;
142 to = newTo;
143 if (eNotificationRequired()) {
144 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.INFORMATION_LINK__TO, oldTo, newTo);
145 if (msgs == null) msgs = notification; else msgs.add(notification);
146 }
147 return msgs;
148 }
149
150 /**
151 * <!-- begin-user-doc -->
152 * <!-- end-user-doc -->
153 * @generated
154 */
155 @Override
156 public void setTo(FunctionalInput newTo) {
157 if (newTo != to) {
158 NotificationChain msgs = null;
159 if (to != null)
160 msgs = ((InternalEObject)to).eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS, FunctionalInput.class, msgs);
161 if (newTo != null)
162 msgs = ((InternalEObject)newTo).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS, FunctionalInput.class, msgs);
163 msgs = basicSetTo(newTo, msgs);
164 if (msgs != null) msgs.dispatch();
165 }
166 else if (eNotificationRequired())
167 eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.INFORMATION_LINK__TO, newTo, newTo));
168 }
169
170 /**
171 * <!-- begin-user-doc -->
172 * <!-- end-user-doc -->
173 * @generated
174 */
175 @Override
176 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
177 switch (featureID) {
178 case FunctionalarchitecturePackage.INFORMATION_LINK__FROM:
179 if (eInternalContainer() != null)
180 msgs = eBasicRemoveFromContainer(msgs);
181 return basicSetFrom((FunctionalOutput)otherEnd, msgs);
182 case FunctionalarchitecturePackage.INFORMATION_LINK__TO:
183 if (to != null)
184 msgs = ((InternalEObject)to).eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS, FunctionalInput.class, msgs);
185 return basicSetTo((FunctionalInput)otherEnd, msgs);
186 }
187 return super.eInverseAdd(otherEnd, featureID, msgs);
188 }
189
190 /**
191 * <!-- begin-user-doc -->
192 * <!-- end-user-doc -->
193 * @generated
194 */
195 @Override
196 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
197 switch (featureID) {
198 case FunctionalarchitecturePackage.INFORMATION_LINK__FROM:
199 return basicSetFrom(null, msgs);
200 case FunctionalarchitecturePackage.INFORMATION_LINK__TO:
201 return basicSetTo(null, msgs);
202 }
203 return super.eInverseRemove(otherEnd, featureID, msgs);
204 }
205
206 /**
207 * <!-- begin-user-doc -->
208 * <!-- end-user-doc -->
209 * @generated
210 */
211 @Override
212 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
213 switch (eContainerFeatureID()) {
214 case FunctionalarchitecturePackage.INFORMATION_LINK__FROM:
215 return eInternalContainer().eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS, FunctionalOutput.class, msgs);
216 }
217 return super.eBasicRemoveFromContainerFeature(msgs);
218 }
219
220 /**
221 * <!-- begin-user-doc -->
222 * <!-- end-user-doc -->
223 * @generated
224 */
225 @Override
226 public Object eGet(int featureID, boolean resolve, boolean coreType) {
227 switch (featureID) {
228 case FunctionalarchitecturePackage.INFORMATION_LINK__FROM:
229 return getFrom();
230 case FunctionalarchitecturePackage.INFORMATION_LINK__TO:
231 if (resolve) return getTo();
232 return basicGetTo();
233 }
234 return super.eGet(featureID, resolve, coreType);
235 }
236
237 /**
238 * <!-- begin-user-doc -->
239 * <!-- end-user-doc -->
240 * @generated
241 */
242 @Override
243 public void eSet(int featureID, Object newValue) {
244 switch (featureID) {
245 case FunctionalarchitecturePackage.INFORMATION_LINK__FROM:
246 setFrom((FunctionalOutput)newValue);
247 return;
248 case FunctionalarchitecturePackage.INFORMATION_LINK__TO:
249 setTo((FunctionalInput)newValue);
250 return;
251 }
252 super.eSet(featureID, newValue);
253 }
254
255 /**
256 * <!-- begin-user-doc -->
257 * <!-- end-user-doc -->
258 * @generated
259 */
260 @Override
261 public void eUnset(int featureID) {
262 switch (featureID) {
263 case FunctionalarchitecturePackage.INFORMATION_LINK__FROM:
264 setFrom((FunctionalOutput)null);
265 return;
266 case FunctionalarchitecturePackage.INFORMATION_LINK__TO:
267 setTo((FunctionalInput)null);
268 return;
269 }
270 super.eUnset(featureID);
271 }
272
273 /**
274 * <!-- begin-user-doc -->
275 * <!-- end-user-doc -->
276 * @generated
277 */
278 @Override
279 public boolean eIsSet(int featureID) {
280 switch (featureID) {
281 case FunctionalarchitecturePackage.INFORMATION_LINK__FROM:
282 return getFrom() != null;
283 case FunctionalarchitecturePackage.INFORMATION_LINK__TO:
284 return to != null;
285 }
286 return super.eIsSet(featureID);
287 }
288
289} //InformationLinkImpl
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/util/FunctionalarchitectureAdapterFactory.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/util/FunctionalarchitectureAdapterFactory.java
new file mode 100644
index 00000000..ed0d9819
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/util/FunctionalarchitectureAdapterFactory.java
@@ -0,0 +1,272 @@
1/**
2 */
3package functionalarchitecture.util;
4
5import functionalarchitecture.FAMTerminator;
6import functionalarchitecture.Function;
7import functionalarchitecture.FunctionalArchitectureModel;
8import functionalarchitecture.FunctionalData;
9import functionalarchitecture.FunctionalElement;
10import functionalarchitecture.FunctionalInput;
11import functionalarchitecture.FunctionalOutput;
12import functionalarchitecture.FunctionalarchitecturePackage;
13import functionalarchitecture.InformationLink;
14
15import org.eclipse.emf.common.notify.Adapter;
16import org.eclipse.emf.common.notify.Notifier;
17
18import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
19
20import org.eclipse.emf.ecore.EObject;
21
22/**
23 * <!-- begin-user-doc -->
24 * The <b>Adapter Factory</b> for the model.
25 * It provides an adapter <code>createXXX</code> method for each class of the model.
26 * <!-- end-user-doc -->
27 * @see functionalarchitecture.FunctionalarchitecturePackage
28 * @generated
29 */
30public class FunctionalarchitectureAdapterFactory extends AdapterFactoryImpl {
31 /**
32 * The cached model package.
33 * <!-- begin-user-doc -->
34 * <!-- end-user-doc -->
35 * @generated
36 */
37 protected static FunctionalarchitecturePackage modelPackage;
38
39 /**
40 * Creates an instance of the adapter factory.
41 * <!-- begin-user-doc -->
42 * <!-- end-user-doc -->
43 * @generated
44 */
45 public FunctionalarchitectureAdapterFactory() {
46 if (modelPackage == null) {
47 modelPackage = FunctionalarchitecturePackage.eINSTANCE;
48 }
49 }
50
51 /**
52 * Returns whether this factory is applicable for the type of the object.
53 * <!-- begin-user-doc -->
54 * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
55 * <!-- end-user-doc -->
56 * @return whether this factory is applicable for the type of the object.
57 * @generated
58 */
59 @Override
60 public boolean isFactoryForType(Object object) {
61 if (object == modelPackage) {
62 return true;
63 }
64 if (object instanceof EObject) {
65 return ((EObject)object).eClass().getEPackage() == modelPackage;
66 }
67 return false;
68 }
69
70 /**
71 * The switch that delegates to the <code>createXXX</code> methods.
72 * <!-- begin-user-doc -->
73 * <!-- end-user-doc -->
74 * @generated
75 */
76 protected FunctionalarchitectureSwitch<Adapter> modelSwitch =
77 new FunctionalarchitectureSwitch<Adapter>() {
78 @Override
79 public Adapter caseFunctionalElement(FunctionalElement object) {
80 return createFunctionalElementAdapter();
81 }
82 @Override
83 public Adapter caseFunctionalArchitectureModel(FunctionalArchitectureModel object) {
84 return createFunctionalArchitectureModelAdapter();
85 }
86 @Override
87 public Adapter caseFunction(Function object) {
88 return createFunctionAdapter();
89 }
90 @Override
91 public Adapter caseFAMTerminator(FAMTerminator object) {
92 return createFAMTerminatorAdapter();
93 }
94 @Override
95 public Adapter caseInformationLink(InformationLink object) {
96 return createInformationLinkAdapter();
97 }
98 @Override
99 public Adapter caseFunctionalInterface(functionalarchitecture.FunctionalInterface object) {
100 return createFunctionalInterfaceAdapter();
101 }
102 @Override
103 public Adapter caseFunctionalInput(FunctionalInput object) {
104 return createFunctionalInputAdapter();
105 }
106 @Override
107 public Adapter caseFunctionalOutput(FunctionalOutput object) {
108 return createFunctionalOutputAdapter();
109 }
110 @Override
111 public Adapter caseFunctionalData(FunctionalData object) {
112 return createFunctionalDataAdapter();
113 }
114 @Override
115 public Adapter defaultCase(EObject object) {
116 return createEObjectAdapter();
117 }
118 };
119
120 /**
121 * Creates an adapter for the <code>target</code>.
122 * <!-- begin-user-doc -->
123 * <!-- end-user-doc -->
124 * @param target the object to adapt.
125 * @return the adapter for the <code>target</code>.
126 * @generated
127 */
128 @Override
129 public Adapter createAdapter(Notifier target) {
130 return modelSwitch.doSwitch((EObject)target);
131 }
132
133
134 /**
135 * Creates a new adapter for an object of class '{@link functionalarchitecture.FunctionalElement <em>Functional Element</em>}'.
136 * <!-- begin-user-doc -->
137 * This default implementation returns null so that we can easily ignore cases;
138 * it's useful to ignore a case when inheritance will catch all the cases anyway.
139 * <!-- end-user-doc -->
140 * @return the new adapter.
141 * @see functionalarchitecture.FunctionalElement
142 * @generated
143 */
144 public Adapter createFunctionalElementAdapter() {
145 return null;
146 }
147
148 /**
149 * Creates a new adapter for an object of class '{@link functionalarchitecture.FunctionalArchitectureModel <em>Functional Architecture Model</em>}'.
150 * <!-- begin-user-doc -->
151 * This default implementation returns null so that we can easily ignore cases;
152 * it's useful to ignore a case when inheritance will catch all the cases anyway.
153 * <!-- end-user-doc -->
154 * @return the new adapter.
155 * @see functionalarchitecture.FunctionalArchitectureModel
156 * @generated
157 */
158 public Adapter createFunctionalArchitectureModelAdapter() {
159 return null;
160 }
161
162 /**
163 * Creates a new adapter for an object of class '{@link functionalarchitecture.Function <em>Function</em>}'.
164 * <!-- begin-user-doc -->
165 * This default implementation returns null so that we can easily ignore cases;
166 * it's useful to ignore a case when inheritance will catch all the cases anyway.
167 * <!-- end-user-doc -->
168 * @return the new adapter.
169 * @see functionalarchitecture.Function
170 * @generated
171 */
172 public Adapter createFunctionAdapter() {
173 return null;
174 }
175
176 /**
177 * Creates a new adapter for an object of class '{@link functionalarchitecture.FAMTerminator <em>FAM Terminator</em>}'.
178 * <!-- begin-user-doc -->
179 * This default implementation returns null so that we can easily ignore cases;
180 * it's useful to ignore a case when inheritance will catch all the cases anyway.
181 * <!-- end-user-doc -->
182 * @return the new adapter.
183 * @see functionalarchitecture.FAMTerminator
184 * @generated
185 */
186 public Adapter createFAMTerminatorAdapter() {
187 return null;
188 }
189
190 /**
191 * Creates a new adapter for an object of class '{@link functionalarchitecture.InformationLink <em>Information Link</em>}'.
192 * <!-- begin-user-doc -->
193 * This default implementation returns null so that we can easily ignore cases;
194 * it's useful to ignore a case when inheritance will catch all the cases anyway.
195 * <!-- end-user-doc -->
196 * @return the new adapter.
197 * @see functionalarchitecture.InformationLink
198 * @generated
199 */
200 public Adapter createInformationLinkAdapter() {
201 return null;
202 }
203
204 /**
205 * Creates a new adapter for an object of class '{@link functionalarchitecture.FunctionalInterface <em>Functional Interface</em>}'.
206 * <!-- begin-user-doc -->
207 * This default implementation returns null so that we can easily ignore cases;
208 * it's useful to ignore a case when inheritance will catch all the cases anyway.
209 * <!-- end-user-doc -->
210 * @return the new adapter.
211 * @see functionalarchitecture.FunctionalInterface
212 * @generated
213 */
214 public Adapter createFunctionalInterfaceAdapter() {
215 return null;
216 }
217
218 /**
219 * Creates a new adapter for an object of class '{@link functionalarchitecture.FunctionalInput <em>Functional Input</em>}'.
220 * <!-- begin-user-doc -->
221 * This default implementation returns null so that we can easily ignore cases;
222 * it's useful to ignore a case when inheritance will catch all the cases anyway.
223 * <!-- end-user-doc -->
224 * @return the new adapter.
225 * @see functionalarchitecture.FunctionalInput
226 * @generated
227 */
228 public Adapter createFunctionalInputAdapter() {
229 return null;
230 }
231
232 /**
233 * Creates a new adapter for an object of class '{@link functionalarchitecture.FunctionalOutput <em>Functional Output</em>}'.
234 * <!-- begin-user-doc -->
235 * This default implementation returns null so that we can easily ignore cases;
236 * it's useful to ignore a case when inheritance will catch all the cases anyway.
237 * <!-- end-user-doc -->
238 * @return the new adapter.
239 * @see functionalarchitecture.FunctionalOutput
240 * @generated
241 */
242 public Adapter createFunctionalOutputAdapter() {
243 return null;
244 }
245
246 /**
247 * Creates a new adapter for an object of class '{@link functionalarchitecture.FunctionalData <em>Functional Data</em>}'.
248 * <!-- begin-user-doc -->
249 * This default implementation returns null so that we can easily ignore cases;
250 * it's useful to ignore a case when inheritance will catch all the cases anyway.
251 * <!-- end-user-doc -->
252 * @return the new adapter.
253 * @see functionalarchitecture.FunctionalData
254 * @generated
255 */
256 public Adapter createFunctionalDataAdapter() {
257 return null;
258 }
259
260 /**
261 * Creates a new adapter for the default case.
262 * <!-- begin-user-doc -->
263 * This default implementation returns null.
264 * <!-- end-user-doc -->
265 * @return the new adapter.
266 * @generated
267 */
268 public Adapter createEObjectAdapter() {
269 return null;
270 }
271
272} //FunctionalarchitectureAdapterFactory
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/util/FunctionalarchitectureSwitch.java b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/util/FunctionalarchitectureSwitch.java
new file mode 100644
index 00000000..c765346e
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/functionalarchitecture/util/FunctionalarchitectureSwitch.java
@@ -0,0 +1,289 @@
1/**
2 */
3package functionalarchitecture.util;
4
5import functionalarchitecture.FAMTerminator;
6import functionalarchitecture.Function;
7import functionalarchitecture.FunctionalArchitectureModel;
8import functionalarchitecture.FunctionalData;
9import functionalarchitecture.FunctionalElement;
10import functionalarchitecture.FunctionalInput;
11import functionalarchitecture.FunctionalOutput;
12import functionalarchitecture.FunctionalarchitecturePackage;
13import functionalarchitecture.InformationLink;
14
15import org.eclipse.emf.ecore.EObject;
16import org.eclipse.emf.ecore.EPackage;
17
18import org.eclipse.emf.ecore.util.Switch;
19
20/**
21 * <!-- begin-user-doc -->
22 * The <b>Switch</b> for the model's inheritance hierarchy.
23 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
24 * to invoke the <code>caseXXX</code> method for each class of the model,
25 * starting with the actual class of the object
26 * and proceeding up the inheritance hierarchy
27 * until a non-null result is returned,
28 * which is the result of the switch.
29 * <!-- end-user-doc -->
30 * @see functionalarchitecture.FunctionalarchitecturePackage
31 * @generated
32 */
33public class FunctionalarchitectureSwitch<T> extends Switch<T> {
34 /**
35 * The cached model package
36 * <!-- begin-user-doc -->
37 * <!-- end-user-doc -->
38 * @generated
39 */
40 protected static FunctionalarchitecturePackage modelPackage;
41
42 /**
43 * Creates an instance of the switch.
44 * <!-- begin-user-doc -->
45 * <!-- end-user-doc -->
46 * @generated
47 */
48 public FunctionalarchitectureSwitch() {
49 if (modelPackage == null) {
50 modelPackage = FunctionalarchitecturePackage.eINSTANCE;
51 }
52 }
53
54 /**
55 * Checks whether this is a switch for the given package.
56 * <!-- begin-user-doc -->
57 * <!-- end-user-doc -->
58 * @param ePackage the package in question.
59 * @return whether this is a switch for the given package.
60 * @generated
61 */
62 @Override
63 protected boolean isSwitchFor(EPackage ePackage) {
64 return ePackage == modelPackage;
65 }
66
67 /**
68 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
69 * <!-- begin-user-doc -->
70 * <!-- end-user-doc -->
71 * @return the first non-null result returned by a <code>caseXXX</code> call.
72 * @generated
73 */
74 @Override
75 protected T doSwitch(int classifierID, EObject theEObject) {
76 switch (classifierID) {
77 case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT: {
78 FunctionalElement functionalElement = (FunctionalElement)theEObject;
79 T result = caseFunctionalElement(functionalElement);
80 if (result == null) result = defaultCase(theEObject);
81 return result;
82 }
83 case FunctionalarchitecturePackage.FUNCTIONAL_ARCHITECTURE_MODEL: {
84 FunctionalArchitectureModel functionalArchitectureModel = (FunctionalArchitectureModel)theEObject;
85 T result = caseFunctionalArchitectureModel(functionalArchitectureModel);
86 if (result == null) result = defaultCase(theEObject);
87 return result;
88 }
89 case FunctionalarchitecturePackage.FUNCTION: {
90 Function function = (Function)theEObject;
91 T result = caseFunction(function);
92 if (result == null) result = caseFunctionalElement(function);
93 if (result == null) result = defaultCase(theEObject);
94 return result;
95 }
96 case FunctionalarchitecturePackage.FAM_TERMINATOR: {
97 FAMTerminator famTerminator = (FAMTerminator)theEObject;
98 T result = caseFAMTerminator(famTerminator);
99 if (result == null) result = defaultCase(theEObject);
100 return result;
101 }
102 case FunctionalarchitecturePackage.INFORMATION_LINK: {
103 InformationLink informationLink = (InformationLink)theEObject;
104 T result = caseInformationLink(informationLink);
105 if (result == null) result = defaultCase(theEObject);
106 return result;
107 }
108 case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE: {
109 functionalarchitecture.FunctionalInterface functionalInterface = (functionalarchitecture.FunctionalInterface)theEObject;
110 T result = caseFunctionalInterface(functionalInterface);
111 if (result == null) result = defaultCase(theEObject);
112 return result;
113 }
114 case FunctionalarchitecturePackage.FUNCTIONAL_INPUT: {
115 FunctionalInput functionalInput = (FunctionalInput)theEObject;
116 T result = caseFunctionalInput(functionalInput);
117 if (result == null) result = caseFunctionalData(functionalInput);
118 if (result == null) result = defaultCase(theEObject);
119 return result;
120 }
121 case FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT: {
122 FunctionalOutput functionalOutput = (FunctionalOutput)theEObject;
123 T result = caseFunctionalOutput(functionalOutput);
124 if (result == null) result = caseFunctionalData(functionalOutput);
125 if (result == null) result = defaultCase(theEObject);
126 return result;
127 }
128 case FunctionalarchitecturePackage.FUNCTIONAL_DATA: {
129 FunctionalData functionalData = (FunctionalData)theEObject;
130 T result = caseFunctionalData(functionalData);
131 if (result == null) result = defaultCase(theEObject);
132 return result;
133 }
134 default: return defaultCase(theEObject);
135 }
136 }
137
138 /**
139 * Returns the result of interpreting the object as an instance of '<em>Functional Element</em>'.
140 * <!-- begin-user-doc -->
141 * This implementation returns null;
142 * returning a non-null result will terminate the switch.
143 * <!-- end-user-doc -->
144 * @param object the target of the switch.
145 * @return the result of interpreting the object as an instance of '<em>Functional Element</em>'.
146 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
147 * @generated
148 */
149 public T caseFunctionalElement(FunctionalElement object) {
150 return null;
151 }
152
153 /**
154 * Returns the result of interpreting the object as an instance of '<em>Functional Architecture Model</em>'.
155 * <!-- begin-user-doc -->
156 * This implementation returns null;
157 * returning a non-null result will terminate the switch.
158 * <!-- end-user-doc -->
159 * @param object the target of the switch.
160 * @return the result of interpreting the object as an instance of '<em>Functional Architecture Model</em>'.
161 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
162 * @generated
163 */
164 public T caseFunctionalArchitectureModel(FunctionalArchitectureModel object) {
165 return null;
166 }
167
168 /**
169 * Returns the result of interpreting the object as an instance of '<em>Function</em>'.
170 * <!-- begin-user-doc -->
171 * This implementation returns null;
172 * returning a non-null result will terminate the switch.
173 * <!-- end-user-doc -->
174 * @param object the target of the switch.
175 * @return the result of interpreting the object as an instance of '<em>Function</em>'.
176 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
177 * @generated
178 */
179 public T caseFunction(Function object) {
180 return null;
181 }
182
183 /**
184 * Returns the result of interpreting the object as an instance of '<em>FAM Terminator</em>'.
185 * <!-- begin-user-doc -->
186 * This implementation returns null;
187 * returning a non-null result will terminate the switch.
188 * <!-- end-user-doc -->
189 * @param object the target of the switch.
190 * @return the result of interpreting the object as an instance of '<em>FAM Terminator</em>'.
191 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
192 * @generated
193 */
194 public T caseFAMTerminator(FAMTerminator object) {
195 return null;
196 }
197
198 /**
199 * Returns the result of interpreting the object as an instance of '<em>Information Link</em>'.
200 * <!-- begin-user-doc -->
201 * This implementation returns null;
202 * returning a non-null result will terminate the switch.
203 * <!-- end-user-doc -->
204 * @param object the target of the switch.
205 * @return the result of interpreting the object as an instance of '<em>Information Link</em>'.
206 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
207 * @generated
208 */
209 public T caseInformationLink(InformationLink object) {
210 return null;
211 }
212
213 /**
214 * Returns the result of interpreting the object as an instance of '<em>Functional Interface</em>'.
215 * <!-- begin-user-doc -->
216 * This implementation returns null;
217 * returning a non-null result will terminate the switch.
218 * <!-- end-user-doc -->
219 * @param object the target of the switch.
220 * @return the result of interpreting the object as an instance of '<em>Functional Interface</em>'.
221 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
222 * @generated
223 */
224 public T caseFunctionalInterface(functionalarchitecture.FunctionalInterface object) {
225 return null;
226 }
227
228 /**
229 * Returns the result of interpreting the object as an instance of '<em>Functional Input</em>'.
230 * <!-- begin-user-doc -->
231 * This implementation returns null;
232 * returning a non-null result will terminate the switch.
233 * <!-- end-user-doc -->
234 * @param object the target of the switch.
235 * @return the result of interpreting the object as an instance of '<em>Functional Input</em>'.
236 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
237 * @generated
238 */
239 public T caseFunctionalInput(FunctionalInput object) {
240 return null;
241 }
242
243 /**
244 * Returns the result of interpreting the object as an instance of '<em>Functional Output</em>'.
245 * <!-- begin-user-doc -->
246 * This implementation returns null;
247 * returning a non-null result will terminate the switch.
248 * <!-- end-user-doc -->
249 * @param object the target of the switch.
250 * @return the result of interpreting the object as an instance of '<em>Functional Output</em>'.
251 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
252 * @generated
253 */
254 public T caseFunctionalOutput(FunctionalOutput object) {
255 return null;
256 }
257
258 /**
259 * Returns the result of interpreting the object as an instance of '<em>Functional Data</em>'.
260 * <!-- begin-user-doc -->
261 * This implementation returns null;
262 * returning a non-null result will terminate the switch.
263 * <!-- end-user-doc -->
264 * @param object the target of the switch.
265 * @return the result of interpreting the object as an instance of '<em>Functional Data</em>'.
266 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
267 * @generated
268 */
269 public T caseFunctionalData(FunctionalData object) {
270 return null;
271 }
272
273 /**
274 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
275 * <!-- begin-user-doc -->
276 * This implementation returns null;
277 * returning a non-null result will terminate the switch, but this is the last case anyway.
278 * <!-- end-user-doc -->
279 * @param object the target of the switch.
280 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
281 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
282 * @generated
283 */
284 @Override
285 public T defaultCase(EObject object) {
286 return null;
287 }
288
289} //FunctionalarchitectureSwitch
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/.classpath b/Tests/hu.bme.mit.inf.dslreasoner.run/.classpath
index 29ba3981..e7847821 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/.classpath
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/.classpath
@@ -1,9 +1,12 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<classpath> 2<classpath>
3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> 3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
4 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> 4 <attributes>
5 <classpathentry kind="src" path="src"/> 5 <attribute name="module" value="true"/>
6 <classpathentry kind="src" path="xtend-gen"/> 6 </attributes>
7 <classpathentry kind="src" path="src-gen"/> 7 </classpathentry>
8 <classpathentry kind="output" path="bin"/> 8 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
9</classpath> 9 <classpathentry kind="src" path="src"/>
10 <classpathentry kind="src" path="xtend-gen"/>
11 <classpathentry kind="output" path="bin"/>
12</classpath>
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF b/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF
index e2918491..fe223d4a 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF
@@ -17,18 +17,21 @@ Require-Bundle: hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlan
17 org.eclipse.viatra.query.tooling.core;bundle-version="1.5.0", 17 org.eclipse.viatra.query.tooling.core;bundle-version="1.5.0",
18 org.eclipse.viatra.query.runtime.base.itc;bundle-version="1.5.0", 18 org.eclipse.viatra.query.runtime.base.itc;bundle-version="1.5.0",
19 hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner;bundle-version="1.0.0", 19 hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner;bundle-version="1.0.0",
20 org.eclipse.viatra.query.patternlanguage;bundle-version="1.5.0",
21 org.eclipse.viatra.query.patternlanguage.emf;bundle-version="1.5.0",
22 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatraquery;bundle-version="1.0.0", 20 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatraquery;bundle-version="1.0.0",
23 org.junit;bundle-version="4.12.0", 21 org.junit;bundle-version="4.12.0",
24 hu.bme.mit.inf.dslreasoner.domains.transima.fam;bundle-version="1.0.0", 22 ModelGenExampleFAM_plugin;bundle-version="1.0.0",
25 hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph;bundle-version="1.0.0", 23 hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph;bundle-version="1.0.0",
26 org.eclipse.viatra.dse;bundle-version="0.15.0", 24 org.eclipse.viatra.dse;bundle-version="0.15.0",
27 hu.bme.mit.inf.dlsreasoner.alloy.reasoner;bundle-version="1.0.0", 25 hu.bme.mit.inf.dlsreasoner.alloy.reasoner;bundle-version="1.0.0",
28 hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic;bundle-version="1.0.0",
29 org.eclipse.viatra.query.runtime.localsearch;bundle-version="1.5.0", 26 org.eclipse.viatra.query.runtime.localsearch;bundle-version="1.5.0",
30 hu.bme.mit.inf.dslreasoner.logic2ecore;bundle-version="1.0.0", 27 hu.bme.mit.inf.dslreasoner.logic2ecore;bundle-version="1.0.0",
31 hu.bme.mit.inf.dslreasoner.visualisation;bundle-version="1.0.0", 28 hu.bme.mit.inf.dslreasoner.visualisation;bundle-version="1.0.0",
32 hu.bme.mit.inf.dslreasoner.domains.alloyexamples;bundle-version="1.0.0" 29 hu.bme.mit.inf.dslreasoner.domains.alloyexamples;bundle-version="1.0.0",
30 org.eclipse.collections;bundle-version="9.2.0",
31 org.eclipse.viatra.query.patternlanguage.emf;bundle-version="2.0.0",
32 org.eclipse.viatra.query.runtime.rete;bundle-version="2.0.0",
33 org.objectweb.asm;bundle-version="7.0.0",
34 com.google.gson;bundle-version="2.8.2",
35 hu.bme.mit.inf.dslreasoner.domains.satellite;bundle-version="0.1.0"
33Import-Package: org.apache.log4j 36Import-Package: org.apache.log4j
34Bundle-RequiredExecutionEnvironment: JavaSE-1.8 37Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu.json
new file mode 100644
index 00000000..b602f2fe
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu.json
@@ -0,0 +1,13 @@
1{
2 "inputPath": "initialModels",
3 "outputPath": "outputModels",
4 "timeout": 300,
5 "saveModels": true,
6 "saveTemporaryFiles": false,
7 "warmupIterations": 0,
8 "iterations": 30,
9 "domain": "Yakindu",
10 "scope": "unsat",
11 "sizes": [20],
12 "solver": "AlloySolver"
13}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json
new file mode 100644
index 00000000..36fb0ea2
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json
@@ -0,0 +1,17 @@
1{
2 "inputPath": "initialModels",
3 "outputPath": "outputModels",
4 "timeout": 300,
5 "saveModels": true,
6 "saveTemporaryFiles": false,
7 "warmupIterations": 0,
8 "iterations": 1,
9 "domain": "ecoreUnsat",
10 "scope": "none",
11 "sizes": [5, 10, 20, 30, 40, 50],
12 "solver": "ViatraSolver",
13 "scopePropagator": "polyhedral",
14 "propagatedConstraints": "hints",
15 "polyhedronSolver": "Clp",
16 "scopeHeuristic": "polyhedral"
17}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json
new file mode 100644
index 00000000..16abb5d0
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json
@@ -0,0 +1,17 @@
1{
2 "inputPath": "initialModels",
3 "outputPath": "outputModels",
4 "timeout": 300,
5 "saveModels": true,
6 "saveTemporaryFiles": false,
7 "warmupIterations": 0,
8 "iterations": 30,
9 "domain": "satelliteUnsat",
10 "scope": "none",
11 "sizes": [10],
12 "solver": "ViatraSolver",
13 "scopePropagator": "polyhedral",
14 "propagatedConstraints": "hints",
15 "polyhedronSolver": "Clp",
16 "scopeHeuristic": "polyhedral"
17}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/FAM.xmi b/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/FAM.xmi
index d2797166..e4115194 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/FAM.xmi
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/FAM.xmi
@@ -1,3 +1,3 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<fam:FunctionalArchitectureModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" 2<fam:FunctionalArchitectureModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fam="FAM" xsi:schemaLocation="FAM FAM.ecore"/> 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fam="http://www.inf.mit.bme.hu/viatrasolver/example/fam"/>
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/satellite.xmi b/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/satellite.xmi
new file mode 100644
index 00000000..77f6ecfd
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/satellite.xmi
@@ -0,0 +1,14 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<satellite:InterferometryMission
3 xmi:version="2.0"
4 xmlns:xmi="http://www.omg.org/XMI"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xmlns:satellite="http://www.example.org/satellite"
7 xsi:schemaLocation="http://www.example.org/satellite ../../hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.ecore">
8 <groundStationNetwork>
9 <commSubsystem
10 xsi:type="satellite:XCommSubsystem"/>
11 <commSubsystem
12 xsi:type="satellite:KaCommSubsystem"/>
13 </groundStationNetwork>
14</satellite:InterferometryMission>
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/CountMatches.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/CountMatches.xtend
deleted file mode 100644
index 02caf9dd..00000000
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/CountMatches.xtend
+++ /dev/null
@@ -1,176 +0,0 @@
1package hu.bme.mit.inf.dslreasoner.run
2
3import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage
4import hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.Mutated
5import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
6import java.io.File
7import java.util.ArrayList
8import java.util.Collection
9import java.util.Comparator
10import java.util.HashMap
11import java.util.List
12import java.util.Map
13import java.util.TreeSet
14import org.eclipse.emf.ecore.EObject
15import org.eclipse.emf.ecore.resource.Resource
16import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
17import org.eclipse.viatra.query.runtime.api.IPatternMatch
18import org.eclipse.viatra.query.runtime.api.IQuerySpecification
19import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine
20import org.eclipse.viatra.query.runtime.emf.EMFScope
21
22class QueryComparator implements Comparator<IQuerySpecification<?>>{
23
24 override compare(IQuerySpecification<?> arg0, IQuerySpecification<?> arg1) {
25 arg0.fullyQualifiedName.compareTo(arg1.fullyQualifiedName)
26 }
27}
28
29class CountMatches {
30 var static List<IQuerySpecification<?>> wfPatterns;
31 var static Map<IQuerySpecification<?>,IQuerySpecification<?>> query2Reference
32
33 def static void main(String[] args) {
34 YakindummPackage.eINSTANCE.eClass
35 Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("*",new XMIResourceFactoryImpl)
36
37 wfPatterns = Mutated.instance.specifications.toList;
38 //wfPatterns = wfPatterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toList
39 wfPatterns.sort(new QueryComparator)
40
41 val groupName2Representant = new HashMap
42 query2Reference = new HashMap
43 for(wfPattern : wfPatterns) {
44 val groupName = wfPattern.groupName
45 if(groupName2Representant.containsKey(groupName)) {
46 val representant = groupName2Representant.get(groupName)
47 query2Reference.put(wfPattern,representant)
48 } else {
49 groupName2Representant.put(groupName,wfPattern)
50 }
51 }
52
53
54 println('''modelpath;run;model;«
55 FOR wfPattern:wfPatterns SEPARATOR ";"»#(«
56 wfPattern.fullyQualifiedName.split("\\.").last»);hash(«
57 wfPattern.fullyQualifiedName.split("\\.").last»)«ENDFOR»;«
58 FOR mutant : wfPatterns.filter[query2Reference.keySet.contains(it)] SEPARATOR ';'»diff(«
59 mutant.fullyQualifiedName.split("\\.").last»)«ENDFOR»'''
60 )
61 countMatches('''D:/FASE18Meas/RemoHF''')
62 }
63
64 def private static simpleName(IQuerySpecification<?> wfPattern) {
65 wfPattern.fullyQualifiedName.split("\\.").last
66 }
67 def private static groupName(IQuerySpecification<?> wfPattern) {
68 wfPattern.simpleName.split('_').head
69 }
70
71 def static void countMatches(String path) {
72 val file = new File(path)
73 if(file.isDirectory) {
74 for(subFileName : file.list) {
75 (path + "/" + subFileName).countMatches
76 }
77 } else if(file.isFile) {
78 if(path.endsWith("xmi")) {
79 countMatches(file,path)
80 }
81 }
82 }
83
84 def static void countMatches(File file, String path) {
85
86
87 val pathSegments = path.split("/")
88 val groupName = pathSegments.get(pathSegments.size-2).split("\\.").last.split("_").get(0)
89 print(groupName +";")
90 val nameExtension = pathSegments.get(pathSegments.size-1).split("\\.").get(0).split("_")
91 try{
92 val runNumber = nameExtension.get(1)
93 val modelNumber = nameExtension.get(2)
94 print('''«runNumber»;«modelNumber»''')
95 } catch(Exception e) {
96 print('''«file.name»;0''')
97 }
98
99 val parent = file.parent
100 val workspace = new FileSystemWorkspace(parent,"")
101 val model = workspace.readModel(EObject,file.name)
102
103 val engine = ViatraQueryEngine.on(new EMFScope(model))
104 val objectCode = model.eResource.calculateObjectCode
105
106 val pattern2Hash = new HashMap
107 for(pattern : wfPatterns) {
108 val matcher = pattern.getMatcher(engine)
109 val matches = matcher.allMatches
110 val hash = matches.getMatchSetDescriptor(objectCode)
111 pattern2Hash.put(pattern,hash)
112 print(''';«matcher.countMatches»;«hash»''')
113 }
114 var mutantsKilled = 0
115 for(mutant : wfPatterns.filter[query2Reference.keySet.contains(it)]) {
116 val equals = pattern2Hash.get(mutant) == pattern2Hash.get(query2Reference.get(mutant))
117 print(''';''')
118 if(equals) {
119 print('0')
120 } else {
121 print('1')
122 mutantsKilled++
123 }
124 }
125 //print(''';«mutantsKilled»''')
126 println()
127 }
128
129 def static Map<EObject,Integer> calculateObjectCode(Resource resource) {
130 val res = new HashMap
131 val iterator = resource.allContents
132 var index = 1
133 while(iterator.hasNext) {
134 res.put(iterator.next,index++)
135 }
136 return res
137 }
138
139 def static getMatchSetDescriptor(Collection<? extends IPatternMatch> matchSet, Map<EObject,Integer> objectCode) {
140 val set = new TreeSet(new ArrayComparator)
141 for(match: matchSet) {
142 val size = match.parameterNames.size
143 val idArray = new ArrayList<Integer>(size)
144 for(i:0..<size) {
145 val objectInMatch = match.get(i)
146 if(objectInMatch instanceof EObject) {
147 val id = objectCode.get(objectInMatch)
148 if(id!== null) {
149 idArray+= id
150 } else {
151 throw new IllegalArgumentException('''Unindexed object in match: «objectInMatch»''')
152 }
153 } else {
154 throw new IllegalArgumentException('''Unknown type object in match: "«objectInMatch.class.simpleName»"''')
155 }
156 }
157 set += idArray
158 }
159 return '''«FOR match : set SEPARATOR ','»[«FOR index : match SEPARATOR ','»«index»«ENDFOR»]«ENDFOR»'''.toString.hashCode
160 }
161}
162
163class ArrayComparator implements Comparator<List<Integer>> {
164
165 override compare(List<Integer> arg0, List<Integer> arg1) {
166 if(arg0.size === arg1.size) {
167 for(i : 0..<arg0.size) {
168 val comparison = arg0.get(i).compareTo(arg1.get(i))
169 if(comparison !== 0) return comparison
170 }
171 return 0
172 } else {
173 throw new IllegalArgumentException('''the arrays need to be in the same size''')
174 }
175 }
176} \ No newline at end of file
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend
index daa932fd..e15dbf3f 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend
@@ -24,7 +24,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor
24import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy 24import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy
25import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner 25import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner
26import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration 26import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration
27import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation 27import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser
28import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace 28import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
29import java.util.LinkedList 29import java.util.LinkedList
30import java.util.List 30import java.util.List
@@ -32,9 +32,6 @@ import org.eclipse.emf.ecore.EObject
32import org.eclipse.emf.ecore.resource.Resource 32import org.eclipse.emf.ecore.resource.Resource
33import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 33import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
34import org.eclipse.xtend.lib.annotations.Data 34import org.eclipse.xtend.lib.annotations.Data
35import org.eclipse.viatra.query.runtime.api.IQuerySpecification
36import java.util.Set
37import java.util.Comparator
38 35
39enum Metamodel { 36enum Metamodel {
40 FAM, YakinduWOSynch, Yakindu 37 FAM, YakinduWOSynch, Yakindu
@@ -187,8 +184,7 @@ class ScenarioRunner {
187 it.runtimeLimit = 300 184 it.runtimeLimit = 300
188 it.typeScopes.maxNewElements = scenario.size 185 it.typeScopes.maxNewElements = scenario.size
189 it.typeScopes.minNewElements = scenario.size 186 it.typeScopes.minNewElements = scenario.size
190 it.solutionScope.numberOfRequiredSolution = scenario.number 187 it.solutionScope.numberOfRequiredSolutions = scenario.number
191 it.existingQueries = vq.patterns.map[it.internalQueryRepresentation]
192 it.nameNewElements = false 188 it.nameNewElements = false
193 it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis 189 it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis
194 it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints 190 it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints
@@ -223,9 +219,8 @@ class ScenarioRunner {
223 it.runtimeLimit = 300 219 it.runtimeLimit = 300
224 it.typeScopes.maxNewElements = scenario.size 220 it.typeScopes.maxNewElements = scenario.size
225 it.typeScopes.minNewElements = scenario.size 221 it.typeScopes.minNewElements = scenario.size
226 it.solutionScope.numberOfRequiredSolution = scenario.number 222 it.solutionScope.numberOfRequiredSolutions = scenario.number
227 it.typeScopes.maxNewIntegers = 0 223 it.typeScopes.maxNewIntegers = 0
228 it.writeToFile=true
229 it.randomise = run-1 224 it.randomise = run-1
230 ] 225 ]
231 } 226 }
@@ -259,7 +254,7 @@ class ScenarioRunner {
259// ecore2GML.transform(root) 254// ecore2GML.transform(root)
260// workspace.writeText('''solutionVisualisation«representationNumber».gml''',gml) 255// workspace.writeText('''solutionVisualisation«representationNumber».gml''',gml)
261// 256//
262 val visualiser = new GraphvizVisualisation 257 val visualiser = new GraphvizVisualiser
263 val visualisation = visualiser.visualiseConcretization(representation) 258 val visualisation = visualiser.visualiseConcretization(representation)
264 visualisation.writeToFile(workspace,'''solutionVisualisation«representationNumber»''') 259 visualisation.writeToFile(workspace,'''solutionVisualisation«representationNumber»''')
265 260
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/Ecore2LogicTraceBasedHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/Ecore2LogicTraceBasedHint.xtend
new file mode 100644
index 00000000..dc2de30c
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/Ecore2LogicTraceBasedHint.xtend
@@ -0,0 +1,56 @@
1package hu.bme.mit.inf.dslreasoner.run
2
3import com.google.common.collect.ImmutableMap
4import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
5import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace
6import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration
7import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type
8import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeConstraintHint
9import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation
10import java.util.Map
11import org.eclipse.viatra.query.runtime.api.IPatternMatch
12import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher
13
14abstract class Ecore2LogicTraceBasedHint implements LinearTypeConstraintHint {
15 val Map<String, Type> nameToType
16 val Map<String, Map<String, RelationDeclaration>> nameToRelation
17
18 protected new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) {
19 nameToType = ImmutableMap.copyOf(ecore2Logic.allClassesInScope(trace).toMap[name].mapValues [ eClass |
20 ecore2Logic.TypeofEClass(trace, eClass)
21 ])
22 nameToRelation = ImmutableMap.copyOf(ecore2Logic.allReferencesInScope(trace).groupBy[EContainingClass.name].
23 mapValues [ references |
24 ImmutableMap.copyOf(references.toMap[name].mapValues [ reference |
25 ecore2Logic.relationOfReference(trace, reference)
26 ])
27 ])
28 }
29
30 protected def getType(String name) {
31 nameToType.get(name)
32 }
33
34 protected def relation(String typeName, String relationName) {
35 nameToRelation.get(typeName).get(relationName)
36 }
37
38 protected static def <T extends IPatternMatch> int countMatches(ViatraQueryMatcher<T> matcher, PartialInterpretation p) {
39 val match = matcher.newEmptyMatch
40 match.set(0, p.problem)
41 match.set(1, p)
42 matcher.countMatches(match)
43 }
44
45 protected static def <T extends IPatternMatch> int getCount(ViatraQueryMatcher<T> matcher, PartialInterpretation p) {
46 val match = matcher.newEmptyMatch
47 match.set(0, p.problem)
48 match.set(1, p)
49 val realMatch = matcher.getOneArbitraryMatch(match)
50 if (realMatch.present) {
51 realMatch.get.get(2) as Integer
52 } else {
53 0
54 }
55 }
56}
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 43d145d3..bf9ca274 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
@@ -1,19 +1,26 @@
1package hu.bme.mit.inf.dslreasoner.run 1package hu.bme.mit.inf.dslreasoner.run
2 2
3import hu.bme.mit.inf.dslreasomer.domains.transima.fam.FunctionalArchitecture.FunctionalArchitecturePackage 3import functionalarchitecture.FunctionalarchitecturePackage
4import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore
4import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.FileSystem 5import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.FileSystem
5import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage 6import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage
6import hu.bme.mit.inf.dslreasoner.domains.transima.fam.patterns.Pattern 7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SatelliteQueriesAll
8import hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns
7import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage 9import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage
10import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
11import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace
8import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor 12import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor
9import hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.Patterns 13import hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.Patterns
10import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor 14import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor
11import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethod 15import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethod
16import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeConstraintHint
12import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ModelGenerationMethodBasedGlobalConstraint 17import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ModelGenerationMethodBasedGlobalConstraint
13import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace 18import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace
14import java.util.Collection 19import java.util.Collection
20import java.util.HashMap
15import java.util.LinkedHashMap 21import java.util.LinkedHashMap
16import java.util.List 22import java.util.List
23import java.util.Map
17import java.util.Set 24import java.util.Set
18import org.eclipse.emf.ecore.EAttribute 25import org.eclipse.emf.ecore.EAttribute
19import org.eclipse.emf.ecore.EClass 26import org.eclipse.emf.ecore.EClass
@@ -21,61 +28,91 @@ import org.eclipse.emf.ecore.EEnum
21import org.eclipse.emf.ecore.EEnumLiteral 28import org.eclipse.emf.ecore.EEnumLiteral
22import org.eclipse.emf.ecore.EObject 29import org.eclipse.emf.ecore.EObject
23import org.eclipse.emf.ecore.EReference 30import org.eclipse.emf.ecore.EReference
24import org.eclipse.xtext.xbase.lib.Functions.Function1
25import java.util.HashMap
26import org.eclipse.emf.ecore.EcorePackage 31import org.eclipse.emf.ecore.EcorePackage
27import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore 32import org.eclipse.xtend.lib.annotations.Data
33import org.eclipse.xtext.xbase.lib.Functions.Function1
34import satellite.SatellitePackage
35
36@Data
37class TypeQuantiles {
38 double low
39 double high
40}
28 41
29abstract class MetamodelLoader { 42abstract class MetamodelLoader {
43 public static val UNSAT_PREFIX = "unsat_"
44
30 protected val ReasonerWorkspace workspace 45 protected val ReasonerWorkspace workspace
31 public new(ReasonerWorkspace workspace) { 46
47 new(ReasonerWorkspace workspace) {
32 this.workspace = workspace 48 this.workspace = workspace
33 } 49 }
50
34 def EcoreMetamodelDescriptor loadMetamodel() 51 def EcoreMetamodelDescriptor loadMetamodel()
52
35 def Set<EClass> getRelevantTypes(EcoreMetamodelDescriptor descriptor) 53 def Set<EClass> getRelevantTypes(EcoreMetamodelDescriptor descriptor)
54
36 def Set<EReference> getRelevantReferences(EcoreMetamodelDescriptor descriptor) 55 def Set<EReference> getRelevantReferences(EcoreMetamodelDescriptor descriptor)
56
37 def ViatraQuerySetDescriptor loadQueries(EcoreMetamodelDescriptor metamodel) 57 def ViatraQuerySetDescriptor loadQueries(EcoreMetamodelDescriptor metamodel)
58
38 def List<EObject> loadPartialModel() 59 def List<EObject> loadPartialModel()
60
61 def List<Function1<ModelGenerationMethod, ModelGenerationMethodBasedGlobalConstraint>> additionalConstraints()
62
63 def Map<String, TypeQuantiles> getTypeQuantiles() {
64 emptyMap
65 }
39 66
40 def List<Function1<ModelGenerationMethod,ModelGenerationMethodBasedGlobalConstraint>> additionalConstraints() 67 def Map<String, TypeQuantiles> getUnsatTypeQuantiles() {
41 68 throw new UnsupportedOperationException("This domain has no type quantiles for unsatisfiable problems")
42 def <T> filterByNames(Iterable<T> collection, Function1<T,String> nameExtractor, Collection<String> requiredNames) { 69 }
70
71 def List<LinearTypeConstraintHint> getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) {
72 emptyList
73 }
74
75 def <T> filterByNames(Iterable<T> collection, Function1<T, String> nameExtractor,
76 Collection<String> requiredNames) {
43 val res = collection.filter[requiredNames.contains(nameExtractor.apply(it))] 77 val res = collection.filter[requiredNames.contains(nameExtractor.apply(it))]
44 if(res.size != requiredNames.size) throw new IllegalArgumentException 78 if(res.size != requiredNames.size) throw new IllegalArgumentException
45 return res.toSet 79 return res.toSet
46 } 80 }
47} 81}
48 82
49class FAMLoader extends MetamodelLoader{ 83class FAMLoader extends MetamodelLoader {
50 84
51 new(ReasonerWorkspace workspace) { 85 new(ReasonerWorkspace workspace) {
52 super(workspace) 86 super(workspace)
53 } 87 }
54 88
55 override loadMetamodel() { 89 override loadMetamodel() {
56 val package = FunctionalArchitecturePackage.eINSTANCE 90 val package = FunctionalarchitecturePackage.eINSTANCE
57 val List<EClass> classes = package.EClassifiers.filter(EClass).toList 91 val List<EClass> classes = package.EClassifiers.filter(EClass).toList
58 val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList 92 val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList
59 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList 93 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList
60 val List<EReference> references = classes.map[EReferences].flatten.toList 94 val List<EReference> references = classes.map[EReferences].flatten.filter [ reference |
95 !#{"model", "type"}.contains(reference.name)
96 ].toList
61 val List<EAttribute> attributes = classes.map[EAttributes].flatten.toList 97 val List<EAttribute> attributes = classes.map[EAttributes].flatten.toList
62 return new EcoreMetamodelDescriptor(classes,#{},false,enums,literals,references,attributes) 98 return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes)
63 } 99 }
64 100
65 override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { 101 override getRelevantTypes(EcoreMetamodelDescriptor descriptor) {
66 return descriptor.classes.filterByNames([it.name],#["FunctionalElement"]) 102 return descriptor.classes.filterByNames([it.name], #["FunctionalElement"])
67 } 103 }
104
68 override getRelevantReferences(EcoreMetamodelDescriptor descriptor) { 105 override getRelevantReferences(EcoreMetamodelDescriptor descriptor) {
69 return descriptor.references.filterByNames([it.name],#["subElements"]) 106 return descriptor.references.filterByNames([it.name], #["subElements"])
70 } 107 }
71 108
72 override loadQueries(EcoreMetamodelDescriptor metamodel) { 109 override loadQueries(EcoreMetamodelDescriptor metamodel) {
73 val i = Pattern.instance 110 val i = FamPatterns.instance
74 val patterns = i.specifications.toList 111 val patterns = i.specifications.toList
75 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet 112 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet
76 val derivedFeatures = new LinkedHashMap 113 val derivedFeatures = new LinkedHashMap
77 derivedFeatures.put(i.type,metamodel.attributes.filter[it.name == "type"].head) 114// derivedFeatures.put(Type.instance,metamodel.attributes.filter[it.name == "type"].head)
78 derivedFeatures.put(i.model,metamodel.references.filter[it.name == "model"].head) 115// derivedFeatures.put(Model.instance,metamodel.references.filter[it.name == "model"].head)
79 val res = new ViatraQuerySetDescriptor( 116 val res = new ViatraQuerySetDescriptor(
80 patterns, 117 patterns,
81 wfPatterns, 118 wfPatterns,
@@ -83,65 +120,75 @@ class FAMLoader extends MetamodelLoader{
83 ) 120 )
84 return res 121 return res
85 } 122 }
123
86 override loadPartialModel() { 124 override loadPartialModel() {
87 this.workspace.readModel(EObject,"FAM.xmi").eResource.allContents.toList 125 this.workspace.readModel(EObject, "FAM.xmi").eResource.allContents.toList
88 } 126 }
89 127
90 override additionalConstraints() { #[] } 128 override additionalConstraints() { #[] }
91} 129}
92 130
93class YakinduLoader extends MetamodelLoader{ 131class YakinduLoader extends MetamodelLoader {
94 132
95 private var useSynchronization = true; 133 var useSynchronization = true;
96 private var useComplexStates = false; 134 var useComplexStates = false;
97 public static val patternsWithSynchronization = #[ 135 public static val patternsWithSynchronization = #["synchHasNoOutgoing", "synchHasNoIncoming",
98 "synchHasNoOutgoing", "synchHasNoIncoming", "SynchronizedIncomingInSameRegion", "notSynchronizingStates", 136 "SynchronizedIncomingInSameRegion", "SynchronizedIncomingInSameRegionHelper1",
99 "hasMultipleOutgoingTrainsition", "hasMultipleIncomingTrainsition", "SynchronizedRegionsAreNotSiblings", 137 "SynchronizedIncomingInSameRegionHelper2", "notSynchronizingStates", "hasMultipleOutgoingTrainsition",
100 "SynchronizedRegionDoesNotHaveMultipleRegions", "synchThree", "twoSynch","noSynch2","synch","noSynch4","noSynch3","noSynch"] 138 "hasMultipleIncomingTrainsition", "SynchronizedRegionsAreNotSiblings",
101 public static val patternsWithComplexStates =#["outgoingFromExit","outgoingFromFinal","choiceHasNoOutgoing","choiceHasNoIncoming"] 139 "SynchronizedRegionsAreNotSiblingsHelper1", "SynchronizedRegionsAreNotSiblingsHelper2",
140 "SynchronizedRegionDoesNotHaveMultipleRegions", "synchThree", "twoSynch", "noSynch2", "synch", "noSynch4",
141 "noSynch3", "noSynch"]
142 public static val patternsWithComplexStates = #["outgoingFromExit", "outgoingFromFinal", "choiceHasNoOutgoing",
143 "choiceHasNoIncoming"]
144
145 val boolean satisfiable
146
102 new(ReasonerWorkspace workspace) { 147 new(ReasonerWorkspace workspace) {
148 this(workspace, true)
149 }
150
151 new(ReasonerWorkspace workspace, boolean satisfiable) {
103 super(workspace) 152 super(workspace)
104 YakindummPackage.eINSTANCE.eClass 153 this.satisfiable = satisfiable
105 } 154 }
106 155
107 public def setUseSynchronization(boolean useSynchronization) { 156 def setUseSynchronization(boolean useSynchronization) {
108 this.useSynchronization = useSynchronization 157 this.useSynchronization = useSynchronization
109 } 158 }
110 public def setUseComplexStates(boolean useComplexStates) { 159
160 def setUseComplexStates(boolean useComplexStates) {
111 this.useComplexStates = useComplexStates 161 this.useComplexStates = useComplexStates
112 } 162 }
113 163
114 override loadMetamodel() { 164 override loadMetamodel() {
115 val useSynchInThisLoad = this.useSynchronization 165 val useSynchInThisLoad = this.useSynchronization
116 val useComplexStates = this.useComplexStates 166 val useComplexStates = this.useComplexStates
117 167
118 val package = YakindummPackage.eINSTANCE 168 val package = YakindummPackage.eINSTANCE
119 val List<EClass> classes = package.EClassifiers.filter(EClass) 169 val List<EClass> classes = package.EClassifiers.filter(EClass).filter [
120 .filter[useSynchInThisLoad || (it.name != "Synchronization")] 170 useSynchInThisLoad || (it.name != "Synchronization")
121 .filter[useComplexStates || (it.name != "Choice" && it.name != "Exit" && it.name != "FinalState")] 171 ].filter[useComplexStates || (it.name != "Choice" && it.name != "Exit" && it.name != "FinalState")].toList
122 .toList
123 val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList 172 val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList
124 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList 173 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList
125 val List<EReference> references = classes.map[EReferences].flatten.toList 174 val List<EReference> references = classes.map[EReferences].flatten.toList
126 val List<EAttribute> attributes = classes.map[EAttributes].flatten.toList 175 val List<EAttribute> attributes = classes.map[EAttributes].flatten.toList
127 176
128 return new EcoreMetamodelDescriptor(classes,#{},false,enums,literals,references,attributes) 177 return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes)
129 } 178 }
179
130 override loadQueries(EcoreMetamodelDescriptor metamodel) { 180 override loadQueries(EcoreMetamodelDescriptor metamodel) {
131 val useSynchInThisLoad = this.useSynchronization 181 val useSynchInThisLoad = this.useSynchronization
132 182
133 val i = Patterns.instance 183 val i = Patterns.instance
134 val patterns = i.specifications 184 val patterns = i.specifications.filter [ spec |
135 .filter[spec | 185 useSynchInThisLoad || !patternsWithSynchronization.exists[spec.fullyQualifiedName.endsWith(it)]
136 useSynchInThisLoad || 186 ].filter [ spec |
137 !patternsWithSynchronization.exists[spec.fullyQualifiedName.endsWith(it)] 187 useComplexStates || !patternsWithComplexStates.exists[spec.fullyQualifiedName.endsWith(it)]
138 ] 188 ].filter [
139 .filter[spec | 189 !satisfiable || !it.simpleName.startsWith(UNSAT_PREFIX)
140 useComplexStates || 190 ].toList
141 !patternsWithComplexStates.exists[spec.fullyQualifiedName.endsWith(it)] 191 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet
142 ]
143 .toList
144 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet
145 val derivedFeatures = new LinkedHashMap 192 val derivedFeatures = new LinkedHashMap
146 val res = new ViatraQuerySetDescriptor( 193 val res = new ViatraQuerySetDescriptor(
147 patterns, 194 patterns,
@@ -150,53 +197,85 @@ class YakinduLoader extends MetamodelLoader{
150 ) 197 )
151 return res 198 return res
152 } 199 }
200
153 override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { 201 override getRelevantTypes(EcoreMetamodelDescriptor descriptor) {
154 descriptor.classes.filterByNames([it.name],#["Vertex","Transition","Synchronization"]) 202 descriptor.classes.filterByNames([it.name], #["Vertex", "Transition", "Synchronization"])
155 } 203 }
156 204
157 override getRelevantReferences(EcoreMetamodelDescriptor descriptor) { 205 override getRelevantReferences(EcoreMetamodelDescriptor descriptor) {
158 descriptor.references.filterByNames([it.name],#["source","target"]) 206 descriptor.references.filterByNames([it.name], #["source", "target"])
159 } 207 }
160 208
161 override loadPartialModel() { 209 override loadPartialModel() {
162 this.workspace.readModel(EObject,"Yakindu.xmi").eResource.allContents.toList 210 this.workspace.readModel(EObject, "Yakindu.xmi").eResource.allContents.toList
211 }
212
213 override additionalConstraints() {
214 // #[[method|new SGraphInconsistencyDetector(method)]]
215 emptyList
216 }
217
218 override getTypeQuantiles() {
219 #{
220 "Choice" -> new TypeQuantiles(0.118279569892473, 0.154020979020979),
221 "Entry" -> new TypeQuantiles(0.0283018867924528, 0.0620167525773196),
222 "Exit" -> new TypeQuantiles(0, 0),
223 "FinalState" -> new TypeQuantiles(0, 0),
224 "Region" -> new TypeQuantiles(0.0294117647058824, 0.0633258678611422),
225 "State" -> new TypeQuantiles(0.132023636740618, 0.175925925925926),
226// "Statechart" -> new TypeQuantiles(0.00961538461538462, 0.010752688172043),
227 "Transition" -> new TypeQuantiles(0.581632653061224, 0.645161290322581)
228 }
163 } 229 }
164 230
165 override additionalConstraints() { //#[] 231 override getUnsatTypeQuantiles() {
166 #[[method | new SGraphInconsistencyDetector(method)]] 232 #{
233 "Choice" -> new TypeQuantiles(0.118279569892473, 0.154020979020979),
234 "Entry" -> new TypeQuantiles(0.2, 0.4),
235 "Exit" -> new TypeQuantiles(0, 0),
236 "FinalState" -> new TypeQuantiles(0, 0),
237 "Region" -> new TypeQuantiles(0.0294117647058824, 0.0633258678611422),
238 "State" -> new TypeQuantiles(0.132023636740618, 0.175925925925926),
239// "Statechart" -> new TypeQuantiles(0.00961538461538462, 0.010752688172043),
240 "Transition" -> new TypeQuantiles(0.581632653061224, 0.645161290322581)
241 }
242 }
243
244 override getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) {
245 #[new SGraphHint(ecore2Logic, trace)]
167 } 246 }
168} 247}
169 248
170class FileSystemLoader extends MetamodelLoader{ 249class FileSystemLoader extends MetamodelLoader {
171 250
172 new(ReasonerWorkspace workspace) { 251 new(ReasonerWorkspace workspace) {
173 super(workspace) 252 super(workspace)
174 } 253 }
175 254
176 override loadMetamodel() { 255 override loadMetamodel() {
177 val package = FilesystemPackage.eINSTANCE 256 val package = FilesystemPackage.eINSTANCE
178 val List<EClass> classes = package.EClassifiers.filter(EClass).toList 257 val List<EClass> classes = package.EClassifiers.filter(EClass).toList
179 val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList 258 val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList
180 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList 259 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList
181 val List<EReference> references = classes.map[EReferences].flatten.toList 260 val List<EReference> references = classes.map[EReferences].flatten.filter[name != "live"].toList
182 val List<EAttribute> attributes = classes.map[EAttributes].flatten.toList 261 val List<EAttribute> attributes = classes.map[EAttributes].flatten.toList
183 return new EcoreMetamodelDescriptor(classes,#{},false,enums,literals,references,attributes) 262 return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes)
184 } 263 }
185 264
186 override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { 265 override getRelevantTypes(EcoreMetamodelDescriptor descriptor) {
187 return null 266 return null
188 } 267 }
189 268
190 override getRelevantReferences(EcoreMetamodelDescriptor descriptor) { 269 override getRelevantReferences(EcoreMetamodelDescriptor descriptor) {
191 null 270 null
192 } 271 }
193 272
194 override loadQueries(EcoreMetamodelDescriptor metamodel) { 273 override loadQueries(EcoreMetamodelDescriptor metamodel) {
195 val patternGroup = FileSystem.instance 274 val patternGroup = FileSystem.instance
196 val patterns = patternGroup.specifications.toList 275 val patterns = patternGroup.specifications.toList
197 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet 276 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet
198 val derivedFeatures = new HashMap 277 val derivedFeatures = new HashMap
199 derivedFeatures.put(patternGroup.live,metamodel.references.filter[it.name == "live"].head) 278// derivedFeatures.put(patternGroup.live,metamodel.references.filter[it.name == "live"].head)
200 return new ViatraQuerySetDescriptor( 279 return new ViatraQuerySetDescriptor(
201 patterns, 280 patterns,
202 wfPatterns, 281 wfPatterns,
@@ -204,45 +283,69 @@ class FileSystemLoader extends MetamodelLoader{
204 ) 283 )
205 284
206 } 285 }
207 286
208 override loadPartialModel() { 287 override loadPartialModel() {
209 this.workspace.readModel(EObject,"fs.xmi").eResource.allContents.toList 288 this.workspace.readModel(EObject, "fs.xmi").eResource.allContents.toList
210 } 289 }
211 290
212 override additionalConstraints() { 291 override additionalConstraints() {
213 #[[method | new FileSystemInconsistencyDetector(method)]] 292 // #[[method|new FileSystemInconsistencyDetector(method)]]
293 emptyList
294 }
295
296 override getTypeQuantiles() {
297 #{
298 "Filesystem" -> new TypeQuantiles(0, 0.05),
299 "Dir" -> new TypeQuantiles(0.15, 0.3),
300 "File" -> new TypeQuantiles(0.25, 0.85)
301 }
214 } 302 }
215
216} 303}
217 304
218class EcoreLoader extends MetamodelLoader { 305class EcoreLoader extends MetamodelLoader {
219 306 val boolean satisfiable
307
220 new(ReasonerWorkspace workspace) { 308 new(ReasonerWorkspace workspace) {
309 this(workspace, true)
310 }
311
312 new(ReasonerWorkspace workspace, boolean satisfiable) {
221 super(workspace) 313 super(workspace)
314 this.satisfiable = satisfiable
222 } 315 }
223 316
224 override loadMetamodel() { 317 override loadMetamodel() {
225 val package = EcorePackage.eINSTANCE 318 val package = EcorePackage.eINSTANCE
226 val List<EClass> classes = package.EClassifiers.filter(EClass).filter[it.name!="EFactory"].toList 319 val List<EClass> classes = package.EClassifiers.filter(EClass).filter [
320 it.name != "EFactory" && it.name != "EObject" && it.name != "EResource"
321 ].toList
227 val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList 322 val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList
228 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList 323 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList
229 val List<EReference> references = classes.map[EReferences].flatten.filter[it.name!="eFactoryInstance"].filter[!it.derived].toList 324 val List<EReference> references = classes.map[EReferences].flatten.filter [
230 val List<EAttribute> attributes = #[] //classes.map[EAttributes].flatten.toList 325 it.name != "eFactoryInstance" && it.name != "contents" && it.name != "references" &&
231 return new EcoreMetamodelDescriptor(classes,#{},false,enums,literals,references,attributes) 326 it.name != "eGenericType" && it.name != "eGenericSuperTypes"
327 ].filter[!it.derived].toList
328 val List<EAttribute> attributes = #[] // classes.map[EAttributes].flatten.toList
329 return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes)
232 } 330 }
233 331
234 override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { 332 override getRelevantTypes(EcoreMetamodelDescriptor descriptor) {
235 return null 333 return null
236 } 334 }
237 335
238 override getRelevantReferences(EcoreMetamodelDescriptor descriptor) { 336 override getRelevantReferences(EcoreMetamodelDescriptor descriptor) {
239 null 337 null
240 } 338 }
241 339
242 override loadQueries(EcoreMetamodelDescriptor metamodel) { 340 override loadQueries(EcoreMetamodelDescriptor metamodel) {
243 val patternGroup = Ecore.instance 341 val patternGroup = Ecore.instance
244 val patterns = patternGroup.specifications.toList 342 val patterns = patternGroup.specifications.toList
245 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet 343 val allWfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet
344 val wfPatterns = if (satisfiable) {
345 allWfPatterns.filter[!it.simpleName.startsWith(UNSAT_PREFIX)].toSet
346 } else {
347 allWfPatterns
348 }
246 val derivedFeatures = new HashMap 349 val derivedFeatures = new HashMap
247 return new ViatraQuerySetDescriptor( 350 return new ViatraQuerySetDescriptor(
248 patterns, 351 patterns,
@@ -251,13 +354,111 @@ class EcoreLoader extends MetamodelLoader {
251 ) 354 )
252 355
253 } 356 }
254 357
255 override loadPartialModel() { 358 override loadPartialModel() {
256 this.workspace.readModel(EObject,"ecore.xmi").eResource.allContents.toList 359 this.workspace.readModel(EObject, "ecore.xmi").eResource.allContents.toList
257 } 360 }
258 361
259 override additionalConstraints() { 362 override additionalConstraints() {
260 #[] 363 #[]
261 } 364 }
262 365
263} \ No newline at end of file 366 override getTypeQuantiles() {
367 #{
368 "EAnnotation" -> new TypeQuantiles(0, 0),
369 "EAttribute" -> new TypeQuantiles(0.14, 0.300943396226415),
370 "EClass" -> new TypeQuantiles(0.224014336917563, 0.372881355932203),
371 "EDataType" -> new TypeQuantiles(0, 0),
372 "EEnum" -> new TypeQuantiles(0, 0.0275208638045255),
373 "EEnumLiteral" -> new TypeQuantiles(0, 0.105204907665065),
374 "EGenericType" -> new TypeQuantiles(0, 0),
375 "EOperation" -> new TypeQuantiles(0, 0),
376 "EPackage" -> new TypeQuantiles(0.0119047619047619, 0.0192307692307692),
377 "EParameter" -> new TypeQuantiles(0, 0),
378 "EReference" -> new TypeQuantiles(0.217599234815878, 0.406779661016949),
379 "EStringToStringMapEntry" -> new TypeQuantiles(0, 0),
380 "ETypeParameter" -> new TypeQuantiles(0, 0)
381 }
382 }
383
384}
385
386class SatelliteLoader extends MetamodelLoader {
387 val boolean satisfiable
388
389 new(ReasonerWorkspace workspace) {
390 this(workspace, true)
391 }
392
393 new(ReasonerWorkspace workspace, boolean satisfiable) {
394 super(workspace)
395 this.satisfiable = satisfiable
396 }
397
398 override loadMetamodel() {
399 val package = SatellitePackage.eINSTANCE
400 val List<EClass> classes = package.EClassifiers.filter(EClass).toList
401 val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList
402 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList
403 val List<EReference> references = classes.map[EReferences].flatten.toList
404 val List<EAttribute> attributes = classes.map[EAttributes].flatten.toList
405 return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes)
406 }
407
408 override getRelevantTypes(EcoreMetamodelDescriptor descriptor) {
409 null
410 }
411
412 override getRelevantReferences(EcoreMetamodelDescriptor descriptor) {
413 null
414 }
415
416 override loadQueries(EcoreMetamodelDescriptor metamodel) {
417 val i = SatelliteQueriesAll.instance
418 val patterns = i.specifications.filter [
419 !satisfiable || !it.simpleName.startsWith(UNSAT_PREFIX)
420 ].toList
421 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet
422 val derivedFeatures = new LinkedHashMap
423 val res = new ViatraQuerySetDescriptor(
424 patterns,
425 wfPatterns,
426 derivedFeatures
427 )
428 return res
429 }
430
431 override loadPartialModel() {
432 this.workspace.readModel(EObject, "satellite.xmi").eResource.allContents.toList
433 }
434
435 override additionalConstraints() { #[] }
436
437 override getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) {
438 #[new SatelliteHint(ecore2Logic, trace)]
439 }
440
441 override getTypeQuantiles() {
442 #{
443 "CubeSat3U" -> new TypeQuantiles(0.1, 0.25),
444 "CubeSat6U" -> new TypeQuantiles(0, 0.25),
445 "SmallSat" -> new TypeQuantiles(0, 0.15),
446 "UHFCommSubsystem" -> new TypeQuantiles(0.08, 0.25),
447 "XCommSubsystem" -> new TypeQuantiles(0.08, 0.25),
448 "KaCommSubsystem" -> new TypeQuantiles(0, 0.1),
449 "InterferometryPayload" -> new TypeQuantiles(0.15, 0.25)
450 }
451 }
452
453 override getUnsatTypeQuantiles() {
454 #{
455 "CubeSat3U" -> new TypeQuantiles(0.1, 0.25),
456 "CubeSat6U" -> new TypeQuantiles(0.1, 0.25),
457 "SmallSat" -> new TypeQuantiles(0.1, 0.25),
458 "UHFCommSubsystem" -> new TypeQuantiles(0.08, 0.1),
459 "XCommSubsystem" -> new TypeQuantiles(0, 0.1),
460 "KaCommSubsystem" -> new TypeQuantiles(0, 0.05),
461 "InterferometryPayload" -> new TypeQuantiles(0.15, 0.25)
462 }
463 }
464}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend
index 8d96958d..ae810a9b 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend
@@ -25,10 +25,12 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod
25import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic 25import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic
26import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation 26import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation
27import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage 27import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage
28import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml
28import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor 29import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor
29import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy 30import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy
30import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner 31import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner
31import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration 32import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration
33import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser
32import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace 34import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
33import java.io.BufferedReader 35import java.io.BufferedReader
34import java.io.InputStreamReader 36import java.io.InputStreamReader
@@ -37,9 +39,6 @@ import org.eclipse.emf.ecore.EObject
37import org.eclipse.emf.ecore.resource.Resource 39import org.eclipse.emf.ecore.resource.Resource
38import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 40import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
39import org.junit.Test 41import org.junit.Test
40import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation
41import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationSizePrinter
42import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml
43 42
44enum UseSolver{Viatra, Smt, ViatraWithSmt, Alloy} 43enum UseSolver{Viatra, Smt, ViatraWithSmt, Alloy}
45enum Domain{FAM, Yakindu, FileSystem,Ecore} 44enum Domain{FAM, Yakindu, FileSystem,Ecore}
@@ -129,7 +128,7 @@ class RunMeasurements {
129 val smtConfig = new SmtSolverConfiguration() => [ 128 val smtConfig = new SmtSolverConfiguration() => [
130 it.typeScopes.maxNewElements = size 129 it.typeScopes.maxNewElements = size
131 it.typeScopes.minNewElements = size 130 it.typeScopes.minNewElements = size
132 it.solutionScope.numberOfRequiredSolution = number 131 it.solutionScope.numberOfRequiredSolutions = number
133 it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"''' 132 it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"'''
134 ] 133 ]
135 val solution = this.smtSolver.solve( 134 val solution = this.smtSolver.solve(
@@ -142,9 +141,8 @@ class RunMeasurements {
142 val alloyConfig = new AlloySolverConfiguration => [ 141 val alloyConfig = new AlloySolverConfiguration => [
143 it.typeScopes.maxNewElements = size 142 it.typeScopes.maxNewElements = size
144 it.typeScopes.minNewElements = size 143 it.typeScopes.minNewElements = size
145 it.solutionScope.numberOfRequiredSolution = number 144 it.solutionScope.numberOfRequiredSolutions = number
146 it.typeScopes.maxNewIntegers = 0 145 it.typeScopes.maxNewIntegers = 0
147 it.writeToFile = true
148 ] 146 ]
149 val solution = this.alloyReasoner.solve( 147 val solution = this.alloyReasoner.solve(
150 problem, 148 problem,
@@ -157,13 +155,12 @@ class RunMeasurements {
157 it.runtimeLimit = 400 155 it.runtimeLimit = 400
158 it.typeScopes.maxNewElements = size 156 it.typeScopes.maxNewElements = size
159 it.typeScopes.minNewElements = size 157 it.typeScopes.minNewElements = size
160 it.solutionScope.numberOfRequiredSolution = number 158 it.solutionScope.numberOfRequiredSolutions = number
161 it.existingQueries = vq.patterns.map[it.internalQueryRepresentation]
162 it.nameNewElements = false 159 it.nameNewElements = false
163 it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis 160 it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis
164 it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints 161 it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints
165 it.stateCoderStrategy = StateCoderStrategy::Neighbourhood 162 it.stateCoderStrategy = StateCoderStrategy::Neighbourhood
166 it.debugCongiguration.partalInterpretationVisualisationFrequency = 100 163 it.debugConfiguration.partalInterpretationVisualisationFrequency = 100
167 //it.debugCongiguration.partialInterpretatioVisualiser = 164 //it.debugCongiguration.partialInterpretatioVisualiser =
168 //new GraphvizVisualisation 165 //new GraphvizVisualisation
169 //new PartialInterpretationSizePrinter 166 //new PartialInterpretationSizePrinter
@@ -267,7 +264,7 @@ class RunMeasurements {
267 val gml = partialInterpretation2GML.transform(representation) 264 val gml = partialInterpretation2GML.transform(representation)
268 r.workspace.writeText('''solution«representationNumber».gml''',gml) 265 r.workspace.writeText('''solution«representationNumber».gml''',gml)
269 if(representation.newElements.size <160) { 266 if(representation.newElements.size <160) {
270 val visualiser = new GraphvizVisualisation 267 val visualiser = new GraphvizVisualiser
271 val visualisation = visualiser.visualiseConcretization(representation) 268 val visualisation = visualiser.visualiseConcretization(representation)
272 visualisation.writeToFile(r.workspace,'''solution«representationNumber»''') 269 visualisation.writeToFile(r.workspace,'''solution«representationNumber»''')
273 } 270 }
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend
index d8f75b89..1b8fe3e9 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend
@@ -30,7 +30,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor
30import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy 30import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy
31import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner 31import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner
32import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration 32import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration
33import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation 33import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser
34import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace 34import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
35import java.io.BufferedReader 35import java.io.BufferedReader
36import java.io.InputStreamReader 36import java.io.InputStreamReader
@@ -44,7 +44,6 @@ import org.eclipse.emf.ecore.resource.Resource
44import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 44import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
45import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine 45import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine
46import org.eclipse.viatra.query.runtime.emf.EMFScope 46import org.eclipse.viatra.query.runtime.emf.EMFScope
47import java.lang.invoke.VolatileCallSite
48 47
49enum PartialModelSource { Homeworks, Random } 48enum PartialModelSource { Homeworks, Random }
50enum ValidationTechique {Alloy, Viatra} 49enum ValidationTechique {Alloy, Viatra}
@@ -116,7 +115,7 @@ class RunModelExtensionMeasurements {
116 val smtConfig = new SmtSolverConfiguration() => [ 115 val smtConfig = new SmtSolverConfiguration() => [
117 it.typeScopes.maxNewElements = size 116 it.typeScopes.maxNewElements = size
118 it.typeScopes.minNewElements = size 117 it.typeScopes.minNewElements = size
119 it.solutionScope.numberOfRequiredSolution = 1 118 it.solutionScope.numberOfRequiredSolutions = 1
120 it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"''' 119 it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"'''
121 ] 120 ]
122 val solution = this.smtSolver.solve( 121 val solution = this.smtSolver.solve(
@@ -129,9 +128,8 @@ class RunModelExtensionMeasurements {
129 val alloyConfig = new AlloySolverConfiguration => [ 128 val alloyConfig = new AlloySolverConfiguration => [
130 it.typeScopes.maxNewElements = size 129 it.typeScopes.maxNewElements = size
131 it.typeScopes.minNewElements = size 130 it.typeScopes.minNewElements = size
132 it.solutionScope.numberOfRequiredSolution = 1 131 it.solutionScope.numberOfRequiredSolutions = 1
133 it.typeScopes.maxNewIntegers = 0 132 it.typeScopes.maxNewIntegers = 0
134 it.writeToFile = true
135 ] 133 ]
136 val solution = this.alloyReasoner.solve( 134 val solution = this.alloyReasoner.solve(
137 problem, 135 problem,
@@ -144,16 +142,12 @@ class RunModelExtensionMeasurements {
144 it.runtimeLimit = 400 142 it.runtimeLimit = 400
145 it.typeScopes.maxNewElements = size 143 it.typeScopes.maxNewElements = size
146 it.typeScopes.minNewElements = size 144 it.typeScopes.minNewElements = size
147 it.solutionScope.numberOfRequiredSolution = 1 145 it.solutionScope.numberOfRequiredSolutions = 1
148 it.existingQueries = vq.patterns.map[it.internalQueryRepresentation]
149 it.nameNewElements = false 146 it.nameNewElements = false
150 it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis 147 it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis
151 it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints 148 it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints
152 it.stateCoderStrategy = StateCoderStrategy::Neighbourhood 149 it.stateCoderStrategy = StateCoderStrategy::Neighbourhood
153 it.debugCongiguration.partalInterpretationVisualisationFrequency = 100 150 it.debugConfiguration.partalInterpretationVisualisationFrequency = 100
154 //it.debugCongiguration.partialInterpretatioVisualiser =
155 //new GraphvizVisualisation
156 //new PartialInterpretationSizePrinter
157 ] 151 ]
158 viatraConfig.diversityRequirement = diversityRequirement 152 viatraConfig.diversityRequirement = diversityRequirement
159 if (solver == UseSolver.Viatra) { 153 if (solver == UseSolver.Viatra) {
@@ -314,7 +308,7 @@ class RunModelExtensionMeasurements {
314 val gml = partialInterpretation2GML.transform(representation) 308 val gml = partialInterpretation2GML.transform(representation)
315 r.workspace.writeText('''solution«representationNumber».gml''',gml) 309 r.workspace.writeText('''solution«representationNumber».gml''',gml)
316 if(representation.newElements.size <160) { 310 if(representation.newElements.size <160) {
317 val visualiser = new GraphvizVisualisation 311 val visualiser = new GraphvizVisualiser
318 val visualisation = visualiser.visualiseConcretization(representation) 312 val visualisation = visualiser.visualiseConcretization(representation)
319 visualisation.writeToFile(r.workspace,'''solution«representationNumber»''') 313 visualisation.writeToFile(r.workspace,'''solution«representationNumber»''')
320 } 314 }
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend
new file mode 100644
index 00000000..97ce4ee6
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend
@@ -0,0 +1,46 @@
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 SGraphHint extends Ecore2LogicTraceBasedHint {
9 new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) {
10 super(ecore2Logic, trace)
11 }
12
13 override getAdditionalPatterns(extension PatternGenerator patternGenerator) {
14 ""
15 }
16
17 override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) {
18 val newEntriesWithoutRegionCount = createBuilder.add(1, "Entry".type).add(-1, "Region".type).build
19 val newStatesWithoutRegionCount = createBuilder.add(1, "State".type).add(-1, "Region".type).build
20 val newTransitionWithoutNeedsOutgoingCount = createBuilder.add(1, "Transition".type).add(-1, "Entry".type).
21 add(-1, "Choice".type).build
22 val newTransitionWithoutNeedsIncomingCount = createBuilder.add(1, "Transition".type).add(-1, "Choice".type).
23 build
24
25 val regionsWithoutEntryMatcher = createMatcher(
26 "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noEntryInRegion")
27 val regionsWithoutStateMatcher = createMatcher(
28 "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noStateInRegion")
29 val entryHasNoOutgoingMatcher = createMatcher(
30 "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noOutgoingTransitionFromEntry")
31 val choiceHasNoOutgoingMatcher = createMatcher(
32 "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_choiceHasNoOutgoing")
33 val choiceHasNoIncomingMatcher = createMatcher(
34 "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_choiceHasNoIncoming")
35 val transitionWithoutTargetMatcher = createMatcher("unfinishedLowerMultiplicity_target_reference_Transition")
36
37 return [ p |
38 newEntriesWithoutRegionCount.assertEqualsTo(regionsWithoutEntryMatcher.countMatches(p))
39 newStatesWithoutRegionCount.tightenLowerBound(regionsWithoutStateMatcher.countMatches(p))
40 newTransitionWithoutNeedsOutgoingCount.tightenLowerBound(
41 entryHasNoOutgoingMatcher.countMatches(p) + choiceHasNoOutgoingMatcher.countMatches(p))
42 newTransitionWithoutNeedsIncomingCount.tightenLowerBound(
43 choiceHasNoIncomingMatcher.countMatches(p) - transitionWithoutTargetMatcher.getCount(p))
44 ]
45 }
46}
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
new file mode 100644
index 00000000..ef5b779e
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend
@@ -0,0 +1,49 @@
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.Modality
6import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeExpressionBuilderFactory
7import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator
8
9class SatelliteHint extends Ecore2LogicTraceBasedHint {
10 static val INTERFEROMETY_PAYLOAD = "hint_interferometryPayload"
11 static val REMAINING_CONTENTS_KA_COMM_SUBSYSTEM = "hint_kaCommSubsystem"
12
13 new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) {
14 super(ecore2Logic, trace)
15 }
16
17 override getAdditionalPatterns(PatternGenerator it) '''
18 pattern «INTERFEROMETY_PAYLOAD»(problem:LogicProblem, interpretation:PartialInterpretation, object:DefinedElement) {
19 find interpretation(problem, interpretation);
20 find mustExist(problem, interpretation, object);
21 «typeIndexer.referInstanceOf("InterferometryPayload".type, Modality.MUST, "object")»
22 }
23
24 private pattern «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»_helper(problem:LogicProblem, interpretation:PartialInterpretation, object:DefinedElement, remainingContents:java Integer) {
25 find remainingContents_commSubsystem_reference_CommunicatingElement_helper(problem, interpretation, object, remainingContents);
26 «typeIndexer.referInstanceOf("SmallSat".type, Modality.MUST, "object")»
27 }
28
29 pattern «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»(problem:LogicProblem, interpretation:PartialInterpretation, remainingContents:java Integer) {
30 find interpretation(problem, interpretation);
31 remainingContents == sum find «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»_helper(problem, interpretation, _, #_);
32 }
33 '''
34
35 override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) {
36 val interferometryPayloadCount = createBuilder.add(1, "InterferometryPayload".type).build
37 val kaCommSubsystemWithoutSmallSatCount = createBuilder.add(1, "KaCommSubsystem".type).add(-2, "SmallSat".type).
38 build
39
40 val interferometryPayloadMatcher = createMatcher(INTERFEROMETY_PAYLOAD)
41 val kaCommSubsystemRemainingContentsMatcher = createMatcher(REMAINING_CONTENTS_KA_COMM_SUBSYSTEM)
42
43 return [ p |
44 interferometryPayloadCount.tightenLowerBound(2 - interferometryPayloadMatcher.countMatches(p))
45 kaCommSubsystemWithoutSmallSatCount.tightenUpperBound(kaCommSubsystemRemainingContentsMatcher.getCount(p))
46 ]
47 }
48
49}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend
index 863a91c8..b65826ad 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend
@@ -1,41 +1,42 @@
1package hu.bme.mit.inf.dslreasoner.run 1package hu.bme.mit.inf.dslreasoner.run
2 2
3import functionalarchitecture.FunctionalarchitecturePackage
4import hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns
5import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Model
6import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Type
7import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
8import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration
9import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor
10import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel
11import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner
12import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult
13import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult
14import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore
15import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic
16import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration
17import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor
18import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.ScopePropagatorStrategy
19import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic
20import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation
21import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml
22import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner
23import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration
24import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser
3import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace 25import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
4import hu.bme.mit.inf.dslreasomer.domains.transima.fam.FunctionalArchitecture.FunctionalArchitecturePackage 26import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace
27import java.util.LinkedHashMap
28import java.util.LinkedList
5import java.util.List 29import java.util.List
30import org.eclipse.emf.ecore.EAttribute
6import org.eclipse.emf.ecore.EClass 31import org.eclipse.emf.ecore.EClass
7import org.eclipse.emf.ecore.EEnumLiteral
8import org.eclipse.emf.ecore.EReference
9import org.eclipse.emf.ecore.EEnum 32import org.eclipse.emf.ecore.EEnum
10import org.eclipse.emf.ecore.EAttribute 33import org.eclipse.emf.ecore.EEnumLiteral
11import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor
12import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace
13import org.eclipse.emf.ecore.EObject 34import org.eclipse.emf.ecore.EObject
14import java.util.LinkedHashMap 35import org.eclipse.emf.ecore.EReference
15import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor
16import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
17import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic
18import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic
19import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration
20import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration
21import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration
22import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod
23import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy
24import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner
25import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult
26import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation
27import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult
28import org.eclipse.emf.ecore.resource.Resource 36import org.eclipse.emf.ecore.resource.Resource
29import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 37import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
30import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml 38import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup
31import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolverConfiguration 39import org.eclipse.viatra.query.runtime.rete.matcher.ReteEngine
32import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolver
33import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore
34import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner
35import java.util.LinkedList
36import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation
37import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicStructureBuilder
38import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder
39 40
40class SimpleRun { 41class SimpleRun {
41 42
@@ -59,7 +60,8 @@ class SimpleRun {
59 60
60 val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel,new Ecore2LogicConfiguration()) 61 val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel,new Ecore2LogicConfiguration())
61 val modelExtensionProblem = instanceModel2Logic.transform(modelGenerationProblem,partialModel) 62 val modelExtensionProblem = instanceModel2Logic.transform(modelGenerationProblem,partialModel)
62 val validModelExtensionProblem = viatra2Logic.transformQueries(queries,modelGenerationProblem,new Viatra2LogicConfiguration) 63 val validModelExtensionProblem = viatra2Logic.transformQueries(queries,modelExtensionProblem,new Viatra2LogicConfiguration)
64// workspace.writeModel(validModelExtensionProblem.output, "generation.logicproblem")
63 65
64 val logicProblem = validModelExtensionProblem.output 66 val logicProblem = validModelExtensionProblem.output
65 67
@@ -71,11 +73,11 @@ class SimpleRun {
71 val viatraConfig = new ViatraReasonerConfiguration => [ 73 val viatraConfig = new ViatraReasonerConfiguration => [
72 it.typeScopes.maxNewElements = 40 74 it.typeScopes.maxNewElements = 40
73 it.typeScopes.minNewElements = 40 75 it.typeScopes.minNewElements = 40
74 it.solutionScope.numberOfRequiredSolution = 1 76 it.solutionScope.numberOfRequiredSolutions = 1
75 it.existingQueries = queries.patterns.map[it.internalQueryRepresentation] 77// it.scopePropagatorStrategy = ScopePropagatorStrategy.BasicTypeHierarchy
76 it.debugCongiguration.logging = false 78 it.documentationLevel = DocumentationLevel.NONE
77 it.debugCongiguration.partalInterpretationVisualisationFrequency = 1 79 it.debugConfiguration.partalInterpretationVisualisationFrequency = 1
78 it.debugCongiguration.partialInterpretatioVisualiser = new GraphvizVisualisation 80 it.debugConfiguration.partialInterpretatioVisualiser = new GraphvizVisualiser
79 ] 81 ]
80 solution = reasoner.solve(logicProblem,viatraConfig,workspace) 82 solution = reasoner.solve(logicProblem,viatraConfig,workspace)
81 /*/ 83 /*/
@@ -92,23 +94,20 @@ class SimpleRun {
92 94
93 println("Problem solved") 95 println("Problem solved")
94 96
95 val interpretations = reasoner.getInterpretations(solution as ModelResult) 97 val result = solution as ModelResult
98 val interpretations = reasoner.getInterpretations(result)
96 val models = new LinkedList 99 val models = new LinkedList
97 for(interpretation : interpretations) { 100 for(interpretation : interpretations) {
98 val extension b = new LogicStructureBuilder
99 val extension a = new LogicProblemBuilder
100
101
102
103 val instanceModel = logic2Ecore.transformInterpretation(interpretation,modelGenerationProblem.trace) 101 val instanceModel = logic2Ecore.transformInterpretation(interpretation,modelGenerationProblem.trace)
104 models+=instanceModel 102 models+=instanceModel
105 } 103 }
104 println(result.statistics.solverTime)
106 105
107 solution.writeSolution(workspace, #[]) 106 solution.writeSolution(workspace, #[])
108 } 107 }
109 108
110 def private static loadMetamodel() { 109 def private static loadMetamodel() {
111 val pckg = FunctionalArchitecturePackage.eINSTANCE 110 val pckg = FunctionalarchitecturePackage.eINSTANCE
112 val List<EClass> classes = pckg.EClassifiers.filter(EClass).toList 111 val List<EClass> classes = pckg.EClassifiers.filter(EClass).toList
113 val List<EEnum> enums = pckg.EClassifiers.filter(EEnum).toList 112 val List<EEnum> enums = pckg.EClassifiers.filter(EEnum).toList
114 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList 113 val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList
@@ -118,12 +117,12 @@ class SimpleRun {
118 } 117 }
119 118
120 def private static loadQueries(EcoreMetamodelDescriptor metamodel) { 119 def private static loadQueries(EcoreMetamodelDescriptor metamodel) {
121 val i = hu.bme.mit.inf.dslreasoner.domains.transima.fam.patterns.Pattern.instance 120 val i = FamPatterns.instance
122 val patterns = i.specifications.toList 121 val patterns = i.specifications.toList
123 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet 122 val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet
124 val derivedFeatures = new LinkedHashMap 123 val derivedFeatures = new LinkedHashMap
125 derivedFeatures.put(i.type,metamodel.attributes.filter[it.name == "type"].head) 124 derivedFeatures.put(Type.instance,metamodel.attributes.filter[it.name == "type"].head)
126 derivedFeatures.put(i.model,metamodel.references.filter[it.name == "model"].head) 125 derivedFeatures.put(Model.instance,metamodel.references.filter[it.name == "model"].head)
127 val res = new ViatraQuerySetDescriptor( 126 val res = new ViatraQuerySetDescriptor(
128 patterns, 127 patterns,
129 wfPatterns, 128 wfPatterns,
@@ -133,6 +132,8 @@ class SimpleRun {
133 } 132 }
134 133
135 def static loadPartialModel(ReasonerWorkspace inputs) { 134 def static loadPartialModel(ReasonerWorkspace inputs) {
135 EMFPatternLanguageStandaloneSetup.doSetup
136 ReteEngine.getClass
136 Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); 137 Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
137 inputs.readModel(EObject,"FAM.xmi").eResource.allContents.toList 138 inputs.readModel(EObject,"FAM.xmi").eResource.allContents.toList
138 } 139 }
@@ -160,8 +161,4 @@ class SimpleRun {
160 println("Solution saved and visualised") 161 println("Solution saved and visualised")
161 } 162 }
162 } 163 }
163
164 def static visualizeSolution() {
165
166 }
167} \ No newline at end of file 164} \ No newline at end of file
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/TypeDistributionCalculator.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/TypeDistributionCalculator.xtend
new file mode 100644
index 00000000..e2d6e6ca
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/TypeDistributionCalculator.xtend
@@ -0,0 +1,35 @@
1package hu.bme.mit.inf.dslreasoner.run
2
3import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage
4import java.io.File
5import org.eclipse.emf.common.util.URI
6import org.eclipse.emf.ecore.EPackage
7import org.eclipse.emf.ecore.EcorePackage
8import org.eclipse.emf.ecore.resource.Resource
9import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
10import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
11
12class TypeDistributionCalculator {
13 public static def void main(String[] args) {
14 Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl)
15 EPackage.Registry.INSTANCE.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE)
16 EPackage.Registry.INSTANCE.put(YakindummPackage.eNS_URI, YakindummPackage.eINSTANCE)
17
18 println("model,className,count")
19 val directory = new File(args.get(0))
20 for (file : directory.listFiles) {
21 val modelName = file.name
22 val resourceSet = new ResourceSetImpl
23 val resource = resourceSet.getResource(URI.createFileURI(file.absolutePath), true)
24 val objectsByTypeName = resource.allContents.filter [ obj |
25 val featureName = obj.eContainingFeature?.name
26 // Filter out "derived containment" references in Ecore.
27 // See https://stackoverflow.com/a/46340165
28 featureName != "eGenericType" && featureName != "eGenericSuperTypes"
29 ].groupBy[eClass.name]
30 for (pair : objectsByTypeName.entrySet) {
31 println('''«modelName»,«pair.key»,«pair.value.size»''')
32 }
33 }
34 }
35}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend
index 6b74d161..3a100ace 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend
@@ -1,16 +1,16 @@
1package hu.bme.mit.inf.dslreasoner.run 1package hu.bme.mit.inf.dslreasoner.run
2 2
3import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage
4import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage
3import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage 5import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage
6import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.Viatra2LogicAnnotationsPackage
4import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation 7import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation
5import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage 8import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage
9import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml
10import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser
6import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace 11import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
7import java.io.File 12import java.io.File
8import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage
9import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage
10import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.Viatra2LogicAnnotationsPackage
11import org.eclipse.emf.ecore.resource.Resource 13import org.eclipse.emf.ecore.resource.Resource
12import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml
13import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation
14import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 14import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
15 15
16class VisualiseAllModelInDirectory { 16class VisualiseAllModelInDirectory {
@@ -62,7 +62,7 @@ class VisualiseAllModelInDirectory {
62 } 62 }
63 63
64 if(!hasPng && model.newElements.size <160) { 64 if(!hasPng && model.newElements.size <160) {
65 val visualiser = new GraphvizVisualisation 65 val visualiser = new GraphvizVisualiser
66 val visualisation = visualiser.visualiseConcretization(model) 66 val visualisation = visualiser.visualiseConcretization(model)
67 visualisation.writeToFile(workspace,fileNameWithoutExtension) 67 visualisation.writeToFile(workspace,fileNameWithoutExtension)
68 println('''«fileNameWithoutExtension».png''') 68 println('''«fileNameWithoutExtension».png''')
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
new file mode 100644
index 00000000..f842afb5
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend
@@ -0,0 +1,77 @@
1package hu.bme.mit.inf.dslreasoner.run.script
2
3import java.util.List
4import org.eclipse.xtend.lib.annotations.Accessors
5
6@Accessors
7class MeasurementScript {
8 String inputPath
9 String outputPath
10 int timeout
11 boolean saveModels
12 boolean saveTemporaryFiles
13 int warmupIterations
14 int iterations
15 Domain domain
16 Scope scope
17 List<Integer> sizes
18 Solver solver
19 ScopePropagator scopePropagator
20 ScopeConstraints propagatedConstraints
21 PolyhedronSolver polyhedronSolver
22 ScopeHeuristic scopeHeuristic
23
24 def toCsvHeader() {
25 '''«domain»,«scope»,«solver»,«scopePropagator ?: "NULL"»,«propagatedConstraints ?: "NULL"»,«polyhedronSolver ?: "NULL"»,«scopeHeuristic ?: "NULL"»'''
26 }
27}
28
29enum Domain {
30 fs,
31 ecore,
32 ecoreUnsat,
33 Yakindu,
34 YakinduUnsat,
35 FAM,
36 satellite,
37 satelliteUnsat
38}
39
40enum Scope {
41 none,
42 quantiles,
43 upperOnly,
44 unsat,
45 exactly
46}
47
48enum Solver {
49 ViatraSolver,
50 AlloySolver,
51 AlloyMiniSat
52}
53
54enum ScopePropagator {
55 none,
56 basic,
57 polyhedral
58}
59
60enum ScopeConstraints {
61 none,
62 typeHierarchy,
63 relations,
64 hints
65}
66
67enum PolyhedronSolver {
68 Z3Integer,
69 Z3Real,
70 Cbc,
71 Clp
72}
73
74enum ScopeHeuristic {
75 basic,
76 polyhedral
77}
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
new file mode 100644
index 00000000..973c3d13
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend
@@ -0,0 +1,400 @@
1package hu.bme.mit.inf.dslreasoner.run.script
2
3import com.google.gson.Gson
4import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolver
5import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolverConfiguration
6import hu.bme.mit.inf.dslreasoner.ecore2logic.EClassMapper
7import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
8import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration
9import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace
10import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel
11import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicSolverConfiguration
12import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes
13import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement
14import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral
15import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral
16import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringLiteral
17import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type
18import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDefinition
19import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem
20import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.IntStatisticEntry
21import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicresultFactory
22import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult
23import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.RealStatisticEntry
24import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.Statistics
25import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.StringStatisticEntry
26import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore
27import hu.bme.mit.inf.dslreasoner.run.EcoreLoader
28import hu.bme.mit.inf.dslreasoner.run.FAMLoader
29import hu.bme.mit.inf.dslreasoner.run.FileSystemLoader
30import hu.bme.mit.inf.dslreasoner.run.MetamodelLoader
31import hu.bme.mit.inf.dslreasoner.run.SatelliteLoader
32import hu.bme.mit.inf.dslreasoner.run.YakinduLoader
33import hu.bme.mit.inf.dslreasoner.util.CollectionsUtil
34import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic
35import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration
36import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedralScopePropagatorConstraints
37import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedralScopePropagatorSolver
38import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.ScopePropagatorStrategy
39import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic
40import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion
41import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner
42import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration
43import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
44import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace
45import java.io.FileReader
46import java.util.HashMap
47import java.util.HashSet
48import java.util.Map
49import java.util.Set
50import org.eclipse.emf.ecore.EObject
51import org.eclipse.emf.ecore.resource.Resource
52import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
53import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup
54import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions
55import org.eclipse.viatra.query.runtime.rete.matcher.ReteBackendFactory
56import org.eclipse.xtend.lib.annotations.Data
57import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloyBackendSolver
58
59class MeasurementScriptRunner {
60 static val MODEL_SIZE_GAP = 0
61 static val SCOPE_PROPAGATOR_TIMEOUT = 10
62 static val USEC_TO_MSEC = 1000000
63
64 static extension val LogicresultFactory = LogicresultFactory.eINSTANCE
65
66 val MeasurementScript script
67 val ReasonerWorkspace inputWorkspace
68 val ReasonerWorkspace outputWorkspace
69 val MetamodelLoader metamodelLoader
70
71 new(MeasurementScript script) {
72 this.script = script
73 inputWorkspace = new FileSystemWorkspace(script.inputPath + "/", "")
74 outputWorkspace = new FileSystemWorkspace(script.outputPath +
75 "/", '''«script.domain»_«script.solver»_«script.scope»_«script.scopePropagator ?: "na"»_«script.propagatedConstraints ?: "na"»_«script.polyhedronSolver ?: "na"»_«script.scopeHeuristic ?: "na"»_''')
76 metamodelLoader = switch (script.domain) {
77 case fs: new FileSystemLoader(inputWorkspace)
78 case ecore: new EcoreLoader(inputWorkspace)
79 case ecoreUnsat: new EcoreLoader(inputWorkspace, false)
80 case Yakindu: new YakinduLoader(inputWorkspace) => [useSynchronization = false; useComplexStates = true]
81 case YakinduUnsat: new YakinduLoader(inputWorkspace, false) => [useSynchronization = false; useComplexStates = true]
82 case FAM: new FAMLoader(inputWorkspace)
83 case satellite: new SatelliteLoader(inputWorkspace)
84 case satelliteUnsat: new SatelliteLoader(inputWorkspace, false)
85 default: throw new IllegalArgumentException("Unsupported domain: " + script.domain)
86 }
87 }
88
89 def run() {
90 if (script.sizes.empty) {
91 return
92 }
93 val start = System.currentTimeMillis
94 val warmupSize = script.sizes.head
95 for (var int i = 0; i < script.warmupIterations; i++) {
96 System.err.println('''Warmup «i + 1»/«script.warmupIterations»...''')
97 runExperiment(warmupSize)
98 }
99 val warmupEnd = System.currentTimeMillis
100 System.err.println('''Warmup completed in «(warmupEnd - start) / 1000» seconds''')
101 for (size : script.sizes) {
102 var int failures = 0
103 for (var int i = 0; i < script.iterations; i++) {
104 System.err.println("Running GC...")
105 runGc()
106 System.err.println('''Iteration «i + 1»/«script.iterations» of size «size»...''')
107 val startTime = System.currentTimeMillis
108 val result = runExperiment(size)
109 val headerPrefix = '''«script.toCsvHeader»,«size»,«i + 1»,«result.resultName»'''
110 println('''«headerPrefix»,startTime,«startTime»''')
111 println('''«headerPrefix»,logic2SolverTransformationTime,«result.statistics.transformationTime»''')
112 println('''«headerPrefix»,solverTime,«result.statistics.solverTime»''')
113 for (statistic : result.statistics.entries) {
114 val valueString = switch (statistic) {
115 IntStatisticEntry: statistic.value.toString
116 RealStatisticEntry: statistic.value.toString
117 StringStatisticEntry: statistic.value.toString
118 default: statistic.toString
119 }
120 println('''«headerPrefix»,«statistic.name»,«valueString»''')
121 }
122 if (script.saveModels && result.model !== null) {
123 outputWorkspace.writeModel(result.model, '''«size»_«i + 1».xmi''')
124 }
125 if (result.resultName === "InsuficientResourcesResultImpl") {
126 failures++
127 }
128 System.out.flush
129 }
130 if (failures == script.iterations) {
131 System.err.println("All measurements failed")
132 return
133 }
134 }
135 val end = System.currentTimeMillis
136 System.err.println('''Measurement completed in «(end - start) / 1000» seconds''')
137 }
138
139 private static def void runGc() {
140 System.gc
141 Thread.sleep(100)
142 System.gc
143 Thread.sleep(100)
144 System.gc
145 Thread.sleep(800)
146 }
147
148 private def createViatraConfig() {
149 val config = new ViatraReasonerConfiguration
150 config.debugConfiguration.partialInterpretatioVisualiser = null
151 config.searchSpaceConstraints.additionalGlobalConstraints += metamodelLoader.additionalConstraints
152 config.scopePropagatorStrategy = switch (script.scopePropagator) {
153 case none:
154 ScopePropagatorStrategy.None
155 case basic:
156 switch (script.propagatedConstraints) {
157 case none:
158 ScopePropagatorStrategy.Basic
159 case typeHierarchy:
160 ScopePropagatorStrategy.BasicTypeHierarchy
161 case relations,
162 case hints:
163 throw new IllegalArgumentException(
164 "Basic scope propagator does not support relational and hint constraints")
165 default:
166 throw new IllegalArgumentException("Unknown scope constraints: " + script.propagatedConstraints)
167 }
168 case polyhedral: {
169 val constraints = switch (script.propagatedConstraints) {
170 case none:
171 throw new IllegalArgumentException(
172 "Polyhedral scope propagator needs at least type hierarchy constraints")
173 case typeHierarchy:
174 PolyhedralScopePropagatorConstraints.TypeHierarchy
175 case relations,
176 case hints:
177 PolyhedralScopePropagatorConstraints.Relational
178 default:
179 throw new IllegalArgumentException("Unknown scope constraints: " + script.propagatedConstraints)
180 }
181 val polyhedronSolver = switch (script.polyhedronSolver) {
182 case Z3Integer: PolyhedralScopePropagatorSolver.Z3Integer
183 case Z3Real: PolyhedralScopePropagatorSolver.Z3Real
184 case Cbc: PolyhedralScopePropagatorSolver.Cbc
185 case Clp: PolyhedralScopePropagatorSolver.Clp
186 default: throw new IllegalArgumentException("Unknown polyhedron solver: " + script.polyhedronSolver)
187 }
188 val updateHeuristic = script.scopeHeuristic != ScopeHeuristic.basic
189 new ScopePropagatorStrategy.Polyhedral(constraints, polyhedronSolver, updateHeuristic,
190 SCOPE_PROPAGATOR_TIMEOUT)
191 }
192 default:
193 throw new IllegalArgumentException("Unknown scope propagator: " + script.scopePropagator)
194 }
195 config
196 }
197
198 private def createAlloyConfig(AlloyBackendSolver backendSolver) {
199 val config = new AlloySolverConfiguration
200 config.solver = backendSolver
201 config
202 }
203
204 private def createConfig(int modelSize) {
205 val config = switch (solver : script.solver) {
206 case ViatraSolver: createViatraConfig()
207 case AlloySolver: createAlloyConfig(AlloyBackendSolver.SAT4J)
208 case AlloyMiniSat: createAlloyConfig(AlloyBackendSolver.MiniSatJNI)
209 default: throw new IllegalArgumentException("Unknown solver: " + solver)
210 }
211 config.solutionScope.numberOfRequiredSolutions = 1
212 config.runtimeLimit = script.timeout
213 config.documentationLevel = if(script.saveTemporaryFiles) DocumentationLevel.NORMAL else DocumentationLevel.NONE
214 config
215 }
216
217 private def runExperiment(int modelSize) {
218 val config = createConfig(modelSize)
219 val modelLoadingStart = System.nanoTime
220 val metamodelDescriptor = metamodelLoader.loadMetamodel
221 val partialModelDescriptor = metamodelLoader.loadPartialModel
222 val queryDescriptor = metamodelLoader.loadQueries(metamodelDescriptor)
223 val modelLoadingTime = System.nanoTime - modelLoadingStart
224
225 val domain2LogicTransformationStart = System.nanoTime
226 val Ecore2Logic ecore2Logic = new Ecore2Logic
227 val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic)
228 val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic
229 var modelGeneration = ecore2Logic.transformMetamodel(metamodelDescriptor, new Ecore2LogicConfiguration())
230 var problem = modelGeneration.output
231 problem = instanceModel2Logic.transform(
232 modelGeneration,
233 partialModelDescriptor
234 ).output
235 problem = viatra2Logic.transformQueries(
236 queryDescriptor,
237 modelGeneration,
238 new Viatra2LogicConfiguration
239 ).output
240 initializeScope(config, modelSize, problem, ecore2Logic, modelGeneration.trace)
241 if (config instanceof ViatraReasonerConfiguration && script.propagatedConstraints == ScopeConstraints.hints) {
242 (config as ViatraReasonerConfiguration).hints = metamodelLoader.getHints(ecore2Logic, modelGeneration.trace)
243 }
244 val domain2LogicTransformationTime = System.nanoTime - domain2LogicTransformationStart
245
246 if (config.documentationLevel != DocumentationLevel.NONE) {
247 outputWorkspace.writeModel(problem, "initial.logicproblem")
248 }
249
250 val solver = switch (solver : script.solver) {
251 case ViatraSolver: new ViatraReasoner
252 case AlloySolver,
253 case AlloyMiniSat: new AlloySolver
254 default: throw new IllegalArgumentException("Unknown solver: " + solver)
255 }
256 val result = solver.solve(problem, config, outputWorkspace)
257 val statistics = result.statistics
258 statistics.entries += createIntStatisticEntry => [
259 name = "modelLoadingTime"
260 value = (modelLoadingTime / USEC_TO_MSEC) as int
261 ]
262 statistics.entries += createIntStatisticEntry => [
263 name = "domain2LogicTransformationTime"
264 value = (domain2LogicTransformationTime / USEC_TO_MSEC) as int
265 ]
266 var EObject modelResult = null
267 if (result instanceof ModelResult) {
268 val intepretations = solver.getInterpretations(result)
269 if (intepretations.size != 1) {
270 throw new IllegalStateException("Expected 1 interpretation, got " + intepretations.size)
271 }
272 var resultTransformationStart = System.nanoTime
273 val logic2Ecore = new Logic2Ecore(ecore2Logic)
274 modelResult = logic2Ecore.transformInterpretation(intepretations.head, modelGeneration.trace)
275 val resultTransformationTime = System.nanoTime - resultTransformationStart
276 statistics.entries += createIntStatisticEntry => [
277 name = "ecore2LogicTransformationTime"
278 value = (resultTransformationTime / USEC_TO_MSEC) as int
279 ]
280 }
281
282 new ExperimentResult(result.class.simpleName, statistics, modelResult)
283 }
284
285 private def initializeScope(LogicSolverConfiguration config, int modelSize, LogicProblem problem,
286 EClassMapper eClassMapper, Ecore2Logic_Trace trace) {
287 val knownElements = initializeKnownElements(problem, config.typeScopes)
288 if (modelSize < 0) {
289 config.typeScopes.minNewElements = 0
290 config.typeScopes.maxNewElements = TypeScopes.Unlimited
291 } else {
292 val numberOfKnownElements = knownElements.values.flatten.toSet.size
293 val newElementCount = modelSize - numberOfKnownElements
294 switch (script.scope) {
295 case upperOnly:
296 config.typeScopes.maxNewElements = newElementCount + MODEL_SIZE_GAP
297 case exactly: {
298 config.typeScopes.minNewElements = newElementCount
299 config.typeScopes.maxNewElements = newElementCount
300 }
301 default: {
302 config.typeScopes.minNewElements = newElementCount
303 config.typeScopes.maxNewElements = newElementCount + MODEL_SIZE_GAP
304 }
305 }
306 }
307 switch (scope : script.scope) {
308 case none,
309 case exactly:
310 return
311 case quantiles,
312 case unsat,
313 case upperOnly: {
314 val quantiles = if (scope == Scope.unsat) {
315 metamodelLoader.unsatTypeQuantiles
316 } else {
317 metamodelLoader.typeQuantiles
318 }
319 for (eClassInScope : eClassMapper.allClassesInScope(trace)) {
320 val quantile = quantiles.get(eClassInScope.name)
321 if (quantile !== null) {
322 val type = eClassMapper.TypeofEClass(trace, eClassInScope)
323 val knownInstances = knownElements.get(type)
324 val currentCount = if(knownInstances === null) 0 else knownInstances.size
325 val lowCount = Math.floor(modelSize * quantile.low) as int
326 val highCount = Math.ceil((modelSize + MODEL_SIZE_GAP) * quantile.high) as int
327// println('''«type.name» «lowCount» «highCount»''')
328 if (script.scope != Scope.upperOnly) {
329 config.typeScopes.minNewElementsByType.put(type, Math.max(lowCount - currentCount, 0))
330 }
331 config.typeScopes.maxNewElementsByType.put(type, highCount - currentCount)
332 }
333 }
334 }
335 default:
336 throw new IllegalArgumentException("Unknown scope: " + script.scope)
337 }
338 }
339
340 /*
341 * Copied from hu.bme.mit.inf.dslreasoner.application.execution.ScopeLoader.initialiseknownElements(LogicProblem, TypeScopes)
342 */
343 private static def initializeKnownElements(LogicProblem p, TypeScopes s) {
344 val Map<Type, Set<DefinedElement>> res = new HashMap
345
346 // 1. fill map with every types
347 for (t : p.types) {
348 res.put(t, new HashSet)
349 }
350
351 // 2. fill map with every objects
352 for (definedType : p.types.filter(TypeDefinition)) {
353 val supertypes = CollectionsUtil.<Type>transitiveClosureStar(definedType)[supertypes]
354 for (supertype : supertypes) {
355 for (element : definedType.elements) {
356 res.get(supertype).add(element)
357 }
358 }
359 }
360 val partialModelContents = p.annotations.filter(PartialModelRelation2Assertion).map[target].toList.map [
361 eAllContents.toIterable
362 ].flatten.toList
363 s.knownIntegers += partialModelContents.filter(IntLiteral).map[it.value]
364 s.knownReals += partialModelContents.filter(RealLiteral).map[it.value]
365 s.knownStrings += partialModelContents.filter(StringLiteral).map[it.value]
366
367 res
368 }
369
370 public static def void main(String[] args) {
371 if (args.length != 1) {
372 System.err.println("Missing measurement script name.")
373 System.exit(-1)
374 }
375 EMFPatternLanguageStandaloneSetup.doSetup
376 ViatraQueryEngineOptions.setSystemDefaultBackends(ReteBackendFactory.INSTANCE, ReteBackendFactory.INSTANCE,
377 ReteBackendFactory.INSTANCE)
378 Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl)
379 val config = readConfig(args.get(0))
380 val runnner = new MeasurementScriptRunner(config)
381 runnner.run()
382 }
383
384 static def readConfig(String scriptPath) {
385 val gson = new Gson
386 val reader = new FileReader(scriptPath)
387 try {
388 gson.fromJson(reader, MeasurementScript)
389 } finally {
390 reader.close
391 }
392 }
393
394 @Data
395 private static class ExperimentResult {
396 String resultName
397 Statistics statistics
398 EObject model
399 }
400}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.classpath b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.classpath
new file mode 100644
index 00000000..ef58158d
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.classpath
@@ -0,0 +1,16 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5 <classpathentry kind="src" path="src">
6 <attributes>
7 <attribute name="test" value="true"/>
8 </attributes>
9 </classpathentry>
10 <classpathentry kind="src" path="xtend-gen">
11 <attributes>
12 <attribute name="test" value="true"/>
13 </attributes>
14 </classpathentry>
15 <classpathentry kind="output" path="bin"/>
16</classpath>
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.gitignore b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.gitignore
new file mode 100644
index 00000000..8ae4e44d
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.gitignore
@@ -0,0 +1,4 @@
1/bin/
2/src-gen/
3/vql-gen/
4/xtend-gen/
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.project b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.project
new file mode 100644
index 00000000..5bc946ea
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.project
@@ -0,0 +1,34 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>org.eclipse.jdt.core.javabuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.pde.ManifestBuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 <buildCommand>
24 <name>org.eclipse.pde.SchemaBuilder</name>
25 <arguments>
26 </arguments>
27 </buildCommand>
28 </buildSpec>
29 <natures>
30 <nature>org.eclipse.pde.PluginNature</nature>
31 <nature>org.eclipse.jdt.core.javanature</nature>
32 <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
33 </natures>
34</projectDescription>
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.settings/org.eclipse.jdt.core.prefs b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..0c68a61d
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
1eclipse.preferences.version=1
2org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4org.eclipse.jdt.core.compiler.compliance=1.8
5org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/META-INF/MANIFEST.MF b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..43e40319
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2
3Bundle-Name: Logic2Viatra Tests
4Bundle-SymbolicName: hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests
5Bundle-Version: 1.0.0.qualifier
6Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests
7Bundle-RequiredExecutionEnvironment: JavaSE-1.8
8Import-Package: org.junit;version="4.12.0"
9Require-Bundle: com.google.guava,
10 org.eclipse.xtext.xbase.lib,
11 org.eclipse.xtend.lib,
12 org.eclipse.xtend.lib.macro,
13 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatraquery
14Export-Package: hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.cardinality,
15 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/build.properties b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/build.properties
new file mode 100644
index 00000000..5b9d2918
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/build.properties
@@ -0,0 +1,5 @@
1source.. = src/
2output.. = bin/
3bin.includes = META-INF/,\
4 .
5additional.bundles = org.junit
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/CbcPolyhedronSolverTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/CbcPolyhedronSolverTest.xtend
new file mode 100644
index 00000000..b22e2a20
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/CbcPolyhedronSolverTest.xtend
@@ -0,0 +1,42 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.cardinality
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.CbcPolyhedronSolver
4import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.Dimension
5import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.Polyhedron
6import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedronSaturationResult
7import org.junit.Test
8
9import static org.junit.Assert.*
10import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearConstraint
11
12class CbcPolyhedronSolverTest extends IntegerPolyhedronSolverTest {
13
14 override protected createSolver() {
15 new CbcPolyhedronSolver(false, 10, true)
16 }
17}
18
19class RelaxedCbcPolyhedronSolverTest extends RelaxedPolyhedronSolverTest {
20
21 override protected createSolver() {
22 new CbcPolyhedronSolver(true, 10, true)
23 }
24}
25
26class CbcPolyhedronSolverTimeoutTest {
27
28 @Test
29 def void timeoutTest() {
30 val solver = new CbcPolyhedronSolver(false, 0, true)
31 val x = new Dimension("x", 0, 1)
32 val polyhedron = new Polyhedron(#[x], #[new LinearConstraint(#{x -> 1}, null, 0)], #[x])
33 val operator = solver.createSaturationOperator(polyhedron)
34 try {
35 val result = operator.saturate
36
37 assertEquals(PolyhedronSaturationResult.UNKNOWN, result)
38 } finally {
39 operator.close()
40 }
41 }
42}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend
new file mode 100644
index 00000000..47534618
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend
@@ -0,0 +1,385 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.cardinality
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.Dimension
4import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearConstraint
5import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.Polyhedron
6import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedronSaturationOperator
7import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedronSaturationResult
8import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedronSolver
9import org.junit.After
10import org.junit.Before
11import org.junit.Test
12
13import static org.junit.Assert.*
14
15abstract class PolyhedronSolverTest {
16 var PolyhedronSolver solver
17 var PolyhedronSaturationOperator operator
18
19 protected def PolyhedronSolver createSolver()
20
21 @Before
22 def void setUp() {
23 solver = createSolver()
24 }
25
26 @After
27 def void tearDown() {
28 destroyOperatorIfExists()
29 }
30
31 @Test
32 def void singleDimensionTest() {
33 val x = new Dimension("x", 0, 1)
34 createSaturationOperator(new Polyhedron(#[x], #[], #[x]))
35
36 val result = saturate()
37
38 assertEquals(PolyhedronSaturationResult.SATURATED, result)
39 assertEquals(0, x.lowerBound)
40 assertEquals(1, x.upperBound)
41 }
42
43 @Test
44 def void singleDimensionNegativeValueTest() {
45 val x = new Dimension("x", -2, -1)
46 createSaturationOperator(new Polyhedron(#[x], #[], #[x]))
47
48 val result = saturate()
49
50 assertEquals(PolyhedronSaturationResult.SATURATED, result)
51 assertEquals(-2, x.lowerBound)
52 assertEquals(-1, x.upperBound)
53 }
54
55 @Test
56 def void singleDimensionConstraintTest() {
57 val x = new Dimension("x", null, null)
58 val constraint = new LinearConstraint(#{x -> 2}, 0, 2)
59 createSaturationOperator(new Polyhedron(#[x], #[constraint], #[x]))
60
61 val result = saturate()
62
63 assertEquals(PolyhedronSaturationResult.SATURATED, result)
64 assertEquals(0, x.lowerBound)
65 assertEquals(1, x.upperBound)
66 }
67
68 @Test
69 def void singleDimensionConstraintUnitCoefficientTest() {
70 val x = new Dimension("x", null, null)
71 val constraint = new LinearConstraint(#{x -> 1}, 1, 3)
72 createSaturationOperator(new Polyhedron(#[x], #[constraint], #[x]))
73
74 val result = saturate()
75
76 assertEquals(PolyhedronSaturationResult.SATURATED, result)
77 assertEquals(1, x.lowerBound)
78 assertEquals(3, x.upperBound)
79 }
80
81 @Test
82 def void singleDimensionUnboundedFromAboveTest() {
83 val x = new Dimension("x", -2, null)
84 createSaturationOperator(new Polyhedron(#[x], #[], #[x]))
85
86 val result = saturate()
87
88 assertEquals(PolyhedronSaturationResult.SATURATED, result)
89 assertEquals(-2, x.lowerBound)
90 assertEquals(null, x.upperBound)
91 }
92
93 @Test
94 def void singleDimensionUnboundedFromBelowTest() {
95 val x = new Dimension("x", null, 2)
96 createSaturationOperator(new Polyhedron(#[x], #[], #[x]))
97
98 val result = saturate()
99
100 assertEquals(PolyhedronSaturationResult.SATURATED, result)
101 assertEquals(null, x.lowerBound)
102 assertEquals(2, x.upperBound)
103 }
104
105 @Test
106 def void singleDimensionUnboundedTest() {
107 val x = new Dimension("x", null, null)
108 createSaturationOperator(new Polyhedron(#[x], #[], #[x]))
109
110 val result = saturate()
111
112 assertEquals(PolyhedronSaturationResult.SATURATED, result)
113 assertEquals(null, x.lowerBound)
114 assertEquals(null, x.upperBound)
115 }
116
117 @Test
118 def void singleDimensionUnboundedObjectiveTest() {
119 val x = new Dimension("x", null, null)
120 val y = new Dimension("y", 0, 1)
121 val objective = new LinearConstraint(#{x -> 1, y -> 1}, null, null)
122 createSaturationOperator(new Polyhedron(#[x, y], #[], #[objective]))
123
124 val result = saturate()
125
126 assertEquals(PolyhedronSaturationResult.SATURATED, result)
127 assertEquals(null, objective.lowerBound)
128 assertEquals(null, objective.upperBound)
129 }
130
131 @Test
132 def void singleDimensionUnsatisfiableTest() {
133 val x = new Dimension("x", 0, 1)
134 val constraint = new LinearConstraint(#{x -> 2}, -2, -1)
135 createSaturationOperator(new Polyhedron(#[x], #[constraint], #[x]))
136
137 val result = saturate()
138
139 assertEquals(PolyhedronSaturationResult.EMPTY, result)
140 }
141
142 @Test
143 def void equalityConstraintTest() {
144 val x = new Dimension("x", null, null)
145 val y = new Dimension("y", 1, 2)
146 val constraint = new LinearConstraint(#{x -> 2, y -> 2}, 6, 6)
147 createSaturationOperator(new Polyhedron(#[x, y], #[constraint], #[x]))
148
149 val result = saturate()
150
151 assertEquals(PolyhedronSaturationResult.SATURATED, result)
152 assertEquals(1, x.lowerBound)
153 assertEquals(2, x.upperBound)
154 }
155
156 @Test
157 def void saturateConstraintTest() {
158 val x = new Dimension("x", 0, 2)
159 val y = new Dimension("y", 1, 2)
160 val constraint = new LinearConstraint(#{x -> 2, y -> 1}, 0, 8)
161 createSaturationOperator(new Polyhedron(#[x, y], #[constraint], #[constraint]))
162
163 val result = saturate()
164
165 assertEquals(PolyhedronSaturationResult.SATURATED, result)
166 assertEquals(1, constraint.lowerBound)
167 assertEquals(6, constraint.upperBound)
168 }
169
170 @Test(expected=IllegalArgumentException)
171 def void unknownVariableTest() {
172 val x = new Dimension("x", 0, 1)
173 val y = new Dimension("y", 0, 1)
174 val constraint = new LinearConstraint(#{y -> 2}, 0, 2)
175 createSaturationOperator(new Polyhedron(#[x], #[constraint], #[x]))
176
177 saturate()
178 }
179
180 @Test
181 def void emptyConstraintTest() {
182 val x = new Dimension("x", 0, 1)
183 val constraint = new LinearConstraint(emptyMap, 0, 1)
184 createSaturationOperator(new Polyhedron(#[x], #[constraint], #[constraint]))
185
186 val result = saturate()
187
188 assertEquals(PolyhedronSaturationResult.SATURATED, result)
189 assertEquals(0, constraint.lowerBound)
190 assertEquals(0, constraint.upperBound)
191 }
192
193 @Test
194 def void emptyConstraintUnsatisfiableTest() {
195 val x = new Dimension("x", 0, 1)
196 val constraint = new LinearConstraint(emptyMap, 1, 0)
197 createSaturationOperator(new Polyhedron(#[x], #[constraint], #[constraint]))
198
199 val result = saturate()
200
201 assertEquals(PolyhedronSaturationResult.EMPTY, result)
202 }
203
204 @Test
205 def void unboundedRelaxationWithIntegerSolutionTest() {
206 val x = new Dimension("x", 1, 3)
207 val y = new Dimension("y", null, null)
208 createSaturationOperator(new Polyhedron(
209 #[x, y],
210 #[new LinearConstraint(#{x -> 2}, 2, 6)],
211 #[x, y]
212 ))
213
214 val result = saturate()
215
216 assertEquals(PolyhedronSaturationResult.SATURATED, result)
217 assertEquals(1, x.lowerBound)
218 assertEquals(3, x.upperBound)
219 assertEquals(null, y.lowerBound)
220 assertEquals(null, y.upperBound)
221 }
222
223 protected def createSaturationOperator(Polyhedron polyhedron) {
224 destroyOperatorIfExists()
225 operator = solver.createSaturationOperator(polyhedron)
226 }
227
228 protected def destroyOperatorIfExists() {
229 if (operator !== null) {
230 operator.close
231 }
232 }
233
234 protected def saturate() {
235 operator.saturate
236 }
237}
238
239abstract class IntegerPolyhedronSolverTest extends PolyhedronSolverTest {
240 @Test
241 def void singleDimensionConstraintNonIntegerTest() {
242 val x = new Dimension("x", null, null)
243 val constraint = new LinearConstraint(#{x -> 2}, 0, 3)
244 createSaturationOperator(new Polyhedron(#[x], #[constraint], #[x]))
245
246 val result = saturate()
247
248 assertEquals(PolyhedronSaturationResult.SATURATED, result)
249 assertEquals(0, x.lowerBound)
250 assertEquals(1, x.upperBound)
251 }
252
253 @Test
254 def void unsatisfiableMultipleInheritanceTest() {
255 val x = new Dimension("x", 0, 1)
256 val y = new Dimension("y", 0, 1)
257 val z = new Dimension("z", 0, 1)
258 createSaturationOperator(new Polyhedron(
259 #[x, y, z],
260 #[
261 new LinearConstraint(#{x -> 1, y -> 1}, 1, 1),
262 new LinearConstraint(#{x -> 1, z -> 1}, 1, 1),
263 new LinearConstraint(#{y -> 1, z -> 1}, 1, 1)
264 ],
265 #[x, y, z]
266 ))
267
268 val result = saturate()
269
270 assertEquals(PolyhedronSaturationResult.EMPTY, result)
271 }
272
273 @Test
274 def void unboundedRelaxationWithNoIntegerSolutionTest() {
275 val x = new Dimension("x", 0, 1)
276 val y = new Dimension("y", null, null)
277 createSaturationOperator(new Polyhedron(
278 #[x, y],
279 #[new LinearConstraint(#{x -> 2}, 1, 1)],
280 #[x, y]
281 ))
282
283 val result = saturate()
284
285 assertEquals(PolyhedronSaturationResult.EMPTY, result)
286 }
287}
288
289abstract class RelaxedPolyhedronSolverTest extends PolyhedronSolverTest {
290 @Test
291 def void singleDimensionConstraintNonIntegerTest() {
292 val x = new Dimension("x", null, null)
293 val constraint = new LinearConstraint(#{x -> 2}, 0, 3)
294 createSaturationOperator(new Polyhedron(#[x], #[constraint], #[x]))
295
296 val result = saturate()
297
298 assertEquals(PolyhedronSaturationResult.SATURATED, result)
299 assertEquals(0, x.lowerBound)
300 assertEquals(2, x.upperBound)
301 }
302
303 @Test
304 def void unsatisfiableMultipleInheritanceTest() {
305 val x = new Dimension("x", 0, 1)
306 val y = new Dimension("y", 0, 1)
307 val z = new Dimension("z", 0, 1)
308 createSaturationOperator(new Polyhedron(
309 #[x, y, z],
310 #[
311 new LinearConstraint(#{x -> 1, y -> 1}, 1, 1),
312 new LinearConstraint(#{x -> 1, z -> 1}, 1, 1),
313 new LinearConstraint(#{y -> 1, z -> 1}, 1, 1)
314 ],
315 #[x, y, z]
316 ))
317
318 val result = saturate()
319
320 assertEquals(PolyhedronSaturationResult.SATURATED, result)
321 assertEquals(0, x.lowerBound)
322 assertEquals(1, x.upperBound)
323 assertEquals(0, y.lowerBound)
324 assertEquals(1, y.upperBound)
325 assertEquals(0, z.lowerBound)
326 assertEquals(1, z.upperBound)
327 }
328
329 @Test
330 def void unboundedRelaxationWithNoIntegerSolutionUnconstrainedVariableTest() {
331 val x = new Dimension("x", 1, 2)
332 val y = new Dimension("y", null, null)
333 createSaturationOperator(new Polyhedron(
334 #[x, y],
335 #[new LinearConstraint(#{x -> 2}, 3, 3)],
336 #[x, y]
337 ))
338
339 val result = saturate()
340
341 assertEquals(PolyhedronSaturationResult.SATURATED, result)
342 assertEquals(1, x.lowerBound)
343 assertEquals(2, x.upperBound)
344 assertEquals(null, y.lowerBound)
345 assertEquals(null, y.upperBound)
346 }
347
348 @Test
349 def void unboundedRelaxationWithNoIntegerSolutionConstrainedVariableTest() {
350 val x = new Dimension("x", 1, 2)
351 val y = new Dimension("y", null, null)
352 createSaturationOperator(new Polyhedron(
353 #[x, y],
354 #[new LinearConstraint(#{x -> 2}, 3, 3), new LinearConstraint(#{y -> 1}, null, 1)],
355 #[x, y]
356 ))
357
358 val result = saturate()
359
360 assertEquals(PolyhedronSaturationResult.SATURATED, result)
361 assertEquals(1, x.lowerBound)
362 assertEquals(2, x.upperBound)
363 assertEquals(null, y.lowerBound)
364 assertEquals(1, y.upperBound)
365 }
366
367 @Test
368 def void unboundedRelaxationWithNoIntegerSolutionBoundedVariableTest() {
369 val x = new Dimension("x", 1, 2)
370 val y = new Dimension("y", null, 1)
371 createSaturationOperator(new Polyhedron(
372 #[x, y],
373 #[new LinearConstraint(#{x -> 2}, 3, 3)],
374 #[x, y]
375 ))
376
377 val result = saturate()
378
379 assertEquals(PolyhedronSaturationResult.SATURATED, result)
380 assertEquals(1, x.lowerBound)
381 assertEquals(2, x.upperBound)
382 assertEquals(null, y.lowerBound)
383 assertEquals(1, y.upperBound)
384 }
385}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/Z3PolyhedronSolverTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/Z3PolyhedronSolverTest.xtend
new file mode 100644
index 00000000..49b916d3
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/Z3PolyhedronSolverTest.xtend
@@ -0,0 +1,17 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.cardinality
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.Z3PolyhedronSolver
4
5class Z3PolyhedronSolverTest extends IntegerPolyhedronSolverTest {
6
7 override protected createSolver() {
8 new Z3PolyhedronSolver(false, 10)
9 }
10}
11
12class RelaxedZ3PolyhedronSolverTest extends RelaxedPolyhedronSolverTest {
13
14 override protected createSolver() {
15 new Z3PolyhedronSolver(true, 10)
16 }
17}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/AdditionTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/AdditionTest.xtend
new file mode 100644
index 00000000..de5f40e1
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/AdditionTest.xtend
@@ -0,0 +1,49 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
4import java.util.Collection
5import org.junit.Assert
6import org.junit.Test
7import org.junit.runner.RunWith
8import org.junit.runners.Parameterized
9import org.junit.runners.Parameterized.Parameter
10import org.junit.runners.Parameterized.Parameters
11
12import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.*
13
14@RunWith(Parameterized)
15class AdditionTest {
16 @Parameters(name = "{index}: {0} + {1} = {2}")
17 static def Collection<Object[]> data() {
18 #[
19 #[EMPTY, EMPTY, EMPTY],
20 #[EMPTY, between(-1, 1), EMPTY],
21 #[between(-1, 1), EMPTY, EMPTY],
22 #[UNBOUNDED, UNBOUNDED, UNBOUNDED],
23 #[UNBOUNDED, upTo(2), UNBOUNDED],
24 #[UNBOUNDED, above(-2), UNBOUNDED],
25 #[UNBOUNDED, between(-1, 1), UNBOUNDED],
26 #[upTo(2), UNBOUNDED, UNBOUNDED],
27 #[upTo(2), upTo(1), upTo(3)],
28 #[upTo(2), above(-1), UNBOUNDED],
29 #[upTo(2), between(-1, 2), upTo(4)],
30 #[above(-2), UNBOUNDED, UNBOUNDED],
31 #[above(-2), upTo(1), UNBOUNDED],
32 #[above(-2), above(-1), above(-3)],
33 #[above(-2), between(-1, 2), above(-3)],
34 #[between(-2, 3), UNBOUNDED, UNBOUNDED],
35 #[between(-2, 3), upTo(1), upTo(4)],
36 #[between(-2, 3), above(-1), above(-3)],
37 #[between(-2, 3), between(-1, 2.5), between(-3, 5.5)]
38 ]
39 }
40
41 @Parameter(0) public var Interval a
42 @Parameter(1) public var Interval b
43 @Parameter(2) public var Interval result
44
45 @Test
46 def void additionTest() {
47 Assert.assertEquals(result, a + b)
48 }
49}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/DivisionTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/DivisionTest.xtend
new file mode 100644
index 00000000..3a8c0c5d
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/DivisionTest.xtend
@@ -0,0 +1,202 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
4import java.util.Collection
5import org.junit.Assert
6import org.junit.Test
7import org.junit.runner.RunWith
8import org.junit.runners.Parameterized
9import org.junit.runners.Parameterized.Parameter
10import org.junit.runners.Parameterized.Parameters
11
12import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.*
13
14@RunWith(Parameterized)
15class DivisionTest {
16 @Parameters(name="{index}: {0} / {1} = {2}")
17 static def Collection<Object[]> data() {
18 #[
19 #[EMPTY, EMPTY, EMPTY],
20 #[EMPTY, between(-1, 1), EMPTY],
21 #[between(-1, 1), EMPTY, EMPTY],
22 #[UNBOUNDED, UNBOUNDED, UNBOUNDED],
23 #[UNBOUNDED, upTo(-2), UNBOUNDED],
24 #[UNBOUNDED, upTo(0), UNBOUNDED],
25 #[UNBOUNDED, upTo(3), UNBOUNDED],
26 #[UNBOUNDED, above(-2), UNBOUNDED],
27 #[UNBOUNDED, above(0), UNBOUNDED],
28 #[UNBOUNDED, above(3), UNBOUNDED],
29 #[UNBOUNDED, between(-4, -3), UNBOUNDED],
30 #[UNBOUNDED, between(-4, 0), UNBOUNDED],
31 #[UNBOUNDED, between(-3, 4), UNBOUNDED],
32 #[UNBOUNDED, between(0, 4), UNBOUNDED],
33 #[UNBOUNDED, between(3, 4), UNBOUNDED],
34 #[UNBOUNDED, ZERO, EMPTY],
35 #[upTo(-12), UNBOUNDED, UNBOUNDED],
36 #[upTo(-12), upTo(-2), above(0)],
37 #[upTo(-12), upTo(0), above(0)],
38 #[upTo(-12), upTo(3), UNBOUNDED],
39 #[upTo(-12), above(-2), UNBOUNDED],
40 #[upTo(-12), above(0), upTo(0)],
41 #[upTo(-12), above(3), upTo(0)],
42 #[upTo(-12), between(-4, -3), above(3)],
43 #[upTo(-12), between(-4, 0), above(3)],
44 #[upTo(-12), between(-3, 4), UNBOUNDED],
45 #[upTo(-12), between(0, 4), upTo(-3)],
46 #[upTo(-12), between(3, 4), upTo(-3)],
47 #[upTo(-12), ZERO, EMPTY],
48 #[upTo(0), UNBOUNDED, UNBOUNDED],
49 #[upTo(0), upTo(-2), above(0)],
50 #[upTo(0), upTo(0), above(0)],
51 #[upTo(0), upTo(3), UNBOUNDED],
52 #[upTo(0), above(-2), UNBOUNDED],
53 #[upTo(0), above(0), upTo(0)],
54 #[upTo(0), above(3), upTo(0)],
55 #[upTo(0), between(-4, -3), above(0)],
56 #[upTo(0), between(-4, 0), above(0)],
57 #[upTo(0), between(-3, 4), UNBOUNDED],
58 #[upTo(0), between(0, 4), upTo(0)],
59 #[upTo(0), between(3, 4), upTo(0)],
60 #[upTo(0), ZERO, EMPTY],
61 #[upTo(12), UNBOUNDED, UNBOUNDED],
62 #[upTo(12), upTo(-2), above(-6)],
63 #[upTo(12), upTo(0), UNBOUNDED],
64 #[upTo(12), upTo(3), UNBOUNDED],
65 #[upTo(12), above(-2), UNBOUNDED],
66 #[upTo(12), above(0), UNBOUNDED],
67 #[upTo(12), above(3), upTo(4)],
68 #[upTo(12), between(-4, -3), above(-4)],
69 #[upTo(12), between(-4, 0), UNBOUNDED],
70 #[upTo(12), between(-3, 4), UNBOUNDED],
71 #[upTo(12), between(0, 4), UNBOUNDED],
72 #[upTo(12), between(3, 4), upTo(4)],
73 #[upTo(12), ZERO, EMPTY],
74 #[above(-12), UNBOUNDED, UNBOUNDED],
75 #[above(-12), upTo(-2), upTo(6)],
76 #[above(-12), upTo(0), UNBOUNDED],
77 #[above(-12), upTo(3), UNBOUNDED],
78 #[above(-12), above(-2), UNBOUNDED],
79 #[above(-12), above(0), UNBOUNDED],
80 #[above(-12), above(3), above(-4)],
81 #[above(-12), between(-4, -3), upTo(4)],
82 #[above(-12), between(-4, 0), UNBOUNDED],
83 #[above(-12), between(-3, 4), UNBOUNDED],
84 #[above(-12), between(0, 4), UNBOUNDED],
85 #[above(-12), between(3, 4), above(-4)],
86 #[above(-12), ZERO, EMPTY],
87 #[above(0), UNBOUNDED, UNBOUNDED],
88 #[above(0), upTo(-2), upTo(0)],
89 #[above(0), upTo(0), upTo(0)],
90 #[above(0), upTo(3), UNBOUNDED],
91 #[above(0), above(-2), UNBOUNDED],
92 #[above(0), above(0), above(0)],
93 #[above(0), above(3), above(0)],
94 #[above(0), between(-4, -3), upTo(0)],
95 #[above(0), between(-4, 0), upTo(0)],
96 #[above(0), between(-3, 4), UNBOUNDED],
97 #[above(0), between(0, 4), above(0)],
98 #[above(0), between(3, 4), above(0)],
99 #[above(0), ZERO, EMPTY],
100 #[above(12), UNBOUNDED, UNBOUNDED],
101 #[above(12), upTo(-2), upTo(0)],
102 #[above(12), upTo(0), upTo(0)],
103 #[above(12), upTo(3), UNBOUNDED],
104 #[above(12), above(-2), UNBOUNDED],
105 #[above(12), above(0), above(0)],
106 #[above(12), above(3), above(0)],
107 #[above(12), between(-4, -3), upTo(-3)],
108 #[above(12), between(-4, 0), upTo(-3)],
109 #[above(12), between(-3, 4), UNBOUNDED],
110 #[above(12), between(0, 4), above(3)],
111 #[above(12), between(3, 4), above(3)],
112 #[above(12), ZERO, EMPTY],
113 #[between(-36, -12), UNBOUNDED, UNBOUNDED],
114 #[between(-36, -12), upTo(-2), between(0, 18)],
115 #[between(-36, -12), upTo(0), above(0)],
116 #[between(-36, -12), upTo(3), UNBOUNDED],
117 #[between(-36, -12), above(-2), UNBOUNDED],
118 #[between(-36, -12), above(0), upTo(0)],
119 #[between(-36, -12), above(3), between(-12, 0)],
120 #[between(-36, -12), between(-4, -3), between(3, 12)],
121 #[between(-36, -12), between(-4, 0), above(3)],
122 #[between(-36, -12), between(-3, 4), UNBOUNDED],
123 #[between(-36, -12), between(0, 4), upTo(-3)],
124 #[between(-36, -12), between(3, 4), between(-12, -3)],
125 #[between(-36, -12), ZERO, EMPTY],
126 #[between(-36, 0), UNBOUNDED, UNBOUNDED],
127 #[between(-36, 0), upTo(-2), between(0, 18)],
128 #[between(-36, 0), upTo(0), above(0)],
129 #[between(-36, 0), upTo(3), UNBOUNDED],
130 #[between(-36, 0), above(-2), UNBOUNDED],
131 #[between(-36, 0), above(0), upTo(0)],
132 #[between(-36, 0), above(3), between(-12, 0)],
133 #[between(-36, 0), between(-4, -3), between(0, 12)],
134 #[between(-36, 0), between(-4, 0), above(0)],
135 #[between(-36, 0), between(-3, 4), UNBOUNDED],
136 #[between(-36, 0), between(0, 4), upTo(0)],
137 #[between(-36, 0), between(3, 4), between(-12, 0)],
138 #[between(-36, 0), ZERO, EMPTY],
139 #[between(-12, 36), UNBOUNDED, UNBOUNDED],
140 #[between(-12, 36), upTo(-2), between(-18, 6)],
141 #[between(-12, 36), upTo(0), UNBOUNDED],
142 #[between(-12, 36), upTo(3), UNBOUNDED],
143 #[between(-12, 36), above(-2), UNBOUNDED],
144 #[between(-12, 36), above(0), UNBOUNDED],
145 #[between(-12, 36), above(3), between(-4, 12)],
146 #[between(-12, 36), between(-4, -3), between(-12, 4)],
147 #[between(-12, 36), between(-4, 0), UNBOUNDED],
148 #[between(-12, 36), between(-3, 4), UNBOUNDED],
149 #[between(-12, 36), between(0, 4), UNBOUNDED],
150 #[between(-12, 36), between(3, 4), between(-4, 12)],
151 #[between(-12, 36), ZERO, EMPTY],
152 #[between(0, 36), UNBOUNDED, UNBOUNDED],
153 #[between(0, 36), upTo(-2), between(-18, 0)],
154 #[between(0, 36), upTo(0), upTo(0)],
155 #[between(0, 36), upTo(3), UNBOUNDED],
156 #[between(0, 36), above(-2), UNBOUNDED],
157 #[between(0, 36), above(0), above(0)],
158 #[between(0, 36), above(3), between(0, 12)],
159 #[between(0, 36), between(-4, -3), between(-12, 0)],
160 #[between(0, 36), between(-4, 0), upTo(0)],
161 #[between(0, 36), between(-3, 4), UNBOUNDED],
162 #[between(0, 36), between(0, 4), above(0)],
163 #[between(0, 36), between(3, 4), between(0, 12)],
164 #[between(0, 36), ZERO, EMPTY],
165 #[between(12, 36), UNBOUNDED, UNBOUNDED],
166 #[between(12, 36), upTo(-2), between(-18, 0)],
167 #[between(12, 36), upTo(0), upTo(0)],
168 #[between(12, 36), upTo(3), UNBOUNDED],
169 #[between(12, 36), above(-2), UNBOUNDED],
170 #[between(12, 36), above(0), above(0)],
171 #[between(12, 36), above(3), between(0, 12)],
172 #[between(12, 36), between(-4, -3), between(-12, -3)],
173 #[between(12, 36), between(-4, 0), upTo(-3)],
174 #[between(12, 36), between(-3, 4), UNBOUNDED],
175 #[between(12, 36), between(0, 4), above(3)],
176 #[between(12, 36), between(3, 4), between(3, 12)],
177 #[between(12, 36), ZERO, EMPTY],
178 #[ZERO, UNBOUNDED, ZERO],
179 #[ZERO, upTo(-2), ZERO],
180 #[ZERO, upTo(0), ZERO],
181 #[ZERO, upTo(3), ZERO],
182 #[ZERO, above(-2), ZERO],
183 #[ZERO, above(0), ZERO],
184 #[ZERO, above(3), ZERO],
185 #[ZERO, between(-4, -3), ZERO],
186 #[ZERO, between(-4, 0), ZERO],
187 #[ZERO, between(-3, 4), ZERO],
188 #[ZERO, between(0, 4), ZERO],
189 #[ZERO, between(3, 4), ZERO],
190 #[ZERO, ZERO, EMPTY]
191 ]
192 }
193
194 @Parameter(0) public var Interval a
195 @Parameter(1) public var Interval b
196 @Parameter(2) public var Interval result
197
198 @Test
199 def void divisionTest() {
200 Assert.assertEquals(result, a / b)
201 }
202}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MinAggregatorTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MinAggregatorTest.xtend
new file mode 100644
index 00000000..7d46e16c
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MinAggregatorTest.xtend
@@ -0,0 +1,67 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
2
3import com.google.common.collect.HashMultiset
4import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
5import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.IntervalAggregationMode
6import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.IntervalAggregationOperator
7import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.IntervalRedBlackNode
8import java.math.BigDecimal
9import java.util.Random
10import org.junit.Assert
11import org.junit.Before
12import org.junit.Test
13
14import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.*
15
16class MinAggregatorTest {
17 val aggregator = new IntervalAggregationOperator(IntervalAggregationMode.MIN)
18 var IntervalRedBlackNode value = null
19
20 @Before
21 def void reset() {
22 value = aggregator.createNeutral
23 }
24
25 @Test
26 def void emptyTest() {
27 assertEquals(EMPTY)
28 }
29
30 @Test
31 def void largeTest() {
32 val starts = #[null, new BigDecimal(-3), new BigDecimal(-2), new BigDecimal(-1)]
33 val ends = #[new BigDecimal(1), new BigDecimal(2), new BigDecimal(3), null]
34 val current = HashMultiset.create
35 val random = new Random(1)
36 for (var int i = 0; i < 1000; i++) {
37 val start = starts.get(random.nextInt(starts.size))
38 val end = ends.get(random.nextInt(ends.size))
39 val interval = Interval.of(start, end)
40 val isInsert = !current.contains(interval) || random.nextInt(3) == 0
41 if (isInsert) {
42 current.add(interval)
43 } else {
44 current.remove(interval)
45 }
46 val expected = current.stream.reduce(aggregator.mode).orElse(EMPTY)
47 update(interval, isInsert)
48 assertEquals(expected)
49 }
50 }
51
52 private def update(Interval interval, boolean isInsert) {
53 value = aggregator.update(value, interval, isInsert)
54 val nodes = newArrayList
55 var node = value.min
56 while (node !== null) {
57 nodes += node
58 node = node.successor
59 }
60 value.assertSubtreeIsValid
61 }
62
63 private def assertEquals(Interval interval) {
64 val actual = aggregator.getAggregate(value)
65 Assert.assertEquals(interval, actual)
66 }
67}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MultiplicationTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MultiplicationTest.xtend
new file mode 100644
index 00000000..5f997094
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MultiplicationTest.xtend
@@ -0,0 +1,205 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
4import java.util.Collection
5import org.junit.Assert
6import org.junit.Test
7import org.junit.runner.RunWith
8import org.junit.runners.Parameterized
9import org.junit.runners.Parameterized.Parameter
10import org.junit.runners.Parameterized.Parameters
11
12import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.*
13
14@RunWith(Parameterized)
15class MultiplicationTest {
16 @Parameters(name="{index}: {0} * {1} = {2}")
17 static def Collection<Object[]> data() {
18 #[
19 #[EMPTY, EMPTY, EMPTY],
20 #[EMPTY, between(-1, 1), EMPTY],
21 #[between(-1, 1), EMPTY, EMPTY],
22 #[UNBOUNDED, UNBOUNDED, UNBOUNDED],
23 #[UNBOUNDED, upTo(-2), UNBOUNDED],
24 #[UNBOUNDED, upTo(0), UNBOUNDED],
25 #[UNBOUNDED, upTo(3), UNBOUNDED],
26 #[UNBOUNDED, above(-2), UNBOUNDED],
27 #[UNBOUNDED, above(0), UNBOUNDED],
28 #[UNBOUNDED, above(3), UNBOUNDED],
29 #[UNBOUNDED, between(-4, -3), UNBOUNDED],
30 #[UNBOUNDED, between(-4, 0), UNBOUNDED],
31 #[UNBOUNDED, between(-3, 4), UNBOUNDED],
32 #[UNBOUNDED, between(0, 4), UNBOUNDED],
33 #[UNBOUNDED, between(3, 4), UNBOUNDED],
34 #[UNBOUNDED, ZERO, ZERO],
35 #[upTo(-5), UNBOUNDED, UNBOUNDED],
36 #[upTo(-5), upTo(-2), above(10)],
37 #[upTo(-5), upTo(0), above(0)],
38 #[upTo(-5), upTo(3), UNBOUNDED],
39 #[upTo(-5), above(-2), UNBOUNDED],
40 #[upTo(-5), above(0), upTo(0)],
41 #[upTo(-5), above(3), upTo(-15)],
42 #[upTo(-5), between(-4, -3), above(15)],
43 #[upTo(-5), between(-4, 0), above(0)],
44 #[upTo(-5), between(-3, 4), UNBOUNDED],
45 #[upTo(-5), between(0, 4), upTo(0)],
46 #[upTo(-5), between(3, 4), upTo(-15)],
47 #[upTo(-5), ZERO, ZERO],
48 #[upTo(0), UNBOUNDED, UNBOUNDED],
49 #[upTo(0), upTo(-2), above(0)],
50 #[upTo(0), upTo(0), above(0)],
51 #[upTo(0), upTo(3), UNBOUNDED],
52 #[upTo(0), above(-2), UNBOUNDED],
53 #[upTo(0), above(0), upTo(0)],
54 #[upTo(0), above(3), upTo(0)],
55 #[upTo(0), between(-4, -3), above(0)],
56 #[upTo(0), between(-4, 0), above(0)],
57 #[upTo(0), between(-3, 4), UNBOUNDED],
58 #[upTo(0), between(0, 4), upTo(0)],
59 #[upTo(0), between(3, 4), upTo(0)],
60 #[upTo(0), ZERO, ZERO],
61 #[upTo(5), UNBOUNDED, UNBOUNDED],
62 #[upTo(5), upTo(-2), UNBOUNDED],
63 #[upTo(5), upTo(0), UNBOUNDED],
64 #[upTo(5), upTo(3), UNBOUNDED],
65 #[upTo(5), above(-2), UNBOUNDED],
66 #[upTo(5), above(0), UNBOUNDED],
67 #[upTo(5), above(3), UNBOUNDED],
68 #[upTo(5), between(-4, -3), above(-20)],
69 #[upTo(5), between(-4, 0), above(-20)],
70 #[upTo(5), between(-3, 4), UNBOUNDED],
71 #[upTo(5), between(0, 4), upTo(20)],
72 #[upTo(5), between(3, 4), upTo(20)],
73 #[upTo(5), ZERO, ZERO],
74 #[above(-5), UNBOUNDED, UNBOUNDED],
75 #[above(-5), upTo(-2), UNBOUNDED],
76 #[above(-5), upTo(0), UNBOUNDED],
77 #[above(-5), upTo(3), UNBOUNDED],
78 #[above(-5), above(-2), UNBOUNDED],
79 #[above(-5), above(0), UNBOUNDED],
80 #[above(-5), above(3), UNBOUNDED],
81 #[above(-5), between(-4, -3), upTo(20)],
82 #[above(-5), between(-4, 0), upTo(20)],
83 #[above(-5), between(-3, 4), UNBOUNDED],
84 #[above(-5), between(0, 4), above(-20)],
85 #[above(-5), between(3, 4), above(-20)],
86 #[above(-5), ZERO, ZERO],
87 #[above(0), UNBOUNDED, UNBOUNDED],
88 #[above(0), upTo(-2), upTo(0)],
89 #[above(0), upTo(0), upTo(0)],
90 #[above(0), upTo(3), UNBOUNDED],
91 #[above(0), above(-2), UNBOUNDED],
92 #[above(0), above(0), above(0)],
93 #[above(0), above(3), above(0)],
94 #[above(0), between(-4, -3), upTo(0)],
95 #[above(0), between(-4, 0), upTo(0)],
96 #[above(0), between(-3, 4), UNBOUNDED],
97 #[above(0), between(0, 4), above(0)],
98 #[above(0), between(3, 4), above(0)],
99 #[above(0), ZERO, ZERO],
100 #[above(5), UNBOUNDED, UNBOUNDED],
101 #[above(5), upTo(-2), upTo(-10)],
102 #[above(5), upTo(0), upTo(0)],
103 #[above(5), upTo(3), UNBOUNDED],
104 #[above(5), above(-2), UNBOUNDED],
105 #[above(5), above(0), above(0)],
106 #[above(5), above(3), above(15)],
107 #[above(5), between(-4, -3), upTo(-15)],
108 #[above(5), between(-4, 0), upTo(0)],
109 #[above(5), between(-3, 4), UNBOUNDED],
110 #[above(5), between(0, 4), above(0)],
111 #[above(5), between(3, 4), above(15)],
112 #[above(5), ZERO, ZERO],
113 #[between(-6, -5), UNBOUNDED, UNBOUNDED],
114 #[between(-6, -5), upTo(-2), above(10)],
115 #[between(-6, -5), upTo(0), above(0)],
116 #[between(-6, -5), upTo(3), above(-18)],
117 #[between(-6, -5), above(-2), upTo(12)],
118 #[between(-6, -5), above(0), upTo(0)],
119 #[between(-6, -5), above(3), upTo(-15)],
120 #[between(-6, -5), between(-4, -3), between(15, 24)],
121 #[between(-6, -5), between(-4, 0), between(0, 24)],
122 #[between(-6, -5), between(-3, 4), between(-24, 18)],
123 #[between(-6, -5), between(0, 4), between(-24, 0)],
124 #[between(-6, -5), between(3, 4), between(-24, -15)],
125 #[between(-6, -5), ZERO, ZERO],
126 #[between(-6, 0), UNBOUNDED, UNBOUNDED],
127 #[between(-6, 0), upTo(-2), above(0)],
128 #[between(-6, 0), upTo(0), above(0)],
129 #[between(-6, 0), upTo(3), above(-18)],
130 #[between(-6, 0), above(-2), upTo(12)],
131 #[between(-6, 0), above(0), upTo(0)],
132 #[between(-6, 0), above(3), upTo(0)],
133 #[between(-6, 0), between(-4, -3), between(0, 24)],
134 #[between(-6, 0), between(-4, 0), between(0, 24)],
135 #[between(-6, 0), between(-3, 4), between(-24, 18)],
136 #[between(-6, 0), between(0, 4), between(-24, 0)],
137 #[between(-6, 0), between(3, 4), between(-24, 0)],
138 #[between(-6, 0), ZERO, ZERO],
139 #[between(-5, 6), UNBOUNDED, UNBOUNDED],
140 #[between(-5, 6), upTo(-2), UNBOUNDED],
141 #[between(-5, 6), upTo(0), UNBOUNDED],
142 #[between(-5, 6), upTo(3), UNBOUNDED],
143 #[between(-5, 6), above(-2), UNBOUNDED],
144 #[between(-5, 6), above(0), UNBOUNDED],
145 #[between(-5, 6), above(3), UNBOUNDED],
146 #[between(-5, 6), between(-4, -3), between(-24, 20)],
147 #[between(-5, 6), between(-4, 0), between(-24, 20)],
148 #[between(-5, 6), between(-3, 4), between(-20, 24)],
149 #[between(-5, 6), between(-3, 2), between(-18, 15)],
150 #[between(-5, 1), between(-3, 4), between(-20, 15)],
151 #[between(-5, 1), between(-3, 2), between(-10, 15)],
152 #[between(-5, 6), between(0, 4), between(-20, 24)],
153 #[between(-5, 6), between(3, 4), between(-20, 24)],
154 #[between(-5, 6), ZERO, ZERO],
155 #[between(0, 6), UNBOUNDED, UNBOUNDED],
156 #[between(0, 6), upTo(-2), upTo(0)],
157 #[between(0, 6), upTo(0), upTo(0)],
158 #[between(0, 6), upTo(3), upTo(18)],
159 #[between(0, 6), above(-2), above(-12)],
160 #[between(0, 6), above(0), above(0)],
161 #[between(0, 6), above(3), above(0)],
162 #[between(0, 6), between(-4, -3), between(-24, 0)],
163 #[between(0, 6), between(-4, 0), between(-24, 0)],
164 #[between(0, 6), between(-3, 4), between(-18, 24)],
165 #[between(0, 6), between(0, 4), between(0, 24)],
166 #[between(0, 6), between(3, 4), between(0, 24)],
167 #[between(0, 6), ZERO, ZERO],
168 #[between(5, 6), UNBOUNDED, UNBOUNDED],
169 #[between(5, 6), upTo(-2), upTo(-10)],
170 #[between(5, 6), upTo(0), upTo(0)],
171 #[between(5, 6), upTo(3), upTo(18)],
172 #[between(5, 6), above(-2), above(-12)],
173 #[between(5, 6), above(0), above(0)],
174 #[between(5, 6), above(3), above(15)],
175 #[between(5, 6), between(-4, -3), between(-24, -15)],
176 #[between(5, 6), between(-4, 0), between(-24, 0)],
177 #[between(5, 6), between(-3, 4), between(-18, 24)],
178 #[between(5, 6), between(0, 4), between(0, 24)],
179 #[between(5, 6), between(3, 4), between(15, 24)],
180 #[between(5, 6), ZERO, ZERO],
181 #[ZERO, UNBOUNDED, ZERO],
182 #[ZERO, upTo(-2), ZERO],
183 #[ZERO, upTo(0), ZERO],
184 #[ZERO, upTo(3), ZERO],
185 #[ZERO, above(-2), ZERO],
186 #[ZERO, above(0), ZERO],
187 #[ZERO, above(3), ZERO],
188 #[ZERO, between(-4, -3), ZERO],
189 #[ZERO, between(-4, 0), ZERO],
190 #[ZERO, between(-3, 4), ZERO],
191 #[ZERO, between(0, 4), ZERO],
192 #[ZERO, between(3, 4), ZERO],
193 #[ZERO, ZERO, ZERO]
194 ]
195 }
196
197 @Parameter(0) public var Interval a
198 @Parameter(1) public var Interval b
199 @Parameter(2) public var Interval result
200
201 @Test
202 def void multiplicatonTest() {
203 Assert.assertEquals(result, a * b)
204 }
205}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/NegationTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/NegationTest.xtend
new file mode 100644
index 00000000..477e925e
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/NegationTest.xtend
@@ -0,0 +1,34 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
4import java.util.Collection
5import org.junit.Assert
6import org.junit.Test
7import org.junit.runner.RunWith
8import org.junit.runners.Parameterized
9import org.junit.runners.Parameterized.Parameter
10import org.junit.runners.Parameterized.Parameters
11
12import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.*
13
14@RunWith(Parameterized)
15class NegationTest {
16 @Parameters(name = "{index}: -{0} = {1}")
17 static def Collection<Object[]> data() {
18 #[
19 #[EMPTY, EMPTY],
20 #[UNBOUNDED, UNBOUNDED],
21 #[upTo(1), above(-1)],
22 #[above(1), upTo(-1)],
23 #[between(2, 3), between(-3, -2)]
24 ]
25 }
26
27 @Parameter(0) public var Interval a
28 @Parameter(1) public var Interval result
29
30 @Test
31 def void negationTest() {
32 Assert.assertEquals(result, -a)
33 }
34}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/PowerTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/PowerTest.xtend
new file mode 100644
index 00000000..c842d90d
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/PowerTest.xtend
@@ -0,0 +1,43 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
4import java.util.Collection
5import org.junit.Assert
6import org.junit.Test
7import org.junit.runner.RunWith
8import org.junit.runners.Parameterized
9import org.junit.runners.Parameterized.Parameter
10import org.junit.runners.Parameterized.Parameters
11
12import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.*
13
14@RunWith(Parameterized)
15class PowerTest {
16 @Parameters(name="{index}: {0} ** {1} = {2}")
17 static def Collection<Object[]> data() {
18 #[
19 #[EMPTY, EMPTY, EMPTY],
20 #[EMPTY, between(-1, 1), EMPTY],
21 #[between(-1, 1), EMPTY, EMPTY],
22 #[upTo(-1), between(-1, 2), EMPTY],
23 #[upTo(0), between(-1, 2), between(0, 0)],
24 #[upTo(2), between(-1, 2), above(0)],
25 #[upTo(2), between(1, 2), between(0, 4)],
26 #[above(1), between(1, 2), above(1)],
27 #[between(2, 4), upTo(1), between(0, 4)],
28 #[between(0.25, 0.5), upTo(1), above(0.25)],
29 #[between(2, 3), above(1), above(2)],
30 #[between(0.25, 0.5), above(1), between(0, 0.5)],
31 #[between(1, 2), between(-1, 2), between(0.5, 4)]
32 ]
33 }
34
35 @Parameter(0) public var Interval a
36 @Parameter(1) public var Interval b
37 @Parameter(2) public var Interval result
38
39 @Test
40 def void powerTest() {
41 Assert.assertEquals(result, a ** b)
42 }
43}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/RelationTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/RelationTest.xtend
new file mode 100644
index 00000000..5527fbaa
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/RelationTest.xtend
@@ -0,0 +1,126 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
4import java.util.Collection
5import org.junit.Assert
6import org.junit.Test
7import org.junit.runner.RunWith
8import org.junit.runners.Parameterized
9import org.junit.runners.Parameterized.Parameter
10import org.junit.runners.Parameterized.Parameters
11
12import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.*
13
14@RunWith(Parameterized)
15class RelationTest {
16 @Parameters(name = "{index}: {0} <> {1}")
17 static def Collection<Object[]> data() {
18 #[
19 #[EMPTY, EMPTY, true, false, true, false, EMPTY],
20 #[EMPTY, between(1, 2), true, false, true, false, between(1, 2)],
21 #[between(1, 2), EMPTY, true, false, true, false, between(1, 2)],
22 #[upTo(1), upTo(0), false, true, false, true, upTo(1)],
23 #[upTo(1), upTo(1), false, true, false, true, upTo(1)],
24 #[upTo(1), upTo(2), false, true, false, true, upTo(2)],
25 #[upTo(1), above(0), false, true, false, true, UNBOUNDED],
26 #[upTo(1), above(1), false, true, false, true, UNBOUNDED],
27 #[upTo(1), above(2), false, false, true, true, UNBOUNDED],
28 #[upTo(1), between(-1, -1), false, true, false, true, upTo(1)],
29 #[upTo(1), between(-1, 0), false, true, false, true, upTo(1)],
30 #[upTo(1), between(-1, 1), false, true, false, true, upTo(1)],
31 #[upTo(1), between(-1, 2), false, true, false, true, upTo(2)],
32 #[upTo(1), between(1, 1), false, true, false, true, upTo(1)],
33 #[upTo(1), between(1, 2), false, true, false, true, upTo(2)],
34 #[upTo(1), between(2, 2), false, false, true, true, upTo(2)],
35 #[upTo(1), between(2, 3), false, false, true, true, upTo(3)],
36 #[above(1), upTo(0), false, false, false, false, UNBOUNDED],
37 #[above(1), upTo(1), false, true, false, false, UNBOUNDED],
38 #[above(1), upTo(2), false, true, false, true, UNBOUNDED],
39 #[above(1), above(0), false, true, false, true, above(0)],
40 #[above(1), above(1), false, true, false, true, above(1)],
41 #[above(1), above(2), false, true, false, true, above(1)],
42 #[above(1), between(-1, -1), false, false, false, false, above(-1)],
43 #[above(1), between(-1, 0), false, false, false, false, above(-1)],
44 #[above(1), between(-1, 1), false, true, false, false, above(-1)],
45 #[above(1), between(-1, 2), false, true, false, true, above(-1)],
46 #[above(1), between(1, 1), false, true, false, false, above(1)],
47 #[above(1), between(1, 2), false, true, false, true, above(1)],
48 #[above(1), between(2, 2), false, true, false, true, above(1)],
49 #[above(1), between(2, 3), false, true, false, true, above(1)],
50 #[between(1, 1), upTo(0), false, false, false, false, upTo(1)],
51 #[between(1, 1), upTo(1), false, true, false, false, upTo(1)],
52 #[between(1, 1), upTo(2), false, true, false, true, upTo(2)],
53 #[between(1, 1), above(0), false, true, false, true, above(0)],
54 #[between(1, 1), above(1), false, true, false, true, above(1)],
55 #[between(1, 1), above(2), false, false, true, true, above(1)],
56 #[between(1, 1), between(-1, -1), false, false, false, false, between(-1, 1)],
57 #[between(1, 1), between(-1, 0), false, false, false, false, between(-1, 1)],
58 #[between(1, 1), between(-1, 1), false, true, false, false, between(-1, 1)],
59 #[between(1, 1), between(-1, 2), false, true, false, true, between(-1, 2)],
60 #[between(1, 1), between(1, 1), true, true, false, false, between(1, 1)],
61 #[between(1, 1), between(1, 2), false, true, false, true, between(1, 2)],
62 #[between(1, 1), between(2, 2), false, false, true, true, between(1, 2)],
63 #[between(1, 1), between(2, 3), false, false, true, true, between(1, 3)],
64 #[between(-1, 1), upTo(-2), false, false, false, false, upTo(1)],
65 #[between(-1, 1), upTo(-1), false, true, false, false, upTo(1)],
66 #[between(-1, 1), upTo(0), false, true, false, true, upTo(1)],
67 #[between(-1, 1), upTo(1), false, true, false, true, upTo(1)],
68 #[between(-1, 1), upTo(2), false, true, false, true, upTo(2)],
69 #[between(-1, 1), above(-2), false, true, false, true, above(-2)],
70 #[between(-1, 1), above(-1), false, true, false, true, above(-1)],
71 #[between(-1, 1), above(0), false, true, false, true, above(-1)],
72 #[between(-1, 1), above(1), false, true, false, true, above(-1)],
73 #[between(-1, 1), above(2), false, false, true, true, above(-1)],
74 #[between(-1, 1), between(-3, -2), false, false, false, false, between(-3, 1)],
75 #[between(-1, 1), between(-2, -2), false, false, false, false, between(-2, 1)],
76 #[between(-1, 1), between(-2, -1), false, true, false, false, between(-2, 1)],
77 #[between(-1, 1), between(-2, 0), false, true, false, true, between(-2, 1)],
78 #[between(-1, 1), between(-2, 1), false, true, false, true, between(-2, 1)],
79 #[between(-1, 1), between(-2, 2), false, true, false, true, between(-2, 2)],
80 #[between(-1, 1), between(-1, -1), false, true, false, false, between(-1, 1)],
81 #[between(-1, 1), between(-1, 0), false, true, false, true, between(-1, 1)],
82 #[between(-1, 1), between(-1, 1), false, true, false, true, between(-1, 1)],
83 #[between(-1, 1), between(-1, 2), false, true, false, true, between(-1, 2)],
84 #[between(-1, 1), between(0, 0), false, true, false, true, between(-1, 1)],
85 #[between(-1, 1), between(0, 1), false, true, false, true, between(-1, 1)],
86 #[between(-1, 1), between(0, 2), false, true, false, true, between(-1, 2)],
87 #[between(-1, 1), between(1, 1), false, true, false, true, between(-1, 1)],
88 #[between(-1, 1), between(1, 2), false, true, false, true, between(-1, 2)],
89 #[between(-1, 1), between(2, 2), false, false, true, true, between(-1, 2)],
90 #[between(-1, 1), between(2, 3), false, false, true, true, between(-1, 3)]
91 ]
92 }
93
94 @Parameter(0) public var Interval a
95 @Parameter(1) public var Interval b
96 @Parameter(2) public var boolean mustEqual
97 @Parameter(3) public var boolean mayEqual
98 @Parameter(4) public var boolean mustBeLessThan
99 @Parameter(5) public var boolean mayBeLessThan
100 @Parameter(6) public var Interval join
101
102 @Test
103 def void mustEqualTest() {
104 Assert.assertEquals(mustEqual, a.mustEqual(b))
105 }
106
107 @Test
108 def void mayEqualTest() {
109 Assert.assertEquals(mayEqual, a.mayEqual(b))
110 }
111
112 @Test
113 def void mustBeLessThanTest() {
114 Assert.assertEquals(mustBeLessThan, a.mustBeLessThan(b))
115 }
116
117 @Test
118 def void mayBeLessThanTest() {
119 Assert.assertEquals(mayBeLessThan, a.mayBeLessThan(b))
120 }
121
122 @Test
123 def void joinTest() {
124 Assert.assertEquals(join, a.join(b))
125 }
126}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SubtractionTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SubtractionTest.xtend
new file mode 100644
index 00000000..30709a9e
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SubtractionTest.xtend
@@ -0,0 +1,49 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
2
3import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
4import java.util.Collection
5import org.junit.Assert
6import org.junit.Test
7import org.junit.runner.RunWith
8import org.junit.runners.Parameterized
9import org.junit.runners.Parameterized.Parameter
10import org.junit.runners.Parameterized.Parameters
11
12import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.*
13
14@RunWith(Parameterized)
15class SubtractionTest {
16 @Parameters(name = "{index}: {0} - {1} = {2}")
17 static def Collection<Object[]> data() {
18 #[
19 #[EMPTY, EMPTY, EMPTY],
20 #[EMPTY, between(-1, 1), EMPTY],
21 #[between(-1, 1), EMPTY, EMPTY],
22 #[UNBOUNDED, UNBOUNDED, UNBOUNDED],
23 #[UNBOUNDED, upTo(2), UNBOUNDED],
24 #[UNBOUNDED, above(-2), UNBOUNDED],
25 #[UNBOUNDED, between(-1, 1), UNBOUNDED],
26 #[upTo(2), UNBOUNDED, UNBOUNDED],
27 #[upTo(2), upTo(1), UNBOUNDED],
28 #[upTo(2), above(-1), upTo(3)],
29 #[upTo(2), between(-1, 2), upTo(3)],
30 #[above(-2), UNBOUNDED, UNBOUNDED],
31 #[above(-2), upTo(1), above(-3)],
32 #[above(-2), above(-1), UNBOUNDED],
33 #[above(-2), between(-1, 2), above(-4)],
34 #[between(-2, 3), UNBOUNDED, UNBOUNDED],
35 #[between(-2, 3), upTo(1), above(-3)],
36 #[between(-2, 3), above(-1), upTo(4)],
37 #[between(-2, 3), between(-1, 2.5), between(-4.5, 4)]
38 ]
39 }
40
41 @Parameter(0) public var Interval a
42 @Parameter(1) public var Interval b
43 @Parameter(2) public var Interval result
44
45 @Test
46 def void subtractionTest() {
47 Assert.assertEquals(result, a - b)
48 }
49}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SumAggregatorTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SumAggregatorTest.xtend
new file mode 100644
index 00000000..56172b6c
--- /dev/null
+++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SumAggregatorTest.xtend
@@ -0,0 +1,140 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval
2
3import com.google.common.collect.HashMultiset
4import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
5import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.IntervalAggregationMode
6import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.IntervalAggregationOperator
7import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.IntervalRedBlackNode
8import java.math.BigDecimal
9import java.util.Random
10import org.junit.Assert
11import org.junit.Before
12import org.junit.Test
13
14import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.*
15
16class SumAggregatorTest {
17 val aggregator = new IntervalAggregationOperator(IntervalAggregationMode.SUM)
18 var IntervalRedBlackNode value = null
19
20 @Before
21 def void reset() {
22 value = aggregator.createNeutral
23 }
24
25 @Test
26 def void emptyTest() {
27 assertEquals(ZERO)
28 }
29
30 @Test
31 def void addSingleTest() {
32 add(between(-1, 1))
33 assertEquals(between(-1, 1))
34 }
35
36 @Test
37 def void addRemoveTest() {
38 add(between(-1, 1))
39 remove(between(-1, 1))
40 assertEquals(ZERO)
41 }
42
43 @Test
44 def void addTwoTest() {
45 add(between(-1, 1))
46 add(above(2))
47 assertEquals(above(1))
48 }
49
50 @Test
51 def void addTwoRemoveFirstTest() {
52 add(between(-1, 1))
53 add(above(2))
54 remove(between(-1, 1))
55 assertEquals(above(2))
56 }
57
58 @Test
59 def void addTwoRemoveSecondTest() {
60 add(between(-1, 1))
61 add(above(2))
62 remove(above(2))
63 assertEquals(between(-1, 1))
64 }
65
66 @Test
67 def void addMultiplicityTest() {
68 add(between(-1, 1))
69 add(between(-1, 1))
70 add(between(-1, 1))
71 assertEquals(between(-3, 3))
72 }
73
74 @Test
75 def void removeAllMultiplicityTest() {
76 add(between(-1, 1))
77 add(between(-1, 1))
78 add(between(-1, 1))
79 remove(between(-1, 1))
80 remove(between(-1, 1))
81 remove(between(-1, 1))
82 assertEquals(ZERO)
83 }
84
85 @Test
86 def void removeSomeMultiplicityTest() {
87 add(between(-1, 1))
88 add(between(-1, 1))
89 add(between(-1, 1))
90 remove(between(-1, 1))
91 remove(between(-1, 1))
92 assertEquals(between(-1, 1))
93 }
94
95 @Test
96 def void largeTest() {
97 val starts = #[null, new BigDecimal(-3), new BigDecimal(-2), new BigDecimal(-1)]
98 val ends = #[new BigDecimal(1), new BigDecimal(2), new BigDecimal(3), null]
99 val current = HashMultiset.create
100 val random = new Random(1)
101 for (var int i = 0; i < 1000; i++) {
102 val start = starts.get(random.nextInt(starts.size))
103 val end = ends.get(random.nextInt(ends.size))
104 val interval = Interval.of(start, end)
105 val isInsert = !current.contains(interval) || random.nextInt(3) == 0
106 if (isInsert) {
107 current.add(interval)
108 } else {
109 current.remove(interval)
110 }
111 val expected = current.stream.reduce(aggregator.mode).orElse(ZERO)
112 update(interval, isInsert)
113 assertEquals(expected)
114 }
115 }
116
117 private def update(Interval interval, boolean isInsert) {
118 value = aggregator.update(value, interval, isInsert)
119 val nodes = newArrayList
120 var node = value.min
121 while (node !== null) {
122 nodes += node
123 node = node.successor
124 }
125 value.assertSubtreeIsValid
126 }
127
128 private def add(Interval interval) {
129 update(interval, true)
130 }
131
132 private def remove(Interval interval) {
133 update(interval, false)
134 }
135
136 private def assertEquals(Interval interval) {
137 val actual = aggregator.getAggregate(value)
138 Assert.assertEquals(interval, actual)
139 }
140}