Skip to content
Snippets Groups Projects
Commit f0cedcbe authored by Chrissi's avatar Chrissi
Browse files

small changes for diss generation stuff

parent 54529b42
No related branches found
No related tags found
No related merge requests found
...@@ -33,14 +33,14 @@ ...@@ -33,14 +33,14 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="film" eType="#//Film" eOpposite="#//Film/figures"/> <eStructuralFeatures xsi:type="ecore:EReference" name="film" eType="#//Film" eOpposite="#//Film/figures"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="playedBy" lowerBound="1" <eStructuralFeatures xsi:type="ecore:EReference" name="playedBy" lowerBound="1"
upperBound="-1" eType="#//Actor" eOpposite="#//Actor/plays"/> upperBound="-1" eType="#//Actor" eOpposite="#//Actor/playsIn"/>
</eClassifiers> </eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Person"> <eClassifiers xsi:type="ecore:EClass" name="Person">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="dob" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="dob" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
</eClassifiers> </eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Actor" eSuperTypes="#//Person"> <eClassifiers xsi:type="ecore:EClass" name="Actor" eSuperTypes="#//Person">
<eStructuralFeatures xsi:type="ecore:EReference" name="plays" upperBound="-1" <eStructuralFeatures xsi:type="ecore:EReference" name="playsIn" upperBound="-1"
eType="#//Figure" eOpposite="#//Figure/playedBy"/> eType="#//Figure" eOpposite="#//Figure/playedBy"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="library" eType="#//IMDB" <eStructuralFeatures xsi:type="ecore:EReference" name="library" eType="#//IMDB"
eOpposite="#//IMDB/actors"/> eOpposite="#//IMDB/actors"/>
......
{"name":"Library","init":{"name":"Library","primaryClass":"LibraryExample.Library","image":"Library.png","nested":[{"name":"Person","primaryClass":"LibraryExample.Person","additionalClasses":["LibraryExample.Employee"]}]}} {"name":"Library","init":{"name":"Library","primaryClass":"sync.lib.Library","image":"Library.png","nested":[{"name":"Person","primaryClass":"sync.lib.Person","additionalClasses":["sync.lib.Employee"]}]}}
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="eclipselibrary" nsURI="http://www.example.org/eclipselibrary" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="Eclipselibrary" nsURI="http://www.example.org/eclipselibrary"
nsPrefix="elib"> nsPrefix="elib">
<eClassifiers xsi:type="ecore:EClass" name="Item" abstract="true"> <eClassifiers xsi:type="ecore:EClass" name="Item" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="publicationDate" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDate"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="publicationDate" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
......
...@@ -25,6 +25,14 @@ class Generator(config: GeneratorConfig) { ...@@ -25,6 +25,14 @@ class Generator(config: GeneratorConfig) {
* Starts the generation. * Starts the generation.
*/ */
def run(): Unit = { def run(): Unit = {
//set package name of scala model files
if (config.create == Creation.rolesum)
PackageNames.sourcePkgPrefix = "sum."
if (config.create == Creation.rolesync)
PackageNames.sourcePkgPrefix = "sync."
if (config.create == Creation.rolecomb)
PackageNames.sourcePkgPrefix = ""
try { try {
if (config.sources.isEmpty) { if (config.sources.isEmpty) {
println("Error: There must be any source file to generate something!!!") println("Error: There must be any source file to generate something!!!")
...@@ -79,8 +87,10 @@ class Generator(config: GeneratorConfig) { ...@@ -79,8 +87,10 @@ class Generator(config: GeneratorConfig) {
if (sm._2.obj != null) { if (sm._2.obj != null) {
new SModelCombiInstanceService prepareModel (sm._1, sm._2) new SModelCombiInstanceService prepareModel (sm._1, sm._2)
} }
if (config.create == Creation.rolecomb) {
//add ref methods //add ref methods
new SModelCombiRefMethodService prepareModel (sm._1) new SModelCombiRefMethodService prepareModel (sm._1)
}
//remove references //remove references
new SModelSUMRemoveRefService prepareModel (sm._1) new SModelSUMRemoveRefService prepareModel (sm._1)
//create view and query stuff //create view and query stuff
......
...@@ -4,7 +4,7 @@ object PackageNames { ...@@ -4,7 +4,7 @@ object PackageNames {
val multiInhertitanceWithTraits = false val multiInhertitanceWithTraits = false
val sourcePkgPrefix: String = "" //sync. , sum. var sourcePkgPrefix: String = "" //sync. , sum.
val viewPkgName: String = "view" val viewPkgName: String = "view"
val viewPostName: String = "View" val viewPostName: String = "View"
......
...@@ -3,6 +3,9 @@ package org.rosi_project.model_sync.generator.sync ...@@ -3,6 +3,9 @@ package org.rosi_project.model_sync.generator.sync
import org.rosi_project.model_sync.generator.acr_model._ import org.rosi_project.model_sync.generator.acr_model._
import org.rosi_project.model_sync.generator.acr_model.types.GenericSequence import org.rosi_project.model_sync.generator.acr_model.types.GenericSequence
/**
* Create the methods to get the references from each instance. Is only possible in combination with sync, because of role functionality.
*/
class ReferenceMethodCreationVisitor extends SModelVisitor { class ReferenceMethodCreationVisitor extends SModelVisitor {
override def visit(sModel: SModel): Unit = { override def visit(sModel: SModel): Unit = {
......
...@@ -7,8 +7,10 @@ import org.rosi_project.model_sync.generator.Creation ...@@ -7,8 +7,10 @@ import org.rosi_project.model_sync.generator.Creation
object ApplicationTest extends App { object ApplicationTest extends App {
runLibraries()
//runTestLibrary(Creation.rolesum) //runTestLibrary(Creation.rolesum)
runCombinedTest(Creation.rolecomb) //runCombinedTest(Creation.rolecomb)
//runShrinkingModel(Creation.rolesum) //runShrinkingModel(Creation.rolesum)
//runTestAML(Creation.rolesum) //runTestAML(Creation.rolesum)
...@@ -22,6 +24,20 @@ object ApplicationTest extends App { ...@@ -22,6 +24,20 @@ object ApplicationTest extends App {
//runAllTests(Creation.rsum) //runAllTests(Creation.rsum)
//runAllTests(Creation.rsync) //runAllTests(Creation.rsync)
def runLibraries(): Unit = {
println("SUMM #####################################################################################")
runCombinedTest(Creation.rolesum)
runTestLibrary(Creation.rolesum)
println("SYNC #####################################################################################")
runCombinedTest(Creation.rolesync)
runTestLibrary(Creation.rolesync)
println("COMB #####################################################################################")
runCombinedTest(Creation.rolecomb)
runTestLibrary(Creation.rolecomb)
}
def runAllTests(cre: Creation.Value): Unit = { def runAllTests(cre: Creation.Value): Unit = {
println("#####################################################################################") println("#####################################################################################")
runTestFamily(cre) runTestFamily(cre)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment