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

new library example and remove error in reading EMF class creation

parent 925e88e2
No related branches found
No related tags found
No related merge requests found
<?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"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="library"
nsURI="http://www.eclipse.org/emf/jcrm/samples/emf/sample/Library" nsPrefix="library">
<eClassifiers xsi:type="ecore:EClass" name="Book">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="Book"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="title" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="title"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="pages" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Int" unsettable="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="pages"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="author" lowerBound="1"
eType="#//Writer">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="author"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Library">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="name"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="books" upperBound="-1"
eType="#//Book" containment="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="books"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Writer">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="name"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GuideBookWriter" eSuperTypes="#//Writer">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="countries" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SpecialistBookWriter" eSuperTypes="#//Writer">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="subject" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</ecore:EPackage>
\ No newline at end of file
...@@ -15,6 +15,15 @@ import org.rosi_project.model_sync.generator.acr_model.types.PredefEcoreTypes ...@@ -15,6 +15,15 @@ import org.rosi_project.model_sync.generator.acr_model.types.PredefEcoreTypes
object EmfTypeTranslator { object EmfTypeTranslator {
private val typeMap: Map[String, SType] = Map( private val typeMap: Map[String, SType] = Map(
"Double" -> PredefTypes.Double,
"Float" -> PredefTypes.Float,
"Int" -> PredefTypes.Integer,
"Char" -> PredefTypes.Char,
"Byte" -> PredefTypes.Byte,
"Boolean" -> PredefTypes.Boolean,
"Long" -> PredefTypes.Long,
"Short" -> PredefTypes.Short,
"String" -> PredefTypes.String,
"EBoolean" -> PredefTypes.Boolean, "EBoolean" -> PredefTypes.Boolean,
"EByte" -> PredefTypes.Byte, "EByte" -> PredefTypes.Byte,
"EChar" -> PredefTypes.Char, "EChar" -> PredefTypes.Char,
......
...@@ -108,7 +108,7 @@ class SumModelReadingVisitor(config: GeneratorConfig) extends SModelVisitor { ...@@ -108,7 +108,7 @@ class SumModelReadingVisitor(config: GeneratorConfig) extends SModelVisitor {
overrides = true) overrides = true)
creatorSync.addMethod(methodSync) creatorSync.addMethod(methodSync)
var s = c.getAttributeConstructorParameters.map(m => s"""obj.eGet(obj.eClass().getEStructuralFeature("${m.getName}"))${if (m.getTypeName == "Boolean") ".asInstanceOf[Boolean]" else ".toString()"} """).mkString(", ") var s = c.getAttributeConstructorParameters.map(m => s"""obj.eGet(obj.eClass().getEStructuralFeature("${m.getName}"))${if (m.getTypeName == "String") ".toString()" else s".asInstanceOf[${m.getTypeName}]"} """).mkString(", ")
if (s.isEmpty()) { if (s.isEmpty()) {
s = "obj" s = "obj"
} else { } else {
......
...@@ -13,7 +13,8 @@ object ApplicationTest extends App { ...@@ -13,7 +13,8 @@ object ApplicationTest extends App {
//runTestAML(Creation.rolesum) //runTestAML(Creation.rolesum)
//TTC Case examples //TTC Case examples
runTTC2019(Creation.rolecomb) runTestEmfLibrary(Creation.rolecomb)
//runTTC2019(Creation.rolecomb)
//runTTC2019(Creation.rolesync) //runTTC2019(Creation.rolesync)
//runTTCLive2019(Creation.rolesync) //runTTCLive2019(Creation.rolesync)
...@@ -83,6 +84,11 @@ object ApplicationTest extends App { ...@@ -83,6 +84,11 @@ object ApplicationTest extends App {
new Generator(config).run() new Generator(config).run()
} }
def runTestEmfLibrary(cre: Creation.Value): Unit = {
var config: GeneratorConfig = GeneratorConfig(Seq("assets/models/EMFLibrary.ecore"), false, new File("assets/models"), create = cre);
new Generator(config).run()
}
def runTestShrinkingModel(cre: Creation.Value): Unit = { def runTestShrinkingModel(cre: Creation.Value): Unit = {
var config: GeneratorConfig = GeneratorConfig(Seq("assets/models/ShrinkingModel.ecore"), false, new File("assets/models"), create = cre); var config: GeneratorConfig = GeneratorConfig(Seq("assets/models/ShrinkingModel.ecore"), false, new File("assets/models"), create = cre);
new Generator(config).run() new Generator(config).run()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment