diff --git a/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java deleted file mode 100644 index 3c1c2ead8b6cd48f7624b67c88886eea1253d822..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java +++ /dev/null @@ -1,66 +0,0 @@ -package ttc2019.metamodels.create; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; - -import sync.tt.Cell; -import sync.tt.Port; -import sync.tt.Row; -import sync.tt.TruthTable; -import ttc2019.TTFactory; - -public class CreateTTinJava { - - private TruthTable truthttable = null; - private Map<EObject, Row> rows = new HashMap<EObject, Row>(); - private Map<EObject, Port> ports = new HashMap<EObject, Port>(); - private Map<EObject, Cell> cells = new HashMap<EObject, Cell>(); - - public void createTruthTable(String name, EObject id) { - truthttable = TTFactory.getTruthTable(name); - } - - public void createInputPort(String name, EObject id) { - ports.put(id, TTFactory.getInputPort(name)); - } - - public void createOutputPort(String name, EObject id) { - ports.put(id, TTFactory.getOutputPort(name)); - } - - public void createRow(EObject id) { - rows.put(id, TTFactory.getRow()); - } - - public void createCell(Boolean value, EObject id) { - cells.put(id, TTFactory.getCell(value)); - } - - public void createTruthTableRowsRow(EObject tt, EObject row) { - Row r = rows.get(row); - truthttable.addRows(r); - r.setOwner(truthttable); - } - - public void createTruthTablePortsPort(EObject tt, EObject port) { - Port p = ports.get(port); - truthttable.addPorts(p); - p.setOwner(truthttable); - } - - public void createRowCellsCell(EObject row, EObject cell) { - Cell c = cells.get(cell); - Row r = rows.get(row); - c.setOwner(r); - r.addCells(c); - } - - public void createCellPortPort(EObject cell, EObject port) { - Cell c = cells.get(cell); - Port p = ports.get(port); - c.setPort(p); - p.addCells(c); - } -} diff --git a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala index 2682d7cc95b277f846e34ddf9b7a5cf9c59529f5..6fefd22441edfe55f372ca806c7c27d9458346eb 100644 --- a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala +++ b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala @@ -96,7 +96,7 @@ object CompleteTTCProcess extends App { } override def main(args: Array[String]): Unit = { - val processConfig = TTCProcessConfiguration(ttFileName = "TT.ttmodel", bddFileName = "Generated.bddmodel", processMode = ProcessMode.BDD) + val processConfig = TTCProcessConfiguration(ttFileName = "TT.ttmodel", bddFileName = "Generated.bddmodel", processMode = ProcessMode.BDTU) executeEntireProcess(processConfig) } diff --git a/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableDirectSync.scala b/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableDirectSync.scala index 79615f6f1308fe26724d2ae1bc27fef9b46d79ba..f5f33619ef1e54301f7e07a6658fb350782c1d9b 100644 --- a/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableDirectSync.scala +++ b/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableDirectSync.scala @@ -3,6 +3,11 @@ package ttc2019 import sync.tt._ import org.eclipse.emf.ecore.EObject +/** + * Create the instances of the truth table in Scala. + * + * @author Christopher Werner + */ class CreateTruthTableDirectSync extends ICreateTruthTable { var truthttable: TruthTable = null diff --git a/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSync.scala b/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSync.scala index 12bd89f545c8e34d62b3da8d6f6d03bc46755123..a4cfd2d66ce77a40799b1d7fac43f75f2ac6aea5 100644 --- a/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSync.scala +++ b/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSync.scala @@ -3,6 +3,11 @@ package ttc2019 import sync.tt._ import org.eclipse.emf.ecore.EObject +/** + * Create the instances of the truth table in Scala. + * + * @author Christopher Werner + */ class CreateTruthTableSync extends ICreateTruthTable { var mapping: Map[EObject, Object] = Map.empty diff --git a/solutions/RSync/src/main/scala/ttc2019/ICreateTruthTable.scala b/solutions/RSync/src/main/scala/ttc2019/ICreateTruthTable.scala index 7215b4c2cdd8e362fcd3281ca929318959cac275..c81b99267db43fc60c76cb05417025c03730ede0 100644 --- a/solutions/RSync/src/main/scala/ttc2019/ICreateTruthTable.scala +++ b/solutions/RSync/src/main/scala/ttc2019/ICreateTruthTable.scala @@ -2,6 +2,9 @@ package ttc2019 import org.eclipse.emf.ecore.EObject +/** + * Interface for creating a truth Table. + */ trait ICreateTruthTable { def createTruthTable(name: String, id: EObject): Unit diff --git a/solutions/RSync/src/main/scala/ttc2019/IWriteOutputModel.scala b/solutions/RSync/src/main/scala/ttc2019/IWriteOutputModel.scala index 7085d0709aa2d4b0731fd71fc776f3933ada2072..bf63ffb25b4c6a7203c760c9a4cdef740d6a5e37 100644 --- a/solutions/RSync/src/main/scala/ttc2019/IWriteOutputModel.scala +++ b/solutions/RSync/src/main/scala/ttc2019/IWriteOutputModel.scala @@ -1,5 +1,8 @@ package ttc2019 +/** + * Interface to write out the target models. + */ trait IWriteOutputModel { def generateEverything(outputFile: String): Unit diff --git a/solutions/RSync/src/main/scala/ttc2019/MetricMeasurement.scala b/solutions/RSync/src/main/scala/ttc2019/MetricMeasurement.scala index d98287a91178c87cc2814306f3add08452c02d35..69b3bc18cee30ff3579643b728f0f612d0501628 100644 --- a/solutions/RSync/src/main/scala/ttc2019/MetricMeasurement.scala +++ b/solutions/RSync/src/main/scala/ttc2019/MetricMeasurement.scala @@ -3,6 +3,9 @@ package ttc2019 import org.rosi_project.model_management.core.ModelElementLists import ttc2019.benchmark.Metrics +/** + * Object to create the metric values from the created target models. + */ object MetricMeasurement { var printDirectly = false diff --git a/solutions/RSync/src/main/scala/ttc2019/TTCLoader.scala b/solutions/RSync/src/main/scala/ttc2019/TTCLoader.scala index 0bbeea80660292ec433334107933bff2fc17e3c3..1126ef9c2952a9e5592260155fcc155f8bbbfb23 100644 --- a/solutions/RSync/src/main/scala/ttc2019/TTCLoader.scala +++ b/solutions/RSync/src/main/scala/ttc2019/TTCLoader.scala @@ -21,10 +21,10 @@ import ttc2019.metamodels.tt._ class TTCLoader { /** - * Fetches an ecore model from XML. + * Fetches an ecore model from XMI directly converted into a truth table. * - * @param path where to find the model - * @return the model described by the XML + * @param path where to find the (meta-)model + * @return the truth table instance from the model */ def javaOptimizedTTJavaEcore(pathMeta: String, pathInstance: String): TruthTable = { require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty) @@ -32,18 +32,36 @@ class TTCLoader { return loader.loadOptimizedTruthTable(pathMeta, pathInstance) } + /** + * Fetches an ecore model from XMI as EObject. + * + * @param path where to find the (meta-)model + * @return the EObject instance from the model + */ def loadOptimizedJavaEcore(pathMeta: String, pathInstance: String): EObject = { require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty) val loader = new LoadEObject return loader.loadOptimized(pathMeta, pathInstance) } + /** + * Fetches an ecore model from XMI as EObject. + * + * @param path where to find the (meta-)model + * @return the EObject instance from the model + */ def loadSimpleJavaEcore(pathMeta: String, pathInstance: String): EObject = { require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty) val loader = new LoadEObject return loader.loadSimple(pathMeta, pathInstance) } + /** + * Fetches an ecore model from XMI as EObject. + * + * @param path where to find the (meta-)model + * @return the EObject instance from the model + */ def loadScalaEcore(pathMeta: String, pathInstance: String): EObject = { require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty) @@ -63,6 +81,9 @@ class TTCLoader { return ressourceModel.getContents().get(0) } + /** + * Create a new object from the incoming element. + */ private def createObj(obj: EObject, ctts: ICreateTruthTable): Unit = { var objName = obj.eClass.getName @@ -77,6 +98,9 @@ class TTCLoader { } } + /** + * Create references between the created objects. + */ private def createReferences(o1: EObject, ctts: ICreateTruthTable): Unit = { o1.eClass().getEAllReferences.forEach(sf => { if (sf.getName == "port" || sf.getName == "owner") { @@ -111,8 +135,10 @@ class TTCLoader { }) } - def createTruthTableRSYNCInstance(tt: TruthTable, cttss: ICreateTruthTable): Unit = { - val ctts = new CreateTTinJava() + /** + * Create the input TruthTable instance from the *.ttmodel file. + */ + def createTruthTableRSYNCInstance(tt: TruthTable, ctts: ICreateTruthTable): Unit = { ctts.createTruthTable(tt.getName, tt) tt.getPorts.forEach(p => { diff --git a/solutions/RSync/src/main/scala/ttc2019/TTFactory.scala b/solutions/RSync/src/main/scala/ttc2019/TTFactory.scala deleted file mode 100644 index a9a8fbe5fb36a756ff91a87a2c236e4c6cd151e2..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/TTFactory.scala +++ /dev/null @@ -1,15 +0,0 @@ -package ttc2019 - -import sync.tt._ - -object TTFactory { - def getInputPort(name: String) = new InputPort(name, Set.empty, null, null) - - def getTruthTable(name: String) = new TruthTable(name, Set.empty, Set.empty, null) - - def getOutputPort(name: String) = new OutputPort(name, Set.empty, null, null) - - def getRow() = new Row(Set.empty, null, null) - - def getCell(value: Boolean) = new Cell(value, null, null, null) -} \ No newline at end of file