From e467c3a264b8373ab7ea700060d63f2f8dfa1835 Mon Sep 17 00:00:00 2001 From: Chrissi <christopher@hbsc-werner.de> Date: Thu, 20 Jun 2019 13:18:36 +0200 Subject: [PATCH] newest version of rsync --- .../metamodels/create/CreateTTinJava.java | 78 ++++ .../IntrinsicIDXMIResourceFactoryImpl.java | 18 + .../metamodels/create/LoadEObject.java | 95 +++++ .../RSync/src/main/scala/bdd/Assignment.scala | 24 -- .../scala/bdd/AssignmentPortOutputPort.scala | 46 --- solutions/RSync/src/main/scala/bdd/BDD.scala | 24 -- .../src/main/scala/bdd/BDDPortsPort.scala | 46 --- .../src/main/scala/bdd/BDDTreeTree.scala | 46 --- .../RSync/src/main/scala/bdd/HelperPort.scala | 19 - .../RSync/src/main/scala/bdd/HelperTree.scala | 19 - .../RSync/src/main/scala/bdd/InputPort.scala | 13 - solutions/RSync/src/main/scala/bdd/Leaf.scala | 13 - .../scala/bdd/LeafAssignmentsAssignment.scala | 46 --- .../RSync/src/main/scala/bdd/OutputPort.scala | 13 - solutions/RSync/src/main/scala/bdd/Port.scala | 24 -- .../RSync/src/main/scala/bdd/Subtree.scala | 13 - .../main/scala/bdd/SubtreePortInputPort.scala | 46 --- .../scala/bdd/SubtreeTreeForOneTree.scala | 46 --- .../scala/bdd/SubtreeTreeForZeroTree.scala | 46 --- solutions/RSync/src/main/scala/bdd/Tree.scala | 15 - .../core/ModelElementLists.scala | 48 ++- .../model_management/core/PlayerSync.scala | 9 +- .../core/RSUMElementLists.scala | 106 ----- .../core/RsumCompartment.scala | 4 +- .../core/SynchronizationCompartment.scala | 14 +- .../sync/IConstructionCompartment.scala | 51 ++- .../sync/compartments/GeneralDestructor.scala | 4 +- .../sync/roles/IRoleManager.scala | 5 + .../src/main/scala/sync/bdd/Assignment.scala | 8 +- .../RSync/src/main/scala/sync/bdd/BDD.scala | 18 +- .../src/main/scala/sync/bdd/InputPort.scala | 12 +- .../RSync/src/main/scala/sync/bdd/Leaf.scala | 20 +- .../src/main/scala/sync/bdd/OutputPort.scala | 12 +- .../RSync/src/main/scala/sync/bdd/Port.scala | 4 +- .../src/main/scala/sync/bdd/Subtree.scala | 30 +- .../RSync/src/main/scala/sync/bdd/Tree.scala | 30 +- .../src/main/scala/sync/bddg/Assignment.scala | 6 +- .../RSync/src/main/scala/sync/bddg/BDD.scala | 28 +- .../src/main/scala/sync/bddg/InputPort.scala | 12 +- .../RSync/src/main/scala/sync/bddg/Leaf.scala | 18 +- .../src/main/scala/sync/bddg/OutputPort.scala | 12 +- .../RSync/src/main/scala/sync/bddg/Port.scala | 4 +- .../src/main/scala/sync/bddg/Subtree.scala | 28 +- .../RSync/src/main/scala/sync/bddg/Tree.scala | 64 +-- .../RSync/src/main/scala/sync/tt/Cell.scala | 8 +- .../src/main/scala/sync/tt/InputPort.scala | 4 +- .../main/scala/sync/tt/LocatedElement.scala | 2 +- .../src/main/scala/sync/tt/OutputPort.scala | 4 +- .../RSync/src/main/scala/sync/tt/Port.scala | 18 +- .../RSync/src/main/scala/sync/tt/Row.scala | 15 +- .../src/main/scala/sync/tt/TruthTable.scala | 28 +- solutions/RSync/src/main/scala/tt/Cell.scala | 22 -- .../src/main/scala/tt/CellPortPort.scala | 46 --- .../RSync/src/main/scala/tt/HelperPort.scala | 19 - .../RSync/src/main/scala/tt/InputPort.scala | 13 - .../src/main/scala/tt/LocatedElement.scala | 24 -- .../RSync/src/main/scala/tt/OutputPort.scala | 13 - solutions/RSync/src/main/scala/tt/Port.scala | 22 -- solutions/RSync/src/main/scala/tt/Row.scala | 13 - .../src/main/scala/tt/RowCellsCell.scala | 46 --- .../RSync/src/main/scala/tt/TruthTable.scala | 22 -- .../main/scala/tt/TruthTablePortsPort.scala | 46 --- .../src/main/scala/tt/TruthTableRowsRow.scala | 46 --- .../scala/ttc2019/CompleteTTCProcess.scala | 9 +- .../ttc2019/CreateTruthTableDirectSync.scala | 71 ++++ .../scala/ttc2019/CreateTruthTableSync.scala | 62 +-- .../main/scala/ttc2019/ExampleCombiCase.scala | 185 --------- .../scala/ttc2019/ExampleCombiCaseOO.scala | 372 ------------------ .../scala/ttc2019/ICreateTruthTable.scala | 20 +- .../scala/ttc2019/MetricMeasurement.scala | 44 +-- .../src/main/scala/ttc2019/TTCEmfSaver.scala | 13 - .../src/main/scala/ttc2019/TTCLoader.scala | 192 ++++----- .../src/main/scala/ttc2019/TTFactory.scala | 15 + .../src/main/scala/ttc2019/WriteOutput.scala | 115 ------ .../{ => worksum}/BdtSumIntegration.scala | 2 +- .../{ => worksum}/CreateTruthTableSum.scala | 24 +- .../{ => worksum}/SyncHeadNamesSum.scala | 2 +- .../{ => worksum}/SyncInputPortNamesSum.scala | 2 +- .../SyncOutputPortNamesSum.scala | 2 +- .../TTandBDTandBDDSumConstruction.scala | 2 +- .../{ => worksum}/WriteSumBddOutput.scala | 31 +- .../{ => worksum}/WriteSumBdtOutput.scala | 29 +- .../{ => worksum}/WriteSumTtOutput.scala | 22 +- .../{ => worksync}/BddSyncIntegration.scala | 3 +- .../BdtAndBddSyncIntegration.scala | 2 +- .../{ => worksync}/BdtSyncIntegration.scala | 3 +- .../{ => worksync}/SyncHeadNamesSync.scala | 2 +- .../SyncInputPortNamesSync.scala | 2 +- .../SyncOutputPortNamesSync.scala | 2 +- .../TTandBDTandBDDSyncConstruction.scala | 4 +- .../{ => worksync}/WriteSyncBddOutput.scala | 15 +- .../{ => worksync}/WriteSyncBdtOutput.scala | 15 +- .../{ => worksync}/WriteSyncTtOutput.scala | 14 +- 93 files changed, 817 insertions(+), 2107 deletions(-) create mode 100644 solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java create mode 100644 solutions/RSync/src/main/java/ttc2019/metamodels/create/IntrinsicIDXMIResourceFactoryImpl.java create mode 100644 solutions/RSync/src/main/java/ttc2019/metamodels/create/LoadEObject.java delete mode 100644 solutions/RSync/src/main/scala/bdd/Assignment.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/AssignmentPortOutputPort.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/BDD.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/BDDPortsPort.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/BDDTreeTree.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/HelperPort.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/HelperTree.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/InputPort.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/Leaf.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/LeafAssignmentsAssignment.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/OutputPort.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/Port.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/Subtree.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/SubtreePortInputPort.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/SubtreeTreeForOneTree.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/SubtreeTreeForZeroTree.scala delete mode 100644 solutions/RSync/src/main/scala/bdd/Tree.scala delete mode 100644 solutions/RSync/src/main/scala/org/rosi_project/model_management/core/RSUMElementLists.scala delete mode 100644 solutions/RSync/src/main/scala/tt/Cell.scala delete mode 100644 solutions/RSync/src/main/scala/tt/CellPortPort.scala delete mode 100644 solutions/RSync/src/main/scala/tt/HelperPort.scala delete mode 100644 solutions/RSync/src/main/scala/tt/InputPort.scala delete mode 100644 solutions/RSync/src/main/scala/tt/LocatedElement.scala delete mode 100644 solutions/RSync/src/main/scala/tt/OutputPort.scala delete mode 100644 solutions/RSync/src/main/scala/tt/Port.scala delete mode 100644 solutions/RSync/src/main/scala/tt/Row.scala delete mode 100644 solutions/RSync/src/main/scala/tt/RowCellsCell.scala delete mode 100644 solutions/RSync/src/main/scala/tt/TruthTable.scala delete mode 100644 solutions/RSync/src/main/scala/tt/TruthTablePortsPort.scala delete mode 100644 solutions/RSync/src/main/scala/tt/TruthTableRowsRow.scala create mode 100644 solutions/RSync/src/main/scala/ttc2019/CreateTruthTableDirectSync.scala delete mode 100644 solutions/RSync/src/main/scala/ttc2019/ExampleCombiCase.scala delete mode 100644 solutions/RSync/src/main/scala/ttc2019/ExampleCombiCaseOO.scala delete mode 100644 solutions/RSync/src/main/scala/ttc2019/TTCEmfSaver.scala create mode 100644 solutions/RSync/src/main/scala/ttc2019/TTFactory.scala delete mode 100644 solutions/RSync/src/main/scala/ttc2019/WriteOutput.scala rename solutions/RSync/src/main/scala/ttc2019/{ => worksum}/BdtSumIntegration.scala (99%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksum}/CreateTruthTableSum.scala (57%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksum}/SyncHeadNamesSum.scala (98%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksum}/SyncInputPortNamesSum.scala (98%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksum}/SyncOutputPortNamesSum.scala (98%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksum}/TTandBDTandBDDSumConstruction.scala (99%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksum}/WriteSumBddOutput.scala (80%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksum}/WriteSumBdtOutput.scala (81%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksum}/WriteSumTtOutput.scala (79%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/BddSyncIntegration.scala (99%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/BdtAndBddSyncIntegration.scala (99%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/BdtSyncIntegration.scala (99%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/SyncHeadNamesSync.scala (98%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/SyncInputPortNamesSync.scala (98%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/SyncOutputPortNamesSync.scala (98%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/TTandBDTandBDDSyncConstruction.scala (99%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/WriteSyncBddOutput.scala (88%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/WriteSyncBdtOutput.scala (88%) rename solutions/RSync/src/main/scala/ttc2019/{ => worksync}/WriteSyncTtOutput.scala (86%) diff --git a/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java new file mode 100644 index 0000000..1fc5b8c --- /dev/null +++ b/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java @@ -0,0 +1,78 @@ +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) { + //mapping += (id -> new InputPort(name, Set.empty, null, null)) + ports.put(id, TTFactory.getInputPort(name)); + } + + public void createOutputPort(String name, EObject id) { + //mapping += (id -> new OutputPort(name, Set.empty, null, null)) + ports.put(id, TTFactory.getOutputPort(name)); + } + + public void createRow(EObject id) { + //mapping += (id -> new Row(Set.empty, null, null)) + rows.put(id, TTFactory.getRow()); + } + + public void createCell(Boolean value, EObject id) { + //mapping += (id -> new Cell(value, null, null, null)) + cells.put(id, TTFactory.getCell(value)); + } + + public void createTruthTableRowsRow(EObject tt, EObject row) { + //val t = mapping.get(tt).get.asInstanceOf[TruthTable] + //val r = mapping.get(row).get.asInstanceOf[Row] + Row r = rows.get(row); + truthttable.addRows(r); + r.setOwner(truthttable); + } + + public void createTruthTablePortsPort(EObject tt, EObject port) { + //val t = mapping.get(tt).get.asInstanceOf[TruthTable] + //val p = mapping.get(port).get.asInstanceOf[Port] + Port p = ports.get(port); + truthttable.addPorts(p); + p.setOwner(truthttable); + } + + public void createRowCellsCell(EObject row, EObject cell) { + //val c = mapping.get(cell).get.asInstanceOf[Cell] + //val r = mapping.get(row).get.asInstanceOf[Row] + Cell c = cells.get(cell); + Row r = rows.get(row); + c.setOwner(r); + r.addCells(c); + } + + public void createCellPortPort(EObject cell, EObject port) { + //val c = mapping.get(cell).get.asInstanceOf[Cell] + //val p = mapping.get(port).get.asInstanceOf[Port] + Cell c = cells.get(cell); + Port p = ports.get(port); + c.setPort(p); + p.addCells(c); + } +} diff --git a/solutions/RSync/src/main/java/ttc2019/metamodels/create/IntrinsicIDXMIResourceFactoryImpl.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/IntrinsicIDXMIResourceFactoryImpl.java new file mode 100644 index 0000000..4a3d14c --- /dev/null +++ b/solutions/RSync/src/main/java/ttc2019/metamodels/create/IntrinsicIDXMIResourceFactoryImpl.java @@ -0,0 +1,18 @@ +package ttc2019.metamodels.create; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; + +import java.util.HashMap; + +class IntrinsicIDXMIResourceFactoryImpl extends XMIResourceFactoryImpl { + @Override + public Resource createResource(URI uri) { + final XMIResourceImpl r = new XMIResourceImpl(uri); + r.setIntrinsicIDToEObjectMap(new HashMap<>()); + return r; + } +} + diff --git a/solutions/RSync/src/main/java/ttc2019/metamodels/create/LoadEObject.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/LoadEObject.java new file mode 100644 index 0000000..33690e0 --- /dev/null +++ b/solutions/RSync/src/main/java/ttc2019/metamodels/create/LoadEObject.java @@ -0,0 +1,95 @@ +package ttc2019.metamodels.create; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.xmi.XMIResource; +import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; +import org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl; + +import ttc2019.metamodels.tt.TTPackage; +import ttc2019.metamodels.tt.TruthTable; + +public class LoadEObject { + + public EObject loadSimple(String pathMeta, String pathInstance) throws IOException { + ResourceSet resourceSet = new ResourceSetImpl(); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); + + Resource ressourceMeta = resourceSet.getResource(URI.createFileURI(pathMeta), true); + EObject packageMeta = ressourceMeta.getContents().get(0); + + resourceSet.getPackageRegistry().put("https://www.transformation-tool-contest.eu/2019/tt", packageMeta); + Resource ressourceModel = resourceSet.getResource(URI.createURI(pathInstance), true); + + return ressourceModel.getContents().get(0); + } + + public EObject load(String pathMeta, String pathInstance) throws IOException { + ResourceSet resourceSet = new ResourceSetImpl(); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl()); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ttmodel", new IntrinsicIDXMIResourceFactoryImpl()); + //resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()); + + //resourceSet.getLoadOptions().put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true); + + Resource ressourceMeta = resourceSet.getResource(URI.createFileURI(pathMeta), true); + EObject packageMeta = ressourceMeta.getContents().get(0); + + resourceSet.getPackageRegistry().put("https://www.transformation-tool-contest.eu/2019/tt", packageMeta); + Resource ressourceModel = resourceSet.getResource(URI.createURI(pathInstance), true); + + Map<String, Object> loadOptions = new HashMap<>(); + loadOptions.put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true); + loadOptions.put(XMIResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl()); + loadOptions.put(XMIResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap<>()); + ressourceModel.load(loadOptions); + return ressourceModel.getContents().get(0); + } + + public TruthTable loadTT(String pathMeta, String pathInstance) throws IOException { + TTPackage.eINSTANCE.getName(); + ResourceSet rs = new ResourceSetImpl(); + //rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); + rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new IntrinsicIDXMIResourceFactoryImpl()); + rs.getLoadOptions().put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true); + Resource rTT = rs.getResource(URI.createFileURI(pathInstance), true); + Map<String, Object> loadOptions = new HashMap<>(); + loadOptions.put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true); + loadOptions.put(XMIResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl()); + loadOptions.put(XMIResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap<>()); + rTT.load(loadOptions); + + TruthTable tt = (TruthTable) rTT.getContents().get(0); + return tt; + + + /*ResourceSet resourceSet = new ResourceSetImpl(); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl()); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ttmodel", new IntrinsicIDXMIResourceFactoryImpl()); + //resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()); + + //resourceSet.getLoadOptions().put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true); + + Resource ressourceMeta = resourceSet.getResource(URI.createFileURI(pathMeta), true); + EObject packageMeta = ressourceMeta.getContents().get(0); + + resourceSet.getPackageRegistry().put("https://www.transformation-tool-contest.eu/2019/tt", packageMeta); + Resource ressourceModel = resourceSet.getResource(URI.createURI(pathInstance), true); + + Map<String, Object> loadOptions = new HashMap<>(); + loadOptions.put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true); + loadOptions.put(XMIResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl()); + loadOptions.put(XMIResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap<>()); + ressourceModel.load(loadOptions); + return (TruthTable)ressourceModel.getContents().get(0);*/ + } +} diff --git a/solutions/RSync/src/main/scala/bdd/Assignment.scala b/solutions/RSync/src/main/scala/bdd/Assignment.scala deleted file mode 100644 index 697ab47..0000000 --- a/solutions/RSync/src/main/scala/bdd/Assignment.scala +++ /dev/null @@ -1,24 +0,0 @@ -package bdd - -import org.rosi_project.model_management.core.PlayerSync - -class Assignment(protected var value: Boolean) extends PlayerSync { - - def getValue(): Boolean = { - value - } - - def setValue(v: Boolean): Unit = { - value = v - +this changeValue () - } - - override def toString(): String = { - "Assignment:" + " value=" + value - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/AssignmentPortOutputPort.scala b/solutions/RSync/src/main/scala/bdd/AssignmentPortOutputPort.scala deleted file mode 100644 index 0abb929..0000000 --- a/solutions/RSync/src/main/scala/bdd/AssignmentPortOutputPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package bdd - -import org.rosi_project.model_management.sum.compartments.IAssociation - -class AssignmentPortOutputPort(private val sInstance: Assignment, private val tInstance: OutputPort) extends IAssociation { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[AssignmentPortOutputPort " + source + ", " + target + "]" - } - - def getSourceIns(): Assignment = { - return sInstance - } - - def getTargetIns(): OutputPort = { - return tInstance - } - - class Source extends IAssociationSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends IAssociationTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/BDD.scala b/solutions/RSync/src/main/scala/bdd/BDD.scala deleted file mode 100644 index f9d45c9..0000000 --- a/solutions/RSync/src/main/scala/bdd/BDD.scala +++ /dev/null @@ -1,24 +0,0 @@ -package bdd - -import org.rosi_project.model_management.core.PlayerSync - -class BDD(protected var name: String) extends PlayerSync { - - def getName(): String = { - name - } - - def setName(n: String): Unit = { - name = n - +this changeName () - } - - override def toString(): String = { - "BDD:" + " name=" + name - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/BDDPortsPort.scala b/solutions/RSync/src/main/scala/bdd/BDDPortsPort.scala deleted file mode 100644 index 52f8db3..0000000 --- a/solutions/RSync/src/main/scala/bdd/BDDPortsPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package bdd - -import org.rosi_project.model_management.sum.compartments.IComposition - -class BDDPortsPort(private val sInstance: BDD, private val tInstance: Port) extends IComposition { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[BDDPortsPort " + source + ", " + target + "]" - } - - def getSourceIns(): BDD = { - return sInstance - } - - def getTargetIns(): Port = { - return tInstance - } - - class Source extends ICompositionSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends ICompositionTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/BDDTreeTree.scala b/solutions/RSync/src/main/scala/bdd/BDDTreeTree.scala deleted file mode 100644 index af3f901..0000000 --- a/solutions/RSync/src/main/scala/bdd/BDDTreeTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package bdd - -import org.rosi_project.model_management.sum.compartments.IComposition - -class BDDTreeTree(private val sInstance: BDD, private val tInstance: Tree) extends IComposition { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[BDDTreeTree " + source + ", " + target + "]" - } - - def getSourceIns(): BDD = { - return sInstance - } - - def getTargetIns(): Tree = { - return tInstance - } - - class Source extends ICompositionSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends ICompositionTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/HelperPort.scala b/solutions/RSync/src/main/scala/bdd/HelperPort.scala deleted file mode 100644 index 0337fa2..0000000 --- a/solutions/RSync/src/main/scala/bdd/HelperPort.scala +++ /dev/null @@ -1,19 +0,0 @@ -package bdd - -import org.rosi_project.model_management.sum.query.QueryHelper - -class HelperPort(p_Name: String) extends Port(p_Name) with QueryHelper { - - override def equals(that: Any): Boolean = { - that.isInstanceOf[Port] - } - - override def toString(): String = { - "HelperPort:" + " name=" + name - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/HelperTree.scala b/solutions/RSync/src/main/scala/bdd/HelperTree.scala deleted file mode 100644 index a124187..0000000 --- a/solutions/RSync/src/main/scala/bdd/HelperTree.scala +++ /dev/null @@ -1,19 +0,0 @@ -package bdd - -import org.rosi_project.model_management.sum.query.QueryHelper - -class HelperTree extends Tree() with QueryHelper { - - override def equals(that: Any): Boolean = { - that.isInstanceOf[Tree] - } - - override def toString(): String = { - "HelperTree:" - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/InputPort.scala b/solutions/RSync/src/main/scala/bdd/InputPort.scala deleted file mode 100644 index fc889b5..0000000 --- a/solutions/RSync/src/main/scala/bdd/InputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package bdd - -class InputPort(p_Name: String) extends Port(p_Name) { - - override def toString(): String = { - "InputPort:" + " name=" + name - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/Leaf.scala b/solutions/RSync/src/main/scala/bdd/Leaf.scala deleted file mode 100644 index 0a268dc..0000000 --- a/solutions/RSync/src/main/scala/bdd/Leaf.scala +++ /dev/null @@ -1,13 +0,0 @@ -package bdd - -class Leaf extends Tree() { - - override def toString(): String = { - "Leaf:" - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/LeafAssignmentsAssignment.scala b/solutions/RSync/src/main/scala/bdd/LeafAssignmentsAssignment.scala deleted file mode 100644 index d96005e..0000000 --- a/solutions/RSync/src/main/scala/bdd/LeafAssignmentsAssignment.scala +++ /dev/null @@ -1,46 +0,0 @@ -package bdd - -import org.rosi_project.model_management.sum.compartments.IComposition - -class LeafAssignmentsAssignment(private val sInstance: Leaf, private val tInstance: Assignment) extends IComposition { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[LeafAssignmentsAssignment " + source + ", " + target + "]" - } - - def getSourceIns(): Leaf = { - return sInstance - } - - def getTargetIns(): Assignment = { - return tInstance - } - - class Source extends ICompositionSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends ICompositionTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/OutputPort.scala b/solutions/RSync/src/main/scala/bdd/OutputPort.scala deleted file mode 100644 index 94294fe..0000000 --- a/solutions/RSync/src/main/scala/bdd/OutputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package bdd - -class OutputPort(p_Name: String) extends Port(p_Name) { - - override def toString(): String = { - "OutputPort:" + " name=" + name - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/Port.scala b/solutions/RSync/src/main/scala/bdd/Port.scala deleted file mode 100644 index 3492588..0000000 --- a/solutions/RSync/src/main/scala/bdd/Port.scala +++ /dev/null @@ -1,24 +0,0 @@ -package bdd - -import org.rosi_project.model_management.core.PlayerSync - -abstract class Port(protected var name: String) extends PlayerSync { - - def getName(): String = { - name - } - - def setName(n: String): Unit = { - name = n - +this changeName () - } - - override def toString(): String = { - "Port:" + " name=" + name - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/Subtree.scala b/solutions/RSync/src/main/scala/bdd/Subtree.scala deleted file mode 100644 index 76c46ee..0000000 --- a/solutions/RSync/src/main/scala/bdd/Subtree.scala +++ /dev/null @@ -1,13 +0,0 @@ -package bdd - -class Subtree extends Tree() { - - override def toString(): String = { - "Subtree:" - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/SubtreePortInputPort.scala b/solutions/RSync/src/main/scala/bdd/SubtreePortInputPort.scala deleted file mode 100644 index e2f3308..0000000 --- a/solutions/RSync/src/main/scala/bdd/SubtreePortInputPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package bdd - -import org.rosi_project.model_management.sum.compartments.IAssociation - -class SubtreePortInputPort(private val sInstance: Subtree, private val tInstance: InputPort) extends IAssociation { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[SubtreePortInputPort " + source + ", " + target + "]" - } - - def getSourceIns(): Subtree = { - return sInstance - } - - def getTargetIns(): InputPort = { - return tInstance - } - - class Source extends IAssociationSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends IAssociationTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/SubtreeTreeForOneTree.scala b/solutions/RSync/src/main/scala/bdd/SubtreeTreeForOneTree.scala deleted file mode 100644 index 208114b..0000000 --- a/solutions/RSync/src/main/scala/bdd/SubtreeTreeForOneTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package bdd - -import org.rosi_project.model_management.sum.compartments.IComposition - -class SubtreeTreeForOneTree(private val sInstance: Subtree, private val tInstance: Tree) extends IComposition { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[SubtreeTreeForOneTree " + source + ", " + target + "]" - } - - def getSourceIns(): Subtree = { - return sInstance - } - - def getTargetIns(): Tree = { - return tInstance - } - - class Source extends ICompositionSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends ICompositionTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/SubtreeTreeForZeroTree.scala b/solutions/RSync/src/main/scala/bdd/SubtreeTreeForZeroTree.scala deleted file mode 100644 index 9b83aed..0000000 --- a/solutions/RSync/src/main/scala/bdd/SubtreeTreeForZeroTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package bdd - -import org.rosi_project.model_management.sum.compartments.IComposition - -class SubtreeTreeForZeroTree(private val sInstance: Subtree, private val tInstance: Tree) extends IComposition { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[SubtreeTreeForZeroTree " + source + ", " + target + "]" - } - - def getSourceIns(): Subtree = { - return sInstance - } - - def getTargetIns(): Tree = { - return tInstance - } - - class Source extends ICompositionSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends ICompositionTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/bdd/Tree.scala b/solutions/RSync/src/main/scala/bdd/Tree.scala deleted file mode 100644 index a21f594..0000000 --- a/solutions/RSync/src/main/scala/bdd/Tree.scala +++ /dev/null @@ -1,15 +0,0 @@ -package bdd - -import org.rosi_project.model_management.core.PlayerSync - -abstract class Tree extends PlayerSync { - - override def toString(): String = { - "Tree:" - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/ModelElementLists.scala b/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/ModelElementLists.scala index 6191714..790b4f1 100644 --- a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/ModelElementLists.scala +++ b/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/ModelElementLists.scala @@ -7,7 +7,7 @@ package org.rosi_project.model_management.core */ object ModelElementLists { - var elements: Map[Class[_ <: AnyRef], List[_ <: AnyRef]] = Map() + var elements: Map[Class[_ <: AnyRef], Set[AnyRef]] = Map() var model2Class: Map[String, Class[_ <: AnyRef]] = Map() /** @@ -22,15 +22,13 @@ object ModelElementLists { return } - var elementsWithClass: List[AnyRef] = elements getOrElse (obj.getClass, List()) - - if (elementsWithClass.contains(obj)) { - return + var elementsWithClass = elements.get(obj.getClass) + + if (elementsWithClass.isEmpty) { + elements += (obj.getClass -> Set(obj)) + } else { + elements += (obj.getClass -> (elementsWithClass.get ++ Set(obj))) } - - elementsWithClass = obj :: elementsWithClass - - elements += (obj.getClass -> elementsWithClass) } /** @@ -40,15 +38,15 @@ object ModelElementLists { * @return all matching instances. If none were found or the class is not yet part of the * repository, an empty list will be returned */ - def getElementsWithClass(clazz: Class[_ <: AnyRef], excludeSubclasses: Boolean = false): List[AnyRef] = { - var matchingElems: List[AnyRef] = elements.getOrElse(clazz, List()) + def getElementsWithClass(clazz: Class[_ <: AnyRef], excludeSubclasses: Boolean = false): Set[AnyRef] = { + var matchingElems: Set[AnyRef] = elements.getOrElse(clazz, Set()) - if (!excludeSubclasses) { + /*if (!excludeSubclasses) { matchingElems ++= elements .filter(elem => elem._1 != clazz && clazz.isAssignableFrom(elem._1)) .values .fold(List[AnyRef]())((l1, l2) => l1 ++ l2) - } + }*/ matchingElems } @@ -60,12 +58,12 @@ object ModelElementLists { * @return if the model was found, all its instances will be wrapped in an [[Option]], otherwise * [[None]] will be returned */ - def getElementsForModel(name: String): Option[List[AnyRef]] = { + def getElementsForModel(name: String): Option[Set[AnyRef]] = { if (!model2Class.contains(name)) { None } else { - Some(elements.getOrElse(model2Class(name), List())) + Some(elements.getOrElse(model2Class(name), Set())) } } @@ -97,7 +95,7 @@ object ModelElementLists { for (model <- model2Class) { println(s"Model: ${model._1}:") - elements.getOrElse(model._2, List()).foreach(e => println(s"++ $e")) + elements.getOrElse(model._2, Set()).foreach(e => println(s"++ $e")) } @@ -105,41 +103,41 @@ object ModelElementLists { if (clazz.toString().contains(s)) { println(s"Model: $clazz:") - elements.getOrElse(clazz, List()).foreach(e => println(s"** $e")) + elements.getOrElse(clazz, Set()).foreach(e => println(s"** $e")) } } } - def getElementsFromType(s: String): List[AnyRef] = { + def getElementsFromType(s: String): Set[AnyRef] = { for { clazz <- elements.keys if !model2Class.exists(t => t._2 == clazz) } { if (clazz.toString().contains(s)) { - return elements.getOrElse(clazz, List()) + return elements.getOrElse(clazz, Set()) } } - return List() + return Set() } - def getDirectElementsFromType(s: String): List[AnyRef] = { + def getDirectElementsFromType(s: String): Set[AnyRef] = { for { clazz <- elements.keys if !model2Class.exists(t => t._2 == clazz) } { if (clazz.getName == s) { - return elements.getOrElse(clazz, List()) + return elements.getOrElse(clazz, Set()) } } - return List() + return Set() } def printAll(): Unit = { for (model <- model2Class) { println(s"Model: ${model._1}:") - elements.getOrElse(model._2, List()).foreach(e => println(s"++ $e")) + elements.getOrElse(model._2, Set()).foreach(e => println(s"++ $e")) } for { clazz <- elements.keys if !model2Class.exists(t => t._2 == clazz) } { println(s"Model: $clazz:") - elements.getOrElse(clazz, List()).foreach(e => println(s"** $e")) + elements.getOrElse(clazz, Set()).foreach(e => println(s"** $e")) } } diff --git a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/PlayerSync.scala b/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/PlayerSync.scala index ae9e00b..8c1f203 100644 --- a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/PlayerSync.scala +++ b/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/PlayerSync.scala @@ -13,15 +13,18 @@ trait PlayerSync extends MultiCompartment { def buildClass(): Unit = { //println("Create New Class") if (!SynchronizationCompartment.isUnderConstruction()) { - this play SynchronizationCompartment.createRoleManager() SynchronizationCompartment combine this - +this manage this + val mani = SynchronizationCompartment.createRoleManager() + this play mani + mani.manage(this) + //this play SynchronizationCompartment.createRoleManager() + //+this manage this } } def deleteObjectFromSynchro(): Unit = { println("Delete Object") - +this deleteRoleFunction() + +this deleteManage this deleted = true } } diff --git a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/RSUMElementLists.scala b/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/RSUMElementLists.scala deleted file mode 100644 index 64d62e0..0000000 --- a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/RSUMElementLists.scala +++ /dev/null @@ -1,106 +0,0 @@ -package org.rosi_project.model_management.core - -/** Provides convenient access to all instances of the synchronized models. - * - * New models may be registered by name to simplify retrieving their instances. - */ -object RSUMElementLists { - - var elements: Map[Class[_ <: AnyRef], List[_ <: AnyRef]] = Map() - var model2Class: Map[String, Class[_ <: AnyRef]] = Map() - - /** Inserts a new instance. - * - * The appropriate model will be inferred automatically - * - * @param obj the instance. May never be `null` - */ - def addElement(obj: Object): Unit = { - if (obj == null) { - return - } - - var elementsWithClass: List[AnyRef] = elements getOrElse (obj.getClass, List()) - - if (elementsWithClass.contains(obj)) { - return - } - - elementsWithClass = obj :: elementsWithClass - - elements += (obj.getClass -> elementsWithClass) - } - - /** Queries for all instances of the given class. - * - * @param clazz the class - * @return all matching instances. If none were found or the class is not yet part of the - * repository, an empty list will be returned - */ - def getElementsWithClass(clazz: Class[_ <: AnyRef], excludeSubclasses: Boolean = false): List[AnyRef] = { - var matchingElems: List[AnyRef] = elements.getOrElse(clazz, List()) - - if (!excludeSubclasses) { - matchingElems ++= elements - .filter(elem => elem._1 != clazz && clazz.isAssignableFrom(elem._1)) - .values - .fold(List[AnyRef]())((l1, l2) => l1 ++ l2) - } - - matchingElems - } - - /** Queries for all instances of a given model - * - * @param name the name of the model - * @return if the model was found, all its instances will be wrapped in an [[Option]], otherwise - * [[None]] will be returned - */ - def getElementsForModel(name: String): Option[List[AnyRef]] = { - - if (!model2Class.contains(name)) { - None - } else { - Some(elements.getOrElse(model2Class(name), List())) - } - - } - - def removeElement(obj: AnyRef): Unit = { - for {elementsWithClass <- elements.get(obj.getClass)} { - val filtered = elementsWithClass.filter(_ != obj) - - elements += (obj.getClass -> filtered) - } - } - - - /** Informs the repository about what objects belong to which model - * - * @param name the model's name - * @param elemsType the class of the corresponding instances - * @throws IllegalArgumentException if the name is already in use - */ - def registerModel(name: String, elemsType: Class[_ <: AnyRef]): Unit = { - if (model2Class.contains(name)) { - throw new IllegalArgumentException(s"Model is already present: $name") - } - - model2Class += (name -> elemsType) - } - - def printAll(): Unit = { - for (model <- model2Class) { - println(s"Model: ${model._1}:") - - elements.getOrElse(model._2, List()).foreach(e => println(s"** $e")) - - } - - for { clazz <- elements.keys if !model2Class.exists(t => t._2 == clazz) } { - println(s"Model: $clazz:") - - elements.getOrElse(clazz, List()).foreach(e => println(s"** $e")) - } - } -} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/RsumCompartment.scala b/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/RsumCompartment.scala index a8f1608..b083579 100644 --- a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/RsumCompartment.scala +++ b/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/RsumCompartment.scala @@ -208,7 +208,7 @@ object RsumCompartment extends MultiCompartment { if (incommingPlayer == null) return - RSUMElementLists.addElement(incommingPlayer) + ModelElementLists.addElement(incommingPlayer) incommingPlayer match { case r: IRelationCompartment => @@ -236,7 +236,7 @@ object RsumCompartment extends MultiCompartment { def deleteEverything(): Unit = { val playerObj = this.player.right.get - RSUMElementLists.removeElement(playerObj) + ModelElementLists.removeElement(playerObj) val roles = playerObj.roles() //iterate over all roles and call remove methods diff --git a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/SynchronizationCompartment.scala b/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/SynchronizationCompartment.scala index 6ee534f..f5df559 100644 --- a/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/SynchronizationCompartment.scala +++ b/solutions/RSync/src/main/scala/org/rosi_project/model_management/core/SynchronizationCompartment.scala @@ -25,7 +25,6 @@ object SynchronizationCompartment extends ISynchronizationCompartment { changeConstructionRule(SuppressingConstructionCompartment) changeDestructionRule(GeneralDestructor) - activateExtensionCompartment(ModelElementsListGCExtension) def getConstructionRule(): IConstructionCompartment = activeConstructionCompartment @@ -419,13 +418,16 @@ object SynchronizationCompartment extends ISynchronizationCompartment { println("-- Ma => Pl: " + m + " | " + m.player.right.get) }) } + + def deleteManage(value: PlayerSync): Unit = { + val delete = activeDestructionCompartment.getDestructorForClassName(value) + if (delete != null) { + this play delete + +this deleteRoleFunction() + } + } def manage(value: PlayerSync): Unit = { - /*println("=== Create Related Roles from the object " + this.player + " " + (+this)) - //combine now in registration of the models - SynchronizationCompartment.this combine constructionCompartment - SynchronizationCompartment.this combine destructionCompartment*/ - val construct = activeConstructionCompartment.getConstructorForClassName(value) if (construct != null) { this play construct diff --git a/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/IConstructionCompartment.scala b/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/IConstructionCompartment.scala index 24c48f3..9c51ea7 100644 --- a/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/IConstructionCompartment.scala +++ b/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/IConstructionCompartment.scala @@ -42,22 +42,6 @@ trait IConstructionCompartment extends Compartment { } } - /*private def addNotificationRoles(containers: ListBuffer[ConstructionContainer]): Unit = { - containers.foreach { cc => - if (cc.isConstructed) { - // add the notification role for the sync UI - val clazz = cc.getPlayerInstance.getClass - ModelRegistry.getModelForInstanceClass(clazz) match { - case Some(model) => - //val notifier = SyncUpdateNotifier(model) - cc.getManagerInstance play SyncUpdateNotifier(model) - case None => - println(s"No model found: $clazz") - } - } - } - }*/ - /** * Add the RoleManager roles from the synchronization compartment if necessary */ @@ -96,8 +80,9 @@ trait IConstructionCompartment extends Compartment { */ protected def synchronizeCompartments(containers: ListBuffer[ConstructionContainer]): Unit = { containers.foreach { cc => - if (cc.isConstructed() && !cc.isStartElement()) + if (cc.isConstructed() && !cc.isStartElement()) { SynchronizationCompartment combine cc.getPlayerInstance + } } } @@ -133,15 +118,39 @@ trait IConstructionCompartment extends Compartment { } protected def makeCompleteConstructionProcess(containers: ListBuffer[ConstructionContainer]): Unit = { - this.addManagerRoles(containers) - //this.addNotificationRoles(containers) - this.addDeleteRoles(containers) - this.addRelatedRoleManager(containers) + //first synchronize new compartments + //var t1 = System.nanoTime() this.synchronizeCompartments(containers) + //var t2 = System.nanoTime() + + //add role manager and relations + this.addManagerRoles(containers) + //var t3 = System.nanoTime() + this.addRelatedRoleManager(containers) + //var t4 = System.nanoTime() + + //binding of roles + //this.addDeleteRoles(containers) this.bindSynchronizationRules(containers) + //var t5 = System.nanoTime() this.addExtensionRoles(containers) + //var t6 = System.nanoTime() + + //notify extensions this.notifyExtensionRoles(containers) + //var t7 = System.nanoTime() + + //fill test list this.fillTestLists(containers) + /*var t8 = System.nanoTime() + println("1: " + (t2 - t1)) + println("2: " + (t3 - t2)) + println("3: " + (t4 - t3)) + println("4: " + (t5 - t4)) + println("5: " + (t6 - t5)) + println("6: " + (t7 - t6)) + println("7: " + (t8 - t7))*/ + /*println("Construction ++++++++++++++++++++++++++++++++++++++++++++------------------------++++++++++++++++++++++++++++++++++++++++++++++++++++") containers.foreach { cc => println((cc.getPlayerInstance).roles()) diff --git a/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/compartments/GeneralDestructor.scala b/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/compartments/GeneralDestructor.scala index 99aaac6..68e051a 100644 --- a/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/compartments/GeneralDestructor.scala +++ b/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/compartments/GeneralDestructor.scala @@ -5,6 +5,7 @@ import org.rosi_project.model_management.sync.IDestructionCompartment import org.rosi_project.model_management.sync.roles.{ IDestructor, IRoleManager } import scala.collection.mutable.ListBuffer +import org.rosi_project.model_management.core.ModelElementLists /** * Calls the destruction method from all related RoleManagers and then deletes all roles from this player. @@ -18,7 +19,7 @@ object GeneralDestructor extends IDestructionCompartment { class DeleteRole() extends IDestructor { def deleteRoleFunction(): Unit = { - println("##Delete roles and related from Player: " + this.player) + //println("##Delete roles and related from Player: " + this.player) var relatedManagers: Set[IRoleManager] = (+this).getRelatedManager() (+this).clearListsOfRelatedManager() @@ -35,6 +36,7 @@ object GeneralDestructor extends IDestructionCompartment { val player = this.player if (player.isRight) { val test: PlayerSync = player.right.get.asInstanceOf[PlayerSync] + ModelElementLists.removeElement(test) val roles = test.roles() roles.foreach { r => r.remove() diff --git a/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/roles/IRoleManager.scala b/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/roles/IRoleManager.scala index 7c6a165..eb17374 100644 --- a/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/roles/IRoleManager.scala +++ b/solutions/RSync/src/main/scala/org/rosi_project/model_management/sync/roles/IRoleManager.scala @@ -73,6 +73,11 @@ trait IRoleManager { */ def manage(value: PlayerSync): Unit + /** + * Function to manage the deletion. + */ + def deleteManage(value: PlayerSync): Unit + /** * Get related PlayerSync with the specific name. */ diff --git a/solutions/RSync/src/main/scala/sync/bdd/Assignment.scala b/solutions/RSync/src/main/scala/sync/bdd/Assignment.scala index 36004c7..26c55d6 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/Assignment.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/Assignment.scala @@ -10,7 +10,7 @@ class Assignment(protected var value: Boolean, protected var owner: Leaf, protec def setValue(v: Boolean): Unit = { value = v - +this changeValue () + +this setValue () } def getOwner(): Leaf = { @@ -19,7 +19,7 @@ class Assignment(protected var value: Boolean, protected var owner: Leaf, protec def setOwner(o: Leaf): Unit = { owner = o - +this changeOwner () + +this setOwner () } def getPort(): OutputPort = { @@ -28,11 +28,11 @@ class Assignment(protected var value: Boolean, protected var owner: Leaf, protec def setPort(p: OutputPort): Unit = { port = p - +this changePort () + +this setPort () } override def toString(): String = { - "Assignment:" + " value=" + value + " out=" + port + "Assignment:" + " value=" + value } } diff --git a/solutions/RSync/src/main/scala/sync/bdd/BDD.scala b/solutions/RSync/src/main/scala/sync/bdd/BDD.scala index 502ab83..d95f461 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/BDD.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/BDD.scala @@ -10,7 +10,7 @@ class BDD(protected var name: String, protected var tree: Tree, protected var po def setName(n: String): Unit = { name = n - +this changeName () + +this setName () } def getTree(): Tree = { @@ -19,25 +19,25 @@ class BDD(protected var name: String, protected var tree: Tree, protected var po def setTree(t: Tree): Unit = { tree = t - +this changeTree () + +this setTree () } def getPorts(): Set[Port] = { ports } - def setPorts(p: Set[Port]): Unit = { - ports = p - +this changePorts () - } - def addPorts(p: Port): Unit = { ports += p - +this changePorts () + +this addPorts () + } + + def removePorts(p: Port): Unit = { + ports -= p + +this removePorts () } override def toString(): String = { - "BDD:" + " name=" + name + " ports=" + ports + " tree=\n" + tree + "BDD:" + " name=" + name } } diff --git a/solutions/RSync/src/main/scala/sync/bdd/InputPort.scala b/solutions/RSync/src/main/scala/sync/bdd/InputPort.scala index 5fe6a5f..eb25fb9 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/InputPort.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/InputPort.scala @@ -6,14 +6,14 @@ class InputPort(protected var subtrees: Set[Subtree], p_Name: String, p_Owner: B subtrees } - def setSubtrees(s: Set[Subtree]): Unit = { - subtrees = s - +this changeSubtrees () - } - def addSubtrees(s: Subtree): Unit = { subtrees += s - +this changeSubtrees () + +this addSubtrees () + } + + def removeSubtrees(s: Subtree): Unit = { + subtrees -= s + +this removeSubtrees () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bdd/Leaf.scala b/solutions/RSync/src/main/scala/sync/bdd/Leaf.scala index 987052d..83a8dc3 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/Leaf.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/Leaf.scala @@ -6,19 +6,25 @@ class Leaf(protected var assignments: Set[Assignment], t_OwnerSubtreeForOne: Sub assignments } - def setAssignments(a: Set[Assignment]): Unit = { - assignments = a - +this changeAssignments () - } - def addAssignments(a: Assignment): Unit = { assignments += a - +this changeAssignments () + +this addAssignments () + } + + def removeAssignments(a: Assignment): Unit = { + assignments -= a + +this removeAssignments () } override def toString(): String = { - this.getStringDeep() + "Leaf:" + " assignments=" + assignments + "Leaf:" } + + def getAvgPath(): Double = 0.0 + + def getMinPath(): Int = 0 + + def getMaxPath(): Int = 0 } diff --git a/solutions/RSync/src/main/scala/sync/bdd/OutputPort.scala b/solutions/RSync/src/main/scala/sync/bdd/OutputPort.scala index d3a0241..3c20131 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/OutputPort.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/OutputPort.scala @@ -6,14 +6,14 @@ class OutputPort(protected var assignments: Set[Assignment], p_Name: String, p_O assignments } - def setAssignments(a: Set[Assignment]): Unit = { - assignments = a - +this changeAssignments () - } - def addAssignments(a: Assignment): Unit = { assignments += a - +this changeAssignments () + +this addAssignments () + } + + def removeAssignments(a: Assignment): Unit = { + assignments -= a + +this removeAssignments () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bdd/Port.scala b/solutions/RSync/src/main/scala/sync/bdd/Port.scala index 75ae112..0d1e395 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/Port.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/Port.scala @@ -10,7 +10,7 @@ abstract class Port(protected var name: String, protected var owner: BDD) extend def setName(n: String): Unit = { name = n - +this changeName () + +this setName () } def getOwner(): BDD = { @@ -19,7 +19,7 @@ abstract class Port(protected var name: String, protected var owner: BDD) extend def setOwner(o: BDD): Unit = { owner = o - +this changeOwner () + +this setOwner () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bdd/Subtree.scala b/solutions/RSync/src/main/scala/sync/bdd/Subtree.scala index 1e42f32..83e197d 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/Subtree.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/Subtree.scala @@ -8,7 +8,7 @@ class Subtree(protected var treeForOne: Tree, protected var treeForZero: Tree, p def setTreeForOne(t: Tree): Unit = { treeForOne = t - +this changeTreeForOne () + +this setTreeForOne () } def getTreeForZero(): Tree = { @@ -17,7 +17,7 @@ class Subtree(protected var treeForOne: Tree, protected var treeForZero: Tree, p def setTreeForZero(t: Tree): Unit = { treeForZero = t - +this changeTreeForZero () + +this setTreeForZero () } def getPort(): InputPort = { @@ -26,11 +26,33 @@ class Subtree(protected var treeForOne: Tree, protected var treeForZero: Tree, p def setPort(p: InputPort): Unit = { port = p - +this changePort () + +this setPort () } override def toString(): String = { - this.getStringDeep() + "Subtree: " + port + " \n 0" + treeForZero + "\n 1" + treeForOne + "Subtree:" + } + + def getAvgPath(): Double = { + return 0.5 * treeForOne.getAvgPath() + 0.5 * treeForZero.getAvgPath() + 1 + } + + def getMinPath(): Int = { + val minZero = treeForZero.getMinPath() + val minOne = treeForOne.getMinPath() + if (minZero < minOne) { + return minZero + 1 + } + return minOne + 1 + } + + def getMaxPath(): Int = { + val maxZero = treeForZero.getMaxPath() + val maxOne = treeForOne.getMaxPath() + if (maxZero > maxOne) { + return maxZero + 1 + } + return maxOne + 1 } } diff --git a/solutions/RSync/src/main/scala/sync/bdd/Tree.scala b/solutions/RSync/src/main/scala/sync/bdd/Tree.scala index ee486da..a1d2576 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/Tree.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/Tree.scala @@ -10,7 +10,7 @@ abstract class Tree(protected var ownerSubtreeForOne: Subtree, protected var own def setOwnerSubtreeForOne(o: Subtree): Unit = { ownerSubtreeForOne = o - +this changeOwnerSubtreeForOne () + +this setOwnerSubtreeForOne () } def getOwnerSubtreeForZero(): Subtree = { @@ -19,7 +19,7 @@ abstract class Tree(protected var ownerSubtreeForOne: Subtree, protected var own def setOwnerSubtreeForZero(o: Subtree): Unit = { ownerSubtreeForZero = o - +this changeOwnerSubtreeForZero () + +this setOwnerSubtreeForZero () } def getOwnerBDD(): BDD = { @@ -28,30 +28,18 @@ abstract class Tree(protected var ownerSubtreeForOne: Subtree, protected var own def setOwnerBDD(o: BDD): Unit = { ownerBDD = o - +this changeOwnerBDD () - } - - def getStringDeep(): String = { - var result = "" - for(i <- 0 to this.getMinDeep()) { - result = result + "\t" - } - result - } - - def getMinDeep(): Int = { - if (ownerSubtreeForOne != null) { - return 1 + ownerSubtreeForOne.getMinDeep() - } - if (ownerSubtreeForZero != null) { - return 1 + ownerSubtreeForZero.getMinDeep() - } - 0 + +this setOwnerBDD () } override def toString(): String = { "Tree:" } + + def getAvgPath(): Double + + def getMinPath(): Int + + def getMaxPath(): Int } diff --git a/solutions/RSync/src/main/scala/sync/bddg/Assignment.scala b/solutions/RSync/src/main/scala/sync/bddg/Assignment.scala index 798945d..2a601fb 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/Assignment.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/Assignment.scala @@ -10,7 +10,7 @@ class Assignment(protected var value: Boolean, protected var owner: Leaf, protec def setValue(v: Boolean): Unit = { value = v - +this changeValue () + +this setValue () } def getOwner(): Leaf = { @@ -19,7 +19,7 @@ class Assignment(protected var value: Boolean, protected var owner: Leaf, protec def setOwner(o: Leaf): Unit = { owner = o - +this changeOwner () + +this setOwner () } def getPort(): OutputPort = { @@ -28,7 +28,7 @@ class Assignment(protected var value: Boolean, protected var owner: Leaf, protec def setPort(p: OutputPort): Unit = { port = p - +this changePort () + +this setPort () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bddg/BDD.scala b/solutions/RSync/src/main/scala/sync/bddg/BDD.scala index 597e249..fe5faa5 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/BDD.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/BDD.scala @@ -10,21 +10,21 @@ class BDD(protected var name: String, protected var trees: Set[Tree], protected def setName(n: String): Unit = { name = n - +this changeName () + +this setName () } def getTrees(): Set[Tree] = { trees } - def setTrees(t: Set[Tree]): Unit = { - trees = t - +this changeTrees () - } - def addTrees(t: Tree): Unit = { trees += t - +this changeTrees () + +this addTrees () + } + + def removeTrees(t: Tree): Unit = { + trees -= t + +this removeTrees () } def getRoot(): Tree = { @@ -33,21 +33,21 @@ class BDD(protected var name: String, protected var trees: Set[Tree], protected def setRoot(r: Tree): Unit = { root = r - +this changeRoot () + +this setRoot () } def getPorts(): Set[Port] = { ports } - def setPorts(p: Set[Port]): Unit = { - ports = p - +this changePorts () - } - def addPorts(p: Port): Unit = { ports += p - +this changePorts () + +this addPorts () + } + + def removePorts(p: Port): Unit = { + ports -= p + +this removePorts () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bddg/InputPort.scala b/solutions/RSync/src/main/scala/sync/bddg/InputPort.scala index 0991068..8ed8b91 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/InputPort.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/InputPort.scala @@ -6,14 +6,14 @@ class InputPort(protected var subtrees: Set[Subtree], p_Name: String, p_Owner: B subtrees } - def setSubtrees(s: Set[Subtree]): Unit = { - subtrees = s - +this changeSubtrees () - } - def addSubtrees(s: Subtree): Unit = { subtrees += s - +this changeSubtrees () + +this addSubtrees () + } + + def removeSubtrees(s: Subtree): Unit = { + subtrees -= s + +this removeSubtrees () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bddg/Leaf.scala b/solutions/RSync/src/main/scala/sync/bddg/Leaf.scala index 3171eeb..570ea43 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/Leaf.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/Leaf.scala @@ -6,19 +6,25 @@ class Leaf(protected var assignments: Set[Assignment], t_OwnerSubtreeForOne: Set assignments } - def setAssignments(a: Set[Assignment]): Unit = { - assignments = a - +this changeAssignments () - } - def addAssignments(a: Assignment): Unit = { assignments += a - +this changeAssignments () + +this addAssignments () + } + + def removeAssignments(a: Assignment): Unit = { + assignments -= a + +this removeAssignments () } override def toString(): String = { "Leaf:" } + + def getAvgPath(): Double = 0.0 + + def getMinPath(): Int = 0 + + def getMaxPath(): Int = 0 } diff --git a/solutions/RSync/src/main/scala/sync/bddg/OutputPort.scala b/solutions/RSync/src/main/scala/sync/bddg/OutputPort.scala index 57e9f4c..80a71d1 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/OutputPort.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/OutputPort.scala @@ -6,14 +6,14 @@ class OutputPort(protected var assignments: Set[Assignment], p_Name: String, p_O assignments } - def setAssignments(a: Set[Assignment]): Unit = { - assignments = a - +this changeAssignments () - } - def addAssignments(a: Assignment): Unit = { assignments += a - +this changeAssignments () + +this addAssignments () + } + + def removeAssignments(a: Assignment): Unit = { + assignments -= a + +this removeAssignments () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bddg/Port.scala b/solutions/RSync/src/main/scala/sync/bddg/Port.scala index 3fb2277..a2cf2db 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/Port.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/Port.scala @@ -10,7 +10,7 @@ abstract class Port(protected var name: String, protected var owner: BDD) extend def setName(n: String): Unit = { name = n - +this changeName () + +this setName () } def getOwner(): BDD = { @@ -19,7 +19,7 @@ abstract class Port(protected var name: String, protected var owner: BDD) extend def setOwner(o: BDD): Unit = { owner = o - +this changeOwner () + +this setOwner () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bddg/Subtree.scala b/solutions/RSync/src/main/scala/sync/bddg/Subtree.scala index 434503b..d8822ba 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/Subtree.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/Subtree.scala @@ -8,7 +8,7 @@ class Subtree(protected var treeForOne: Tree, protected var treeForZero: Tree, p def setTreeForOne(t: Tree): Unit = { treeForOne = t - +this changeTreeForOne () + +this setTreeForOne () } def getTreeForZero(): Tree = { @@ -17,7 +17,7 @@ class Subtree(protected var treeForOne: Tree, protected var treeForZero: Tree, p def setTreeForZero(t: Tree): Unit = { treeForZero = t - +this changeTreeForZero () + +this setTreeForZero () } def getPort(): InputPort = { @@ -26,12 +26,34 @@ class Subtree(protected var treeForOne: Tree, protected var treeForZero: Tree, p def setPort(p: InputPort): Unit = { port = p - +this changePort () + +this setPort () } override def toString(): String = { "Subtree:" } + + def getAvgPath(): Double = { + return 0.5 * treeForOne.getAvgPath() + 0.5 * treeForZero.getAvgPath() + 1 + } + + def getMinPath(): Int = { + val minZero = treeForZero.getMinPath() + val minOne = treeForOne.getMinPath() + if (minZero < minOne) { + return minZero + 1 + } + return minOne + 1 + } + + def getMaxPath(): Int = { + val maxZero = treeForZero.getMaxPath() + val maxOne = treeForOne.getMaxPath() + if (maxZero > maxOne) { + return maxZero + 1 + } + return maxOne + 1 + } } diff --git a/solutions/RSync/src/main/scala/sync/bddg/Tree.scala b/solutions/RSync/src/main/scala/sync/bddg/Tree.scala index 7b4ac48..cf5f037 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/Tree.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/Tree.scala @@ -8,28 +8,28 @@ abstract class Tree(protected var ownerSubtreeForOne: Set[Subtree], protected va ownerSubtreeForOne } - def setOwnerSubtreeForOne(o: Set[Subtree]): Unit = { - ownerSubtreeForOne = o - +this changeOwnerSubtreeForOne () - } - def addOwnerSubtreeForOne(o: Subtree): Unit = { ownerSubtreeForOne += o - +this changeOwnerSubtreeForOne () + +this addOwnerSubtreeForOne () } - def getOwnerSubtreeForZero(): Set[Subtree] = { - ownerSubtreeForZero + def removeOwnerSubtreeForOne(o: Subtree): Unit = { + ownerSubtreeForOne -= o + +this removeOwnerSubtreeForOne () } - def setOwnerSubtreeForZero(o: Set[Subtree]): Unit = { - ownerSubtreeForZero = o - +this changeOwnerSubtreeForZero () + def getOwnerSubtreeForZero(): Set[Subtree] = { + ownerSubtreeForZero } def addOwnerSubtreeForZero(o: Subtree): Unit = { ownerSubtreeForZero += o - +this changeOwnerSubtreeForZero () + +this addOwnerSubtreeForZero () + } + + def removeOwnerSubtreeForZero(o: Subtree): Unit = { + ownerSubtreeForZero -= o + +this removeOwnerSubtreeForZero () } def getOwnerBDD(): BDD = { @@ -38,44 +38,18 @@ abstract class Tree(protected var ownerSubtreeForOne: Set[Subtree], protected va def setOwnerBDD(o: BDD): Unit = { ownerBDD = o - +this changeOwnerBDD () - } - - def getMinDeep(): Int = { - var minDepth = -1 - var depth = 0 - ownerSubtreeForOne.foreach(s => { - depth = s.getMinDeep() - if (1 + depth < minDepth || minDepth == -1) { - minDepth = 1 + depth - } - }) - ownerSubtreeForZero.foreach(s => { - depth = s.getMinDeep() - if (1 + depth < minDepth || minDepth == -1) { - minDepth = 1 + depth - } - }) - if (minDepth == -1) { - minDepth = 0 - } - minDepth - } - - def getSumDeep(): Int = { - var sumDepth = 0 - ownerSubtreeForOne.foreach(s => { - sumDepth += s.getMinDeep() + 1 - }) - ownerSubtreeForZero.foreach(s => { - sumDepth += s.getMinDeep() + 1 - }) - sumDepth + +this setOwnerBDD () } override def toString(): String = { "Tree:" } + + def getAvgPath(): Double + + def getMinPath(): Int + + def getMaxPath(): Int } diff --git a/solutions/RSync/src/main/scala/sync/tt/Cell.scala b/solutions/RSync/src/main/scala/sync/tt/Cell.scala index b1e035c..6e07c8b 100644 --- a/solutions/RSync/src/main/scala/sync/tt/Cell.scala +++ b/solutions/RSync/src/main/scala/sync/tt/Cell.scala @@ -1,6 +1,6 @@ package sync.tt -class Cell(protected var value: Boolean, protected var port: Port, protected var owner: Row, l_Location: String) extends LocatedElement(l_Location) { +class Cell(protected var value: Boolean, protected var port: Port = null, protected var owner: Row = null, l_Location: String = null) extends LocatedElement(l_Location) { def getValue(): Boolean = { value @@ -8,7 +8,7 @@ class Cell(protected var value: Boolean, protected var port: Port, protected var def setValue(v: Boolean): Unit = { value = v - +this changeValue () + +this setValue () } def getPort(): Port = { @@ -17,7 +17,7 @@ class Cell(protected var value: Boolean, protected var port: Port, protected var def setPort(p: Port): Unit = { port = p - +this changePort () + +this setPort () } def getOwner(): Row = { @@ -26,7 +26,7 @@ class Cell(protected var value: Boolean, protected var port: Port, protected var def setOwner(o: Row): Unit = { owner = o - +this changeOwner () + +this setOwner () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/tt/InputPort.scala b/solutions/RSync/src/main/scala/sync/tt/InputPort.scala index c59295b..e174f30 100644 --- a/solutions/RSync/src/main/scala/sync/tt/InputPort.scala +++ b/solutions/RSync/src/main/scala/sync/tt/InputPort.scala @@ -1,6 +1,8 @@ package sync.tt -class InputPort(p_Name: String, p_Cells: Set[Cell], p_Owner: TruthTable, p_Location: String) extends Port(p_Name, p_Cells, p_Owner, p_Location) { +//import scala.collection.mutable.Set + +class InputPort(p_Name: String, p_Cells: Set[Cell] = Set.empty, p_Owner: TruthTable = null, p_Location: String = null) extends Port(p_Name, p_Cells, p_Owner, p_Location) { override def toString(): String = { "InputPort:" + " name=" + name + " location=" + location diff --git a/solutions/RSync/src/main/scala/sync/tt/LocatedElement.scala b/solutions/RSync/src/main/scala/sync/tt/LocatedElement.scala index 112b9ad..03c08a8 100644 --- a/solutions/RSync/src/main/scala/sync/tt/LocatedElement.scala +++ b/solutions/RSync/src/main/scala/sync/tt/LocatedElement.scala @@ -10,7 +10,7 @@ class LocatedElement(protected var location: String) extends PlayerSync { def setLocation(l: String): Unit = { location = l - +this changeLocation () + +this setLocation () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/tt/OutputPort.scala b/solutions/RSync/src/main/scala/sync/tt/OutputPort.scala index b8543a7..0c7244e 100644 --- a/solutions/RSync/src/main/scala/sync/tt/OutputPort.scala +++ b/solutions/RSync/src/main/scala/sync/tt/OutputPort.scala @@ -1,6 +1,8 @@ package sync.tt -class OutputPort(p_Name: String, p_Cells: Set[Cell], p_Owner: TruthTable, p_Location: String) extends Port(p_Name, p_Cells, p_Owner, p_Location) { +//import scala.collection.mutable.Set + +class OutputPort(p_Name: String, p_Cells: Set[Cell] = Set.empty, p_Owner: TruthTable = null, p_Location: String = null) extends Port(p_Name, p_Cells, p_Owner, p_Location) { override def toString(): String = { "OutputPort:" + " name=" + name + " location=" + location diff --git a/solutions/RSync/src/main/scala/sync/tt/Port.scala b/solutions/RSync/src/main/scala/sync/tt/Port.scala index 01e8634..86b0c0e 100644 --- a/solutions/RSync/src/main/scala/sync/tt/Port.scala +++ b/solutions/RSync/src/main/scala/sync/tt/Port.scala @@ -1,5 +1,7 @@ package sync.tt +//import scala.collection.mutable.Set + abstract class Port(protected var name: String, protected var cells: Set[Cell], protected var owner: TruthTable, l_Location: String) extends LocatedElement(l_Location) { def getName(): String = { @@ -8,21 +10,21 @@ abstract class Port(protected var name: String, protected var cells: Set[Cell], def setName(n: String): Unit = { name = n - +this changeName () + +this setName () } def getCells(): Set[Cell] = { cells } - def setCells(c: Set[Cell]): Unit = { - cells = c - +this changeCells () - } - def addCells(c: Cell): Unit = { cells += c - +this changeCells () + +this addCells () + } + + def removeCells(c: Cell): Unit = { + cells -= c + +this removeCells () } def getOwner(): TruthTable = { @@ -31,7 +33,7 @@ abstract class Port(protected var name: String, protected var cells: Set[Cell], def setOwner(o: TruthTable): Unit = { owner = o - +this changeOwner () + +this setOwner () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/tt/Row.scala b/solutions/RSync/src/main/scala/sync/tt/Row.scala index 9fce935..d798038 100644 --- a/solutions/RSync/src/main/scala/sync/tt/Row.scala +++ b/solutions/RSync/src/main/scala/sync/tt/Row.scala @@ -1,24 +1,21 @@ package sync.tt +//import scala.collection.mutable.Set + class Row(protected var cells: Set[Cell], protected var owner: TruthTable, l_Location: String) extends LocatedElement(l_Location) { def getCells(): Set[Cell] = { cells } - def setCells(c: Set[Cell]): Unit = { - cells = c - +this changeCells () - } - def addCells(c: Cell): Unit = { cells += c - +this changeCells () + +this addCells () } - + def removeCells(c: Cell): Unit = { cells -= c - +this changeCells () + +this removeCells () } def getOwner(): TruthTable = { @@ -27,7 +24,7 @@ class Row(protected var cells: Set[Cell], protected var owner: TruthTable, l_Loc def setOwner(o: TruthTable): Unit = { owner = o - +this changeOwner () + +this setOwner () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/tt/TruthTable.scala b/solutions/RSync/src/main/scala/sync/tt/TruthTable.scala index fc13e40..a81ee21 100644 --- a/solutions/RSync/src/main/scala/sync/tt/TruthTable.scala +++ b/solutions/RSync/src/main/scala/sync/tt/TruthTable.scala @@ -1,5 +1,7 @@ package sync.tt +//import scala.collection.mutable.Set + class TruthTable(protected var name: String, protected var rows: Set[Row], protected var ports: Set[Port], l_Location: String) extends LocatedElement(l_Location) { def getName(): String = { @@ -8,35 +10,35 @@ class TruthTable(protected var name: String, protected var rows: Set[Row], prote def setName(n: String): Unit = { name = n - +this changeName () + +this setName () } def getRows(): Set[Row] = { rows } - def setRows(r: Set[Row]): Unit = { - rows = r - +this changeRows () - } - def addRows(r: Row): Unit = { rows += r - +this changeRows () + +this addRows () } - def getPorts(): Set[Port] = { - ports + def removeRows(r: Row): Unit = { + rows -= r + +this removeRows () } - def setPorts(p: Set[Port]): Unit = { - ports = p - +this changePorts () + def getPorts(): Set[Port] = { + ports } def addPorts(p: Port): Unit = { ports += p - +this changePorts () + +this addPorts () + } + + def removePorts(p: Port): Unit = { + ports -= p + +this removePorts () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/tt/Cell.scala b/solutions/RSync/src/main/scala/tt/Cell.scala deleted file mode 100644 index 17d1a0d..0000000 --- a/solutions/RSync/src/main/scala/tt/Cell.scala +++ /dev/null @@ -1,22 +0,0 @@ -package tt - -class Cell(protected var value: Boolean, l_Location: String) extends LocatedElement(l_Location) { - - def getValue(): Boolean = { - value - } - - def setValue(v: Boolean): Unit = { - value = v - +this changeValue () - } - - override def toString(): String = { - "Cell:" + " value=" + value + " location=" + location - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/CellPortPort.scala b/solutions/RSync/src/main/scala/tt/CellPortPort.scala deleted file mode 100644 index 62c3c23..0000000 --- a/solutions/RSync/src/main/scala/tt/CellPortPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package tt - -import org.rosi_project.model_management.sum.compartments.IAssociation - -class CellPortPort(private val sInstance: Cell, private val tInstance: Port) extends IAssociation { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[CellPortPort " + source + ", " + target + "]" - } - - def getSourceIns(): Cell = { - return sInstance - } - - def getTargetIns(): Port = { - return tInstance - } - - class Source extends IAssociationSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends IAssociationTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/HelperPort.scala b/solutions/RSync/src/main/scala/tt/HelperPort.scala deleted file mode 100644 index 004c0f4..0000000 --- a/solutions/RSync/src/main/scala/tt/HelperPort.scala +++ /dev/null @@ -1,19 +0,0 @@ -package tt - -import org.rosi_project.model_management.sum.query.QueryHelper - -class HelperPort(p_Name: String, p_Location: String) extends Port(p_Name, p_Location) with QueryHelper { - - override def equals(that: Any): Boolean = { - that.isInstanceOf[Port] - } - - override def toString(): String = { - "HelperPort:" + " name=" + name + " location=" + location - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/InputPort.scala b/solutions/RSync/src/main/scala/tt/InputPort.scala deleted file mode 100644 index 8ad5a84..0000000 --- a/solutions/RSync/src/main/scala/tt/InputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package tt - -class InputPort(p_Name: String, p_Location: String) extends Port(p_Name, p_Location) { - - override def toString(): String = { - "InputPort:" + " name=" + name - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/LocatedElement.scala b/solutions/RSync/src/main/scala/tt/LocatedElement.scala deleted file mode 100644 index b1ae08e..0000000 --- a/solutions/RSync/src/main/scala/tt/LocatedElement.scala +++ /dev/null @@ -1,24 +0,0 @@ -package tt - -import org.rosi_project.model_management.core.PlayerSync - -class LocatedElement(protected var location: String) extends PlayerSync { - - def getLocation(): String = { - location - } - - def setLocation(l: String): Unit = { - location = l - +this changeLocation () - } - - override def toString(): String = { - "LocatedElement:" + " location=" + location - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/OutputPort.scala b/solutions/RSync/src/main/scala/tt/OutputPort.scala deleted file mode 100644 index cd8cec9..0000000 --- a/solutions/RSync/src/main/scala/tt/OutputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package tt - -class OutputPort(p_Name: String, p_Location: String) extends Port(p_Name, p_Location) { - - override def toString(): String = { - "OutputPort:" + " name=" + name - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/Port.scala b/solutions/RSync/src/main/scala/tt/Port.scala deleted file mode 100644 index 05844e2..0000000 --- a/solutions/RSync/src/main/scala/tt/Port.scala +++ /dev/null @@ -1,22 +0,0 @@ -package tt - -abstract class Port(protected var name: String, l_Location: String) extends LocatedElement(l_Location) { - - def getName(): String = { - name - } - - def setName(n: String): Unit = { - name = n - +this changeName () - } - - override def toString(): String = { - "Port:" + " name=" + name + " location=" + location - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/Row.scala b/solutions/RSync/src/main/scala/tt/Row.scala deleted file mode 100644 index 17c86de..0000000 --- a/solutions/RSync/src/main/scala/tt/Row.scala +++ /dev/null @@ -1,13 +0,0 @@ -package tt - -class Row(l_Location: String) extends LocatedElement(l_Location) { - - override def toString(): String = { - "Row:" + " location=" + location - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/RowCellsCell.scala b/solutions/RSync/src/main/scala/tt/RowCellsCell.scala deleted file mode 100644 index bc90df9..0000000 --- a/solutions/RSync/src/main/scala/tt/RowCellsCell.scala +++ /dev/null @@ -1,46 +0,0 @@ -package tt - -import org.rosi_project.model_management.sum.compartments.IComposition - -class RowCellsCell(private val sInstance: Row, private val tInstance: Cell) extends IComposition { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[RowCellsCell " + source + ", " + target + "]" - } - - def getSourceIns(): Row = { - return sInstance - } - - def getTargetIns(): Cell = { - return tInstance - } - - class Source extends ICompositionSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends ICompositionTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/TruthTable.scala b/solutions/RSync/src/main/scala/tt/TruthTable.scala deleted file mode 100644 index 1ea3c76..0000000 --- a/solutions/RSync/src/main/scala/tt/TruthTable.scala +++ /dev/null @@ -1,22 +0,0 @@ -package tt - -class TruthTable(protected var name: String, l_Location: String) extends LocatedElement(l_Location) { - - def getName(): String = { - name - } - - def setName(n: String): Unit = { - name = n - +this changeName () - } - - override def toString(): String = { - "TruthTable:" + " name=" + name + " location=" + location - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/TruthTablePortsPort.scala b/solutions/RSync/src/main/scala/tt/TruthTablePortsPort.scala deleted file mode 100644 index 002a60f..0000000 --- a/solutions/RSync/src/main/scala/tt/TruthTablePortsPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package tt - -import org.rosi_project.model_management.sum.compartments.IComposition - -class TruthTablePortsPort(private val sInstance: TruthTable, private val tInstance: Port) extends IComposition { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[TruthTablePortsPort " + source + ", " + target + "]" - } - - def getSourceIns(): TruthTable = { - return sInstance - } - - def getTargetIns(): Port = { - return tInstance - } - - class Source extends ICompositionSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends ICompositionTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/tt/TruthTableRowsRow.scala b/solutions/RSync/src/main/scala/tt/TruthTableRowsRow.scala deleted file mode 100644 index f933870..0000000 --- a/solutions/RSync/src/main/scala/tt/TruthTableRowsRow.scala +++ /dev/null @@ -1,46 +0,0 @@ -package tt - -import org.rosi_project.model_management.sum.compartments.IComposition - -class TruthTableRowsRow(private val sInstance: TruthTable, private val tInstance: Row) extends IComposition { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[TruthTableRowsRow " + source + ", " + target + "]" - } - - def getSourceIns(): TruthTable = { - return sInstance - } - - def getTargetIns(): Row = { - return tInstance - } - - class Source extends ICompositionSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends ICompositionTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala index a93b67c..8225475 100644 --- a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala +++ b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala @@ -5,6 +5,9 @@ import org.rosi_project.model_management.core.SynchronizationCompartment import org.rosi_project.model_management.core.RsumCompartment import org.rosi_project.model_management.core.ModelElementLists import org.rosi_project.model_management.sync.IIntegrationCompartment +import ttc2019.metamodels.tt.TruthTable +import ttc2019.worksync._ +import ttc2019.worksum._ /** The `CompleteTTCProcess` executes the entire transformation workflow. Its methods are inspired * by the different phases that the benchmark is expecting. @@ -18,7 +21,7 @@ object CompleteTTCProcess extends App { var writeOut: IWriteOutputModel = _ var loader: TTCLoader = _ var validator: Validator = _ - var saver: TTCEmfSaver = _ + var saver: TruthTable = _ var processConfig: TTCProcessConfiguration = _ /** Performs necessary setup instructions such as loading the ecore meta-model. @@ -39,12 +42,12 @@ object CompleteTTCProcess extends App { writeOut = WriteSumBdtOutput } this.processConfig = processConfig - saver = loader.loadEcore(processConfig.ttEcoreName, processConfig.ttFileName) + saver = loader.javaTTfromEcore(processConfig.ttEcoreName, processConfig.ttFileName) } /** Loads the truth table. */ - def load(): Unit = loader.createTruthTableInstance(saver, ctts) + def load(): Unit = loader.createTruthTableRSYNCInstance(saver, ctts) /** Transforms the truth table instance to a binary decision diagram. */ diff --git a/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableDirectSync.scala b/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableDirectSync.scala new file mode 100644 index 0000000..4278ac9 --- /dev/null +++ b/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableDirectSync.scala @@ -0,0 +1,71 @@ +package ttc2019 + +import sync.tt._ +import org.eclipse.emf.ecore.EObject + +class CreateTruthTableDirectSync extends ICreateTruthTable { + + //var mapping: Map[EObject, Object] = Map.empty + var truthttable: TruthTable = null + var rows: java.util.Map[EObject, Row] = new java.util.HashMap() + var cells: java.util.Map[EObject, Cell] = new java.util.HashMap() + var ports: java.util.Map[EObject, Port] = new java.util.HashMap() + + def createTruthTable(name: String, id: EObject): Unit = { + truthttable = new TruthTable(name, Set.empty, Set.empty, null) + } + + def createInputPort(name: String, id: EObject): Unit = { + //mapping += (id -> new InputPort(name, Set.empty, null, null)) + ports.put(id, new InputPort(name, Set.empty, null, null)) + } + + def createOutputPort(name: String, id: EObject): Unit = { + //mapping += (id -> new OutputPort(name, Set.empty, null, null)) + ports.put(id, new OutputPort(name, Set.empty, null, null)) + } + + def createRow(id: EObject): Unit = { + //mapping += (id -> new Row(Set.empty, null, null)) + rows.put(id, new Row(Set.empty, null, null)) + } + + def createCell(value: Boolean, id: EObject): Unit = { + //mapping += (id -> new Cell(value, null, null, null)) + cells.put(id, new Cell(value, null, null, null)) + } + + def createTruthTableRowsRow(tt: EObject, row: EObject): Unit = { + //val t = mapping.get(tt).get.asInstanceOf[TruthTable] + //val r = mapping.get(row).get.asInstanceOf[Row] + val r = rows.get(row) + truthttable.addRows(r) + r.setOwner(truthttable) + } + + def createTruthTablePortsPort(tt: EObject, port: EObject): Unit = { + //val t = mapping.get(tt).get.asInstanceOf[TruthTable] + //val p = mapping.get(port).get.asInstanceOf[Port] + val p = ports.get(port) + truthttable.addPorts(p) + p.setOwner(truthttable) + } + + def createRowCellsCell(row: EObject, cell: EObject): Unit = { + //val c = mapping.get(cell).get.asInstanceOf[Cell] + //val r = mapping.get(row).get.asInstanceOf[Row] + val c = cells.get(cell) + val r = rows.get(row) + c.setOwner(r) + r.addCells(c) + } + + def createCellPortPort(cell: EObject, port: EObject): Unit = { + //val c = mapping.get(cell).get.asInstanceOf[Cell] + //val p = mapping.get(port).get.asInstanceOf[Port] + val c = cells.get(cell) + val p = ports.get(port) + c.setPort(p) + p.addCells(c) + } +} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSync.scala b/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSync.scala index f0878f6..c0f4371 100644 --- a/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSync.scala +++ b/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSync.scala @@ -1,55 +1,71 @@ package ttc2019 import sync.tt._ +import org.eclipse.emf.ecore.EObject +//import scala.collection.mutable.Map class CreateTruthTableSync extends ICreateTruthTable { - var mapping: Map[Int, Object] = Map.empty + //var mapping: Map[EObject, Object] = Map.empty + var mapping: java.util.Map[EObject, Object] = new java.util.HashMap() - def createTruthTable(name: String, id: Int): Unit = { - mapping = mapping + (id -> new TruthTable(name, Set.empty, Set.empty, null)) + def createTruthTable(name: String, id: EObject): Unit = { + //mapping += (id -> new TruthTable(name, Set.empty, Set.empty, null)) + mapping.put(id, new TruthTable(name, Set.empty, Set.empty, null)) } - def createInputPort(name: String, id: Int): Unit = { - mapping = mapping + (id -> new InputPort(name, Set.empty, null, null)) + def createInputPort(name: String, id: EObject): Unit = { + //mapping += (id -> new InputPort(name, Set.empty, null, null)) + mapping.put(id, new InputPort(name, Set.empty, null, null)) } - def createOutputPort(name: String, id: Int): Unit = { - mapping = mapping + (id -> new OutputPort(name, Set.empty, null, null)) + def createOutputPort(name: String, id: EObject): Unit = { + //mapping += (id -> new OutputPort(name, Set.empty, null, null)) + mapping.put(id, new OutputPort(name, Set.empty, null, null)) } - def createRow(id: Int): Unit = { - mapping = mapping + (id -> new Row(Set.empty, null, null)) + def createRow(id: EObject): Unit = { + //mapping += (id -> new Row(Set.empty, null, null)) + mapping.put(id, new Row(Set.empty, null, null)) } - def createCell(value: Boolean, id: Int): Unit = { - mapping = mapping + (id -> new Cell(value, null, null, null)) + def createCell(value: Boolean, id: EObject): Unit = { + //mapping += (id -> new Cell(value, null, null, null)) + mapping.put(id, new Cell(value, null, null, null)) } - def createTruthTableRowsRow(tt: Int, row: Int): Unit = { - val t = mapping.get(tt).get.asInstanceOf[TruthTable] - val r = mapping.get(row).get.asInstanceOf[Row] + def createTruthTableRowsRow(tt: EObject, row: EObject): Unit = { + //val t = mapping.get(tt).get.asInstanceOf[TruthTable] + //val r = mapping.get(row).get.asInstanceOf[Row] + val t = mapping.get(tt).asInstanceOf[TruthTable] + val r = mapping.get(row).asInstanceOf[Row] t.addRows(r) r.setOwner(t) } - def createTruthTablePortsPort(tt: Int, port: Int): Unit = { - val t = mapping.get(tt).get.asInstanceOf[TruthTable] - val p = mapping.get(port).get.asInstanceOf[Port] + def createTruthTablePortsPort(tt: EObject, port: EObject): Unit = { + //val t = mapping.get(tt).get.asInstanceOf[TruthTable] + //val p = mapping.get(port).get.asInstanceOf[Port] + val t = mapping.get(tt).asInstanceOf[TruthTable] + val p = mapping.get(port).asInstanceOf[Port] t.addPorts(p) p.setOwner(t) } - def createRowCellsCell(row: Int, cell: Int): Unit = { - val c = mapping.get(cell).get.asInstanceOf[Cell] - val r = mapping.get(row).get.asInstanceOf[Row] + def createRowCellsCell(row: EObject, cell: EObject): Unit = { + //val c = mapping.get(cell).get.asInstanceOf[Cell] + //val r = mapping.get(row).get.asInstanceOf[Row] + val c = mapping.get(cell).asInstanceOf[Cell] + val r = mapping.get(row).asInstanceOf[Row] c.setOwner(r) r.addCells(c) } - def createCellPortPort(cell: Int, port: Int): Unit = { - val c = mapping.get(cell).get.asInstanceOf[Cell] - val p = mapping.get(port).get.asInstanceOf[Port] + def createCellPortPort(cell: EObject, port: EObject): Unit = { + //val c = mapping.get(cell).get.asInstanceOf[Cell] + //val p = mapping.get(port).get.asInstanceOf[Port] + val c = mapping.get(cell).asInstanceOf[Cell] + val p = mapping.get(port).asInstanceOf[Port] c.setPort(p) p.addCells(c) } diff --git a/solutions/RSync/src/main/scala/ttc2019/ExampleCombiCase.scala b/solutions/RSync/src/main/scala/ttc2019/ExampleCombiCase.scala deleted file mode 100644 index 48a3e8f..0000000 --- a/solutions/RSync/src/main/scala/ttc2019/ExampleCombiCase.scala +++ /dev/null @@ -1,185 +0,0 @@ -package ttc2019 - -import sum.tt._ - -import org.rosi_project.model_management.core._ -import ttc2019.metamodels.create.Validator -import ttc2019.metamodels.create.Launcher - -object ExampleCombiCase extends App { - - SynchronizationCompartment combine RsumCompartment - - val i0 = new TruthTable("Test", null) - val i1 = new InputPort("a", null) - val i2 = new InputPort("b", null) - val i3 = new InputPort("c", null) - val i4 = new InputPort("d", null) - val i5 = new OutputPort("s", null) - val i6 = new Row(null) - val i7 = new Cell(false, null) - val i8 = new Cell(false, null) - val i9 = new Cell(false, null) - val i10 = new Row(null) - val i11 = new Cell(false, null) - val i12 = new Cell(true, null) - val i13 = new Cell(false, null) - val i14 = new Cell(false, null) - val i15 = new Cell(true, null) - val i16 = new Row(null) - val i17 = new Cell(false, null) - val i18 = new Cell(true, null) - val i19 = new Cell(false, null) - val i20 = new Cell(true, null) - val i21 = new Cell(false, null) - val i22 = new Row(null) - val i23 = new Cell(false, null) - val i24 = new Cell(true, null) - val i25 = new Cell(true, null) - val i26 = new Cell(false, null) - val i27 = new Row(null) - val i28 = new Cell(true, null) - val i29 = new Cell(false, null) - val i30 = new Cell(false, null) - val i31 = new Cell(false, null) - val i32 = new Cell(false, null) - val i33 = new Row(null) - val i34 = new Cell(true, null) - val i35 = new Cell(false, null) - val i36 = new Cell(true, null) - val i37 = new Cell(false, null) - val i38 = new Cell(true, null) - val i39 = new Row(null) - val i40 = new Cell(true, null) - val i41 = new Cell(true, null) - val i42 = new Cell(false, null) - val i43 = new Row(null) - val i44 = new Cell(true, null) - val i45 = new Cell(true, null) - val i46 = new Cell(false, null) - val i47 = new Cell(false, null) - val i48 = new Cell(true, null) - val i49 = new Row(null) - val i50 = new Cell(true, null) - val i51 = new Cell(true, null) - val i52 = new Cell(true, null) - val i53 = new Cell(false, null) - val i54 = new Cell(false, null) - (new TruthTableRowsRow(i0, i6)).initialize() - (new TruthTableRowsRow(i0, i10)).initialize() - (new TruthTableRowsRow(i0, i16)).initialize() - (new TruthTableRowsRow(i0, i22)).initialize() - (new TruthTableRowsRow(i0, i27)).initialize() - (new TruthTableRowsRow(i0, i33)).initialize() - (new TruthTableRowsRow(i0, i39)).initialize() - (new TruthTableRowsRow(i0, i43)).initialize() - (new TruthTableRowsRow(i0, i49)).initialize() - (new TruthTablePortsPort(i0, i1)).initialize() - (new TruthTablePortsPort(i0, i2)).initialize() - (new TruthTablePortsPort(i0, i3)).initialize() - (new TruthTablePortsPort(i0, i4)).initialize() - (new TruthTablePortsPort(i0, i5)).initialize() - (new RowCellsCell(i6, i7)).initialize() - (new RowCellsCell(i6, i8)).initialize() - (new RowCellsCell(i6, i9)).initialize() - (new CellPortPort(i7, i1)).initialize() - (new CellPortPort(i8, i2)).initialize() - (new CellPortPort(i9, i5)).initialize() - (new RowCellsCell(i10, i11)).initialize() - (new RowCellsCell(i10, i12)).initialize() - (new RowCellsCell(i10, i13)).initialize() - (new RowCellsCell(i10, i14)).initialize() - (new RowCellsCell(i10, i15)).initialize() - (new CellPortPort(i11, i1)).initialize() - (new CellPortPort(i12, i2)).initialize() - (new CellPortPort(i13, i3)).initialize() - (new CellPortPort(i14, i4)).initialize() - (new CellPortPort(i15, i5)).initialize() - (new RowCellsCell(i16, i17)).initialize() - (new RowCellsCell(i16, i18)).initialize() - (new RowCellsCell(i16, i19)).initialize() - (new RowCellsCell(i16, i20)).initialize() - (new RowCellsCell(i16, i21)).initialize() - (new CellPortPort(i17, i1)).initialize() - (new CellPortPort(i18, i2)).initialize() - (new CellPortPort(i19, i3)).initialize() - (new CellPortPort(i20, i4)).initialize() - (new CellPortPort(i21, i5)).initialize() - (new RowCellsCell(i22, i23)).initialize() - (new RowCellsCell(i22, i24)).initialize() - (new RowCellsCell(i22, i25)).initialize() - (new RowCellsCell(i22, i26)).initialize() - (new CellPortPort(i23, i1)).initialize() - (new CellPortPort(i24, i2)).initialize() - (new CellPortPort(i25, i3)).initialize() - (new CellPortPort(i26, i5)).initialize() - (new RowCellsCell(i27, i28)).initialize() - (new RowCellsCell(i27, i29)).initialize() - (new RowCellsCell(i27, i30)).initialize() - (new RowCellsCell(i27, i31)).initialize() - (new RowCellsCell(i27, i32)).initialize() - (new CellPortPort(i28, i1)).initialize() - (new CellPortPort(i29, i2)).initialize() - (new CellPortPort(i30, i3)).initialize() - (new CellPortPort(i31, i4)).initialize() - (new CellPortPort(i32, i5)).initialize() - (new RowCellsCell(i33, i34)).initialize() - (new RowCellsCell(i33, i35)).initialize() - (new RowCellsCell(i33, i36)).initialize() - (new RowCellsCell(i33, i37)).initialize() - (new RowCellsCell(i33, i38)).initialize() - (new CellPortPort(i34, i1)).initialize() - (new CellPortPort(i35, i2)).initialize() - (new CellPortPort(i36, i3)).initialize() - (new CellPortPort(i37, i4)).initialize() - (new CellPortPort(i38, i5)).initialize() - (new RowCellsCell(i39, i40)).initialize() - (new RowCellsCell(i39, i41)).initialize() - (new RowCellsCell(i39, i42)).initialize() - (new CellPortPort(i40, i1)).initialize() - (new CellPortPort(i41, i4)).initialize() - (new CellPortPort(i42, i5)).initialize() - (new RowCellsCell(i43, i44)).initialize() - (new RowCellsCell(i43, i45)).initialize() - (new RowCellsCell(i43, i46)).initialize() - (new RowCellsCell(i43, i47)).initialize() - (new RowCellsCell(i43, i48)).initialize() - (new CellPortPort(i44, i1)).initialize() - (new CellPortPort(i45, i2)).initialize() - (new CellPortPort(i46, i3)).initialize() - (new CellPortPort(i47, i4)).initialize() - (new CellPortPort(i48, i5)).initialize() - (new RowCellsCell(i49, i50)).initialize() - (new RowCellsCell(i49, i51)).initialize() - (new RowCellsCell(i49, i52)).initialize() - (new RowCellsCell(i49, i53)).initialize() - (new RowCellsCell(i49, i54)).initialize() - (new CellPortPort(i50, i1)).initialize() - (new CellPortPort(i51, i2)).initialize() - (new CellPortPort(i52, i3)).initialize() - (new CellPortPort(i53, i4)).initialize() - (new CellPortPort(i54, i5)).initialize() - - //ModelElementLists.printAll() - - SynchronizationCompartment.integrateNewModel(BdtSumIntegration) - - println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++") - ModelElementLists.printFromPackage("BDD") - //ModelElementLists.printAll() - - val bddFileName = "Generated.bddmodel" - val ttFileName = "TTTest.ttmodel" - - WriteSumBdtOutput.generateEverything(bddFileName) - - val validator = new Launcher() - - validator.launch(ttFileName, bddFileName) - - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/ExampleCombiCaseOO.scala b/solutions/RSync/src/main/scala/ttc2019/ExampleCombiCaseOO.scala deleted file mode 100644 index 200cf08..0000000 --- a/solutions/RSync/src/main/scala/ttc2019/ExampleCombiCaseOO.scala +++ /dev/null @@ -1,372 +0,0 @@ -package ttc2019 - -import sum.tt._ - -import org.rosi_project.model_management.core._ -import ttc2019.metamodels.create.Validator -import ttc2019.metamodels.create.Launcher - -object ExampleCombiCaseOO extends App { - - SynchronizationCompartment combine RsumCompartment - - val loader = new TTCLoader() - val validator = new Launcher() - val bddFileName = "Generated.bddmodel" - val ttFileName = "TT.ttmodel" - val ttEcoreName = "TT.ecore" - - val saver = loader.loadEcore(ttEcoreName, ttFileName) - - val i0 = new TruthTable("TableI4O2Seed42", null) - val i1 = new InputPort("I0", null) - val i2 = new InputPort("I1", null) - val i3 = new InputPort("I2", null) - val i4 = new InputPort("I3", null) - val i5 = new OutputPort("O0", null) - val i6 = new OutputPort("O1", null) - val i7 = new Row(null) - val i8 = new Cell(false, null) - val i9 = new Cell(false, null) - val i10 = new Cell(false, null) - val i11 = new Cell(false, null) - val i12 = new Cell(true, null) - val i13 = new Cell(false, null) - val i14 = new Row(null) - val i15 = new Cell(true, null) - val i16 = new Cell(false, null) - val i17 = new Cell(false, null) - val i18 = new Cell(false, null) - val i19 = new Cell(true, null) - val i20 = new Cell(false, null) - val i21 = new Row(null) - val i22 = new Cell(false, null) - val i23 = new Cell(true, null) - val i24 = new Cell(false, null) - val i25 = new Cell(false, null) - val i26 = new Cell(false, null) - val i27 = new Cell(true, null) - val i28 = new Row(null) - val i29 = new Cell(true, null) - val i30 = new Cell(true, null) - val i31 = new Cell(false, null) - val i32 = new Cell(false, null) - val i33 = new Cell(false, null) - val i34 = new Cell(true, null) - val i35 = new Row(null) - val i36 = new Cell(false, null) - val i37 = new Cell(false, null) - val i38 = new Cell(true, null) - val i39 = new Cell(false, null) - val i40 = new Cell(true, null) - val i41 = new Cell(false, null) - val i42 = new Row(null) - val i43 = new Cell(true, null) - val i44 = new Cell(false, null) - val i45 = new Cell(true, null) - val i46 = new Cell(false, null) - val i47 = new Cell(true, null) - val i48 = new Cell(false, null) - val i49 = new Row(null) - val i50 = new Cell(false, null) - val i51 = new Cell(true, null) - val i52 = new Cell(true, null) - val i53 = new Cell(false, null) - val i54 = new Cell(false, null) - val i55 = new Cell(false, null) - val i56 = new Row(null) - val i57 = new Cell(true, null) - val i58 = new Cell(true, null) - val i59 = new Cell(true, null) - val i60 = new Cell(false, null) - val i61 = new Cell(false, null) - val i62 = new Cell(true, null) - val i63 = new Row(null) - val i64 = new Cell(false, null) - val i65 = new Cell(false, null) - val i66 = new Cell(false, null) - val i67 = new Cell(true, null) - val i68 = new Cell(false, null) - val i69 = new Cell(true, null) - val i70 = new Row(null) - val i71 = new Cell(true, null) - val i72 = new Cell(false, null) - val i73 = new Cell(false, null) - val i74 = new Cell(true, null) - val i75 = new Cell(true, null) - val i76 = new Cell(true, null) - val i77 = new Row(null) - val i78 = new Cell(false, null) - val i79 = new Cell(true, null) - val i80 = new Cell(false, null) - val i81 = new Cell(true, null) - val i82 = new Cell(true, null) - val i83 = new Cell(false, null) - val i84 = new Row(null) - val i85 = new Cell(true, null) - val i86 = new Cell(true, null) - val i87 = new Cell(false, null) - val i88 = new Cell(true, null) - val i89 = new Cell(false, null) - val i90 = new Cell(false, null) - val i91 = new Row(null) - val i92 = new Cell(false, null) - val i93 = new Cell(false, null) - val i94 = new Cell(true, null) - val i95 = new Cell(true, null) - val i96 = new Cell(true, null) - val i97 = new Cell(true, null) - val i98 = new Row(null) - val i99 = new Cell(true, null) - val i100 = new Cell(false, null) - val i101 = new Cell(true, null) - val i102 = new Cell(true, null) - val i103 = new Cell(false, null) - val i104 = new Cell(true, null) - val i105 = new Row(null) - val i106 = new Cell(false, null) - val i107 = new Cell(true, null) - val i108 = new Cell(true, null) - val i109 = new Cell(true, null) - val i110 = new Cell(false, null) - val i111 = new Cell(false, null) - val i112 = new Row(null) - val i113 = new Cell(true, null) - val i114 = new Cell(true, null) - val i115 = new Cell(true, null) - val i116 = new Cell(true, null) - val i117 = new Cell(true, null) - val i118 = new Cell(false, null) - (new TruthTableRowsRow(i0, i7)).initialize() - (new TruthTableRowsRow(i0, i14)).initialize() - (new TruthTableRowsRow(i0, i21)).initialize() - (new TruthTableRowsRow(i0, i28)).initialize() - (new TruthTableRowsRow(i0, i35)).initialize() - (new TruthTableRowsRow(i0, i42)).initialize() - (new TruthTableRowsRow(i0, i49)).initialize() - (new TruthTableRowsRow(i0, i56)).initialize() - (new TruthTableRowsRow(i0, i63)).initialize() - (new TruthTableRowsRow(i0, i70)).initialize() - (new TruthTableRowsRow(i0, i77)).initialize() - (new TruthTableRowsRow(i0, i84)).initialize() - (new TruthTableRowsRow(i0, i91)).initialize() - (new TruthTableRowsRow(i0, i98)).initialize() - (new TruthTableRowsRow(i0, i105)).initialize() - (new TruthTableRowsRow(i0, i112)).initialize() - (new TruthTablePortsPort(i0, i1)).initialize() - (new TruthTablePortsPort(i0, i2)).initialize() - (new TruthTablePortsPort(i0, i3)).initialize() - (new TruthTablePortsPort(i0, i4)).initialize() - (new TruthTablePortsPort(i0, i5)).initialize() - (new TruthTablePortsPort(i0, i6)).initialize() - (new RowCellsCell(i7, i8)).initialize() - (new RowCellsCell(i7, i9)).initialize() - (new RowCellsCell(i7, i10)).initialize() - (new RowCellsCell(i7, i11)).initialize() - (new RowCellsCell(i7, i12)).initialize() - (new RowCellsCell(i7, i13)).initialize() - (new CellPortPort(i8, i1)).initialize() - (new CellPortPort(i9, i2)).initialize() - (new CellPortPort(i10, i3)).initialize() - (new CellPortPort(i11, i4)).initialize() - (new CellPortPort(i12, i5)).initialize() - (new CellPortPort(i13, i6)).initialize() - (new RowCellsCell(i14, i15)).initialize() - (new RowCellsCell(i14, i16)).initialize() - (new RowCellsCell(i14, i17)).initialize() - (new RowCellsCell(i14, i18)).initialize() - (new RowCellsCell(i14, i19)).initialize() - (new RowCellsCell(i14, i20)).initialize() - (new CellPortPort(i15, i1)).initialize() - (new CellPortPort(i16, i2)).initialize() - (new CellPortPort(i17, i3)).initialize() - (new CellPortPort(i18, i4)).initialize() - (new CellPortPort(i19, i5)).initialize() - (new CellPortPort(i20, i6)).initialize() - (new RowCellsCell(i21, i22)).initialize() - (new RowCellsCell(i21, i23)).initialize() - (new RowCellsCell(i21, i24)).initialize() - (new RowCellsCell(i21, i25)).initialize() - (new RowCellsCell(i21, i26)).initialize() - (new RowCellsCell(i21, i27)).initialize() - (new CellPortPort(i22, i1)).initialize() - (new CellPortPort(i23, i2)).initialize() - (new CellPortPort(i24, i3)).initialize() - (new CellPortPort(i25, i4)).initialize() - (new CellPortPort(i26, i5)).initialize() - (new CellPortPort(i27, i6)).initialize() - (new RowCellsCell(i28, i29)).initialize() - (new RowCellsCell(i28, i30)).initialize() - (new RowCellsCell(i28, i31)).initialize() - (new RowCellsCell(i28, i32)).initialize() - (new RowCellsCell(i28, i33)).initialize() - (new RowCellsCell(i28, i34)).initialize() - (new CellPortPort(i29, i1)).initialize() - (new CellPortPort(i30, i2)).initialize() - (new CellPortPort(i31, i3)).initialize() - (new CellPortPort(i32, i4)).initialize() - (new CellPortPort(i33, i5)).initialize() - (new CellPortPort(i34, i6)).initialize() - (new RowCellsCell(i35, i36)).initialize() - (new RowCellsCell(i35, i37)).initialize() - (new RowCellsCell(i35, i38)).initialize() - (new RowCellsCell(i35, i39)).initialize() - (new RowCellsCell(i35, i40)).initialize() - (new RowCellsCell(i35, i41)).initialize() - (new CellPortPort(i36, i1)).initialize() - (new CellPortPort(i37, i2)).initialize() - (new CellPortPort(i38, i3)).initialize() - (new CellPortPort(i39, i4)).initialize() - (new CellPortPort(i40, i5)).initialize() - (new CellPortPort(i41, i6)).initialize() - (new RowCellsCell(i42, i43)).initialize() - (new RowCellsCell(i42, i44)).initialize() - (new RowCellsCell(i42, i45)).initialize() - (new RowCellsCell(i42, i46)).initialize() - (new RowCellsCell(i42, i47)).initialize() - (new RowCellsCell(i42, i48)).initialize() - (new CellPortPort(i43, i1)).initialize() - (new CellPortPort(i44, i2)).initialize() - (new CellPortPort(i45, i3)).initialize() - (new CellPortPort(i46, i4)).initialize() - (new CellPortPort(i47, i5)).initialize() - (new CellPortPort(i48, i6)).initialize() - (new RowCellsCell(i49, i50)).initialize() - (new RowCellsCell(i49, i51)).initialize() - (new RowCellsCell(i49, i52)).initialize() - (new RowCellsCell(i49, i53)).initialize() - (new RowCellsCell(i49, i54)).initialize() - (new RowCellsCell(i49, i55)).initialize() - (new CellPortPort(i50, i1)).initialize() - (new CellPortPort(i51, i2)).initialize() - (new CellPortPort(i52, i3)).initialize() - (new CellPortPort(i53, i4)).initialize() - (new CellPortPort(i54, i5)).initialize() - (new CellPortPort(i55, i6)).initialize() - (new RowCellsCell(i56, i57)).initialize() - (new RowCellsCell(i56, i58)).initialize() - (new RowCellsCell(i56, i59)).initialize() - (new RowCellsCell(i56, i60)).initialize() - (new RowCellsCell(i56, i61)).initialize() - (new RowCellsCell(i56, i62)).initialize() - (new CellPortPort(i57, i1)).initialize() - (new CellPortPort(i58, i2)).initialize() - (new CellPortPort(i59, i3)).initialize() - (new CellPortPort(i60, i4)).initialize() - (new CellPortPort(i61, i5)).initialize() - (new CellPortPort(i62, i6)).initialize() - (new RowCellsCell(i63, i64)).initialize() - (new RowCellsCell(i63, i65)).initialize() - (new RowCellsCell(i63, i66)).initialize() - (new RowCellsCell(i63, i67)).initialize() - (new RowCellsCell(i63, i68)).initialize() - (new RowCellsCell(i63, i69)).initialize() - (new CellPortPort(i64, i1)).initialize() - (new CellPortPort(i65, i2)).initialize() - (new CellPortPort(i66, i3)).initialize() - (new CellPortPort(i67, i4)).initialize() - (new CellPortPort(i68, i5)).initialize() - (new CellPortPort(i69, i6)).initialize() - (new RowCellsCell(i70, i71)).initialize() - (new RowCellsCell(i70, i72)).initialize() - (new RowCellsCell(i70, i73)).initialize() - (new RowCellsCell(i70, i74)).initialize() - (new RowCellsCell(i70, i75)).initialize() - (new RowCellsCell(i70, i76)).initialize() - (new CellPortPort(i71, i1)).initialize() - (new CellPortPort(i72, i2)).initialize() - (new CellPortPort(i73, i3)).initialize() - (new CellPortPort(i74, i4)).initialize() - (new CellPortPort(i75, i5)).initialize() - (new CellPortPort(i76, i6)).initialize() - (new RowCellsCell(i77, i78)).initialize() - (new RowCellsCell(i77, i79)).initialize() - (new RowCellsCell(i77, i80)).initialize() - (new RowCellsCell(i77, i81)).initialize() - (new RowCellsCell(i77, i82)).initialize() - (new RowCellsCell(i77, i83)).initialize() - (new CellPortPort(i78, i1)).initialize() - (new CellPortPort(i79, i2)).initialize() - (new CellPortPort(i80, i3)).initialize() - (new CellPortPort(i81, i4)).initialize() - (new CellPortPort(i82, i5)).initialize() - (new CellPortPort(i83, i6)).initialize() - (new RowCellsCell(i84, i85)).initialize() - (new RowCellsCell(i84, i86)).initialize() - (new RowCellsCell(i84, i87)).initialize() - (new RowCellsCell(i84, i88)).initialize() - (new RowCellsCell(i84, i89)).initialize() - (new RowCellsCell(i84, i90)).initialize() - (new CellPortPort(i85, i1)).initialize() - (new CellPortPort(i86, i2)).initialize() - (new CellPortPort(i87, i3)).initialize() - (new CellPortPort(i88, i4)).initialize() - (new CellPortPort(i89, i5)).initialize() - (new CellPortPort(i90, i6)).initialize() - (new RowCellsCell(i91, i92)).initialize() - (new RowCellsCell(i91, i93)).initialize() - (new RowCellsCell(i91, i94)).initialize() - (new RowCellsCell(i91, i95)).initialize() - (new RowCellsCell(i91, i96)).initialize() - (new RowCellsCell(i91, i97)).initialize() - (new CellPortPort(i92, i1)).initialize() - (new CellPortPort(i93, i2)).initialize() - (new CellPortPort(i94, i3)).initialize() - (new CellPortPort(i95, i4)).initialize() - (new CellPortPort(i96, i5)).initialize() - (new CellPortPort(i97, i6)).initialize() - (new RowCellsCell(i98, i99)).initialize() - (new RowCellsCell(i98, i100)).initialize() - (new RowCellsCell(i98, i101)).initialize() - (new RowCellsCell(i98, i102)).initialize() - (new RowCellsCell(i98, i103)).initialize() - (new RowCellsCell(i98, i104)).initialize() - (new CellPortPort(i99, i1)).initialize() - (new CellPortPort(i100, i2)).initialize() - (new CellPortPort(i101, i3)).initialize() - (new CellPortPort(i102, i4)).initialize() - (new CellPortPort(i103, i5)).initialize() - (new CellPortPort(i104, i6)).initialize() - (new RowCellsCell(i105, i106)).initialize() - (new RowCellsCell(i105, i107)).initialize() - (new RowCellsCell(i105, i108)).initialize() - (new RowCellsCell(i105, i109)).initialize() - (new RowCellsCell(i105, i110)).initialize() - (new RowCellsCell(i105, i111)).initialize() - (new CellPortPort(i106, i1)).initialize() - (new CellPortPort(i107, i2)).initialize() - (new CellPortPort(i108, i3)).initialize() - (new CellPortPort(i109, i4)).initialize() - (new CellPortPort(i110, i5)).initialize() - (new CellPortPort(i111, i6)).initialize() - (new RowCellsCell(i112, i113)).initialize() - (new RowCellsCell(i112, i114)).initialize() - (new RowCellsCell(i112, i115)).initialize() - (new RowCellsCell(i112, i116)).initialize() - (new RowCellsCell(i112, i117)).initialize() - (new RowCellsCell(i112, i118)).initialize() - (new CellPortPort(i113, i1)).initialize() - (new CellPortPort(i114, i2)).initialize() - (new CellPortPort(i115, i3)).initialize() - (new CellPortPort(i116, i4)).initialize() - (new CellPortPort(i117, i5)).initialize() - (new CellPortPort(i118, i6)).initialize() - - - //ModelElementLists.printAll() - - SynchronizationCompartment.integrateNewModel(BdtSumIntegration) - - println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++") - //ModelElementLists.printFromPackage("BDD") - //ModelElementLists.printAll() - - WriteSumBdtOutput.generateEverything(bddFileName) - - validator.launch(ttFileName, bddFileName) - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/ICreateTruthTable.scala b/solutions/RSync/src/main/scala/ttc2019/ICreateTruthTable.scala index bf0f41c..7215b4c 100644 --- a/solutions/RSync/src/main/scala/ttc2019/ICreateTruthTable.scala +++ b/solutions/RSync/src/main/scala/ttc2019/ICreateTruthTable.scala @@ -1,22 +1,24 @@ package ttc2019 +import org.eclipse.emf.ecore.EObject + trait ICreateTruthTable { - def createTruthTable(name: String, id: Int): Unit + def createTruthTable(name: String, id: EObject): Unit - def createInputPort(name: String, id: Int): Unit + def createInputPort(name: String, id: EObject): Unit - def createOutputPort(name: String, id: Int): Unit + def createOutputPort(name: String, id: EObject): Unit - def createRow(id: Int): Unit + def createRow(id: EObject): Unit - def createCell(value: Boolean, id: Int): Unit + def createCell(value: Boolean, id: EObject): Unit - def createTruthTableRowsRow(tt: Int, row: Int): Unit + def createTruthTableRowsRow(tt: EObject, row: EObject): Unit - def createTruthTablePortsPort(tt: Int, port: Int): Unit + def createTruthTablePortsPort(tt: EObject, port: EObject): Unit - def createRowCellsCell(row: Int, cell: Int): Unit + def createRowCellsCell(row: EObject, cell: EObject): Unit - def createCellPortPort(cell: Int, port: Int): Unit + def createCellPortPort(cell: EObject, port: EObject): Unit } \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/MetricMeasurement.scala b/solutions/RSync/src/main/scala/ttc2019/MetricMeasurement.scala index c865c6a..d98287a 100644 --- a/solutions/RSync/src/main/scala/ttc2019/MetricMeasurement.scala +++ b/solutions/RSync/src/main/scala/ttc2019/MetricMeasurement.scala @@ -9,23 +9,13 @@ object MetricMeasurement { def printMetricsBDT(directly: Boolean = false): Metrics = { printDirectly = directly + val bdd = ModelElementLists.getElementsFromType("sync.bdd.BDD").head.asInstanceOf[_root_.sync.bdd.BDD] val numberSubtrees = ModelElementLists.getElementsFromType("sync.bdd.Subtree").size val numberLeafs = ModelElementLists.getElementsFromType("sync.bdd.Leaf").size - var maxPath: Int = -1 - var minPath: Int = -1 - - var sumDepth: Int = 0 - ModelElementLists.getElementsFromType("sync.bdd.Leaf").asInstanceOf[List[sync.bdd.Leaf]].foreach(l => { - var depth = l.getMinDeep() - sumDepth += depth - if (depth > maxPath) { - maxPath = depth - } - if (depth < minPath || minPath == -1) { - minPath = depth - } - }) - val averagePath: Double = sumDepth.toDouble / numberLeafs.toDouble + + val maxPath = bdd.getTree().getMaxPath() + val minPath = bdd.getTree().getMinPath() + val averagePath = bdd.getTree().getAvgPath() if (directly) { println("Number Subtrees: " + numberSubtrees) @@ -39,25 +29,13 @@ object MetricMeasurement { def printMetricsBDD(directly: Boolean = false): Metrics = { printDirectly = directly + val bdd = ModelElementLists.getElementsFromType("sync.bddg.BDD").head.asInstanceOf[_root_.sync.bddg.BDD] val numberSubtrees = ModelElementLists.getElementsFromType("sync.bddg.Subtree").size val numberLeafs = ModelElementLists.getElementsFromType("sync.bddg.Leaf").size - var maxPath: Int = -1 - var minPath: Int = -1 - - var sumDepth: Int = 0 - var sumNodes: Int = 0 - ModelElementLists.getElementsFromType("sync.bddg.Leaf").asInstanceOf[List[sync.bddg.Leaf]].foreach(l => { - var depth = l.getMinDeep() - sumNodes += l.getOwnerSubtreeForOne().size + l.getOwnerSubtreeForZero().size - sumDepth += l.getSumDeep() - if (depth > maxPath) { - maxPath = depth - } - if (depth < minPath || minPath == -1) { - minPath = depth - } - }) - val averagePath: Double = sumDepth.toDouble / sumNodes.toDouble + + val maxPath = bdd.getRoot().getMaxPath() + val minPath = bdd.getRoot().getMinPath() + val averagePath = bdd.getRoot().getAvgPath() if (directly) { println("Number Subtrees: " + numberSubtrees) @@ -68,4 +46,4 @@ object MetricMeasurement { } Metrics(nLeafs = numberLeafs, nSubTrees = numberSubtrees, maxPathLength = maxPath, minPathLength = minPath, avgPathLength = averagePath) } -} +} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/TTCEmfSaver.scala b/solutions/RSync/src/main/scala/ttc2019/TTCEmfSaver.scala deleted file mode 100644 index 40e2b53..0000000 --- a/solutions/RSync/src/main/scala/ttc2019/TTCEmfSaver.scala +++ /dev/null @@ -1,13 +0,0 @@ -package ttc2019 - -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.EPackage - -/** - * Save meta and instance model. - * - * @author Christopher Werner - */ -class TTCEmfSaver(val pkg: EPackage, val obj: EObject) { - -} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/TTCLoader.scala b/solutions/RSync/src/main/scala/ttc2019/TTCLoader.scala index d7160b1..8934cb2 100644 --- a/solutions/RSync/src/main/scala/ttc2019/TTCLoader.scala +++ b/solutions/RSync/src/main/scala/ttc2019/TTCLoader.scala @@ -3,12 +3,15 @@ package ttc2019 import org.eclipse.emf.common.util.URI import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl import org.eclipse.emf.ecore.{ EObject, EPackage } +import org.eclipse.emf.ecore.xmi.XMLResource import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl import scala.collection.JavaConverters._ import java.io.File import org.eclipse.emf.ecore.EStructuralFeature +import ttc2019.metamodels.create._ +import ttc2019.metamodels.tt._ /** * Simple service to load an ECORE meta and instance model from a file. @@ -23,110 +26,119 @@ class TTCLoader { * @param path where to find the model * @return the model described by the XML */ - def loadEcore(pathMeta: String, pathInstance: String): TTCEmfSaver = { + def javaLoadEcore(pathMeta: String, pathInstance: String): EObject = { + require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty) + + val loader = new LoadEObject + return loader.load(pathMeta, pathInstance) + } + + def javaSimpleLoadEcore(pathMeta: String, pathInstance: String): EObject = { + require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty) + + val loader = new LoadEObject + return loader.loadSimple(pathMeta, pathInstance) + } + + def javaTTfromEcore(pathMeta: String, pathInstance: String): TruthTable = { require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty) - - val resourceSet = new ResourceSetImpl() - resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()) - val res = resourceSet.getResource(URI.createFileURI(pathMeta), true) + val loader = new LoadEObject + return loader.loadTT(pathMeta, pathInstance) + } + + def scalaLoadEcore(pathMeta: String, pathInstance: String): EObject = { + require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty) - require(null != res) - require(!res.getContents.isEmpty) + val resourceSet = new ResourceSetImpl(); + /*resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_ATTACHMENT, true.asInstanceOf[Object]); + resourceSet.getLoadOptions().put(XMLResource.OPTION_USE_DEPRECATED_METHODS, true.asInstanceOf[Object]); + resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true.asInstanceOf[Object]) + resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put("ecore", new EcoreResourceFactoryImpl()) + resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put("ttmodel", new IntrinsicIDXMIResourceFactoryImpl())*/ + resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()) + + + val ressourceMeta = resourceSet.getResource(URI.createFileURI(pathMeta), true) + val packageMeta = ressourceMeta.getContents().get(0) - val univEPackage = res.getContents().get(0); - resourceSet.getPackageRegistry().put("https://www.transformation-tool-contest.eu/2019/tt", univEPackage); - val myModel = resourceSet.getResource(URI.createURI(pathInstance), true); + require(null != ressourceMeta) + require(!ressourceMeta.getContents.isEmpty) + + resourceSet.getPackageRegistry().put("https://www.transformation-tool-contest.eu/2019/tt", packageMeta); + val ressourceModel = resourceSet.getResource(URI.createURI(pathInstance), true); - return new TTCEmfSaver(res.getContents.toArray(new Array[EObject](0)).toList.find(_.isInstanceOf[EPackage]).map((p: EObject) => p.asInstanceOf[EPackage]).orNull, - myModel.getContents().toArray(new Array[EObject](0)).toList.head) + return ressourceModel.getContents().get(0) } - /** - * Create the input TruthTable instance from the *.ttmodel file. - */ - def createTruthTableInstance(clsins: TTCEmfSaver, ctts: ICreateTruthTable): Unit = { - //println("++++++++++++++++++++++++++++++++++++++++++++++") - val contents = clsins.obj.eAllContents().asScala - var counter = 0 - var ecoreMap: Map[EObject, Int] = Map.empty - var objName = clsins.obj.eClass.getName + private def createObj(obj: EObject, ctts: ICreateTruthTable): Unit = { + var objName = obj.eClass.getName //println(objName) objName match { - case "TruthTable" => ctts.createTruthTable(clsins.obj.eGet(clsins.obj.eClass().getEStructuralFeature("name")).toString(), counter) - case "InputPort" => ctts.createInputPort(clsins.obj.eGet(clsins.obj.eClass().getEStructuralFeature("name")).toString(), counter) - case "OutputPort" => ctts.createOutputPort(clsins.obj.eGet(clsins.obj.eClass().getEStructuralFeature("name")).toString(), counter) - case "Row" => ctts.createRow(counter) - case "Cell" => ctts.createCell(clsins.obj.eGet(clsins.obj.eClass().getEStructuralFeature("value")).asInstanceOf[Boolean], counter) + case "TruthTable" => ctts.createTruthTable(obj.eGet(obj.eClass().getEStructuralFeature("name")).toString(), obj) + case "InputPort" => ctts.createInputPort(obj.eGet(obj.eClass().getEStructuralFeature("name")).toString(), obj) + case "OutputPort" => ctts.createOutputPort(obj.eGet(obj.eClass().getEStructuralFeature("name")).toString(), obj) + case "Row" => ctts.createRow(obj) + case "Cell" => ctts.createCell(obj.eGet(obj.eClass().getEStructuralFeature("value")).asInstanceOf[Boolean], obj) case _ => } - ecoreMap += (clsins.obj -> counter) - counter += 1 - - contents.foreach(o => { - var objName = o.eClass().getName - //println(objName) - objName match { - case "TruthTable" => { - /*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala - structs.foreach(a => { - println("AName: " + a.getName) - })*/ - ctts.createTruthTable(o.eGet(o.eClass().getEStructuralFeature("name")).toString(), counter) - } - case "InputPort" => { - /*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala - structs.foreach(a => { - println("AName: " + a.getName) - })*/ - ctts.createInputPort(o.eGet(o.eClass().getEStructuralFeature("name")).toString(), counter) - } - case "OutputPort" => { - /*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala - structs.foreach(a => { - println("AName: " + a.getName) - })*/ - ctts.createOutputPort(o.eGet(o.eClass().getEStructuralFeature("name")).toString(), counter) - } - case "Row" => { - /*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala - structs.foreach(a => { - println("AName: " + a.getName) - })*/ - ctts.createRow(counter) - } - case "Cell" => { - /*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala - structs.foreach(a => { - println("AName: " + a.getName) - })*/ - ctts.createCell(o.eGet(o.eClass().getEStructuralFeature("value")).asInstanceOf[Boolean], counter) + } + + private def createReferences(o1: EObject, ctts: ICreateTruthTable): Unit = { + o1.eClass().getEAllReferences.forEach(sf => { + if (sf.getName == "port" || sf.getName == "owner") { + val o2 = o1.eGet(sf).asInstanceOf[EObject] + //println("++ " + o1.eClass().getName + " " + sf.getName + " " + o2.eClass().getName) + if (o1.eClass().getName == "Cell" && sf.getName == "port" && o2.eClass().getName.contains("Port")) { + ctts.createCellPortPort(o1, o2) + } else if (o1.eClass().getName == "Cell" && sf.getName == "owner" && o2.eClass().getName == "Row") { + ctts.createRowCellsCell(o2, o1) + } else if (o1.eClass().getName.contains("Port") && sf.getName == "owner" && o2.eClass().getName == "TruthTable") { + ctts.createTruthTablePortsPort(o2, o1) + } else if (o1.eClass().getName == "Row" && sf.getName == "owner" && o2.eClass().getName == "TruthTable") { + ctts.createTruthTableRowsRow(o2, o1) } - case _ => } - ecoreMap += (o -> counter) - counter += 1 - }) + }) + } + + /** + * Create the input TruthTable instance from the *.ttmodel file. + */ + def createTruthTableInstance(obj: EObject, ctts: ICreateTruthTable): Unit = { + createObj(obj, ctts) + obj.eAllContents().asScala.foreach(o => { + createObj(o, ctts) + }) + //add values for instances - ecoreMap.keySet.foreach(o1 => { - o1.eClass().getEAllReferences.forEach(sf => { - if (sf.getName == "port" || sf.getName == "owner") { - val o2 = o1.eGet(sf).asInstanceOf[EObject] - //println("++ " + o1.eClass().getName + " " + sf.getName + " " + o2.eClass().getName) - if (o1.eClass().getName == "Cell" && sf.getName == "port" && o2.eClass().getName.contains("Port")) { - ctts.createCellPortPort(ecoreMap.get(o1).get, ecoreMap.get(o2).get) - } - if (o1.eClass().getName == "Cell" && sf.getName == "owner" && o2.eClass().getName == "Row") { - ctts.createRowCellsCell(ecoreMap.get(o2).get, ecoreMap.get(o1).get) - } - if (o1.eClass().getName.contains("Port") && sf.getName == "owner" && o2.eClass().getName == "TruthTable") { - ctts.createTruthTablePortsPort(ecoreMap.get(o2).get, ecoreMap.get(o1).get) - } - if (o1.eClass().getName == "Row" && sf.getName == "owner" && o2.eClass().getName == "TruthTable") { - ctts.createTruthTableRowsRow(ecoreMap.get(o2).get, ecoreMap.get(o1).get) - } - } + createReferences(obj, ctts) + obj.eAllContents().asScala.foreach(o1 => { + createReferences(o1, ctts) + }) + } + + def createTruthTableRSYNCInstance(tt: TruthTable, cttss: ICreateTruthTable): Unit = { + val ctts = new CreateTTinJava() + ctts.createTruthTable(tt.getName, tt) + + tt.getPorts.forEach(p => { + if (p.isInstanceOf[InputPort]) { + ctts.createInputPort(p.getName, p) + } else { + ctts.createOutputPort(p.getName, p) + } + ctts.createTruthTablePortsPort(tt, p) + }) + + tt.getRows.forEach(r => { + ctts.createRow(r) + ctts.createTruthTableRowsRow(tt, r) + r.getCells.forEach(c => { + ctts.createCell(c.isValue(), c) + ctts.createRowCellsCell(r, c) + ctts.createCellPortPort(c, c.getPort) }) }) } diff --git a/solutions/RSync/src/main/scala/ttc2019/TTFactory.scala b/solutions/RSync/src/main/scala/ttc2019/TTFactory.scala new file mode 100644 index 0000000..a9a8fbe --- /dev/null +++ b/solutions/RSync/src/main/scala/ttc2019/TTFactory.scala @@ -0,0 +1,15 @@ +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 diff --git a/solutions/RSync/src/main/scala/ttc2019/WriteOutput.scala b/solutions/RSync/src/main/scala/ttc2019/WriteOutput.scala deleted file mode 100644 index d95dc4c..0000000 --- a/solutions/RSync/src/main/scala/ttc2019/WriteOutput.scala +++ /dev/null @@ -1,115 +0,0 @@ -package ttc2019 - -import bdd.BDD -import bdd.InputPort -import bdd.OutputPort -import bdd.Assignment -import bdd.Leaf -import bdd.Subtree -import bdd.AssignmentPortOutputPort -import bdd.BDDPortsPort -import bdd.BDDTreeTree -import bdd.LeafAssignmentsAssignment -import bdd.SubtreePortInputPort -import bdd.SubtreeTreeForOneTree -import bdd.SubtreeTreeForZeroTree - -import ttc2019.metamodels.create.CreationHelper -import org.rosi_project.model_management.core.ModelElementLists - -object WriteOutput { - - def generateEverything(outputFile: String): Unit = { - val creation = new CreationHelper() - - val bd = ModelElementLists.getDirectElementsFromType("bdd.BDD").asInstanceOf[List[BDD]] - val in = ModelElementLists.getDirectElementsFromType("bdd.InputPort").asInstanceOf[List[InputPort]] - val ou = ModelElementLists.getDirectElementsFromType("bdd.OutputPort").asInstanceOf[List[OutputPort]] - val as = ModelElementLists.getDirectElementsFromType("bdd.Assignment").asInstanceOf[List[Assignment]] - val le = ModelElementLists.getDirectElementsFromType("bdd.Leaf").asInstanceOf[List[Leaf]] - val su = ModelElementLists.getDirectElementsFromType("bdd.Subtree").asInstanceOf[List[Subtree]] - - val apo = ModelElementLists.getDirectElementsFromType("bdd.AssignmentPortOutputPort").asInstanceOf[List[AssignmentPortOutputPort]] - val bpp = ModelElementLists.getDirectElementsFromType("bdd.BDDPortsPort").asInstanceOf[List[BDDPortsPort]] - val btt = ModelElementLists.getDirectElementsFromType("bdd.BDDTreeTree").asInstanceOf[List[BDDTreeTree]] - val laa = ModelElementLists.getDirectElementsFromType("bdd.LeafAssignmentsAssignment").asInstanceOf[List[LeafAssignmentsAssignment]] - val spi = ModelElementLists.getDirectElementsFromType("bdd.SubtreePortInputPort").asInstanceOf[List[SubtreePortInputPort]] - val szt = ModelElementLists.getDirectElementsFromType("bdd.SubtreeTreeForZeroTree").asInstanceOf[List[SubtreeTreeForZeroTree]] - val sot = ModelElementLists.getDirectElementsFromType("bdd.SubtreeTreeForOneTree").asInstanceOf[List[SubtreeTreeForOneTree]] - - /*println(bd) - println(in) - println(ou) - println(as) - println(le) - println(su) - - println(apo) - println(bpp) - println(btt) - println(laa) - println(spi) - println(szt) - println(sot) */ - - //add normal instances - bd.foreach(o => { - creation.createBDD(o, o.getName()) - }) - in.foreach(o => { - creation.createInputPort(o, o.getName()) - }) - ou.foreach(o => { - creation.createOutputPort(o, o.getName()) - }) - as.foreach(o => { - creation.createAssignment(o, o.getValue()) - }) - le.foreach(o => { - creation.createLeaf(o) - }) - su.foreach(o => { - creation.createSubtree(o) - }) - - var setLeafs: Set[Leaf] = Set.empty - var setAssignment: Set[Assignment] = Set.empty - - //add connections - bpp.foreach(o => { - creation.addBDDPortConnection(o.getTargetIns()) - }) - btt.foreach(o => { - creation.addBDDTreeConnection(o.getTargetIns()) - if (o.getTargetIns().isInstanceOf[Leaf]) { - setLeafs += o.getTargetIns().asInstanceOf[Leaf] - } - }) - spi.foreach(o => { - creation.addInputSubtreeConnection(o.getTargetIns(), o.getSourceIns()) - }) - szt.foreach(o => { - creation.addSubtreeZeroTreeConnection(o.getTargetIns(), o.getSourceIns()) - if (o.getTargetIns().isInstanceOf[Leaf]) { - setLeafs += o.getTargetIns().asInstanceOf[Leaf] - } - }) - sot.foreach(o => { - creation.addSubtreeOneTreeConnection(o.getTargetIns(), o.getSourceIns()) - if (o.getTargetIns().isInstanceOf[Leaf]) { - setLeafs += o.getTargetIns().asInstanceOf[Leaf] - } - }) - laa.filter(o => setLeafs.contains(o.getSourceIns())).foreach(o => { - creation.addLeafAssignmentConnection(o.getSourceIns(), o.getTargetIns()) - setAssignment += o.getTargetIns() - }) - //critical only push assignments that are connected - apo.filter(o => setAssignment.contains(o.getSourceIns())).foreach(o => { - creation.addOutputAssignmentConnection(o.getTargetIns(), o.getSourceIns()) - }) - - //generate output file - creation.generate(outputFile) - } -} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/BdtSumIntegration.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/BdtSumIntegration.scala similarity index 99% rename from solutions/RSync/src/main/scala/ttc2019/BdtSumIntegration.scala rename to solutions/RSync/src/main/scala/ttc2019/worksum/BdtSumIntegration.scala index 990b92d..c027426 100644 --- a/solutions/RSync/src/main/scala/ttc2019/BdtSumIntegration.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksum/BdtSumIntegration.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksum import org.rosi_project.model_management.core._ import org.rosi_project.model_management.sync.IIntegrationCompartment diff --git a/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSum.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/CreateTruthTableSum.scala similarity index 57% rename from solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSum.scala rename to solutions/RSync/src/main/scala/ttc2019/worksum/CreateTruthTableSum.scala index c9725a5..3b3b4af 100644 --- a/solutions/RSync/src/main/scala/ttc2019/CreateTruthTableSum.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksum/CreateTruthTableSum.scala @@ -1,44 +1,46 @@ -package ttc2019 +package ttc2019.worksum import sum.tt._ +import org.eclipse.emf.ecore.EObject +import ttc2019.ICreateTruthTable class CreateTruthTableSum extends ICreateTruthTable { - var mapping: Map[Int, Object] = Map.empty + var mapping: Map[EObject, Object] = Map.empty - def createTruthTable(name: String, id: Int): Unit = { + def createTruthTable(name: String, id: EObject): Unit = { mapping = mapping + (id -> new TruthTable(name, null)) } - def createInputPort(name: String, id: Int): Unit = { + def createInputPort(name: String, id: EObject): Unit = { mapping = mapping + (id -> new InputPort(name, null)) } - def createOutputPort(name: String, id: Int): Unit = { + def createOutputPort(name: String, id: EObject): Unit = { mapping = mapping + (id -> new OutputPort(name, null)) } - def createRow(id: Int): Unit = { + def createRow(id: EObject): Unit = { mapping = mapping + (id -> new Row(null)) } - def createCell(value: Boolean, id: Int): Unit = { + def createCell(value: Boolean, id: EObject): Unit = { mapping = mapping + (id -> new Cell(value, null)) } - def createTruthTableRowsRow(tt: Int, row: Int): Unit = { + def createTruthTableRowsRow(tt: EObject, row: EObject): Unit = { (new TruthTableRowsRow(mapping.get(tt).get.asInstanceOf[TruthTable], mapping.get(row).get.asInstanceOf[Row])).initialize() } - def createTruthTablePortsPort(tt: Int, port: Int): Unit = { + def createTruthTablePortsPort(tt: EObject, port: EObject): Unit = { (new TruthTablePortsPort(mapping.get(tt).get.asInstanceOf[TruthTable], mapping.get(port).get.asInstanceOf[Port])).initialize() } - def createRowCellsCell(row: Int, cell: Int): Unit = { + def createRowCellsCell(row: EObject, cell: EObject): Unit = { (new RowCellsCell(mapping.get(row).get.asInstanceOf[Row], mapping.get(cell).get.asInstanceOf[Cell])).initialize() } - def createCellPortPort(cell: Int, port: Int): Unit = { + def createCellPortPort(cell: EObject, port: EObject): Unit = { (new CellPortPort(mapping.get(cell).get.asInstanceOf[Cell], mapping.get(port).get.asInstanceOf[Port])).initialize() } } \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/SyncHeadNamesSum.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/SyncHeadNamesSum.scala similarity index 98% rename from solutions/RSync/src/main/scala/ttc2019/SyncHeadNamesSum.scala rename to solutions/RSync/src/main/scala/ttc2019/worksum/SyncHeadNamesSum.scala index 5fe6fc2..3a05f4b 100644 --- a/solutions/RSync/src/main/scala/ttc2019/SyncHeadNamesSum.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksum/SyncHeadNamesSum.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksum import org.rosi_project.model_management.sync.ISyncCompartment import org.rosi_project.model_management.sync.roles.ISyncRole diff --git a/solutions/RSync/src/main/scala/ttc2019/SyncInputPortNamesSum.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/SyncInputPortNamesSum.scala similarity index 98% rename from solutions/RSync/src/main/scala/ttc2019/SyncInputPortNamesSum.scala rename to solutions/RSync/src/main/scala/ttc2019/worksum/SyncInputPortNamesSum.scala index fb7c11a..42dedb3 100644 --- a/solutions/RSync/src/main/scala/ttc2019/SyncInputPortNamesSum.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksum/SyncInputPortNamesSum.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksum import org.rosi_project.model_management.sync.ISyncCompartment import org.rosi_project.model_management.sync.roles.ISyncRole diff --git a/solutions/RSync/src/main/scala/ttc2019/SyncOutputPortNamesSum.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/SyncOutputPortNamesSum.scala similarity index 98% rename from solutions/RSync/src/main/scala/ttc2019/SyncOutputPortNamesSum.scala rename to solutions/RSync/src/main/scala/ttc2019/worksum/SyncOutputPortNamesSum.scala index 8655b64..89bcf7e 100644 --- a/solutions/RSync/src/main/scala/ttc2019/SyncOutputPortNamesSum.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksum/SyncOutputPortNamesSum.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksum import org.rosi_project.model_management.sync.ISyncCompartment import org.rosi_project.model_management.sync.roles.ISyncRole diff --git a/solutions/RSync/src/main/scala/ttc2019/TTandBDTandBDDSumConstruction.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/TTandBDTandBDDSumConstruction.scala similarity index 99% rename from solutions/RSync/src/main/scala/ttc2019/TTandBDTandBDDSumConstruction.scala rename to solutions/RSync/src/main/scala/ttc2019/worksum/TTandBDTandBDDSumConstruction.scala index 614d55d..d2e7f62 100644 --- a/solutions/RSync/src/main/scala/ttc2019/TTandBDTandBDDSumConstruction.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksum/TTandBDTandBDDSumConstruction.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksum import org.rosi_project.model_management.sync.IConstructionCompartment import org.rosi_project.model_management.sync.roles.IConstructor diff --git a/solutions/RSync/src/main/scala/ttc2019/WriteSumBddOutput.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBddOutput.scala similarity index 80% rename from solutions/RSync/src/main/scala/ttc2019/WriteSumBddOutput.scala rename to solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBddOutput.scala index 1bb977a..4a10be0 100644 --- a/solutions/RSync/src/main/scala/ttc2019/WriteSumBddOutput.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBddOutput.scala @@ -1,9 +1,10 @@ -package ttc2019 +package ttc2019.worksum import sum.bddg._ import ttc2019.metamodels.create.BddCreationHelper import org.rosi_project.model_management.core.ModelElementLists +import ttc2019.IWriteOutputModel object WriteSumBddOutput extends IWriteOutputModel { @@ -12,21 +13,21 @@ object WriteSumBddOutput extends IWriteOutputModel { val pkgName = "sum.bddg." - val bd = ModelElementLists.getDirectElementsFromType(pkgName + "BDD").asInstanceOf[List[BDD]] - val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[List[InputPort]] - val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[List[OutputPort]] - val as = ModelElementLists.getDirectElementsFromType(pkgName + "Assignment").asInstanceOf[List[Assignment]] - val le = ModelElementLists.getDirectElementsFromType(pkgName + "Leaf").asInstanceOf[List[Leaf]] - val su = ModelElementLists.getDirectElementsFromType(pkgName + "Subtree").asInstanceOf[List[Subtree]] + val bd = ModelElementLists.getDirectElementsFromType(pkgName + "BDD").asInstanceOf[Set[BDD]] + val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[Set[InputPort]] + val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[Set[OutputPort]] + val as = ModelElementLists.getDirectElementsFromType(pkgName + "Assignment").asInstanceOf[Set[Assignment]] + val le = ModelElementLists.getDirectElementsFromType(pkgName + "Leaf").asInstanceOf[Set[Leaf]] + val su = ModelElementLists.getDirectElementsFromType(pkgName + "Subtree").asInstanceOf[Set[Subtree]] - val apo = ModelElementLists.getDirectElementsFromType(pkgName + "AssignmentPortOutputPort").asInstanceOf[List[AssignmentPortOutputPort]] - val bpp = ModelElementLists.getDirectElementsFromType(pkgName + "BDDPortsPort").asInstanceOf[List[BDDPortsPort]] - val btt = ModelElementLists.getDirectElementsFromType(pkgName + "BDDTreesTree").asInstanceOf[List[BDDTreesTree]] - val brt = ModelElementLists.getDirectElementsFromType(pkgName + "BDDRootTree").asInstanceOf[List[BDDRootTree]] - val laa = ModelElementLists.getDirectElementsFromType(pkgName + "LeafAssignmentsAssignment").asInstanceOf[List[LeafAssignmentsAssignment]] - val spi = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreePortInputPort").asInstanceOf[List[SubtreePortInputPort]] - val szt = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreeTreeForZeroTree").asInstanceOf[List[SubtreeTreeForZeroTree]] - val sot = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreeTreeForOneTree").asInstanceOf[List[SubtreeTreeForOneTree]] + val apo = ModelElementLists.getDirectElementsFromType(pkgName + "AssignmentPortOutputPort").asInstanceOf[Set[AssignmentPortOutputPort]] + val bpp = ModelElementLists.getDirectElementsFromType(pkgName + "BDDPortsPort").asInstanceOf[Set[BDDPortsPort]] + val btt = ModelElementLists.getDirectElementsFromType(pkgName + "BDDTreesTree").asInstanceOf[Set[BDDTreesTree]] + val brt = ModelElementLists.getDirectElementsFromType(pkgName + "BDDRootTree").asInstanceOf[Set[BDDRootTree]] + val laa = ModelElementLists.getDirectElementsFromType(pkgName + "LeafAssignmentsAssignment").asInstanceOf[Set[LeafAssignmentsAssignment]] + val spi = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreePortInputPort").asInstanceOf[Set[SubtreePortInputPort]] + val szt = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreeTreeForZeroTree").asInstanceOf[Set[SubtreeTreeForZeroTree]] + val sot = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreeTreeForOneTree").asInstanceOf[Set[SubtreeTreeForOneTree]] /*println(bd) println(in) diff --git a/solutions/RSync/src/main/scala/ttc2019/WriteSumBdtOutput.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBdtOutput.scala similarity index 81% rename from solutions/RSync/src/main/scala/ttc2019/WriteSumBdtOutput.scala rename to solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBdtOutput.scala index 2edfbd7..ca4172a 100644 --- a/solutions/RSync/src/main/scala/ttc2019/WriteSumBdtOutput.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBdtOutput.scala @@ -1,9 +1,10 @@ -package ttc2019 +package ttc2019.worksum import sum.bdd._ import ttc2019.metamodels.create.BdtCreationHelper import org.rosi_project.model_management.core.ModelElementLists +import ttc2019.IWriteOutputModel object WriteSumBdtOutput extends IWriteOutputModel { @@ -12,20 +13,20 @@ object WriteSumBdtOutput extends IWriteOutputModel { val pkgName = "sum.bdd." - val bd = ModelElementLists.getDirectElementsFromType(pkgName + "BDD").asInstanceOf[List[BDD]] - val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[List[InputPort]] - val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[List[OutputPort]] - val as = ModelElementLists.getDirectElementsFromType(pkgName + "Assignment").asInstanceOf[List[Assignment]] - val le = ModelElementLists.getDirectElementsFromType(pkgName + "Leaf").asInstanceOf[List[Leaf]] - val su = ModelElementLists.getDirectElementsFromType(pkgName + "Subtree").asInstanceOf[List[Subtree]] + val bd = ModelElementLists.getDirectElementsFromType(pkgName + "BDD").asInstanceOf[Set[BDD]] + val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[Set[InputPort]] + val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[Set[OutputPort]] + val as = ModelElementLists.getDirectElementsFromType(pkgName + "Assignment").asInstanceOf[Set[Assignment]] + val le = ModelElementLists.getDirectElementsFromType(pkgName + "Leaf").asInstanceOf[Set[Leaf]] + val su = ModelElementLists.getDirectElementsFromType(pkgName + "Subtree").asInstanceOf[Set[Subtree]] - val apo = ModelElementLists.getDirectElementsFromType(pkgName + "AssignmentPortOutputPort").asInstanceOf[List[AssignmentPortOutputPort]] - val bpp = ModelElementLists.getDirectElementsFromType(pkgName + "BDDPortsPort").asInstanceOf[List[BDDPortsPort]] - val btt = ModelElementLists.getDirectElementsFromType(pkgName + "BDDTreeTree").asInstanceOf[List[BDDTreeTree]] - val laa = ModelElementLists.getDirectElementsFromType(pkgName + "LeafAssignmentsAssignment").asInstanceOf[List[LeafAssignmentsAssignment]] - val spi = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreePortInputPort").asInstanceOf[List[SubtreePortInputPort]] - val szt = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreeTreeForZeroTree").asInstanceOf[List[SubtreeTreeForZeroTree]] - val sot = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreeTreeForOneTree").asInstanceOf[List[SubtreeTreeForOneTree]] + val apo = ModelElementLists.getDirectElementsFromType(pkgName + "AssignmentPortOutputPort").asInstanceOf[Set[AssignmentPortOutputPort]] + val bpp = ModelElementLists.getDirectElementsFromType(pkgName + "BDDPortsPort").asInstanceOf[Set[BDDPortsPort]] + val btt = ModelElementLists.getDirectElementsFromType(pkgName + "BDDTreeTree").asInstanceOf[Set[BDDTreeTree]] + val laa = ModelElementLists.getDirectElementsFromType(pkgName + "LeafAssignmentsAssignment").asInstanceOf[Set[LeafAssignmentsAssignment]] + val spi = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreePortInputPort").asInstanceOf[Set[SubtreePortInputPort]] + val szt = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreeTreeForZeroTree").asInstanceOf[Set[SubtreeTreeForZeroTree]] + val sot = ModelElementLists.getDirectElementsFromType(pkgName + "SubtreeTreeForOneTree").asInstanceOf[Set[SubtreeTreeForOneTree]] /*println(bd) println(in) diff --git a/solutions/RSync/src/main/scala/ttc2019/WriteSumTtOutput.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumTtOutput.scala similarity index 79% rename from solutions/RSync/src/main/scala/ttc2019/WriteSumTtOutput.scala rename to solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumTtOutput.scala index 62ae00e..9d3bd89 100644 --- a/solutions/RSync/src/main/scala/ttc2019/WriteSumTtOutput.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumTtOutput.scala @@ -1,9 +1,9 @@ -package ttc2019 +package ttc2019.worksum import sum.tt._ - import ttc2019.metamodels.create.TtCreationHelper import org.rosi_project.model_management.core.ModelElementLists +import ttc2019.IWriteOutputModel object WriteSumTtOutput extends IWriteOutputModel { def generateEverything(outputFile: String): Unit = { @@ -11,16 +11,16 @@ object WriteSumTtOutput extends IWriteOutputModel { val pkgName = "sum.tt." - val tt = ModelElementLists.getDirectElementsFromType(pkgName + "TruthTable").asInstanceOf[List[TruthTable]] - val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[List[InputPort]] - val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[List[OutputPort]] - val ro = ModelElementLists.getDirectElementsFromType(pkgName + "Row").asInstanceOf[List[Row]] - val ce = ModelElementLists.getDirectElementsFromType(pkgName + "Cell").asInstanceOf[List[Cell]] + val tt = ModelElementLists.getDirectElementsFromType(pkgName + "TruthTable").asInstanceOf[Set[TruthTable]] + val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[Set[InputPort]] + val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[Set[OutputPort]] + val ro = ModelElementLists.getDirectElementsFromType(pkgName + "Row").asInstanceOf[Set[Row]] + val ce = ModelElementLists.getDirectElementsFromType(pkgName + "Cell").asInstanceOf[Set[Cell]] - val cpp = ModelElementLists.getDirectElementsFromType(pkgName + "CellPortPort").asInstanceOf[List[CellPortPort]] - val rcc = ModelElementLists.getDirectElementsFromType(pkgName + "RowCellsCell").asInstanceOf[List[RowCellsCell]] - val tpp = ModelElementLists.getDirectElementsFromType(pkgName + "TruthTablePortsPort").asInstanceOf[List[TruthTablePortsPort]] - val trr = ModelElementLists.getDirectElementsFromType(pkgName + "TruthTableRowsRow").asInstanceOf[List[TruthTableRowsRow]] + val cpp = ModelElementLists.getDirectElementsFromType(pkgName + "CellPortPort").asInstanceOf[Set[CellPortPort]] + val rcc = ModelElementLists.getDirectElementsFromType(pkgName + "RowCellsCell").asInstanceOf[Set[RowCellsCell]] + val tpp = ModelElementLists.getDirectElementsFromType(pkgName + "TruthTablePortsPort").asInstanceOf[Set[TruthTablePortsPort]] + val trr = ModelElementLists.getDirectElementsFromType(pkgName + "TruthTableRowsRow").asInstanceOf[Set[TruthTableRowsRow]] /*println(tt) println(in) diff --git a/solutions/RSync/src/main/scala/ttc2019/BddSyncIntegration.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/BddSyncIntegration.scala similarity index 99% rename from solutions/RSync/src/main/scala/ttc2019/BddSyncIntegration.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/BddSyncIntegration.scala index 7af05aa..adbfdc1 100644 --- a/solutions/RSync/src/main/scala/ttc2019/BddSyncIntegration.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/BddSyncIntegration.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksync import org.rosi_project.model_management.core.PlayerSync import org.rosi_project.model_management.core.SynchronizationCompartment @@ -12,7 +12,6 @@ import org.rosi_project.model_management.core.ModelElementLists object BddSyncIntegration extends IIntegrationCompartment { - //private var createdObjects: Set[PlayerSync] = Set.empty private var leafNodes: Map[Set[String], sync.bddg.Leaf] = Map.empty private var createdBdds: Set[sync.bddg.BDD] = Set.empty diff --git a/solutions/RSync/src/main/scala/ttc2019/BdtAndBddSyncIntegration.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/BdtAndBddSyncIntegration.scala similarity index 99% rename from solutions/RSync/src/main/scala/ttc2019/BdtAndBddSyncIntegration.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/BdtAndBddSyncIntegration.scala index 435aa82..9e58e63 100644 --- a/solutions/RSync/src/main/scala/ttc2019/BdtAndBddSyncIntegration.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/BdtAndBddSyncIntegration.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksync import org.rosi_project.model_management.core.PlayerSync import org.rosi_project.model_management.core.SynchronizationCompartment diff --git a/solutions/RSync/src/main/scala/ttc2019/BdtSyncIntegration.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/BdtSyncIntegration.scala similarity index 99% rename from solutions/RSync/src/main/scala/ttc2019/BdtSyncIntegration.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/BdtSyncIntegration.scala index 552fccb..8a5afd3 100644 --- a/solutions/RSync/src/main/scala/ttc2019/BdtSyncIntegration.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/BdtSyncIntegration.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksync import org.rosi_project.model_management.core.PlayerSync import org.rosi_project.model_management.core.SynchronizationCompartment @@ -12,7 +12,6 @@ import org.rosi_project.model_management.core.ModelElementLists object BdtSyncIntegration extends IIntegrationCompartment { - private var leafNodes: Map[Set[String], sync.bdd.Leaf] = Map.empty private var createdBdds: Set[sync.bdd.BDD] = Set.empty def printManager(): Unit = { diff --git a/solutions/RSync/src/main/scala/ttc2019/SyncHeadNamesSync.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/SyncHeadNamesSync.scala similarity index 98% rename from solutions/RSync/src/main/scala/ttc2019/SyncHeadNamesSync.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/SyncHeadNamesSync.scala index 7b278e2..ad02e8d 100644 --- a/solutions/RSync/src/main/scala/ttc2019/SyncHeadNamesSync.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/SyncHeadNamesSync.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksync import org.rosi_project.model_management.sync.ISyncCompartment import org.rosi_project.model_management.sync.roles.ISyncRole diff --git a/solutions/RSync/src/main/scala/ttc2019/SyncInputPortNamesSync.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/SyncInputPortNamesSync.scala similarity index 98% rename from solutions/RSync/src/main/scala/ttc2019/SyncInputPortNamesSync.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/SyncInputPortNamesSync.scala index ed45f50..a7b3e34 100644 --- a/solutions/RSync/src/main/scala/ttc2019/SyncInputPortNamesSync.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/SyncInputPortNamesSync.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksync import org.rosi_project.model_management.sync.ISyncCompartment import org.rosi_project.model_management.sync.roles.ISyncRole diff --git a/solutions/RSync/src/main/scala/ttc2019/SyncOutputPortNamesSync.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/SyncOutputPortNamesSync.scala similarity index 98% rename from solutions/RSync/src/main/scala/ttc2019/SyncOutputPortNamesSync.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/SyncOutputPortNamesSync.scala index 2230c61..75fb40a 100644 --- a/solutions/RSync/src/main/scala/ttc2019/SyncOutputPortNamesSync.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/SyncOutputPortNamesSync.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksync import org.rosi_project.model_management.sync.ISyncCompartment import org.rosi_project.model_management.sync.roles.ISyncRole diff --git a/solutions/RSync/src/main/scala/ttc2019/TTandBDTandBDDSyncConstruction.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/TTandBDTandBDDSyncConstruction.scala similarity index 99% rename from solutions/RSync/src/main/scala/ttc2019/TTandBDTandBDDSyncConstruction.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/TTandBDTandBDDSyncConstruction.scala index 2079fd0..93fca64 100644 --- a/solutions/RSync/src/main/scala/ttc2019/TTandBDTandBDDSyncConstruction.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/TTandBDTandBDDSyncConstruction.scala @@ -1,4 +1,4 @@ -package ttc2019 +package ttc2019.worksync import org.rosi_project.model_management.sync.IConstructionCompartment import org.rosi_project.model_management.sync.roles.IConstructor @@ -6,8 +6,6 @@ import org.rosi_project.model_management.core.PlayerSync import org.rosi_project.model_management.sync.roles.IRoleManager import org.rosi_project.model_management.core.SynchronizationCompartment - - /** * Construction Process for Model BDD and TT. */ diff --git a/solutions/RSync/src/main/scala/ttc2019/WriteSyncBddOutput.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/WriteSyncBddOutput.scala similarity index 88% rename from solutions/RSync/src/main/scala/ttc2019/WriteSyncBddOutput.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/WriteSyncBddOutput.scala index fa9fc0e..e79f2b8 100644 --- a/solutions/RSync/src/main/scala/ttc2019/WriteSyncBddOutput.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/WriteSyncBddOutput.scala @@ -1,9 +1,10 @@ -package ttc2019 +package ttc2019.worksync import sync.bddg._ import ttc2019.metamodels.create.BddCreationHelper import org.rosi_project.model_management.core.ModelElementLists +import ttc2019.IWriteOutputModel object WriteSyncBddOutput extends IWriteOutputModel { @@ -12,12 +13,12 @@ object WriteSyncBddOutput extends IWriteOutputModel { val pkgName = "sync.bddg." - val bd = ModelElementLists.getDirectElementsFromType(pkgName + "BDD").asInstanceOf[List[BDD]] - val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[List[InputPort]] - val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[List[OutputPort]] - val as = ModelElementLists.getDirectElementsFromType(pkgName + "Assignment").asInstanceOf[List[Assignment]] - val le = ModelElementLists.getDirectElementsFromType(pkgName + "Leaf").asInstanceOf[List[Leaf]] - val su = ModelElementLists.getDirectElementsFromType(pkgName + "Subtree").asInstanceOf[List[Subtree]] + val bd = ModelElementLists.getDirectElementsFromType(pkgName + "BDD").asInstanceOf[Set[BDD]] + val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[Set[InputPort]] + val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[Set[OutputPort]] + val as = ModelElementLists.getDirectElementsFromType(pkgName + "Assignment").asInstanceOf[Set[Assignment]] + val le = ModelElementLists.getDirectElementsFromType(pkgName + "Leaf").asInstanceOf[Set[Leaf]] + val su = ModelElementLists.getDirectElementsFromType(pkgName + "Subtree").asInstanceOf[Set[Subtree]] /*println(bd) println(in) diff --git a/solutions/RSync/src/main/scala/ttc2019/WriteSyncBdtOutput.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/WriteSyncBdtOutput.scala similarity index 88% rename from solutions/RSync/src/main/scala/ttc2019/WriteSyncBdtOutput.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/WriteSyncBdtOutput.scala index 47b3a44..88a6358 100644 --- a/solutions/RSync/src/main/scala/ttc2019/WriteSyncBdtOutput.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/WriteSyncBdtOutput.scala @@ -1,9 +1,10 @@ -package ttc2019 +package ttc2019.worksync import sync.bdd._ import ttc2019.metamodels.create.BdtCreationHelper import org.rosi_project.model_management.core.ModelElementLists +import ttc2019.IWriteOutputModel object WriteSyncBdtOutput extends IWriteOutputModel { @@ -12,12 +13,12 @@ object WriteSyncBdtOutput extends IWriteOutputModel { val pkgName = "sync.bdd." - val bd = ModelElementLists.getDirectElementsFromType(pkgName + "BDD").asInstanceOf[List[BDD]] - val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[List[InputPort]] - val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[List[OutputPort]] - val as = ModelElementLists.getDirectElementsFromType(pkgName + "Assignment").asInstanceOf[List[Assignment]] - val le = ModelElementLists.getDirectElementsFromType(pkgName + "Leaf").asInstanceOf[List[Leaf]] - val su = ModelElementLists.getDirectElementsFromType(pkgName + "Subtree").asInstanceOf[List[Subtree]] + val bd = ModelElementLists.getDirectElementsFromType(pkgName + "BDD").asInstanceOf[Set[BDD]] + val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[Set[InputPort]] + val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[Set[OutputPort]] + val as = ModelElementLists.getDirectElementsFromType(pkgName + "Assignment").asInstanceOf[Set[Assignment]] + val le = ModelElementLists.getDirectElementsFromType(pkgName + "Leaf").asInstanceOf[Set[Leaf]] + val su = ModelElementLists.getDirectElementsFromType(pkgName + "Subtree").asInstanceOf[Set[Subtree]] /*println(bd) println(in) diff --git a/solutions/RSync/src/main/scala/ttc2019/WriteSyncTtOutput.scala b/solutions/RSync/src/main/scala/ttc2019/worksync/WriteSyncTtOutput.scala similarity index 86% rename from solutions/RSync/src/main/scala/ttc2019/WriteSyncTtOutput.scala rename to solutions/RSync/src/main/scala/ttc2019/worksync/WriteSyncTtOutput.scala index c401254..d8ef94f 100644 --- a/solutions/RSync/src/main/scala/ttc2019/WriteSyncTtOutput.scala +++ b/solutions/RSync/src/main/scala/ttc2019/worksync/WriteSyncTtOutput.scala @@ -1,9 +1,9 @@ -package ttc2019 +package ttc2019.worksync import sync.tt._ - import ttc2019.metamodels.create.TtCreationHelper import org.rosi_project.model_management.core.ModelElementLists +import ttc2019.IWriteOutputModel object WriteSyncTtOutput extends IWriteOutputModel { def generateEverything(outputFile: String): Unit = { @@ -11,11 +11,11 @@ object WriteSyncTtOutput extends IWriteOutputModel { val pkgName = "sync.tt." - val tt = ModelElementLists.getDirectElementsFromType(pkgName + "TruthTable").asInstanceOf[List[TruthTable]] - val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[List[InputPort]] - val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[List[OutputPort]] - val ro = ModelElementLists.getDirectElementsFromType(pkgName + "Row").asInstanceOf[List[Row]] - val ce = ModelElementLists.getDirectElementsFromType(pkgName + "Cell").asInstanceOf[List[Cell]] + val tt = ModelElementLists.getDirectElementsFromType(pkgName + "TruthTable").asInstanceOf[Set[TruthTable]] + val in = ModelElementLists.getDirectElementsFromType(pkgName + "InputPort").asInstanceOf[Set[InputPort]] + val ou = ModelElementLists.getDirectElementsFromType(pkgName + "OutputPort").asInstanceOf[Set[OutputPort]] + val ro = ModelElementLists.getDirectElementsFromType(pkgName + "Row").asInstanceOf[Set[Row]] + val ce = ModelElementLists.getDirectElementsFromType(pkgName + "Cell").asInstanceOf[Set[Cell]] /*println(tt) println(in) -- GitLab